From: HyungKyu Song Date: Fri, 15 Feb 2013 15:51:09 +0000 (+0900) Subject: Tizen 2.0 Release X-Git-Tag: accepted/tizen_2.0/20130215.205017^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_2.0;p=toolchains%2Fpython-lxml.git Tizen 2.0 Release --- diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..b19f7ca --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,2125 @@ +============== +lxml changelog +============== + +2.2.3 (2009-10-30) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* The ``resolve_entities`` option did not work in the incremental feed + parser. + +* Looking up and deleting attributes without a namespace could hit a + namespaced attribute of the same name instead. + +* Late errors during calls to ``SubElement()`` (e.g. attribute related + ones) could leave a partially initialised element in the tree. + +* Modifying trees that contain parsed entity references could result + in an infinite loop. + +* ObjectifiedElement.__setattr__ created an empty-string child element when the + attribute value was rejected as a non-unicode/non-ascii string + +* Syntax errors in ``lxml.cssselect`` could result in misleading error + messages. + +* Invalid syntax in CSS expressions could lead to an infinite loop in + the parser of ``lxml.cssselect``. + +* CSS special character escapes were not properly handled in + ``lxml.cssselect``. + +* CSS Unicode escapes were not properly decoded in ``lxml.cssselect``. + +* Select options in HTML forms that had no explicit ``value`` + attribute were not handled correctly. The HTML standard dictates + that their value is defined by their text content. This is now + supported by lxml.html. + +* XPath raised a TypeError when finding CDATA sections. This is now + fully supported. + +* Calling ``help(lxml.objectify)`` didn't work at the prompt. + +* The ``ElementMaker`` in lxml.objectify no longer defines the default + namespaces when annotation is disabled. + +* Feed parser failed to honout the 'recover' option on parse errors. + +* Diverting the error logging to Python's logging system was broken. + +Other changes +------------- + + +2.2.2 (2009-06-21) +================== + +Features added +-------------- + +* New helper functions ``strip_attributes()``, ``strip_elements()``, + ``strip_tags()`` in lxml.etree to remove attributes/subtrees/tags + from a subtree. + +Bugs fixed +---------- + +* Namespace cleanup on subtree insertions could result in missing + namespace declarations (and potentially crashes) if the element + defining a namespace was deleted and the namespace was not used by + the top element of the inserted subtree but only in deeper subtrees. + +* Raising an exception from a parser target callback didn't always + terminate the parser. + +* Only {true, false, 1, 0} are accepted as the lexical representation for + BoolElement ({True, False, T, F, t, f} not any more), restoring lxml <= 2.0 + behaviour. + +Other changes +------------- + + +2.2.1 (2009-06-02) +================== + +Features added +-------------- + +* Injecting default attributes into a document during XML Schema + validation (also at parse time). + +* Pass ``huge_tree`` parser option to disable parser security + restrictions imposed by libxml2 2.7. + +Bugs fixed +---------- + +* The script for statically building libxml2 and libxslt didn't work + in Py3. + +* ``XMLSchema()`` also passes invalid schema documents on to libxml2 + for parsing (which could lead to a crash before release 2.6.24). + +Other changes +------------- + + +2.2 (2009-03-21) +================ + +Features added +-------------- + +* Support for ``standalone`` flag in XML declaration through + ``tree.docinfo.standalone`` and by passing ``standalone=True/False`` + on serialisation. + +Bugs fixed +---------- + +* Crash when parsing an XML Schema with external imports from a + filename. + + +2.2beta4 (2009-02-27) +===================== + +Features added +-------------- + +* Support strings and instantiable Element classes as child arguments + to the constructor of custom Element classes. + +* GZip compression support for serialisation to files and file-like + objects. + +Bugs fixed +---------- + +* Deep-copying an ElementTree copied neither its sibling PIs and + comments nor its internal/external DTD subsets. + +* Soupparser failed on broken attributes without values. + +* Crash in XSLT when overwriting an already defined attribute using + ``xsl:attribute``. + +* Crash bug in exception handling code under Python 3. This was due + to a problem in Cython, not lxml itself. + +* ``lxml.html.FormElement._name()`` failed for non top-level forms. + +* ``TAG`` special attribute in constructor of custom Element classes + was evaluated incorrectly. + +Other changes +------------- + +* Official support for Python 3.0.1. + +* ``Element.findtext()`` now returns an empty string instead of None + for Elements without text content. + + +2.2beta3 (2009-02-17) +===================== + +Features added +-------------- + +* ``XSLT.strparam()`` class method to wrap quoted string parameters + that require escaping. + +Bugs fixed +---------- + +* Memory leak in XPath evaluators. + +* Crash when parsing indented XML in one thread and merging it with + other documents parsed in another thread. + +* Setting the ``base`` attribute in ``lxml.objectify`` from a unicode + string failed. + +* Fixes following changes in Python 3.0.1. + +* Minor fixes for Python 3. + +Other changes +------------- + +* The global error log (which is copied into the exception log) is now + local to a thread, which fixes some race conditions. + +* More robust error handling on serialisation. + + +2.2beta2 (2009-01-25) +===================== + +Bugs fixed +---------- + +* Potential memory leak on exception handling. This was due to a + problem in Cython, not lxml itself. + +* ``iter_links`` (and related link-rewriting functions) in + ``lxml.html`` would interpret CSS like ``url("link")`` incorrectly + (treating the quotation marks as part of the link). + +* Failing import on systems that have an ``io`` module. + + +2.1.5 (2009-01-06) +================== + +Bugs fixed +---------- + +* Potential memory leak on exception handling. This was due to a + problem in Cython, not lxml itself. + +* Failing import on systems that have an ``io`` module. + + +2.2beta1 (2008-12-12) +===================== + +Features added +-------------- + +* Allow ``lxml.html.diff.htmldiff`` to accept Element objects, not + just HTML strings. + +Bugs fixed +---------- + +* Crash when using an XPath evaluator in multiple threads. + +* Fixed missing whitespace before ``Link:...`` in ``lxml.html.diff``. + +Other changes +------------- + +* Export ``lxml.html.parse``. + + +2.1.4 (2008-12-12) +================== + +Bugs fixed +---------- + +* Crash when using an XPath evaluator in multiple threads. + + +2.0.11 (2008-12-12) +=================== + +Bugs fixed +---------- + +* Crash when using an XPath evaluator in multiple threads. + + +2.2alpha1 (2008-11-23) +====================== + +Features added +-------------- + +* Support for XSLT result tree fragments in XPath/XSLT extension + functions. + +* QName objects have new properties ``namespace`` and ``localname``. + +* New options for exclusive C14N and C14N without comments. + +* Instantiating a custom Element classes creates a new Element. + +Bugs fixed +---------- + +* XSLT didn't inherit the parse options of the input document. + +* 0-bytes could slip through the API when used inside of Unicode + strings. + +* With ``lxml.html.clean.autolink``, links with balanced parenthesis, + that end in a parenthesis, will be linked in their entirety (typical + with Wikipedia links). + +Other changes +------------- + + +2.1.3 (2008-11-17) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* Ref-count leaks when lxml enters a try-except statement while an + outside exception lives in sys.exc_*(). This was due to a problem in + Cython, not lxml itself. + +* Parser Unicode decoding errors could get swallowed by other + exceptions. + +* Name/import errors in some Python modules. + +* Internal DTD subsets that did not specify a system or public ID were + not serialised and did not appear in the docinfo property of + ElementTrees. + +* Fix a pre-Py3k warning when parsing from a gzip file in Py2.6. + +* Test suite fixes for libxml2 2.7. + +* Resolver.resolve_string() did not work for non-ASCII byte strings. + +* Resolver.resolve_file() was broken. + +* Overriding the parser encoding didn't work for many encodings. + +Other changes +------------- + + +2.0.10 (2008-11-17) +=================== + +Bugs fixed +---------- + +* Ref-count leaks when lxml enters a try-except statement while an + outside exception lives in sys.exc_*(). This was due to a problem in + Cython, not lxml itself. + + +2.1.2 (2008-09-05) +================== + +Features added +-------------- + +* lxml.etree now tries to find the absolute path name of files when + parsing from a file-like object. This helps custom resolvers when + resolving relative URLs, as lixbml2 can prepend them with the path + of the source document. + +Bugs fixed +---------- + +* Memory problem when passing documents between threads. + +* Target parser did not honour the ``recover`` option and raised an + exception instead of calling ``.close()`` on the target. + +Other changes +------------- + + +2.0.9 (2008-09-05) +================== + +Bugs fixed +---------- + +* Memory problem when passing documents between threads. + +* Target parser did not honour the ``recover`` option and raised an + exception instead of calling ``.close()`` on the target. + + +2.1.1 (2008-07-24) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* Crash when parsing XSLT stylesheets in a thread and using them in + another. + +* Encoding problem when including text with ElementInclude under + Python 3. + +Other changes +------------- + + +2.0.8 (2008-07-24) +================== + +Features added +-------------- + +* ``lxml.html.rewrite_links()`` strips links to work around documents + with whitespace in URL attributes. + +Bugs fixed +---------- + +* Crash when parsing XSLT stylesheets in a thread and using them in + another. + +* CSS selector parser dropped remaining expression after a function + with parameters. + +Other changes +------------- + + +2.1 (2008-07-09) +================ + +Features added +-------------- + +* Smart strings can be switched off in XPath (``smart_strings`` + keyword option). + +* ``lxml.html.rewrite_links()`` strips links to work around documents + with whitespace in URL attributes. + +Bugs fixed +---------- + +* Custom resolvers were not used for XMLSchema includes/imports and + XInclude processing. + +* CSS selector parser dropped remaining expression after a function + with parameters. + +Other changes +------------- + +* ``objectify.enableRecursiveStr()`` was removed, use + ``objectify.enable_recursive_str()`` instead + +* Speed-up when running XSLTs on documents from other threads + + +2.0.7 (2008-06-20) +================== + +Features added +-------------- + +* Pickling ``ElementTree`` objects in lxml.objectify. + +Bugs fixed +---------- + +* Descending dot-separated classes in CSS selectors were not resolved + correctly. + +* ``ElementTree.parse()`` didn't handle target parser result. + +* Potential threading problem in XInclude. + +* Crash in Element class lookup classes when the __init__() method of + the super class is not called from Python subclasses. + +Other changes +------------- + +* Non-ASCII characters in attribute values are no longer escaped on + serialisation. + + +2.1beta3 (2008-06-19) +===================== + +Features added +-------------- + +* Major overhaul of ``tools/xpathgrep.py`` script. + +* Pickling ``ElementTree`` objects in lxml.objectify. + +* Support for parsing from file-like objects that return unicode + strings. + +* New function ``etree.cleanup_namespaces(el)`` that removes unused + namespace declarations from a (sub)tree (experimental). + +* XSLT results support the buffer protocol in Python 3. + +* Polymorphic functions in ``lxml.html`` that accept either a tree or + a parsable string will return either a UTF-8 encoded byte string, a + unicode string or a tree, based on the type of the input. + Previously, the result was always a byte string or a tree. + +* Support for Python 2.6 and 3.0 beta. + +* File name handling now uses a heuristic to convert between byte + strings (usually filenames) and unicode strings (usually URLs). + +* Parsing from a plain file object frees the GIL under Python 2.x. + +* Running ``iterparse()`` on a plain file (or filename) frees the GIL + on reading under Python 2.x. + +* Conversion functions ``html_to_xhtml()`` and ``xhtml_to_html()`` in + lxml.html (experimental). + +* Most features in lxml.html work for XHTML namespaced tag names + (experimental). + +Bugs fixed +---------- + +* ``ElementTree.parse()`` didn't handle target parser result. + +* Crash in Element class lookup classes when the __init__() method of + the super class is not called from Python subclasses. + +* A number of problems related to unicode/byte string conversion of + filenames and error messages were fixed. + +* Building on MacOS-X now passes the "flat_namespace" option to the C + compiler, which reportedly prevents build quirks and crashes on this + platform. + +* Windows build was broken. + +* Rare crash when serialising to a file object with certain encodings. + +Other changes +------------- + +* Non-ASCII characters in attribute values are no longer escaped on + serialisation. + +* Passing non-ASCII byte strings or invalid unicode strings as .tag, + namespaces, etc. will result in a ValueError instead of an + AssertionError (just like the tag well-formedness check). + +* Up to several times faster attribute access (i.e. tree traversal) in + lxml.objectify. + + +2.0.6 (2008-05-31) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* Incorrect evaluation of ``el.find("tag[child]")``. + +* Windows build was broken. + +* Moving a subtree from a document created in one thread into a + document of another thread could crash when the rest of the source + document is deleted while the subtree is still in use. + +* Rare crash when serialising to a file object with certain encodings. + +Other changes +------------- + +* lxml should now build without problems on MacOS-X. + + +2.1beta2 (2008-05-02) +===================== + +Features added +-------------- + +* All parse functions in lxml.html take a ``parser`` keyword argument. + +* lxml.html has a new parser class ``XHTMLParser`` and a module + attribute ``xhtml_parser`` that provide XML parsers that are + pre-configured for the lxml.html package. + +Bugs fixed +---------- + +* Moving a subtree from a document created in one thread into a + document of another thread could crash when the rest of the source + document is deleted while the subtree is still in use. + +* Passing an nsmap when creating an Element will no longer strip + redundantly defined namespace URIs. This prevented the definition + of more than one prefix for a namespace on the same Element. + +Other changes +------------- + +* If the default namespace is redundantly defined with a prefix on the + same Element, the prefix will now be preferred for subelements and + attributes. This allows users to work around a problem in libxml2 + where attributes from the default namespace could serialise without + a prefix even when they appear on an Element with a different + namespace (i.e. they would end up in the wrong namespace). + + +2.0.5 (2008-05-01) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* Resolving to a filename in custom resolvers didn't work. + +* lxml did not honour libxslt's second error state "STOPPED", which + let some XSLT errors pass silently. + +* Memory leak in Schematron with libxml2 >= 2.6.31. + +Other changes +------------- + + +2.1beta1 (2008-04-15) +===================== + +Features added +-------------- + +* Error logging in Schematron (requires libxml2 2.6.32 or later). + +* Parser option ``strip_cdata`` for normalising or keeping CDATA + sections. Defaults to ``True`` as before, thus replacing CDATA + sections by their text content. + +* ``CDATA()`` factory to wrap string content as CDATA section. + +Bugs fixed +---------- + +* Resolving to a filename in custom resolvers didn't work. + +* lxml did not honour libxslt's second error state "STOPPED", which + let some XSLT errors pass silently. + +* Memory leak in Schematron with libxml2 >= 2.6.31. + +* lxml.etree accepted non well-formed namespace prefix names. + +Other changes +------------- + +* Major cleanup in internal ``moveNodeToDocument()`` function, which + takes care of namespace cleanup when moving elements between + different namespace contexts. + +* New Elements created through the ``makeelement()`` method of an HTML + parser or through lxml.html now end up in a new HTML document + (doctype HTML 4.01 Transitional) instead of a generic XML document. + This mostly impacts the serialisation and the availability of a DTD + context. + + +2.0.4 (2008-04-13) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* Hanging thread in conjunction with GTK threading. + +* Crash bug in iterparse when moving elements into other documents. + +* HTML elements' ``.cssselect()`` method was broken. + +* ``ElementTree.find*()`` didn't accept QName objects. + +Other changes +------------- + + +2.1alpha1 (2008-03-27) +====================== + +Features added +-------------- + +* New event types 'comment' and 'pi' in ``iterparse()``. + +* ``XSLTAccessControl`` instances have a property ``options`` that + returns a dict of access configuration options. + +* Constant instances ``DENY_ALL`` and ``DENY_WRITE`` on + ``XSLTAccessControl`` class. + +* Extension elements for XSLT (experimental!) + +* ``Element.base`` property returns the xml:base or HTML base URL of + an Element. + +* ``docinfo.URL`` property is writable. + +Bugs fixed +---------- + +* Default encoding for plain text serialisation was different from + that of XML serialisation (UTF-8 instead of ASCII). + +Other changes +------------- + +* Minor API speed-ups. + +* The benchmark suite now uses tail text in the trees, which makes the + absolute numbers incomparable to previous results. + +* Generating the HTML documentation now requires Pygments_, which is + used to enable syntax highlighting for the doctest examples. + +.. _Pygments: http://pygments.org/ + +Most long-time deprecated functions and methods were removed: + +- ``etree.clearErrorLog()``, use ``etree.clear_error_log()`` + +- ``etree.useGlobalPythonLog()``, use + ``etree.use_global_python_log()`` + +- ``etree.ElementClassLookup.setFallback()``, use + ``etree.ElementClassLookup.set_fallback()`` + +- ``etree.getDefaultParser()``, use ``etree.get_default_parser()`` + +- ``etree.setDefaultParser()``, use ``etree.set_default_parser()`` + +- ``etree.setElementClassLookup()``, use + ``etree.set_element_class_lookup()`` + + Note that ``parser.setElementClassLookup()`` has not been removed + yet, although ``parser.set_element_class_lookup()`` should be used + instead. + +- ``xpath_evaluator.registerNamespace()``, use + ``xpath_evaluator.register_namespace()`` + +- ``xpath_evaluator.registerNamespaces()``, use + ``xpath_evaluator.register_namespaces()`` + +- ``objectify.setPytypeAttributeTag``, use + ``objectify.set_pytype_attribute_tag`` + +- ``objectify.setDefaultParser()``, use + ``objectify.set_default_parser()`` + + +2.0.3 (2008-03-26) +================== + +Features added +-------------- + +* soupparser.parse() allows passing keyword arguments on to + BeautifulSoup. + +* ``fromstring()`` method in ``lxml.html.soupparser``. + +Bugs fixed +---------- + +* ``lxml.html.diff`` didn't treat empty tags properly (e.g., + ``
``). + +* Handle entity replacements correctly in target parser. + +* Crash when using ``iterparse()`` with XML Schema validation. + +* The BeautifulSoup parser (soupparser.py) did not replace entities, + which made them turn up in text content. + +* Attribute assignment of custom PyTypes in objectify could fail to + correctly serialise the value to a string. + +Other changes +------------- + +* ``lxml.html.ElementSoup`` was replaced by a new module + ``lxml.html.soupparser`` with a more consistent API. The old module + remains for compatibility with ElementTree's own ElementSoup module. + +* Setting the XSLT_CONFIG and XML2_CONFIG environment variables at + build time will let setup.py pick up the ``xml2-config`` and + ``xslt-config`` scripts from the supplied path name. + +* Passing ``--with-xml2-config=/path/to/xml2-config`` to setup.py will + override the ``xml2-config`` script that is used to determine the C + compiler options. The same applies for the ``--with-xslt-config`` + option. + + +2.0.2 (2008-02-22) +================== + +Features added +-------------- + +* Support passing ``base_url`` to file parser functions to override + the filename of the file(-like) object. + +Bugs fixed +---------- + +* The prefix for objectify's pytype namespace was missing from the set + of default prefixes. + +* Memory leak in Schematron (fixed only for libxml2 2.6.31+). + +* Error type names in RelaxNG were reported incorrectly. + +* Slice deletion bug fixed in objectify. + +Other changes +------------- + +* Enabled doctests for some Python modules (especially ``lxml.html``). + +* Add a ``method`` argument to ``lxml.html.tostring()`` + (``method="xml"`` for XHTML output). + +* Make it clearer that methods like ``lxml.html.fromstring()`` take a + ``base_url`` argument. + + +2.0.1 (2008-02-13) +================== + +Features added +-------------- + +* Child iteration in ``lxml.pyclasslookup``. + +* Loads of new docstrings reflect the signature of functions and + methods to make them visible in API docs and ``help()`` + +Bugs fixed +---------- + +* The module ``lxml.html.builder`` was duplicated as + ``lxml.htmlbuilder`` + +* Form elements would return None for ``form.fields.keys()`` if there + was an unnamed input field. Now unnamed input fields are completely + ignored. + +* Setting an element slice in objectify could insert slice-overlapping + elements at the wrong position. + +Other changes +------------- + +* The generated API documentation was cleaned up and disburdened from + non-public classes etc. + +* The previously public module ``lxml.html.setmixin`` was renamed to + ``lxml.html._setmixin`` as it is not an official part of lxml. If + you want to use it, feel free to copy it over to your own source + base. + +* Passing ``--with-xslt-config=/path/to/xslt-config`` to setup.py will + override the ``xslt-config`` script that is used to determine the C + compiler options. + + +2.0 (2008-02-01) +================ + +Features added +-------------- + +* Passing the ``unicode`` type as ``encoding`` to ``tostring()`` will + serialise to unicode. The ``tounicode()`` function is now + deprecated. + +* ``XMLSchema()`` and ``RelaxNG()`` can parse from StringIO. + +* ``makeparser()`` function in ``lxml.objectify`` to create a new + parser with the usual objectify setup. + +* Plain ASCII XPath string results are no longer forced into unicode + objects as in 2.0beta1, but are returned as plain strings as before. + +* All XPath string results are 'smart' objects that have a + ``getparent()`` method to retrieve their parent Element. + +* ``with_tail`` option in serialiser functions. + +* More accurate exception messages in validator creation. + +* Parse-time XML schema validation (``schema`` parser keyword). + +* XPath string results of the ``text()`` function and attribute + selection make their Element container accessible through a + ``getparent()`` method. As a side-effect, they are now always + unicode objects (even ASCII strings). + +* ``XSLT`` objects are usable in any thread - at the cost of a deep + copy if they were not created in that thread. + +* Invalid entity names and character references will be rejected by + the ``Entity()`` factory. + +* ``entity.text`` returns the textual representation of the entity, + e.g. ``&``. + +* New properties ``position`` and ``code`` on ParseError exception (as + in ET 1.3) + +* Rich comparison of ``element.attrib`` proxies. + +* ElementTree compatible TreeBuilder class. + +* Use default prefixes for some common XML namespaces. + +* ``lxml.html.clean.Cleaner`` now allows for a ``host_whitelist``, and + two overridable methods: ``allow_embedded_url(el, url)`` and the + more general ``allow_element(el)``. + +* Extended slicing of Elements as in ``element[1:-1:2]``, both in + etree and in objectify + +* Resolvers can now provide a ``base_url`` keyword argument when + resolving a document as string data. + +* When using ``lxml.doctestcompare`` you can give the doctest option + ``NOPARSE_MARKUP`` (like ``# doctest: +NOPARSE_MARKUP``) to suppress + the special checking for one test. + +* Separate ``feed_error_log`` property for the feed parser interface. + The normal parser interface and ``iterparse`` continue to use + ``error_log``. + +* The normal parsers and the feed parser interface are now separated + and can be used concurrently on the same parser instance. + +* ``fromstringlist()`` and ``tostringlist()`` functions as in + ElementTree 1.3 + +* ``iterparse()`` accepts an ``html`` boolean keyword argument for + parsing with the HTML parser (note that this interface may be + subject to change) + +* Parsers accept an ``encoding`` keyword argument that overrides the encoding + of the parsed documents. + +* New C-API function ``hasChild()`` to test for children + +* ``annotate()`` function in objectify can annotate with Python types and XSI + types in one step. Accompanied by ``xsiannotate()`` and ``pyannotate()``. + +* ``ET.write()``, ``tostring()`` and ``tounicode()`` now accept a keyword + argument ``method`` that can be one of 'xml' (or None), 'html' or 'text' to + serialise as XML, HTML or plain text content. + +* ``iterfind()`` method on Elements returns an iterator equivalent to + ``findall()`` + +* ``itertext()`` method on Elements + +* Setting a QName object as value of the .text property or as an attribute + will resolve its prefix in the respective context + +* ElementTree-like parser target interface as described in + http://effbot.org/elementtree/elementtree-xmlparser.htm + +* ElementTree-like feed parser interface on XMLParser and HTMLParser + (``feed()`` and ``close()`` methods) + +* Reimplemented ``objectify.E`` for better performance and improved + integration with objectify. Provides extended type support based on + registered PyTypes. + +* XSLT objects now support deep copying + +* New ``makeSubElement()`` C-API function that allows creating a new + subelement straight with text, tail and attributes. + +* XPath extension functions can now access the current context node + (``context.context_node``) and use a context dictionary + (``context.eval_context``) from the context provided in their first + parameter + +* HTML tag soup parser based on BeautifulSoup in ``lxml.html.ElementSoup`` + +* New module ``lxml.doctestcompare`` by Ian Bicking for writing simplified + doctests based on XML/HTML output. Use by importing ``lxml.usedoctest`` or + ``lxml.html.usedoctest`` from within a doctest. + +* New module ``lxml.cssselect`` by Ian Bicking for selecting Elements with CSS + selectors. + +* New package ``lxml.html`` written by Ian Bicking for advanced HTML + treatment. + +* Namespace class setup is now local to the ``ElementNamespaceClassLookup`` + instance and no longer global. + +* Schematron validation (incomplete in libxml2) + +* Additional ``stringify`` argument to ``objectify.PyType()`` takes a + conversion function to strings to support setting text values from arbitrary + types. + +* Entity support through an ``Entity`` factory and element classes. XML + parsers now have a ``resolve_entities`` keyword argument that can be set to + False to keep entities in the document. + +* ``column`` field on error log entries to accompany the ``line`` field + +* Error specific messages in XPath parsing and evaluation + NOTE: for evaluation errors, you will now get an XPathEvalError instead of + an XPathSyntaxError. To catch both, you can except on ``XPathError`` + +* The regular expression functions in XPath now support passing a node-set + instead of a string + +* Extended type annotation in objectify: new ``xsiannotate()`` function + +* EXSLT RegExp support in standard XPath (not only XSLT) + +Bugs fixed +---------- + +* Missing import in ``lxml.html.clean``. + +* Some Python 2.4-isms prevented lxml from building/running under + Python 2.3. + +* XPath on ElementTrees could crash when selecting the virtual root + node of the ElementTree. + +* Compilation ``--without-threading`` was buggy in alpha5/6. + +* Memory leak in the ``parse()`` function. + +* Minor bugs in XSLT error message formatting. + +* Result document memory leak in target parser. + +* Target parser failed to report comments. + +* In the ``lxml.html`` ``iter_links`` method, links in ```` + tags weren't recognized. (Note: plugin-specific link parameters + still aren't recognized.) Also, the ```` tag, though not + standard, is now included in ``lxml.html.defs.special_inline_tags``. + +* Using custom resolvers on XSLT stylesheets parsed from a string + could request ill-formed URLs. + +* With ``lxml.doctestcompare`` if you do ```` in your + output, it will then be namespace-neutral (before the ellipsis was + treated as a real namespace). + +* AttributeError in feed parser on parse errors + +* XML feed parser setup problem + +* Type annotation for unicode strings in ``DataElement()`` + +* lxml failed to serialise namespace declarations of elements other than the + root node of a tree + +* Race condition in XSLT where the resolver context leaked between concurrent + XSLT calls + +* lxml.etree did not check tag/attribute names + +* The XML parser did not report undefined entities as error + +* The text in exceptions raised by XML parsers, validators and XPath + evaluators now reports the first error that occurred instead of the last + +* Passing '' as XPath namespace prefix did not raise an error + +* Thread safety in XPath evaluators + +Other changes +------------- + +* Exceptions carry only the part of the error log that is related to + the operation that caused the error. + +* ``XMLSchema()`` and ``RelaxNG()`` now enforce passing the source + file/filename through the ``file`` keyword argument. + +* The test suite now skips most doctests under Python 2.3. + +* ``make clean`` no longer removes the .c files (use ``make + realclean`` instead) + +* Minor performance tweaks for Element instantiation and subelement + creation + +* Various places in the XPath, XSLT and iteration APIs now require + keyword-only arguments. + +* The argument order in ``element.itersiblings()`` was changed to + match the order used in all other iteration methods. The second + argument ('preceding') is now a keyword-only argument. + +* The ``getiterator()`` method on Elements and ElementTrees was + reverted to return an iterator as it did in lxml 1.x. The ET API + specification allows it to return either a sequence or an iterator, + and it traditionally returned a sequence in ET and an iterator in + lxml. However, it is now deprecated in favour of the ``iter()`` + method, which should be used in new code wherever possible. + +* The 'pretty printed' serialisation of ElementTree objects now + inserts newlines at the root level between processing instructions, + comments and the root tag. + +* A 'pretty printed' serialisation is now terminated with a newline. + +* Second argument to ``lxml.etree.Extension()`` helper is no longer + required, third argument is now a keyword-only argument ``ns``. + +* ``lxml.html.tostring`` takes an ``encoding`` argument. + +* The module source files were renamed to "lxml.*.pyx", such as + "lxml.etree.pyx". This was changed for consistency with the way + Pyrex commonly handles package imports. The main effect is that + classes now know about their fully qualified class name, including + the package name of their module. + +* Keyword-only arguments in some API functions, especially in the + parsers and serialisers. + +* Tag name validation in lxml.etree (and lxml.html) now distinguishes + between HTML tags and XML tags based on the parser that was used to + parse or create them. HTML tags no longer reject any non-ASCII + characters in tag names but only spaces and the special characters + ``<>&/"'``. + +* lxml.etree now emits a warning if you use XPath with libxml2 2.6.27 + (which can crash on certain XPath errors) + +* Type annotation in objectify now preserves the already annotated type by + default to prevent loosing type information that is already there. + +* ``element.getiterator()`` returns a list, use ``element.iter()`` to retrieve + an iterator (ElementTree 1.3 compatible behaviour) + +* objectify.PyType for None is now called "NoneType" + +* ``el.getiterator()`` renamed to ``el.iter()``, following ElementTree 1.3 - + original name is still available as alias + +* In the public C-API, ``findOrBuildNodeNs()`` was replaced by the more + generic ``findOrBuildNodeNsPrefix`` + +* Major refactoring in XPath/XSLT extension function code + +* Network access in parsers disabled by default + + +1.3.6 (2007-10-29) +================== + +Bugs fixed +---------- + +* Backported decref crash fix from 2.0 + +* Well hidden free-while-in-use crash bug in ObjectPath + +Other changes +------------- + +* The test suites now run ``gc.collect()`` in the ``tearDown()`` + methods. While this makes them take a lot longer to run, it also + makes it easier to link a specific test to garbage collection + problems that would otherwise appear in later tests. + + +1.3.5 (2007-10-22) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* lxml.etree could crash when adding more than 10000 namespaces to a + document + +* lxml failed to serialise namespace declarations of elements other + than the root node of a tree + + +1.3.4 (2007-08-30) +================== + +Features added +-------------- + +* The ``ElementMaker`` in ``lxml.builder`` now accepts the keyword arguments + ``namespace`` and ``nsmap`` to set a namespace and nsmap for the Elements it + creates. + +* The ``docinfo`` on ElementTree objects has new properties ``internalDTD`` + and ``externalDTD`` that return a DTD object for the internal or external + subset of the document respectively. + +* Serialising an ElementTree now includes any internal DTD subsets that are + part of the document, as well as comments and PIs that are siblings of the + root node. + +Bugs fixed +---------- + +* Parsing with the ``no_network`` option could fail + +Other changes +------------- + +* lxml now raises a TagNameWarning about tag names containing ':' instead of + an Error as 1.3.3 did. The reason is that a number of projects currently + misuse the previous lack of tag name validation to generate namespace + prefixes without declaring namespaces. Apart from the danger of generating + broken XML this way, it also breaks most of the namespace-aware tools in + XML, including XPath, XSLT and validation. lxml 1.3.x will continue to + support this bug with a Warning, while lxml 2.0 will be strict about + well-formed tag names (not only regarding ':'). + +* Serialising an Element no longer includes its comment and PI siblings (only + ElementTree serialisation includes them). + + +1.3.3 (2007-07-26) +================== + +Features added +-------------- + +* ElementTree compatible parser ``ETCompatXMLParser`` strips processing + instructions and comments while parsing XML + +* Parsers now support stripping PIs (keyword argument 'remove_pis') + +* ``etree.fromstring()`` now supports parsing both HTML and XML, depending on + the parser you pass. + +* Support ``base_url`` keyword argument in ``HTML()`` and ``XML()`` + +Bugs fixed +---------- + +* Parsing from Python Unicode strings failed on some platforms + +* ``Element()`` did not raise an exception on tag names containing ':' + +* ``Element.getiterator(tag)`` did not accept ``Comment`` and + ``ProcessingInstruction`` as tags. It also accepts ``Element`` now. + + +1.3.2 (2007-07-03) +================== + +Features added +-------------- + +Bugs fixed +---------- + +* "deallocating None" crash bug + + +1.3.1 (2007-07-02) +================== + +Features added +-------------- + +* objectify.DataElement now supports setting values from existing data + elements (not just plain Python types) and reuses defined namespaces etc. + +* E-factory support for lxml.objectify (``objectify.E``) + +Bugs fixed +---------- + +* Better way to prevent crashes in Element proxy cleanup code + +* objectify.DataElement didn't set up None value correctly + +* objectify.DataElement didn't check the value against the provided type hints + +* Reference-counting bug in ``Element.attrib.pop()`` + + +1.3 (2007-06-24) +================ + +Features added +-------------- + +* Module ``lxml.pyclasslookup`` module implements an Element class lookup + scheme that can access the entire tree in read-only mode to help determining + a suitable Element class + +* Parsers take a ``remove_comments`` keyword argument that skips over comments + +* ``parse()`` function in ``objectify``, corresponding to ``XML()`` etc. + +* ``Element.addnext(el)`` and ``Element.addprevious(el)`` methods to support + adding processing instructions and comments around the root node + +* ``Element.attrib`` was missing ``clear()`` and ``pop()`` methods + +* Extended type annotation in objectify: cleaner annotation namespace setup + plus new ``deannotate()`` function + +* Support for custom Element class instantiation in lxml.sax: passing a + ``makeelement`` function to the ElementTreeContentHandler will reuse the + lookup context of that function + +* '.' represents empty ObjectPath (identity) + +* ``Element.values()`` to accompany the existing ``.keys()`` and ``.items()`` + +* ``collectAttributes()`` C-function to build a list of attribute + keys/values/items for a libxml2 node + +* ``DTD`` validator class (like ``RelaxNG`` and ``XMLSchema``) + +* HTML generator helpers by Fredrik Lundh in ``lxml.htmlbuilder`` + +* ``ElementMaker`` XML generator by Fredrik Lundh in ``lxml.builder.E`` + +* Support for pickeling ``objectify.ObjectifiedElement`` objects to XML + +* ``update()`` method on Element.attrib + +* Optimised replacement for libxml2's _xmlReconsiliateNs(). This allows lxml + a better handling of namespaces when moving elements between documents. + +Bugs fixed +---------- + +* Removing Elements from a tree could make them loose their namespace + declarations + +* ``ElementInclude`` didn't honour base URL of original document + +* Replacing the children slice of an Element would cut off the tails of the + original children + +* ``Element.getiterator(tag)`` did not accept ``Comment`` and + ``ProcessingInstruction`` as tags + +* API functions now check incoming strings for XML conformity. Zero bytes or + low ASCII characters are no longer accepted (AssertionError). + +* XSLT parsing failed to pass resolver context on to imported documents + +* passing '' as namespace prefix in nsmap could be passed through to libxml2 + +* Objectify couldn't handle prefixed XSD type names in ``xsi:type`` + +* More ET compatible behaviour when writing out XML declarations or not + +* More robust error handling in ``iterparse()`` + +* Documents lost their top-level PIs and comments on serialisation + +* lxml.sax failed on comments and PIs. Comments are now properly ignored and + PIs are copied. + +* Possible memory leaks in namespace handling when moving elements between + documents + +Other changes +------------- + +* major restructuring in the documentation + + +1.2.1 (2007-02-27) +================== + +Bugs fixed +---------- + +* Build fixes for MS compiler + +* Item assignments to special names like ``element["text"]`` failed + +* Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier + to access + +* The pattern for attribute names in ObjectPath was too restrictive + + +1.2 (2007-02-20) +================ + +Features added +-------------- + +* Rich comparison of QName objects + +* Support for regular expressions in benchmark selection + +* get/set emulation (not .attrib!) for attributes on processing instructions + +* ElementInclude Python module for ElementTree compatible XInclude processing + that honours custom resolvers registered with the source document + +* ElementTree.parser property holds the parser used to parse the document + +* setup.py has been refactored for greater readability and flexibility + +* --rpath flag to setup.py to induce automatic linking-in of dynamic library + runtime search paths has been renamed to --auto-rpath. This makes it + possible to pass an --rpath directly to distutils; previously this was being + shadowed. + +Bugs fixed +---------- + +* Element instantiation now uses locks to prevent race conditions with threads + +* ElementTree.write() did not raise an exception when the file was not writable + +* Error handling could crash under Python <= 2.4.1 - fixed by disabling thread + support in these environments + +* Element.find*() did not accept QName objects as path + +Other changes +------------- + +* code cleanup: redundant _NodeBase super class merged into _Element class + Note: although the impact should be zero in most cases, this change breaks + the compatibiliy of the public C-API + + +1.1.2 (2006-10-30) +================== + +Features added +-------------- + +* Data elements in objectify support repr(), which is now used by dump() + +* Source distribution now ships with a patched Pyrex + +* New C-API function makeElement() to create new elements with text, + tail, attributes and namespaces + +* Reuse original parser flags for XInclude + +* Simplified support for handling XSLT processing instructions + +Bugs fixed +---------- + +* Parser resources were not freed before the next parser run + +* Open files and XML strings returned by Python resolvers were not + closed/freed + +* Crash in the IDDict returned by XMLDTDID + +* Copying Comments and ProcessingInstructions failed + +* Memory leak for external URLs in _XSLTProcessingInstruction.parseXSL() + +* Memory leak when garbage collecting tailed root elements + +* HTML script/style content was not propagated to .text + +* Show text xincluded between text nodes correctly in .text and .tail + +* 'integer * objectify.StringElement' operation was not supported + + +1.1.1 (2006-09-21) +================== + +Features added +-------------- + +* XSLT profiling support (``profile_run`` keyword) + +* countchildren() method on objectify.ObjectifiedElement + +* Support custom elements for tree nodes in lxml.objectify + +Bugs fixed +---------- + +* lxml.objectify failed to support long data values (e.g., "123L") + +* Error messages from XSLT did not reach ``XSLT.error_log`` + +* Factories objectify.Element() and objectify.DataElement() were missing + ``attrib`` and ``nsmap`` keyword arguments + +* Changing the default parser in lxml.objectify did not update the factories + Element() and DataElement() + +* Let lxml.objectify.Element() always generate tree elements (not data + elements) + +* Build under Windows failed ('\0' bug in patched Pyrex version) + + +1.1 (2006-09-13) +================ + +Features added +-------------- + +* Comments and processing instructions return '' and + '' for repr() + +* Parsers are now the preferred (and default) place where element class lookup + schemes should be registered. Namespace lookup is no longer supported by + default. + +* Support for Python 2.5 beta + +* Unlock the GIL for deep copying documents and for XPath() + +* New ``compact`` keyword argument for parsing read-only documents + +* Support for parser options in iterparse() + +* The ``namespace`` axis is supported in XPath and returns (prefix, URI) + tuples + +* The XPath expression "/" now returns an empty list instead of raising an + exception + +* XML-Object API on top of lxml (lxml.objectify) + +* Customizable Element class lookup: + + * different pre-implemented lookup mechanisms + + * support for externally provided lookup functions + +* Support for processing instructions (ET-like, not compatible) + +* Public C-level API for independent extension modules + +* Module level ``iterwalk()`` function as 'iterparse' for trees + +* Module level ``iterparse()`` function similar to ElementTree (see + documentation for differences) + +* Element.nsmap property returns a mapping of all namespace prefixes known at + the Element to their namespace URI + +* Reentrant threading support in RelaxNG, XMLSchema and XSLT + +* Threading support in parsers and serializers: + + * All in-memory operations (tostring, parse(StringIO), etc.) free the GIL + + * File operations (on file names) free the GIL + + * Reading from file-like objects frees the GIL and reacquires it for reading + + * Serialisation to file-like objects is single-threaded (high lock overhead) + +* Element iteration over XPath axes: + + * Element.iterdescendants() iterates over the descendants of an element + + * Element.iterancestors() iterates over the ancestors of an element (from + parent to parent) + + * Element.itersiblings() iterates over either the following or preceding + siblings of an element + + * Element.iterchildren() iterates over the children of an element in either + direction + + * All iterators support the ``tag`` keyword argument to restrict the + generated elements + +* Element.getnext() and Element.getprevious() return the direct siblings of an + element + +Bugs fixed +---------- + +* filenames with local 8-bit encoding were not supported + +* 1.1beta did not compile under Python 2.3 + +* ignore unknown 'pyval' attribute values in objectify + +* objectify.ObjectifiedElement.addattr() failed to accept Elements and Lists + +* objectify.ObjectPath.setattr() failed to accept Elements and Lists + +* XPathSyntaxError now inherits from XPathError + +* Threading race conditions in RelaxNG and XMLSchema + +* Crash when mixing elements from XSLT results into other trees, concurrent + XSLT is only allowed when the stylesheet was parsed in the main thread + +* The EXSLT ``regexp:match`` function now works as defined (except for some + differences in the regular expression syntax) + +* Setting element.text to '' returned None on request, not the empty string + +* ``iterparse()`` could crash on long XML files + +* Creating documents no longer copies the parser for later URL resolving. For + performance reasons, only a reference is kept. Resolver updates on the + parser will now be reflected by documents that were parsed before the + change. Although this should rarely become visible, it is a behavioral + change from 1.0. + + +1.0.4 (2006-09-09) +================== + +Features added +-------------- + +* List-like ``Element.extend()`` method + +Bugs fixed +---------- + +* Crash in tail handling in ``Element.replace()`` + + +1.0.3 (2006-08-08) +================== + +Features added +-------------- + +* Element.replace(old, new) method to replace a subelement by another one + +Bugs fixed +---------- + +* Crash when mixing elements from XSLT results into other trees + +* Copying/deepcopying did not work for ElementTree objects + +* Setting an attribute to a non-string value did not raise an exception + +* Element.remove() deleted the tail text from the removed Element + + +1.0.2 (2006-06-27) +================== + +Features added +-------------- + +* Support for setting a custom default Element class as opposed to namespace + specific classes (which still override the default class) + +Bugs fixed +---------- + +* Rare exceptions in Python list functions were not handled + +* Parsing accepted unicode strings with XML encoding declaration in certain + cases + +* Parsing 8-bit encoded strings from StringIO objects raised an exception + +* Module function ``initThread()`` was removed - useless (and never worked) + +* XSLT and parser exception messages include the error line number + + +1.0.1 (2006-06-09) +================== + +Features added +-------------- + +* Repeated calls to Element.attrib now efficiently return the same instance + +Bugs fixed +---------- + +* Document deallocation could crash in certain garbage collection scenarios + +* Extension function calls in XSLT variable declarations could break the + stylesheet and crash on repeated calls + +* Deep copying Elements could loose namespaces declared in parents + +* Deep copying Elements did not copy tail + +* Parsing file(-like) objects failed to load external entities + +* Parsing 8-bit strings from file(-like) objects raised an exception + +* xsl:include failed when the stylesheet was parsed from a file-like object + +* lxml.sax.ElementTreeProducer did not call startDocument() / endDocument() + +* MSVC compiler complained about long strings (supports only 2048 bytes) + + +1.0 (2006-06-01) +================ + +Features added +-------------- + +* Element.getiterator() and the findall() methods support finding arbitrary + elements from a namespace (pattern ``{namespace}*``) + +* Another speedup in tree iteration code + +* General speedup of Python Element object creation and deallocation + +* Writing C14N no longer serializes in memory (reduced memory footprint) + +* PyErrorLog for error logging through the Python ``logging`` module + +* ``Element.getroottree()`` returns an ElementTree for the root node of the + document that contains the element. + +* ElementTree.getpath(element) returns a simple, absolute XPath expression to + find the element in the tree structure + +* Error logs have a ``last_error`` attribute for convenience + +* Comment texts can be changed through the API + +* Formatted output via ``pretty_print`` keyword in serialization functions + +* XSLT can block access to file system and network via ``XSLTAccessControl`` + +* ElementTree.write() no longer serializes in memory (reduced memory + footprint) + +* Speedup of Element.findall(tag) and Element.getiterator(tag) + +* Support for writing the XML representation of Elements and ElementTrees to + Python unicode strings via ``etree.tounicode()`` + +* Support for writing XSLT results to Python unicode strings via ``unicode()`` + +* Parsing a unicode string no longer copies the string (reduced memory + footprint) + +* Parsing file-like objects reads chunks rather than the whole file (reduced + memory footprint) + +* Parsing StringIO objects from the start avoids copying the string (reduced + memory footprint) + +* Read-only 'docinfo' attribute in ElementTree class holds DOCTYPE + information, original encoding and XML version as seen by the parser + +* etree module can be compiled without libxslt by commenting out the line + ``include "xslt.pxi"`` near the end of the etree.pyx source file + +* Better error messages in parser exceptions + +* Error reporting also works in XSLT + +* Support for custom document loaders (URI resolvers) in parsers and XSLT, + resolvers are registered at parser level + +* Implementation of exslt:regexp for XSLT based on the Python 're' module, + enabled by default, can be switched off with 'regexp=False' keyword argument + +* Support for exslt extensions (libexslt) and libxslt extra functions + (node-set, document, write, output) + +* Substantial speedup in XPath.evaluate() + +* HTMLParser for parsing (broken) HTML + +* XMLDTDID function parses XML into tuple (root node, ID dict) based on xml:id + implementation of libxml2 (as opposed to ET compatible XMLID) + +Bugs fixed +---------- + +* Memory leak in Element.__setitem__ + +* Memory leak in Element.attrib.items() and Element.attrib.values() + +* Memory leak in XPath extension functions + +* Memory leak in unicode related setup code + +* Element now raises ValueError on empty tag names + +* Namespace fixing after moving elements between documents could fail if the + source document was freed too early + +* Setting namespace-less tag names on namespaced elements ('{ns}t' -> 't') + didn't reset the namespace + +* Unknown constants from newer libxml2 versions could raise exceptions in the + error handlers + +* lxml.etree compiles much faster + +* On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail + in certain cases + +* Document reference in ElementTree objects was not updated when the root + element was moved to a different document + +* Running absolute XPath expressions on an Element now evaluates against the + root tree + +* Evaluating absolute XPath expressions (``/*``) on an ElementTree could fail + +* Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree + objects + +* Removed public function ``initThreadLogging()``, replaced by more general + ``initThread()`` which fixes a number of setup problems in threads + +* Memory leak when using iconv encoders in tostring/write + +* Deep copying Elements and ElementTrees maintains the document information + +* Serialization functions raise LookupError for unknown encodings + +* Memory deallocation crash resulting from deep copying elements + +* Some ElementTree methods could crash if the root node was not initialized + (neither file nor element passed to the constructor) + +* Element/SubElement failed to set attribute namespaces from passed ``attrib`` + dictionary + +* ``tostring()`` adds an XML declaration for non-ASCII encodings + +* ``tostring()`` failed to serialize encodings that contain 0-bytes + +* ElementTree.xpath() and XPathDocumentEvaluator were not using the + ElementTree root node as reference point + +* Calling ``document('')`` in XSLT failed to return the stylesheet + + +0.9.2 (2006-05-10) +================== + +Features added +-------------- + +* Speedup for Element.makeelement(): the new element reuses the original + libxml2 document instead of creating a new empty one + +* Speedup for reversed() iteration over element children (Py2.4+ only) + +* ElementTree compatible QName class + +* RelaxNG and XMLSchema accept any Element, not only ElementTrees + +Bugs fixed +---------- + +* str(xslt_result) was broken for XSLT output other than UTF-8 + +* Memory leak if write_c14n fails to write the file after conversion + +* Crash in XMLSchema and RelaxNG when passing non-schema documents + +* Memory leak in RelaxNG() when RelaxNGParseError is raised + +0.9.1 (2006-03-30) +================== + +Features added +-------------- + +* lxml.sax.ElementTreeContentHandler checks closing elements and raises + SaxError on mismatch + +* lxml.sax.ElementTreeContentHandler supports namespace-less SAX events + (startElement, endElement) and defaults to empty attributes (keyword + argument) + +* Speedup for repeatedly accessing element tag names + +* Minor API performance improvements + +Bugs fixed +---------- + +* Memory deallocation bug when using XSLT output method "html" + +* sax.py was handling UTF-8 encoded tag names where it shouldn't + +* lxml.tests package will no longer be installed (is still in source tar) + +0.9 (2006-03-20) +================ + +Features added +-------------- + +* Error logging API for libxml2 error messages + +* Various performance improvements + +* Benchmark script for lxml, ElementTree and cElementTree + +* Support for registering extension functions through new FunctionNamespace + class (see doc/extensions.txt) + +* ETXPath class for XPath expressions in ElementTree notation ('//{ns}tag') + +* Support for variables in XPath expressions (also in XPath class) + +* XPath class for compiled XPath expressions + +* XMLID module level function (ElementTree compatible) + +* XMLParser API for customized libxml2 parser configuration + +* Support for custom Element classes through new Namespace API (see + doc/namespace_extensions.txt) + +* Common exception base class LxmlError for module exceptions + +* real iterator support in iter(Element), Element.getiterator() + +* XSLT objects are callable, result trees support str() + +* Added MANIFEST.in for easier creation of RPM files. + +* 'getparent' method on elements allows navigation to an element's + parent element. + +* Python core compatible SAX tree builder and SAX event generator. See + doc/sax.txt for more information. + +Bugs fixed +---------- + +* Segfaults and memory leaks in various API functions of Element + +* Segfault in XSLT.tostring() + +* ElementTree objects no longer interfere, Elements can be root of different + ElementTrees at the same time + +* document('') works in XSLT documents read from files (in-memory documents + cannot support this due to libxslt deficiencies) + +0.8 (2005-11-03) +================ + +Features added +-------------- + +* Support for copy.deepcopy() on elements. copy.copy() works also, but + does the same thing, and does *not* create a shallow copy, as that + makes no sense in the context of libxml2 trees. This means a + potential incompatibility with ElementTree, but there's more chance + that it works than if copy.copy() isn't supported at all. + +* Increased compatibility with (c)ElementTree; .parse() on ElementTree is + supported and parsing of gzipped XML files works. + +* implemented index() on elements, allowing one to find the index of a + SubElement. + +Bugs fixed +---------- + +* Use xslt-config instead of xml2-config to find out libxml2 + directories to take into account a case where libxslt is installed + in a different directory than libxslt. + +* Eliminate crash condition in iteration when text nodes are changed. + +* Passing 'None' to tostring() does not result in a segfault anymore, + but an AssertionError. + +* Some test fixes for Windows. + +* Raise XMLSyntaxError and XPathSyntaxError instead of plain python + syntax errors. This should be less confusing. + +* Fixed error with uncaught exception in Pyrex code. + +* Calling lxml.etree.fromstring('') throws XMLSyntaxError instead of a + segfault. + +* has_key() works on attrib. 'in' tests also work correctly on attrib. + +* INSTALL.txt was saying 2.2.16 instead of 2.6.16 as a supported + libxml2 version, as it should. + +* Passing a UTF-8 encoded string to the XML() function would fail; + fixed. + +0.7 (2005-06-15) +================ + +Features added +-------------- + +* parameters (XPath expressions) can be passed to XSLT using keyword + parameters. + +* Simple XInclude support. Calling the xinclude() method on a tree + will process any XInclude statements in the document. + +* XMLSchema support. Use the XMLSchema class or the convenience + xmlschema() method on a tree to do XML Schema (XSD) validation. + +* Added convenience xslt() method on tree. This is less efficient + than the XSLT object, but makes it easier to write quick code. + +* Added convenience relaxng() method on tree. This is less efficient + than the RelaxNG object, but makes it easier to write quick code. + +* Make it possible to use XPathEvaluator with elements as well. The + XPathEvaluator in this case will retain the element so multiple + XPath queries can be made against one element efficiently. This + replaces the second argument to the .evaluate() method that existed + previously. + +* Allow registerNamespace() to be called on an XPathEvaluator, after + creation, to add additional namespaces. Also allow registerNamespaces(), + which does the same for a namespace dictionary. + +* Add 'prefix' attribute to element to be able to read prefix information. + This is entirely read-only. + +* It is possible to supply an extra nsmap keyword parameter to + the Element() and SubElement() constructors, which supplies a + prefix to namespace URI mapping. This will create namespace + prefix declarations on these elements and these prefixes will show up + in XML serialization. + +Bugs fixed +---------- + +* Killed yet another memory management related bug: trees created + using newDoc would not get a libxml2-level dictionary, which caused + problems when deallocating these documents later if they contained a + node that came from a document with a dictionary. + +* Moving namespaced elements between documents was problematic as + references to the original document would remain. This has been fixed + by applying xmlReconciliateNs() after each move operation. + +* Can pass None to 'dump()' without segfaults. + +* tostring() works properly for non-root elements as well. + +* Cleaned out the tostring() method so it should handle encoding + correctly. + +* Cleaned out the ElementTree.write() method so it should handle encoding + correctly. Writing directly to a file should also be faster, as there is no + need to go through a Python string in that case. Made sure the test cases + test both serializing to StringIO as well as serializing to a real file. + +0.6 (2005-05-14) +================ + +Features added +-------------- + +* Changed setup.py so that library_dirs is also guessed. This should + help with compilation on the Mac OS X platform, where otherwise the + wrong library (shipping with the OS) could be picked up. + +* Tweaked setup.py so that it picks up the version from version.txt. + +Bugs fixed +---------- + +* Do the right thing when handling namespaced attributes. + +* fix bug where tostring() moved nodes into new documents. tostring() + had very nasty side-effects before this fix, sorry! + +0.5.1 (2005-04-09) +================== + +* Python 2.2 compatibility fixes. + +* unicode fixes in Element() and Comment() as well as XML(); unicode + input wasn't properly being UTF-8 encoded. + +0.5 (2005-04-08) +================ + +Initial public release. diff --git a/CREDITS.txt b/CREDITS.txt new file mode 100644 index 0000000..71f2280 --- /dev/null +++ b/CREDITS.txt @@ -0,0 +1,75 @@ +======= +Credits +======= + +Main contributors +================= + +Stefan Behnel + main developer and maintainer + +Martijn Faassen + creator of lxml and initial main developer + +Ian Bicking + creator and maintainer of lxml.html + +Holger Joukl + bug reports, feedback and development on lxml.objectify + +Sidnei da Silva + official MS Windows builds + +Marc-Antoine Parent + XPath extension function help and patches + +Olivier Grisel + improved (c)ElementTree compatibility patches, + website improvements. + +Kasimier Buchcik + help with specs and libxml2 + +Florian Wagner + help with copy.deepcopy support, bug reporting + +Emil Kroymann + help with encoding support, bug reporting + +Paul Everitt + bug reporting, feedback on API design + +Victor Ng + Discussions on memory management strategies, vlibxml2 + +Robert Kern + feedback on API design + +Andreas Pakulat + rpath linking support, doc improvements + +David Sankel + building statically on Windows + +Marcin Kasperski + PDF documentation generation + +... and lots of other people who contributed to lxml by reporting +bugs, discussing its functionality or blaming the docs for the bugs in +their code. Thank you all, user feedback and discussions form a very +important part of an Open Source project! + + +Special thanks goes to: +======================= + +* Daniel Veillard and the libxml2 project for a great XML library. + +* Fredrik Lundh for ElementTree, its API, and the competition through + cElementTree. + +* Greg Ewing (Pyrex) and Robert Bradshaw (Cython) for the binding + technology. + +* the codespeak crew, in particular Philipp von Weitershausen and + Holger Krekel for hosting lxml on codespeak.net diff --git a/IDEAS.txt b/IDEAS.txt new file mode 100644 index 0000000..62a6cd8 --- /dev/null +++ b/IDEAS.txt @@ -0,0 +1,43 @@ +Things to try out when life permits +=================================== + +* zlib-based parsing/serialising of compressed in-memory data + + * requires a libxml2 I/O OutputBuffer with appropriate I/O functions + that call into the lzma compression routines + +* lzma-based parsing/serialising of compressed in-memory data + + * requires a libxml2 I/O OutputBuffer with appropriate I/O functions + that call into the lzma compression routines + + * advantage over zlib: probably faster and better compression + + * maybe embed the lzma C sources in the distro + http://www.7-zip.org/sdk.html + +* generating XML using the ``with`` statement + + http://comments.gmane.org/gmane.comp.python.general/579950?set_lines=100000 + +* parse-time validation against a user provided DTD + + * currently only works for XML Schema + +* somehow integrate RelaxNG compact notation (rnc versus rng) + + * currently not supported by libxml2 (patch exists) + +* support subclassing XSLTAccessControl to provide custom per-URL + access check methods + + * maybe custom resolvers are enough, or can be combined with this? + +* reimplement iterparse() using the libxml2 xmlReader API + + * Advantage: the implementation can be made safer than the current + SAX implementation, as the parser would not interact with the + Python-level tree. + + * Disadvantage: the tree has to be built manually. In the current + SAX based implementation, libxml2 does it for us. diff --git a/INSTALL.txt b/INSTALL.txt new file mode 100644 index 0000000..ebdce21 --- /dev/null +++ b/INSTALL.txt @@ -0,0 +1,92 @@ +Installing lxml +=============== + +Requirements +------------ + +You need Python 2.3 or later. + +You need libxml2 and libxslt, in particular: + +* libxml 2.6.21 or later. It can be found here: + http://xmlsoft.org/downloads.html + + If you want to use XPath, do not use libxml2 2.6.27. We recommend + libxml2 2.7.2 or later. + +* libxslt 1.1.15 or later. It can be found here: + http://xmlsoft.org/XSLT/downloads.html + +Newer versions generally contain less bugs and are therefore +recommended. XML Schema support is also still worked on in libxml2, +so newer versions will give you better complience with the W3C spec. + + +Installation +------------ + +If you have easy_install_, you can run the following as super-user (or +administrator):: + + easy_install lxml + +.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall + +This has been reported to work on Linux, MacOS-X 10.4 and Windows, as long as +libxml2 and libxslt are properly installed (including development packages, +i.e. header files, etc.). + + +Building lxml from sources +-------------------------- + +If you want to build lxml from SVN you should read `how to build lxml +from source`_ (or the file ``doc/build.txt`` in the source tree). +Building from Subversion sources or from modified distribution sources +requires Cython_ to translate the lxml sources into C code. The +source distribution ships with pre-generated C source files, so you do +not need Cython installed to build from release sources. + +.. _Cython: http://www.cython.org +.. _`how to build lxml from source`: build.html + +If you have read these instructions and still cannot manage to install lxml, +you can check the archives of the `mailing list`_ to see if your problem is +known or otherwise send a mail to the list. + + .. _`mailing list`: http://codespeak.net/mailman/listinfo/lxml-dev + + +MS Windows +---------- + +For MS Windows, the `binary egg distribution of lxml`_ is statically +built against the libraries, i.e. it already includes them. There is +no need to install the external libraries if you use an official lxml +build from PyPI. + +If you want to upgrade the libraries and/or compile lxml from sources, you +should install a `binary distribution`_ of libxml2 and libxslt. You need both +libxml2 and libxslt, as well as iconv and zlib. + +.. _`binary distribution`: http://www.zlatkovic.com/libxml.en.html +.. _`binary egg distribution of lxml`: http://cheeseshop.python.org/pypi/lxml + + +MacOS-X +------- + +The system libraries of libxml2 and libxslt installed under MacOS-X +tend to be rather outdated. In any case, they are older than the +required versions for lxml 2.x, so you will have a hard time getting +lxml to work without installing newer libraries. + +A number of users reported success with updated libraries (e.g. using +fink_ or macports), but needed to set the runtime environment variable +``DYLD_LIBRARY_PATH`` to the directory where fink keeps the libraries. +See the `FAQ entry on MacOS-X`_ for more information. + +.. _fink: http://finkproject.org/ +.. _`FAQ entry on MacOS-X`: FAQ.html#my-application-crashes-on-macos-x + +A macport of lxml is available. Try ``port install py25-lxml``. diff --git a/LICENSES.txt b/LICENSES.txt new file mode 100644 index 0000000..44bbd4a --- /dev/null +++ b/LICENSES.txt @@ -0,0 +1,15 @@ +lxml is copyright Infrae and distributed under the BSD license (see +doc/licenses/BSD.txt), with the following exceptions: + +Some code, such a selftest.py, selftest2.py and +src/lxml/_elementpath.py are derived from ElementTree and +cElementTree. See doc/licenses/elementtree.txt for the license text. + +test.py, the test-runner script, is GPL and copyright Shuttleworth +Foundation. See doc/licenses/GPL.txt. It is believed the unchanged +inclusion of test.py to run the unit test suite falls under the +"aggregation" clause of the GPL and thus does not affect the license +of the rest of the package. + +the doctest.py module is taken from the Python library and falls under +the PSF Python License. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..26b8cb3 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,18 @@ +exclude *.py +include setup.py ez_setup.py setupinfo.py versioninfo.py buildlibxml.py +include test.py selftest.py selftest2.py +include update-error-constants.py +include MANIFEST.in Makefile version.txt +include CHANGES.txt CREDITS.txt INSTALL.txt LICENSES.txt README.txt TODO.txt +recursive-include src *.pyx *.pxd *.pxi *.py +recursive-include src/lxml lxml.etree.c lxml.objectify.c +recursive-include src/lxml lxml.etree.h lxml.etree_api.h etree_defs.h +recursive-include src/lxml/tests *.rng *.xslt *.xml *.dtd *.xsd *.html *.txt +recursive-include src/lxml/html/tests *.data *.txt +recursive-include samples *.xml +recursive-include benchmark *.py +recursive-include doc *.txt *.html *.css *.xml *.mgp pubkey.asc tagpython*.png +recursive-include doc/s5/ui *.gif *.htc *.png *.js +recursive-include doc/s5/ep2008 *.py *.png *.rng +recursive-include fake_pyrex *.py +include doc/mkhtml.py doc/rest2html.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..97edaa5 --- /dev/null +++ b/Makefile @@ -0,0 +1,116 @@ +PYTHON?=python +PYTHON3?=python3.0 +TESTFLAGS=-p -v +TESTOPTS= +SETUPFLAGS= +LXMLVERSION=`cat version.txt` + +all: inplace + +# Build in-place +inplace: + $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i + +build: + $(PYTHON) setup.py $(SETUPFLAGS) build + +test_build: build + $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) + +test_inplace: inplace + $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) + PYTHONPATH=src:$(PYTHONPATH) $(PYTHON) selftest.py + PYTHONPATH=src:$(PYTHONPATH) $(PYTHON) selftest2.py + +test_inplace3: inplace + $(MAKE) clean + $(PYTHON3) setup.py $(SETUPFLAGS) build_ext -i + $(PYTHON3) test.py $(TESTFLAGS) $(TESTOPTS) + PYTHONPATH=src:$(PYTHONPATH) $(PYTHON3) selftest.py + PYTHONPATH=src:$(PYTHONPATH) $(PYTHON3) selftest2.py + +valgrind_test_inplace: inplace + valgrind --tool=memcheck --leak-check=full --num-callers=30 --suppressions=valgrind-python.supp \ + $(PYTHON) test.py + +gdb_test_inplace: inplace + @echo -e "file $(PYTHON)\nrun test.py" > .gdb.command + gdb -x .gdb.command -d src -d src/lxml + +bench_inplace: inplace + $(PYTHON) benchmark/bench_etree.py -i + $(PYTHON) benchmark/bench_xpath.py -i + $(PYTHON) benchmark/bench_xslt.py -i + $(PYTHON) benchmark/bench_objectify.py -i + +ftest_build: build + $(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS) + +ftest_inplace: inplace + $(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS) + +apihtml: inplace + rm -fr doc/html/api + @[ -x "`which epydoc`" ] \ + && (cd src && echo "Generating API docs ..." && \ + PYTHONPATH=. epydoc -v --docformat "restructuredtext en" \ + -o ../doc/html/api --exclude='[.]html[.]tests|[.]_' \ + --exclude-introspect='[.]usedoctest' \ + --name "lxml API" --url http://codespeak.net/lxml/ lxml/) \ + || (echo "not generating epydoc API documentation") + +website: inplace + PYTHONPATH=src:$(PYTHONPATH) $(PYTHON) doc/mkhtml.py doc/html . ${LXMLVERSION} + +html: inplace website apihtml s5 + +s5: + $(MAKE) -C doc/s5 slides + +apipdf: inplace + rm -fr doc/pdf + mkdir -p doc/pdf + @[ -x "`which epydoc`" ] \ + && (cd src && echo "Generating API docs ..." && \ + PYTHONPATH=. epydoc -v --latex --docformat "restructuredtext en" \ + -o ../doc/pdf --exclude='([.]html)?[.]tests|[.]_' \ + --exclude-introspect='html[.]clean|[.]usedoctest' \ + --name "lxml API" --url http://codespeak.net/lxml/ lxml/) \ + || (echo "not generating epydoc API documentation") + +pdf: apipdf + $(PYTHON) doc/mklatex.py doc/pdf . ${LXMLVERSION} + (cd doc/pdf && pdflatex lxmldoc.tex \ + && pdflatex lxmldoc.tex \ + && pdflatex lxmldoc.tex) + @pdfopt doc/pdf/lxmldoc.pdf doc/pdf/lxmldoc-${LXMLVERSION}.pdf + @echo "PDF available as doc/pdf/lxmldoc-${LXMLVERSION}.pdf" + +# Two pdflatex runs are needed to build the correct Table of contents. + +test: test_inplace + +test3: test_inplace3 + +valtest: valgrind_test_inplace + +gdbtest: gdb_test_inplace + +bench: bench_inplace + +ftest: ftest_inplace + +clean: + find . \( -name '*.o' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \; + rm -rf build + +docclean: + $(MAKE) -C doc/s5 clean + rm -f doc/html/*.html + rm -fr doc/html/api + rm -fr doc/pdf + +realclean: clean docclean + find . -name '*.c' -exec rm -f {} \; + rm -f TAGS + $(PYTHON) setup.py clean -a diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..4a555e9 --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,108 @@ +Metadata-Version: 1.0 +Name: lxml +Version: 2.2.3 +Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API. +Home-page: http://codespeak.net/lxml +Author: lxml dev team +Author-email: lxml-dev@codespeak.net +License: UNKNOWN +Download-URL: http://pypi.python.org/packages/source/l/lxml/lxml-2.2.3.tar.gz +Description: lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It + provides safe and convenient access to these libraries using the ElementTree + API. + + It extends the ElementTree API significantly to offer support for XPath, + RelaxNG, XML Schema, XSLT, C14N and much more. + + To contact the project, go to the `project home page + `_ or see our bug tracker at + https://launchpad.net/lxml + + In case you want to use the current in-development version of lxml, you can + get it from the subversion repository at http://codespeak.net/svn/lxml/trunk . + Running ``easy_install lxml==dev`` will install it from + http://codespeak.net/svn/lxml/trunk#egg=lxml-dev + + + After an official release of a new stable series, bug fixes may become + available at + http://codespeak.net/svn/lxml/branch/lxml-2.2 . + Running ``easy_install lxml==2.2bugfix`` will install + the unreleased branch state from + http://codespeak.net/svn/lxml/branch/lxml-2.2#egg=lxml-2.2bugfix + as soon as a maintenance branch has been established. + 2.2.3 (2009-10-30) + ================== + + Features added + -------------- + + Bugs fixed + ---------- + + * The ``resolve_entities`` option did not work in the incremental feed + parser. + + * Looking up and deleting attributes without a namespace could hit a + namespaced attribute of the same name instead. + + * Late errors during calls to ``SubElement()`` (e.g. attribute related + ones) could leave a partially initialised element in the tree. + + * Modifying trees that contain parsed entity references could result + in an infinite loop. + + * ObjectifiedElement.__setattr__ created an empty-string child element when the + attribute value was rejected as a non-unicode/non-ascii string + + * Syntax errors in ``lxml.cssselect`` could result in misleading error + messages. + + * Invalid syntax in CSS expressions could lead to an infinite loop in + the parser of ``lxml.cssselect``. + + * CSS special character escapes were not properly handled in + ``lxml.cssselect``. + + * CSS Unicode escapes were not properly decoded in ``lxml.cssselect``. + + * Select options in HTML forms that had no explicit ``value`` + attribute were not handled correctly. The HTML standard dictates + that their value is defined by their text content. This is now + supported by lxml.html. + + * XPath raised a TypeError when finding CDATA sections. This is now + fully supported. + + * Calling ``help(lxml.objectify)`` didn't work at the prompt. + + * The ``ElementMaker`` in lxml.objectify no longer defines the default + namespaces when annotation is disabled. + + * Feed parser failed to honout the 'recover' option on parse errors. + + * Diverting the error logging to Python's logging system was broken. + + Other changes + ------------- + + + +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Information Technology +Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.3 +Classifier: Programming Language :: Python :: 2.4 +Classifier: Programming Language :: Python :: 2.5 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.0 +Classifier: Programming Language :: C +Classifier: Operating System :: OS Independent +Classifier: Topic :: Text Processing :: Markup :: HTML +Classifier: Topic :: Text Processing :: Markup :: XML +Classifier: Topic :: Software Development :: Libraries :: Python Modules diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..b2803a6 --- /dev/null +++ b/README.txt @@ -0,0 +1,3 @@ +See doc/main.txt and doc/intro.txt + +For installation information, see INSTALL.txt diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..e263867 --- /dev/null +++ b/TODO.txt @@ -0,0 +1,54 @@ +=============== +ToDo's for lxml +=============== + +lxml +==== + +In general +---------- + +* test namespaces more in-depth + +* more testing on multi-threading + +* better exception messages for XPath and schemas based on error log, + e.g. missing namespace mappings in XPath + +* more testing on input/output of encoded filenames, including custom + resolvers, relative XSLT imports, ... + +* always use '' as URL when tree was parsed from string? (can libxml2 + handle this?) + +* follow PEP 8 in API naming (avoidCamelCase in_favour_of_underscores) + +* use per-call or per-thread error logs in XSLT/XPath/etc. to keep the + messages separate, especially in exceptions + + +QName +----- + +* expose prefix support? + + +Entities +-------- + +* clean support for entities (is the Entity element class enough?) + + +Objectify +--------- + +* emulate setting special __attributes__ on ObjectifiedElement's as Python + attributes, not XML children + + +Maybe +----- + +* rewrite iterparse() to accept a parser as argument instead of being + one (or maybe not: iterparse() can't deal with all parser options + anyway). diff --git a/benchmark/bench_etree.py b/benchmark/bench_etree.py new file mode 100644 index 0000000..71628cc --- /dev/null +++ b/benchmark/bench_etree.py @@ -0,0 +1,406 @@ +import sys, copy +from itertools import * +from StringIO import StringIO + +import benchbase +from benchbase import (with_attributes, with_text, onlylib, + serialized, children, nochange) + +TEXT = "some ASCII text" +UTEXT = u"some klingon: \F8D2" + +############################################################ +# Benchmarks +############################################################ + +class BenchMark(benchbase.TreeBenchMark): + @nochange + def bench_iter_children(self, root): + for child in root: + pass + + @nochange + def bench_iter_children_reversed(self, root): + for child in reversed(root): + pass + + @nochange + def bench_first_child(self, root): + for i in self.repeat1000: + child = root[0] + + @nochange + def bench_last_child(self, root): + for i in self.repeat1000: + child = root[-1] + + @nochange + def bench_middle_child(self, root): + pos = len(root) / 2 + for i in self.repeat1000: + child = root[pos] + + @nochange + @with_attributes(False) + @with_text(text=True) + @onlylib('lxe', 'ET') + def bench_tostring_text_ascii(self, root): + self.etree.tostring(root, method="text") + + @nochange + @with_attributes(False) + @with_text(text=True, utext=True) + @onlylib('lxe') + def bench_tostring_text_unicode(self, root): + self.etree.tostring(root, method="text", encoding=unicode) + + @nochange + @with_attributes(False) + @with_text(text=True, utext=True) + @onlylib('lxe', 'ET') + def bench_tostring_text_utf16(self, root): + self.etree.tostring(root, method="text", encoding='UTF-16') + + @nochange + @with_attributes(False) + @with_text(text=True, utext=True) + @onlylib('lxe') + @children + def bench_tostring_text_utf8_with_tail(self, children): + for child in children: + self.etree.tostring(child, method="text", + encoding='UTF-8', with_tail=True) + + @nochange + @with_attributes(True, False) + @with_text(text=True, utext=True) + def bench_tostring_utf8(self, root): + self.etree.tostring(root, encoding='UTF-8') + + @nochange + @with_attributes(True, False) + @with_text(text=True, utext=True) + def bench_tostring_utf16(self, root): + self.etree.tostring(root, encoding='UTF-16') + + @nochange + @with_attributes(True, False) + @with_text(text=True, utext=True) + def bench_tostring_utf8_unicode_XML(self, root): + xml = unicode(self.etree.tostring(root, encoding='UTF-8'), 'UTF-8') + self.etree.XML(xml) + + @nochange + @with_attributes(True, False) + @with_text(text=True, utext=True) + def bench_write_utf8_parse_stringIO(self, root): + f = StringIO() + self.etree.ElementTree(root).write(f, encoding='UTF-8') + f.seek(0) + self.etree.parse(f) + + @with_attributes(True, False) + @with_text(text=True, utext=True) + @serialized + def bench_parse_stringIO(self, root_xml): + f = StringIO(root_xml) + self.etree.parse(f) + + @with_attributes(True, False) + @with_text(text=True, utext=True) + @serialized + def bench_XML(self, root_xml): + self.etree.XML(root_xml) + + @with_attributes(True, False) + @with_text(text=True, utext=True) + @serialized + def bench_iterparse_stringIO(self, root_xml): + f = StringIO(root_xml) + for event, element in self.etree.iterparse(f): + pass + + @with_attributes(True, False) + @with_text(text=True, utext=True) + @serialized + def bench_iterparse_stringIO_clear(self, root_xml): + f = StringIO(root_xml) + for event, element in self.etree.iterparse(f): + element.clear() + + def bench_append_from_document(self, root1, root2): + # == "1,2 2,3 1,3 3,1 3,2 2,1" # trees 1 and 2, or 2 and 3, or ... + for el in root2: + root1.append(el) + + def bench_insert_from_document(self, root1, root2): + pos = len(root1)/2 + for el in root2: + root1.insert(pos, el) + pos = pos + 1 + + def bench_rotate_children(self, root): + # == "1 2 3" # runs on any single tree independently + for i in range(100): + el = root[0] + del root[0] + root.append(el) + + def bench_reorder(self, root): + for i in range(1,len(root)/2): + el = root[0] + del root[0] + root[-i:-i] = [ el ] + + def bench_reorder_slice(self, root): + for i in range(1,len(root)/2): + els = root[0:1] + del root[0] + root[-i:-i] = els + + def bench_clear(self, root): + root.clear() + + @nochange + @children + def bench_has_children(self, children): + for child in children: + if child and child and child and child and child: + pass + + @nochange + @children + def bench_len(self, children): + for child in children: + map(len, repeat(child, 20)) + + @children + def bench_create_subelements(self, children): + SubElement = self.etree.SubElement + for child in children: + SubElement(child, '{test}test') + + def bench_append_elements(self, root): + Element = self.etree.Element + for child in root: + el = Element('{test}test') + child.append(el) + + @nochange + @children + def bench_makeelement(self, children): + empty_attrib = {} + for child in children: + child.makeelement('{test}test', empty_attrib) + + @nochange + @children + def bench_create_elements(self, children): + Element = self.etree.Element + for child in children: + Element('{test}test') + + @children + def bench_replace_children_element(self, children): + Element = self.etree.Element + for child in children: + el = Element('{test}test') + child[:] = [el] + + @children + def bench_replace_children(self, children): + els = [ self.etree.Element("newchild") ] + for child in children: + child[:] = els + + def bench_remove_children(self, root): + for child in root: + root.remove(child) + + def bench_remove_children_reversed(self, root): + for child in reversed(root): + root.remove(child) + + @children + def bench_set_attributes(self, children): + for child in children: + child.set('a', 'bla') + + @with_attributes(True) + @children + @nochange + def bench_get_attributes(self, children): + for child in children: + child.get('bla1') + child.get('{attr}test1') + + @children + def bench_setget_attributes(self, children): + for child in children: + child.set('a', 'bla') + for child in children: + child.get('a') + + @nochange + def bench_root_getchildren(self, root): + root.getchildren() + + @nochange + def bench_root_list_children(self, root): + list(root) + + @nochange + @children + def bench_getchildren(self, children): + for child in children: + child.getchildren() + + @nochange + @children + def bench_get_children_slice(self, children): + for child in children: + child[:] + + @nochange + @children + def bench_get_children_slice_2x(self, children): + for child in children: + child[:] + child[:] + + @nochange + @children + @with_attributes(True, False) + @with_text(utext=True, text=True, no_text=True) + def bench_deepcopy(self, children): + for child in children: + copy.deepcopy(child) + + @nochange + @with_attributes(True, False) + @with_text(utext=True, text=True, no_text=True) + def bench_deepcopy_all(self, root): + copy.deepcopy(root) + + @nochange + @children + def bench_tag(self, children): + for child in children: + child.tag + + @nochange + @children + def bench_tag_repeat(self, children): + for child in children: + for i in self.repeat100: + child.tag + + @nochange + @with_text(utext=True, text=True, no_text=True) + @children + def bench_text(self, children): + for child in children: + child.text + + @nochange + @with_text(utext=True, text=True, no_text=True) + @children + def bench_text_repeat(self, children): + for child in children: + for i in self.repeat500: + child.text + + @children + def bench_set_text(self, children): + text = TEXT + for child in children: + child.text = text + + @children + def bench_set_utext(self, children): + text = UTEXT + for child in children: + child.text = text + + @nochange + @onlylib('lxe') + def bench_index(self, root): + for child in root: + root.index(child) + + @nochange + @onlylib('lxe') + def bench_index_slice(self, root): + for child in root[5:100]: + root.index(child, 5, 100) + + @nochange + @onlylib('lxe') + def bench_index_slice_neg(self, root): + for child in root[-100:-5]: + root.index(child, start=-100, stop=-5) + + @nochange + def bench_getiterator_all(self, root): + list(root.getiterator()) + + @nochange + def bench_getiterator_islice(self, root): + list(islice(root.getiterator(), 10, 110)) + + @nochange + def bench_getiterator_tag(self, root): + list(islice(root.getiterator(self.SEARCH_TAG), 3, 10)) + + @nochange + def bench_getiterator_tag_all(self, root): + list(root.getiterator(self.SEARCH_TAG)) + + @nochange + def bench_getiterator_tag_none(self, root): + list(root.getiterator("{ThisShould}NeverExist")) + + @nochange + def bench_getiterator_tag_text(self, root): + [ e.text for e in root.getiterator(self.SEARCH_TAG) ] + + @nochange + def bench_findall(self, root): + root.findall(".//*") + + @nochange + def bench_findall_child(self, root): + root.findall(".//*/" + self.SEARCH_TAG) + + @nochange + def bench_findall_tag(self, root): + root.findall(".//" + self.SEARCH_TAG) + + @nochange + def bench_findall_path(self, root): + root.findall(".//*[%s]/./%s/./*" % (self.SEARCH_TAG, self.SEARCH_TAG)) + + @nochange + @onlylib('lxe') + def bench_xpath_path(self, root): + ns, tag = self.SEARCH_TAG[1:].split('}') + root.xpath(".//*[p:%s]/./p:%s/./*" % (tag,tag), + namespaces = {'p':ns}) + + @nochange + @onlylib('lxe') + def bench_iterfind(self, root): + list(root.iterfind(".//*")) + + @nochange + @onlylib('lxe') + def bench_iterfind_tag(self, root): + list(root.iterfind(".//" + self.SEARCH_TAG)) + + @nochange + @onlylib('lxe') + def bench_iterfind_islice(self, root): + list(islice(root.iterfind(".//*"), 10, 110)) + +if __name__ == '__main__': + benchbase.main(BenchMark) diff --git a/benchmark/bench_objectify.py b/benchmark/bench_objectify.py new file mode 100644 index 0000000..12d0e87 --- /dev/null +++ b/benchmark/bench_objectify.py @@ -0,0 +1,125 @@ +import sys, copy +from itertools import * +from StringIO import StringIO + +import benchbase +from benchbase import (with_attributes, with_text, onlylib, + serialized, children, nochange) + +############################################################ +# Benchmarks +############################################################ + +class BenchMark(benchbase.TreeBenchMark): + repeat100 = range(100) + repeat1000 = range(1000) + repeat3000 = range(3000) + + def __init__(self, lib): + from lxml import etree, objectify + self.objectify = objectify + parser = etree.XMLParser(remove_blank_text=True) + lookup = objectify.ObjectifyElementClassLookup() + parser.setElementClassLookup(lookup) + super(BenchMark, self).__init__(etree, parser) + + @nochange + def bench_attribute(self, root): + "1 2 4" + for i in self.repeat3000: + root.zzzzz + + def bench_attribute_assign_int(self, root): + "1 2 4" + for i in self.repeat3000: + root.XYZ = 5 + + def bench_attribute_assign_string(self, root): + "1 2 4" + for i in self.repeat3000: + root.XYZ = "5" + + @nochange + def bench_attribute_cached(self, root): + "1 2 4" + cache = root.zzzzz + for i in self.repeat3000: + root.zzzzz + + @nochange + def bench_attributes_deep(self, root): + "1 2 4" + for i in self.repeat3000: + root.zzzzz['{cdefg}a00001'] + + @nochange + def bench_attributes_deep_cached(self, root): + "1 2 4" + cache1 = root.zzzzz + cache2 = cache1['{cdefg}a00001'] + for i in self.repeat3000: + root.zzzzz['{cdefg}a00001'] + + @nochange + def bench_objectpath(self, root): + "1 2 4" + path = self.objectify.ObjectPath(".zzzzz") + for i in self.repeat3000: + path(root) + + @nochange + def bench_objectpath_deep(self, root): + "1 2 4" + path = self.objectify.ObjectPath(".zzzzz.{cdefg}a00001") + for i in self.repeat3000: + path(root) + + @nochange + def bench_objectpath_deep_cached(self, root): + "1 2 4" + cache1 = root.zzzzz + cache2 = cache1['{cdefg}a00001'] + path = self.objectify.ObjectPath(".zzzzz.{cdefg}a00001") + for i in self.repeat3000: + path(root) + + @with_text(text=True, utext=True, no_text=True) + def bench_annotate(self, root): + self.objectify.annotate(root) + + @nochange + def bench_descendantpaths(self, root): + root.descendantpaths() + + @nochange + @with_text(text=True) + def bench_type_inference(self, root): + "1 2 4" + el = root.aaaaa + for i in self.repeat1000: + el.getchildren() + + @nochange + @with_text(text=True) + def bench_type_inference_annotated(self, root): + "1 2 4" + el = root.aaaaa + self.objectify.annotate(el) + for i in self.repeat1000: + el.getchildren() + + @nochange + @children + def bench_elementmaker(self, children): + E = self.objectify.E + for child in children: + root = E.this( + "test", + E.will( + E.do("nothing"), + E.special, + ) + ) + +if __name__ == '__main__': + benchbase.main(BenchMark) diff --git a/benchmark/bench_xpath.py b/benchmark/bench_xpath.py new file mode 100644 index 0000000..e48df56 --- /dev/null +++ b/benchmark/bench_xpath.py @@ -0,0 +1,95 @@ +import sys, copy +from itertools import * +from StringIO import StringIO + +import benchbase +from benchbase import with_attributes, with_text, onlylib, serialized, children, nochange + +############################################################ +# Benchmarks +############################################################ + +class XPathBenchMark(benchbase.TreeBenchMark): + @nochange + @onlylib('lxe') + @children + def bench_xpath_class(self, children): + xpath = self.etree.XPath("./*[0]") + for child in children: + xpath(child) + + @nochange + @onlylib('lxe') + @children + def bench_xpath_class_repeat(self, children): + for child in children: + xpath = self.etree.XPath("./*[0]") + xpath(child) + + @nochange + @onlylib('lxe') + def bench_xpath_element(self, root): + xpath = self.etree.XPathElementEvaluator(root) + for child in root: + xpath.evaluate("./*[0]") + + @nochange + @onlylib('lxe') + @children + def bench_xpath_method(self, children): + for child in children: + child.xpath("./*[0]") + + @nochange + @onlylib('lxe') + @children + def bench_multiple_xpath_or(self, children): + xpath = self.etree.XPath(".//p:a00001|.//p:b00001|.//p:c00001", + namespaces={'p':'cdefg'}) + for child in children: + xpath(child) + + @nochange + @onlylib('lxe') + @children + def bench_multiple_iter_tag(self, children): + for child in children: + list(child.iter("{cdefg}a00001")) + list(child.iter("{cdefg}b00001")) + list(child.iter("{cdefg}c00001")) + + @nochange + @onlylib('lxe') + @children + def bench_xpath_old_extensions(self, children): + def return_child(_, elements): + if elements: + return elements[0][0] + else: + return () + extensions = {("test", "child") : return_child} + xpath = self.etree.XPath("t:child(.)", namespaces={"test":"t"}, + extensions=extensions) + for child in children: + xpath(child) + + @nochange + @onlylib('lxe') + @children + def bench_xpath_extensions(self, children): + def return_child(_, elements): + if elements: + return elements[0][0] + else: + return () + self.etree.FunctionNamespace("testns")["t"] = return_child + + try: + xpath = self.etree.XPath("test:t(.)", namespaces={"test":"testns"}) + for child in children: + xpath(child) + finally: + del self.etree.FunctionNamespace("testns")["t"] + +if __name__ == '__main__': + benchbase.main(XPathBenchMark) diff --git a/benchmark/bench_xslt.py b/benchmark/bench_xslt.py new file mode 100644 index 0000000..f70ca15 --- /dev/null +++ b/benchmark/bench_xslt.py @@ -0,0 +1,58 @@ +import sys, copy +from itertools import * +from StringIO import StringIO + +import benchbase +from benchbase import with_attributes, with_text, onlylib, serialized + +############################################################ +# Benchmarks +############################################################ + +class XSLTBenchMark(benchbase.TreeBenchMark): + @onlylib('lxe') + def bench_xslt_extensions_old(self, root): + tree = self.etree.XML("""\ + + TEST + + + + + + + + +""") + def return_child(_, elements): + return elements[0][0] + + extensions = {('testns', 'child') : return_child} + + transform = self.etree.XSLT(tree, extensions) + for i in range(10): + transform(root) + + @onlylib('lxe') + def bench_xslt_document(self, root): + transform = self.etree.XSLT(self.etree.XML("""\ + + TEST + + + + + + + + +""")) + transform(root) + +if __name__ == '__main__': + benchbase.main(XSLTBenchMark) diff --git a/benchmark/benchbase.py b/benchmark/benchbase.py new file mode 100644 index 0000000..1b4feff --- /dev/null +++ b/benchmark/benchbase.py @@ -0,0 +1,528 @@ +import sys, re, string, time, copy, gc +from itertools import * +from StringIO import StringIO +import time + + +TREE_FACTOR = 1 # increase tree size with '-l / '-L' cmd option + +_TEXT = "some ASCII text" * TREE_FACTOR +_UTEXT = u"some klingon: \F8D2" * TREE_FACTOR +_ATTRIBUTES = { + '{attr}test1' : _TEXT, + '{attr}test2' : _TEXT, + 'bla1' : _TEXT, + 'bla2' : _TEXT, + 'bla3' : _TEXT + } + + +def initArgs(argv): + global TREE_FACTOR + try: + argv.remove('-l') + # use large trees + TREE_FACTOR *= 2 + except ValueError: + pass + + try: + argv.remove('-L') + # use LARGE trees + TREE_FACTOR *= 2 + except ValueError: + pass + +############################################################ +# benchmark decorators +############################################################ + +def with_attributes(*use_attributes): + "Decorator for benchmarks that use attributes" + vmap = {False : 0, True : 1} + values = [ vmap[bool(v)] for v in use_attributes ] + def set_value(function): + try: + function.ATTRIBUTES.update(values) + except AttributeError: + function.ATTRIBUTES = set(values) + return function + return set_value + +def with_text(no_text=False, text=False, utext=False): + "Decorator for benchmarks that use text" + values = [] + if no_text: + values.append(0) + if text: + values.append(1) + if utext: + values.append(2) + def set_value(function): + try: + function.TEXT.add(values) + except AttributeError: + function.TEXT = set(values) + return function + return set_value + +def onlylib(*libs): + "Decorator to restrict benchmarks to specific libraries" + def set_libs(function): + if libs: + function.LIBS = libs + return function + return set_libs + +def serialized(function): + "Decorator for benchmarks that require serialized XML data" + function.STRING = True + return function + +def children(function): + "Decorator for benchmarks that require a list of root children" + function.CHILDREN = True + return function + +def nochange(function): + "Decorator for benchmarks that do not change the XML tree" + function.NO_CHANGE = True + return function + +############################################################ +# benchmark baseclass +############################################################ + +class SkippedTest(Exception): + pass + +class TreeBenchMark(object): + atoz = string.ascii_lowercase + repeat100 = range(100) + repeat500 = range(500) + repeat1000 = range(1000) + + _LIB_NAME_MAP = { + 'etree' : 'lxe', + 'ElementTree' : 'ET', + 'cElementTree' : 'cET' + } + + SEARCH_TAG = "{cdefg}a00001" + + def __init__(self, etree, etree_parser=None): + self.etree = etree + libname = etree.__name__.split('.')[-1] + self.lib_name = self._LIB_NAME_MAP.get(libname, libname) + + if libname == 'etree': + deepcopy = copy.deepcopy + def set_property(root, fname): + xml = self._serialize_tree(root) + if etree_parser is not None: + setattr(self, fname, lambda : etree.XML(xml, etree_parser)) + else: + setattr(self, fname, lambda : deepcopy(root)) + setattr(self, fname + '_xml', lambda : xml) + setattr(self, fname + '_children', lambda : root[:]) + else: + def set_property(root, fname): + setattr(self, fname, self.et_make_clone_factory(root)) + xml = self._serialize_tree(root) + setattr(self, fname + '_xml', lambda : xml) + setattr(self, fname + '_children', lambda : root[:]) + + attribute_list = list(enumerate( [{}, _ATTRIBUTES] )) + text_list = list(enumerate( [None, _TEXT, _UTEXT] )) + build_name = self._tree_builder_name + + self.setup_times = [] + for tree in self._all_trees(): + times = [] + self.setup_times.append(times) + setup = getattr(self, '_setup_tree%d' % tree) + for an, attributes in attribute_list: + for tn, text in text_list: + root, t = setup(text, attributes) + times.append(t) + set_property(root, build_name(tree, tn, an)) + + def _tree_builder_name(self, tree, tn, an): + return '_root%d_T%d_A%d' % (tree, tn, an) + + def tree_builder(self, tree, tn, an, serial, children): + name = self._tree_builder_name(tree, tn, an) + if serial: + name += '_xml' + elif children: + name += '_children' + return getattr(self, name) + + def _serialize_tree(self, root): + return self.etree.tostring(root, encoding='UTF-8') + + def et_make_clone_factory(self, elem): + def generate_elem(append, elem, level): + var = "e" + str(level) + arg = repr(elem.tag) + if elem.attrib: + arg += ", **%r" % elem.attrib + if level == 1: + append(" e1 = Element(%s)" % arg) + else: + append(" %s = SubElement(e%d, %s)" % (var, level-1, arg)) + if elem.text: + append(" %s.text = %r" % (var, elem.text)) + if elem.tail: + append(" %s.tail = %r" % (var, elem.tail)) + for e in elem: + generate_elem(append, e, level+1) + # generate code for a function that creates a tree + output = ["def element_factory():"] + generate_elem(output.append, elem, 1) + output.append(" return e1") + # setup global function namespace + namespace = { + "Element" : self.etree.Element, + "SubElement" : self.etree.SubElement + } + # create function object + exec "\n".join(output) in namespace + return namespace["element_factory"] + + def _all_trees(self): + all_trees = [] + for name in dir(self): + if name.startswith('_setup_tree'): + all_trees.append(int(name[11:])) + return all_trees + + def _setup_tree1(self, text, attributes): + "tree with 26 2nd level and 520 * TREE_FACTOR 3rd level children" + atoz = self.atoz + SubElement = self.etree.SubElement + current_time = time.time + t = current_time() + root = self.etree.Element('{abc}rootnode') + for ch1 in atoz: + el = SubElement(root, "{abc}"+ch1*5, attributes) + el.text = text + for ch2 in atoz: + tag = "{cdefg}%s00001" % ch2 + for i in range(20 * TREE_FACTOR): + SubElement(el, tag).tail = text + t = current_time() - t + return (root, t) + + def _setup_tree2(self, text, attributes): + "tree with 520 * TREE_FACTOR 2nd level and 26 3rd level children" + atoz = self.atoz + SubElement = self.etree.SubElement + current_time = time.time + t = current_time() + root = self.etree.Element('{abc}rootnode') + for ch1 in atoz: + for i in range(20 * TREE_FACTOR): + el = SubElement(root, "{abc}"+ch1*5, attributes) + el.text = text + for ch2 in atoz: + SubElement(el, "{cdefg}%s00001" % ch2).tail = text + t = current_time() - t + return (root, t) + + def _setup_tree3(self, text, attributes): + "tree of depth 8 + TREE_FACTOR with 3 children per node" + SubElement = self.etree.SubElement + current_time = time.time + t = current_time() + root = self.etree.Element('{abc}rootnode') + children = [root] + for i in range(6 + TREE_FACTOR): + tag_no = count().next + children = [ SubElement(c, "{cdefg}a%05d" % (i%8), attributes) + for i,c in enumerate(chain(children, children, children)) ] + for child in children: + child.text = text + child.tail = text + t = current_time() - t + return (root, t) + + def _setup_tree4(self, text, attributes): + "small tree with 26 2nd level and 2 3rd level children" + SubElement = self.etree.SubElement + current_time = time.time + t = current_time() + root = self.etree.Element('{abc}rootnode') + children = [root] + for ch1 in self.atoz: + el = SubElement(root, "{abc}"+ch1*5, attributes) + el.text = text + SubElement(el, "{cdefg}a00001", attributes).tail = text + SubElement(el, "{cdefg}z00000", attributes).tail = text + t = current_time() - t + return (root, t) + + def benchmarks(self): + """Returns a list of all benchmarks. + + A benchmark is a tuple containing a method name and a list of tree + numbers. Trees are prepared by the setup function. + """ + all_trees = self._all_trees() + benchmarks = [] + for name in dir(self): + if not name.startswith('bench_'): + continue + method = getattr(self, name) + if hasattr(method, 'LIBS') and self.lib_name not in method.LIBS: + method_call = None + else: + method_call = method + if method.__doc__: + tree_sets = method.__doc__.split() + else: + tree_sets = () + if tree_sets: + tree_tuples = [ map(int, tree_set.split(',')) + for tree_set in tree_sets ] + else: + try: + function = getattr(method, 'im_func', method) + arg_count = method.func_code.co_argcount - 1 + except AttributeError: + arg_count = 1 + tree_tuples = self._permutations(all_trees, arg_count) + + serialized = getattr(method, 'STRING', False) + children = getattr(method, 'CHILDREN', False) + no_change = getattr(method, 'NO_CHANGE', False) + + for tree_tuple in tree_tuples: + for tn in sorted(getattr(method, 'TEXT', (0,))): + for an in sorted(getattr(method, 'ATTRIBUTES', (0,))): + benchmarks.append((name, method_call, tree_tuple, + tn, an, serialized, children, + no_change)) + + return benchmarks + + def _permutations(self, seq, count): + def _permutations(prefix, remainder, count): + if count == 0: + return [ prefix[:] ] + count -= 1 + perms = [] + prefix.append(None) + for pos, el in enumerate(remainder): + new_remainder = remainder[:pos] + remainder[pos+1:] + prefix[-1] = el + perms.extend( _permutations(prefix, new_remainder, count) ) + prefix.pop() + return perms + return _permutations([], seq, count) + +############################################################ +# Prepare and run benchmark suites +############################################################ + +def buildSuites(benchmark_class, etrees, selected): + benchmark_suites = map(benchmark_class, etrees) + + # sorted by name and tree tuple + benchmarks = [ sorted(b.benchmarks()) for b in benchmark_suites ] + + selected = [ re.compile(r).search for r in selected ] + + if selected: + benchmarks = [ [ b for b in bs + if [ match for match in selected + if match(b[0]) ] ] + for bs in benchmarks ] + + return (benchmark_suites, benchmarks) + +def build_treeset_name(trees, tn, an, serialized, children): + text = {0:'-', 1:'S', 2:'U'}[tn] + attr = {0:'-', 1:'A'}[an] + ser = {True:'X', False:'T'}[serialized] + chd = {True:'C', False:'R'}[children] + return "%s%s%s%s T%s" % (text, attr, ser, chd, ',T'.join(imap(str, trees))[:6]) + +def printSetupTimes(benchmark_suites): + print "Setup times for trees in seconds:" + for b in benchmark_suites: + print "%-3s: " % b.lib_name, + for an in (0,1): + for tn in (0,1,2): + print ' %s ' % build_treeset_name((), tn, an, False, False)[:2], + print + for i, tree_times in enumerate(b.setup_times): + print " T%d:" % (i+1), ' '.join("%6.4f" % t for t in tree_times) + print + +def runBench(suite, method_name, method_call, tree_set, tn, an, + serial, children, no_change): + if method_call is None: + raise SkippedTest + + current_time = time.time + call_repeat = range(10) + + tree_builders = [ suite.tree_builder(tree, tn, an, serial, children) + for tree in tree_set ] + + rebuild_trees = not no_change and not serial + + args = tuple([ build() for build in tree_builders ]) + method_call(*args) # run once to skip setup overhead + + times = [] + for i in range(3): + gc.collect() + gc.disable() + t = -1 + for i in call_repeat: + if rebuild_trees: + args = [ build() for build in tree_builders ] + t_one_call = current_time() + method_call(*args) + t_one_call = current_time() - t_one_call + if t < 0: + t = t_one_call + else: + t = min(t, t_one_call) + times.append(1000.0 * t) + gc.enable() + if rebuild_trees: + args = () + args = () + gc.collect() + return times + +def runBenchmarks(benchmark_suites, benchmarks): + for bench_calls in izip(*benchmarks): + for lib, (bench, benchmark_setup) in enumerate(izip(benchmark_suites, bench_calls)): + bench_name = benchmark_setup[0] + tree_set_name = build_treeset_name(*benchmark_setup[-6:-1]) + print "%-3s: %-28s" % (bench.lib_name, bench_name[6:34]), + print "(%-10s)" % tree_set_name, + sys.stdout.flush() + + try: + result = runBench(bench, *benchmark_setup) + except SkippedTest: + print "skipped" + except KeyboardInterrupt: + print "interrupted by user" + sys.exit(1) + except Exception, e: + print "failed: %s: %s" % (e.__class__.__name__, e) + else: + print "%9.4f msec/pass, best of (" % min(result), + for t in result: + print "%9.4f" % t, + print ")" + + if len(benchmark_suites) > 1: + print # empty line between different benchmarks + +############################################################ +# Main program +############################################################ + +def main(benchmark_class): + import_lxml = True + callgrind_zero = False + if len(sys.argv) > 1: + try: + sys.argv.remove('-i') + # run benchmark 'inplace' + sys.path.insert(0, 'src') + except ValueError: + pass + + try: + sys.argv.remove('-nolxml') + # run without lxml + import_lxml = False + except ValueError: + pass + + try: + sys.argv.remove('-z') + # reset callgrind after tree setup + callgrind_zero = True + except ValueError: + pass + + initArgs(sys.argv) + + _etrees = [] + if import_lxml: + from lxml import etree + _etrees.append(etree) + + try: + sys.argv.remove('-fel') + except ValueError: + pass + else: + # use fast element creation in lxml.etree + etree.set_element_class_lookup( + etree.ElementDefaultClassLookup()) + + if len(sys.argv) > 1: + if '-a' in sys.argv or '-c' in sys.argv: + # 'all' or 'C-implementations' ? + try: + sys.argv.remove('-c') + except ValueError: + pass + try: + import cElementTree as cET + _etrees.append(cET) + except ImportError: + try: + import xml.etree.cElementTree as cET + _etrees.append(cET) + except ImportError: + pass + + try: + # 'all' ? + sys.argv.remove('-a') + except ValueError: + pass + else: + try: + from elementtree import ElementTree as ET + _etrees.append(ET) + except ImportError: + try: + from xml.etree import ElementTree as ET + _etrees.append(ET) + except ImportError: + pass + + if not _etrees: + print "No library to test. Exiting." + sys.exit(1) + + print "Preparing test suites and trees ..." + selected = set( sys.argv[1:] ) + benchmark_suites, benchmarks = \ + buildSuites(benchmark_class, _etrees, selected) + + print "Running benchmark on", ', '.join(b.lib_name + for b in benchmark_suites) + print + + printSetupTimes(benchmark_suites) + + if callgrind_zero: + cmd = open("callgrind.cmd", 'w') + cmd.write('+Instrumentation\n') + cmd.write('Zero\n') + cmd.close() + + runBenchmarks(benchmark_suites, benchmarks) diff --git a/buildlibxml.py b/buildlibxml.py new file mode 100644 index 0000000..687bd54 --- /dev/null +++ b/buildlibxml.py @@ -0,0 +1,234 @@ +import os, re, sys +from distutils import log, sysconfig + +try: + from urlparse import urlsplit, urljoin + from urllib import urlretrieve +except ImportError: + from urllib.parse import urlsplit + from urllib.request import urlretrieve + +## Routines to download and build libxml2/xslt: + +LIBXML2_LOCATION = 'ftp://xmlsoft.org/libxml2/' +match_libfile_version = re.compile('^[^-]*-([.0-9-]+)[.].*').match + +def ftp_listdir(url): + import ftplib, posixpath + scheme, netloc, path, qs, fragment = urlsplit(url) + assert scheme.lower() == 'ftp' + server = ftplib.FTP(netloc) + server.login() + files = [posixpath.basename(fn) for fn in server.nlst(path)] + return files + +def tryint(s): + try: + return int(s) + except ValueError: + return s + +def download_libxml2(dest_dir, version=None): + """Downloads libxml2, returning the filename where the library was downloaded""" + version_re = re.compile(r'^LATEST_LIBXML2_IS_(.*)$') + filename = 'libxml2-%s.tar.gz' + return download_library(dest_dir, LIBXML2_LOCATION, 'libxml2', + version_re, filename, version=version) + +def download_libxslt(dest_dir, version=None): + """Downloads libxslt, returning the filename where the library was downloaded""" + version_re = re.compile(r'^LATEST_LIBXSLT_IS_(.*)$') + filename = 'libxslt-%s.tar.gz' + return download_library(dest_dir, LIBXML2_LOCATION, 'libxslt', + version_re, filename, version=version) + +def download_library(dest_dir, location, name, version_re, filename, + version=None): + if version is None: + try: + fns = ftp_listdir(location) + for fn in fns: + match = version_re.search(fn) + if match: + version = match.group(1) + print('Latest version of %s is %s' % (name, version)) + break + else: + raise Exception( + "Could not find the most current version of the %s from the files: %s" + % (name, fns)) + except IOError: + # network failure - maybe we have the files already? + latest = (0,0,0) + fns = os.listdir(dest_dir) + for fn in fns: + if fn.startswith(name+'-'): + match = match_libfile_version(fn) + if match: + version = tuple(map(tryint, match.group(1).split('.'))) + if version > latest: + latest = version + filename = fn + break + else: + raise + filename = filename % version + full_url = urljoin(location, filename) + dest_filename = os.path.join(dest_dir, filename) + if os.path.exists(dest_filename): + print('Using existing %s downloaded into %s (delete this file if you want to re-download the package)' + % (name, dest_filename)) + else: + print('Downloading %s into %s' % (name, dest_filename)) + urlretrieve(full_url, dest_filename) + return dest_filename + +## Backported method of tarfile.TarFile.extractall (doesn't exist in 2.4): +def _extractall(self, path=".", members=None): + """Extract all members from the archive to the current working + directory and set owner, modification time and permissions on + directories afterwards. `path' specifies a different directory + to extract to. `members' is optional and must be a subset of the + list returned by getmembers(). + """ + import copy + is_ignored_file = re.compile( + r'''[\\/]((test|results?)[\\/] + |doc[\\/].*(Log|[.](out|imp|err|png|ent|gif|tif|pdf))$ + |tests[\\/](.*[\\/])?(?!Makefile)[^\\/]*$ + |python[\\/].*[.]py$ + ) + ''', re.X).search + + directories = [] + + if members is None: + members = self + + for tarinfo in members: + if is_ignored_file(tarinfo.name): + continue + if tarinfo.isdir(): + # Extract directories with a safe mode. + directories.append((tarinfo.name, tarinfo)) + tarinfo = copy.copy(tarinfo) + tarinfo.mode = 448 # 0700 + self.extract(tarinfo, path) + + # Reverse sort directories. + directories.sort() + directories.reverse() + + # Set correct owner, mtime and filemode on directories. + for name, tarinfo in directories: + dirpath = os.path.join(path, name) + try: + self.chown(tarinfo, dirpath) + self.utime(tarinfo, dirpath) + self.chmod(tarinfo, dirpath) + except tarfile.ExtractError: + if self.errorlevel > 1: + raise + else: + self._dbg(1, "tarfile: %s" % sys.exc_info()[1]) + +def unpack_tarball(tar_filename, dest): + import tarfile + print('Unpacking %s into %s' % (os.path.basename(tar_filename), dest)) + tar = tarfile.open(tar_filename) + base_dir = None + for member in tar: + base_name = member.name.split('/')[0] + if base_dir is None: + base_dir = base_name + else: + if base_dir != base_name: + print('Unexpected path in %s: %s' % (tar_filename, base_name)) + _extractall(tar, dest) + tar.close() + return os.path.join(dest, base_dir) + +def call_subprocess(cmd, **kw): + import subprocess + cwd = kw.get('cwd', '.') + cmd_desc = ' '.join(cmd) + log.info('Running "%s" in %s' % (cmd_desc, cwd)) + returncode = subprocess.call(cmd, **kw) + if returncode: + raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode)) + +def safe_mkdir(dir): + if not os.path.exists(dir): + os.makedirs(dir) + +def build_libxml2xslt(download_dir, build_dir, + static_include_dirs, static_library_dirs, + static_cflags, static_binaries, + libxml2_version=None, libxslt_version=None): + safe_mkdir(download_dir) + safe_mkdir(build_dir) + libxml2_dir = unpack_tarball(download_libxml2(download_dir, libxml2_version), build_dir) + libxslt_dir = unpack_tarball(download_libxslt(download_dir, libxslt_version), build_dir) + prefix = os.path.join(os.path.abspath(build_dir), 'libxml2') + safe_mkdir(prefix) + + call_setup = {} + env_setup = None + if sys.platform in ('darwin',): + # We compile Universal if we are on a machine > 10.3 + major_version = int(os.uname()[2].split('.')[0]) + if major_version > 7: + env = os.environ.copy() + env.update({ + 'CFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2", + 'LDFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk", + 'MACOSX_DEPLOYMENT_TARGET' : "10.3" + }) + call_setup['env'] = env + + # We may loose the link to iconv, so make sure it's there + static_binaries.append('-liconv') + + configure_cmd = ['./configure', + '--without-python', + '--disable-dependency-tracking', + '--disable-shared', + '--prefix=%s' % prefix, + ] + call_subprocess(configure_cmd, cwd=libxml2_dir, **call_setup) + call_subprocess( + ['make'], cwd=libxml2_dir, **call_setup) + call_subprocess( + ['make', 'install'], cwd=libxml2_dir, **call_setup) + + libxslt_configure_cmd = configure_cmd + [ + '--with-libxml-prefix=%s' % prefix, + ] + if sys.platform in ('darwin',): + libxslt_configure_cmd += [ + '--without-crypto', + ] + + call_subprocess(libxslt_configure_cmd, cwd=libxslt_dir, **call_setup) + call_subprocess( + ['make'], cwd=libxslt_dir, **call_setup) + call_subprocess( + ['make', 'install'], cwd=libxslt_dir, **call_setup) + + xslt_config = os.path.join(prefix, 'bin', 'xslt-config') + xml2_config = os.path.join(prefix, 'bin', 'xml2-config') + + lib_dir = os.path.join(prefix, 'lib') + static_include_dirs.extend([ + os.path.join(prefix, 'include'), + os.path.join(prefix, 'include', 'libxml2'), + os.path.join(prefix, 'include', 'libxslt'), + os.path.join(prefix, 'include', 'libexslt')]) + static_library_dirs.append(lib_dir) + + for filename in os.listdir(lib_dir): + if [l for l in ['libxml2', 'libxslt', 'libexslt'] if l in filename]: + if [ext for ext in ['.a'] if filename.endswith(ext)]: + static_binaries.append(os.path.join(lib_dir,filename)) + + return (xml2_config, xslt_config) diff --git a/doc/FAQ.txt b/doc/FAQ.txt new file mode 100644 index 0000000..b6fda86 --- /dev/null +++ b/doc/FAQ.txt @@ -0,0 +1,946 @@ +===================================== +lxml FAQ - Frequently Asked Questions +===================================== + +.. meta:: + :description: Frequently Asked Questions about lxml (FAQ) + :keywords: lxml, lxml.etree, FAQ, frequently asked questions + +Frequently asked questions on lxml. See also the notes on compatibility_ to +ElementTree_. + +.. _compatibility: compatibility.html +.. _ElementTree: http://effbot.org/zone/element-index.htm +.. _`build instructions`: build.html +.. _`MacOS-X` : build.html#building-lxml-on-macos-x + +.. contents:: +.. + 1 General Questions + 1.1 Is there a tutorial? + 1.2 Where can I find more documentation about lxml? + 1.3 What standards does lxml implement? + 1.4 Who uses lxml? + 1.5 What is the difference between lxml.etree and lxml.objectify? + 1.6 How can I make my application run faster? + 1.7 What about that trailing text on serialised Elements? + 1.8 How can I find out if an Element is a comment or PI? + 1.9 How can I map an XML tree into a dict of dicts? + 2 Installation + 2.1 Which version of libxml2 and libxslt should I use or require? + 2.2 Where are the binary builds? + 2.3 Why do I get errors about missing UCS4 symbols when installing lxml? + 3 Contributing + 3.1 Why is lxml not written in Python? + 3.2 How can I contribute? + 4 Bugs + 4.1 My application crashes! + 4.2 My application crashes on MacOS-X! + 4.3 I think I have found a bug in lxml. What should I do? + 4.4 How do I know a bug is really in lxml and not in libxml2? + 5 Threading + 5.1 Can I use threads to concurrently access the lxml API? + 5.2 Does my program run faster if I use threads? + 5.3 Would my single-threaded program run faster if I turned off threading? + 5.4 Why can't I reuse XSLT stylesheets in other threads? + 5.5 My program crashes when run with mod_python/Pyro/Zope/Plone/... + 6 Parsing and Serialisation + 6.1 Why doesn't the ``pretty_print`` option reformat my XML output? + 6.2 Why can't lxml parse my XML from unicode strings? + 6.3 What is the difference between str(xslt(doc)) and xslt(doc).write() ? + 6.4 Why can't I just delete parents or clear the root node in iterparse()? + 6.5 How do I output null characters in XML text? + 7 XPath and Document Traversal + 7.1 What are the ``findall()`` and ``xpath()`` methods on Element(Tree)? + 7.2 Why doesn't ``findall()`` support full XPath expressions? + 7.3 How can I find out which namespace prefixes are used in a document? + 7.4 How can I specify a default namespace for XPath expressions? + +.. + >>> import sys + >>> from lxml import etree as _etree + >>> if sys.version_info[0] >= 3: + ... class etree_mock(object): + ... def __getattr__(self, name): return getattr(_etree, name) + ... def tostring(self, *args, **kwargs): + ... s = _etree.tostring(*args, **kwargs) + ... if isinstance(s, bytes): s = s.decode("utf-8") # CR + ... if s[-1] == '\n': s = s[:-1] + ... return s + ... else: + ... class etree_mock(object): + ... def __getattr__(self, name): return getattr(_etree, name) + ... def tostring(self, *args, **kwargs): + ... s = _etree.tostring(*args, **kwargs) + ... if s[-1] == '\n': s = s[:-1] + ... return s + >>> etree = etree_mock() + + +General Questions +================= + +Is there a tutorial? +-------------------- + +Read the `lxml.etree Tutorial`_. While this is still work in progress +(just as any good documentation), it provides an overview of the most +important concepts in ``lxml.etree``. If you want to help out, +improving the tutorial is a very good place to start. + +There is also a `tutorial for ElementTree`_ which works for +``lxml.etree``. The documentation of the `extended etree API`_ also +contains many examples for ``lxml.etree``. Fredrik Lundh's `element +library`_ contains a lot of nice recipes that show how to solve common +tasks in ElementTree and lxml.etree. To learn using +``lxml.objectify``, read the `objectify documentation`_. + +John Shipman has written another tutorial called `Python XML +processing with lxml`_ that contains lots of examples. Liza Daly +wrote a nice article about high-performance aspects when `parsing +large files with lxml`_. + +.. _`lxml.etree Tutorial`: tutorial.html +.. _`tutorial for ElementTree`: http://effbot.org/zone/element.htm +.. _`extended etree API`: api.html +.. _`objectify documentation`: objectify.html +.. _`Python XML processing with lxml`: http://www.nmt.edu/tcc/help/pubs/pylxml/ +.. _`element library`: http://effbot.org/zone/element-lib.htm +.. _`parsing large files with lxml`: http://www.ibm.com/developerworks/xml/library/x-hiperfparse/ + + +Where can I find more documentation about lxml? +----------------------------------------------- + +There is a lot of documentation on the web and also in the Python +standard library documentation, as lxml implements the well-known +`ElementTree API`_ and tries to follow its documentation as closely as +possible. The recipes in Fredrik Lundh's `element library`_ are +generally worth taking a look at. There are a couple of issues where +lxml cannot keep up compatibility. They are described in the +compatibility_ documentation. + +The lxml specific extensions to the API are described by individual +files in the ``doc`` directory of the source distribution and on `the +web page`_. + +The `generated API documentation`_ is a comprehensive API reference +for the lxml package. + +.. _`ElementTree API`: http://effbot.org/zone/element-index.htm +.. _`the web page`: http://codespeak.net/lxml/#documentation +.. _`generated API documentation`: api/index.html + + +What standards does lxml implement? +----------------------------------- + +The compliance to XML Standards depends on the support in libxml2 and libxslt. +Here is a quote from `http://xmlsoft.org/ `_: + + In most cases libxml2 tries to implement the specifications in a relatively + strictly compliant way. As of release 2.4.16, libxml2 passed all 1800+ tests + from the OASIS XML Tests Suite. + +lxml currently supports libxml2 2.6.20 or later, which has even better +support for various XML standards. The important ones are: + +* XML 1.0 +* HTML 4 +* XML namespaces +* XML Schema 1.0 +* XPath 1.0 +* XInclude 1.0 +* XSLT 1.0 +* EXSLT +* XML catalogs +* canonical XML +* RelaxNG +* xml:id +* xml:base + +Support for XML Schema is currently not 100% complete in libxml2, but +is definitely very close to compliance. Schematron is supported, +although not necessarily complete. libxml2 also supports loading +documents through HTTP and FTP. + + +Who uses lxml? +-------------- + +As an XML library, lxml is often used under the hood of in-house +server applications, such as web servers or applications that +facilitate some kind of document management. Many people who deploy +Zope_ or Plone_ use it together with lxml. Therefore, it is hard to +get an idea of who uses it, and the following list of 'users and +projects we know of' is definitely not a complete list of lxml's +users. + +Also note that the compatibility to the ElementTree library does not +require projects to set a hard dependency on lxml - as long as they do +not take advantage of lxml's enhanced feature set. + +* cssutils_, a CSS parser and toolkit, can be used with ``lxml.cssselect`` +* Deliverance_, a content theming tool +* `Enfold Proxy 4`_, a web server accelerator with on-the-fly XSLT processing +* Inteproxy_, a secure HTTP proxy +* lwebstring_, an XML template engine +* OpenXMLlib_, a library for handling OpenXML document meta data +* Pycoon_, a WSGI web development framework based on XML pipelines +* PyQuery_, a query framework for XML/HTML, similar to jQuery for JavaScript +* Rambler_, a meta search engine that aggregates different data sources +* rdfadict_, an RDFa parser with a simple dictionary-like interface. + +Zope3 and some of its extensions have good support for lxml: + +* gocept.lxml_, Zope3 interface bindings for lxml +* z3c.rml_, an implementation of ReportLab's RML format +* zif.sedna_, an XQuery based interface to the Sedna OpenSource XML database + +And don't miss the quotes by our generally happy_ users_, and other +`sites that link to lxml`_. As `Liza Daly`_ puts it: "Many software +products come with the pick-two caveat, meaning that you must choose +only two: speed, flexibility, or readability. When used carefully, +lxml can provide all three." + +.. _Zope: http://www.zope.org/ +.. _Plone: http://www.plone.org/ +.. _cssutils: http://code.google.com/p/cssutils/source/browse/trunk/examples/style.py?r=917 +.. _Deliverance: http://www.openplans.org/projects/deliverance/project-home +.. _`Enfold Proxy 4`: http://www.enfoldsystems.com/Products/Proxy/4 +.. _gocept.lxml: http://pypi.python.org/pypi/gocept.lxml +.. _Inteproxy: http://lists.wald.intevation.org/pipermail/inteproxy-devel/2007-February/000000.html +.. _lwebstring: http://pypi.python.org/pypi/lwebstring +.. _OpenXMLlib: http://permalink.gmane.org/gmane.comp.python.lxml.devel/3250 +.. _Pycoon: http://pypi.python.org/pypi/pycoon +.. _PyQuery: http://pypi.python.org/pypi/pyquery +.. _Rambler: http://beta.rambler.ru/srch?query=python+lxml&searchtype=web +.. _rdfadict: http://pypi.python.org/pypi/rdfadict +.. _z3c.rml: http://pypi.python.org/pypi/z3c.rml +.. _zif.sedna: http://pypi.python.org/pypi/zif.sedna + +.. _happy: http://thread.gmane.org/gmane.comp.python.lxml.devel/3244/focus=3244 +.. _users: http://article.gmane.org/gmane.comp.python.lxml.devel/3246 +.. _`sites that link to lxml`: http://www.google.com/search?as_lq=http:%2F%2Fcodespeak.net%2Flxml +.. _`Liza Daly`: http://www.ibm.com/developerworks/xml/library/x-hiperfparse/ + + +What is the difference between lxml.etree and lxml.objectify? +------------------------------------------------------------- + +The two modules provide different ways of handling XML. However, objectify +builds on top of lxml.etree and therefore inherits most of its capabilities +and a large portion of its API. + +* lxml.etree is a generic API for XML and HTML handling. It aims for + ElementTree compatibility_ and supports the entire XML infoset. It is well + suited for both mixed content and data centric XML. Its generality makes it + the best choice for most applications. + +* lxml.objectify is a specialized API for XML data handling in a Python object + syntax. It provides a very natural way to deal with data fields stored in a + structurally well defined XML format. Data is automatically converted to + Python data types and can be manipulated with normal Python operators. Look + at the examples in the `objectify documentation`_ to see what it feels like + to use it. + + Objectify is not well suited for mixed contents or HTML documents. As it is + built on top of lxml.etree, however, it inherits the normal support for + XPath, XSLT or validation. + + +How can I make my application run faster? +----------------------------------------- + +lxml.etree is a very fast library for processing XML. There are, however, `a +few caveats`_ involved in the mapping of the powerful libxml2 library to the +simple and convenient ElementTree API. Not all operations are as fast as the +simplicity of the API might suggest, while some use cases can heavily benefit +from finding the right way of doing them. The `benchmark page`_ has a +comparison to other ElementTree implementations and a number of tips for +performance tweaking. As with any Python application, the rule of thumb is: +the more of your processing runs in C, the faster your application gets. See +also the section on threading_. + +.. _`a few caveats`: performance.html#the-elementtree-api +.. _`benchmark page`: performance.html +.. _threading: #threading + + +What about that trailing text on serialised Elements? +----------------------------------------------------- + +The ElementTree tree model defines an Element as a container with a tag name, +contained text, child Elements and a tail text. This means that whenever you +serialise an Element, you will get all parts of that Element: + +.. sourcecode:: pycon + + >>> root = etree.XML("texttail") + >>> print(etree.tostring(root[0])) + texttail + +Here is an example that shows why not serialising the tail would be +even more surprising from an object point of view: + +.. sourcecode:: pycon + + >>> root = etree.Element("test") + + >>> root.text = "TEXT" + >>> print(etree.tostring(root)) + TEXT + + >>> root.tail = "TAIL" + >>> print(etree.tostring(root)) + TEXTTAIL + + >>> root.tail = None + >>> print(etree.tostring(root)) + TEXT + +Just imagine a Python list where you append an item and it doesn't +show up when you look at the list. + +The ``.tail`` property is a huge simplification for the tree model as +it avoids text nodes to appear in the list of children and makes +access to them quick and simple. So this is a benefit in most +applications and simplifies many, many XML tree algorithms. + +However, in document-like XML (and especially HTML), the above result can be +unexpected to new users and can sometimes require a bit more overhead. A good +way to deal with this is to use helper functions that copy the Element without +its tail. The ``lxml.html`` package also deals with this in a couple of +places, as most HTML algorithms benefit from a tail-free behaviour. + + +How can I find out if an Element is a comment or PI? +---------------------------------------------------- + +.. sourcecode:: pycon + + >>> root = etree.XML("") + + >>> root.tag + 'root' + >>> root.getprevious().tag is etree.PI + True + >>> root[0].tag is etree.Comment + True + + +How can I map an XML tree into a dict of dicts? +----------------------------------------------- + +I'm glad you asked. + +.. sourcecode:: python + + def recursive_dict(element): + return element.tag, \ + dict(map(recursive_dict, element)) or element.text + + +Installation +============ + +Which version of libxml2 and libxslt should I use or require? +------------------------------------------------------------- + +It really depends on your application, but the rule of thumb is: more recent +versions contain less bugs and provide more features. + +* Do not use libxml2 2.6.27 if you want to use XPath (including XSLT). You + will get crashes when XPath errors occur during the evaluation (e.g. for + unknown functions). This happens inside the evaluation call to libxml2, so + there is nothing that lxml can do about it. + +* Try to use versions of both libraries that were released together. At least + the libxml2 version should not be older than the libxslt version. + +* If you use XML Schema or Schematron which are still under development, the + most recent version of libxml2 is usually a good bet. + +* The same applies to XPath, where a substantial number of bugs and memory + leaks were fixed over time. If you encounter crashes or memory leaks in + XPath applications, try a more recent version of libxml2. + +* For parsing and fixing broken HTML, lxml requires at least libxml2 2.6.21. + +* For the normal tree handling, however, any libxml2 version starting with + 2.6.20 should do. + +Read the `release notes of libxml2`_ and the `release notes of libxslt`_ to +see when (or if) a specific bug has been fixed. + +.. _`release notes of libxml2`: http://xmlsoft.org/news.html +.. _`release notes of libxslt`: http://xmlsoft.org/XSLT/news.html + + +Where are the binary builds? +---------------------------- + +Sidnei da Silva regularly contributes Windows binaries for new +releases. This is because two of the major problems of Microsoft +Windows make it non-trivial for users to build lxml on this platform: +the lack of a pre-installed standard compiler and the missing package +management. + +If there is not currently a binary distribution of the most recent +lxml release for this platform available from the Python Package Index +(PyPI), please look through the older versions to see if they provide +a binary build. This is done by appending the version number to the +PyPI URL, e.g.:: + + http://pypi.python.org/pypi/lxml/2.1.5 + +Apart from that, we generally do not provide binary builds of lxml, as +most of the other operating systems out there can build lxml without +problems (with the exception of `MacOS-X`_), and the sheer mass of +variations between platforms makes it futile to provide builds for +everyone. + + +Why do I get errors about missing UCS4 symbols when installing lxml? +-------------------------------------------------------------------- + +Most likely, you use a Python installation that was configured for internal +use of UCS2 unicode, meaning 16-bit unicode. The lxml egg distributions are +generally compiled on platforms that use UCS4, a 32-bit unicode encoding, as +this is used on the majority of platforms. Sadly, both are not compatible, so +the eggs can only support the one they were compiled with. + +This means that you have to compile lxml from sources for your system. Note +that you do not need Cython for this, the lxml source distribution is directly +compilable on both platform types. See the `build instructions`_ on how to do +this. + + +Contributing +============ + +Why is lxml not written in Python? +---------------------------------- + +It *almost* is. + +lxml is not written in plain Python, because it interfaces with two C +libraries: libxml2 and libxslt. Accessing them at the C-level is +required for performance reasons. + +However, to avoid writing plain C-code and caring too much about the +details of built-in types and reference counting, lxml is written in +Cython_, a Python-like language that is translated into C-code. +Chances are that if you know Python, you can write `code that Cython +accepts`_. Again, the C-ish style used in the lxml code is just for +performance optimisations. If you want to contribute, don't bother +with the details, a Python implementation of your contribution is +better than none. And keep in mind that lxml's flexible API often +favours an implementation of features in pure Python, without +bothering with C-code at all. For example, the ``lxml.html`` package +is entirely written in Python. + +Please contact the `mailing list`_ if you need any help. + +.. _Cython: http://www.cython.org/ +.. _`code that Cython accepts`: http://docs.cython.org/docs/tutorial.html + + +How can I contribute? +--------------------- + +If you find something that you would like lxml to do (or do better), +then please tell us about it on the `mailing list`_. Patches are +always appreciated, especially when accompanied by unit tests and +documentation (doctests would be great). See the ``tests`` +subdirectories in the lxml source tree (below the ``src`` directory) +and the ReST_ `text files`_ in the ``doc`` directory. + +We also have a `list of missing features`_ that we would like to +implement but didn't due to lack if time. If *you* find the time, +patches are very welcome. + +.. _ReST: http://docutils.sourceforge.net/rst.html +.. _`text files`: http://codespeak.net/svn/lxml/trunk/doc/ +.. _`list of missing features`: http://codespeak.net/svn/lxml/trunk/IDEAS.txt + +Besides enhancing the code, there are a lot of places where you can help the +project and its user base. You can + +* spread the word and write about lxml. Many users (especially new Python + users) have not yet heared about lxml, although our user base is constantly + growing. If you write your own blog and feel like saying something about + lxml, go ahead and do so. If we think your contribution or criticism is + valuable to other users, we may even put a link or a quote on the project + page. + +* provide code examples for the general usage of lxml or specific problems + solved with lxml. Readable code is a very good way of showing how a library + can be used and what great things you can do with it. Again, if we hear + about it, we can set a link on the project page. + +* work on the documentation. The web page is generated from a set of ReST_ + `text files`_. It is meant both as a representative project page for lxml + and as a site for documenting lxml's API and usage. If you have questions + or an idea how to make it more readable and accessible while you are reading + it, please send a comment to the `mailing list`_. + +* enhance the web site. We put some work into making the web site + usable, understandable and also easy to find, but there's always + things that can be done better. You may notice that we are not + top-ranked when searching the web for "Python and XML", so maybe you + have an idea how to improve that. + +* help with the tutorial. A tutorial is the most important stating point for + new users, so it is important for us to provide an easy to understand guide + into lxml. As allo documentation, the tutorial is work in progress, so we + appreciate every helping hand. + +* improve the docstrings. lxml uses docstrings to support Python's integrated + online ``help()`` function. However, sometimes these are not sufficient to + grasp the details of the function in question. If you find such a place, + you can try to write up a better description and send it to the `mailing + list`_. + + +Bugs +==== + +My application crashes! +----------------------- + +One of the goals of lxml is "no segfaults", so if there is no clear +warning in the documentation that you were doing something potentially +harmful, you have found a bug and we would like to hear about it. +Please report this bug to the `mailing list`_. See the section on bug +reporting to learn how to do that. + +If your application (or e.g. your web container) uses threads, please +see the FAQ section on threading_ to check if you touch on one of the +potential pitfalls. + +In any case, try to reproduce the problem with the latest versions of +libxml2 and libxslt. From time to time, bugs and race conditions are found +in these libraries, so a more recent version might already contain a fix for +your problem. + +Remember: even if you see lxml appear in a crash stack trace, it is +not necessarily lxml that *caused* the crash. + + +My application crashes on MacOS-X! +---------------------------------- + +This was a common problem up to lxml 2.1.x. Since lxml 2.2, the only +officially supported way to use it on this platform is through a +static build against freshly downloaded versions of libxml2 and +libxslt. See the build instructions for `MacOS-X`_. + + +I think I have found a bug in lxml. What should I do? +----------------------------------------------------- + +First, you should look at the `current developer changelog`_ to see if this +is a known problem that has already been fixed in the SVN trunk since the +release you are using. + +.. _`current developer changelog`: http://codespeak.net/svn/lxml/trunk/CHANGES.txt + +Also, the 'crash' section above has a few good advices what to try to see if +the problem is really in lxml - and not in your setup. Believe it or not, +that happens more often than you might think, especially when old libraries +or even multiple library versions are installed. + +You should always try to reproduce the problem with the latest +versions of libxml2 and libxslt - and make sure they are used. +``lxml.etree`` can tell you what it runs with: + +.. sourcecode:: python + + from lxml import etree + print "lxml.etree: ", etree.LXML_VERSION + print "libxml used: ", etree.LIBXML_VERSION + print "libxml compiled: ", etree.LIBXML_COMPILED_VERSION + print "libxslt used: ", etree.LIBXSLT_VERSION + print "libxslt compiled: ", etree.LIBXSLT_COMPILED_VERSION + +If you can figure that the problem is not in lxml but in the +underlying libxml2 or libxslt, you can ask right on the respective +mailing lists, which may considerably reduce the time to find a fix or +work-around. See the next question for some hints on how to do that. + +Otherwise, we would really like to hear about it. Please report it to +the `mailing list`_ so that we can fix it. It is very helpful in this +case if you can come up with a short code snippet that demonstrates +your problem. If others can reproduce and see the problem, it is much +easier for them to fix it - and maybe even easier for you to describe +it and get people convinced that it really is a problem to fix. + +It is important that you always report the version of lxml, libxml2 +and libxslt that you get from the code snippet above. If we do not +know the library versions you are using, we will ask back, so it will +take longer for you to get a helpful answer. + +Since as a user of lxml you are likely a programmer, you might find +`this article on bug reports`_ an interesting read. + +.. _`mailing list`: http://codespeak.net/mailman/listinfo/lxml-dev +.. _`this article on bug reports`: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html + + +How do I know a bug is really in lxml and not in libxml2? +--------------------------------------------------------- + +A large part of lxml's functionality is implemented by libxml2 and +libxslt, so problems that you encounter may be in one or the other. +Knowing the right place to ask will reduce the time it takes to fix +the problem, or to find a work-around. + +Both libxml2 and libxslt come with their own command line frontends, +namely ``xmllint`` and ``xsltproc``. If you encounter problems with +XSLT processing for specific stylesheets or with validation for +specific schemas, try to run the XSLT with ``xsltproc`` or the +validation with ``xmllint`` respectively to find out if it fails there +as well. If it does, please report directly to the mailing lists of +the respective project, namely: + +* `libxml2 mailing list `_ +* `libxslt mailing list `_ + +On the other hand, everything that seems to be related to Python code, +including custom resolvers, custom XPath functions, etc. is likely +outside of the scope of libxml2/libxslt. If you encounter problems +here or you are not sure where there the problem may come from, please +ask on the lxml mailing list first. + +In any case, a good explanation of the problem including some simple +test code and some input data will help us (or the libxml2 developers) +see and understand the problem, which largely increases your chance of +getting help. See the question above for a few hints on what is +helpful here. + + +Threading +========= + +Can I use threads to concurrently access the lxml API? +------------------------------------------------------ + +Short answer: yes, if you use lxml 2.2 and later. + +Since version 1.1, lxml frees the GIL (Python's global interpreter +lock) internally when parsing from disk and memory, as long as you use +either the default parser (which is replicated for each thread) or +create a parser for each thread yourself. lxml also allows +concurrency during validation (RelaxNG and XMLSchema) and XSL +transformation. You can share RelaxNG, XMLSchema and XSLT objects +between threads. + +While you can also share parsers between threads, this will serialize +the access to each of them, so it is better to ``.copy()`` parsers or +to just use the default parser if you do not need any special +configuration. The same applies to the XPath evaluators, which use an +internal lock to protect their prepared evaluation contexts. It is +therefore best to use separate evaluator instances in threads. + +Warning: Before lxml 2.2, and especially before 2.1, there were +various issues when moving subtrees between different threads, or when +applying XSLT objects from one thread to trees parsed or modified in +another. If you need code to run with older versions, you should +generally avoid modifying trees in other threads than the one it was +generated in. Although this should work in many cases, there are +certain scenarios where the termination of a thread that parsed a tree +can crash the application if subtrees of this tree were moved to other +documents. You should be on the safe side when passing trees between +threads if you either + +- do not modify these trees and do not move their elements to other + trees, or + +- do not terminate threads while the trees they parsed are still in + use (e.g. by using a fixed size thread-pool or long-running threads + in processing chains) + +Since lxml 2.2, even multi-thread pipelines are supported. However, +note that it is more efficient to do all tree work inside one thread, +than to let multiple threads work on a tree one after the other. This +is because trees inherit state from the thread that created them, +which must be maintained when the tree is modified inside another +thread. + + +Does my program run faster if I use threads? +-------------------------------------------- + +Depends. The best way to answer this is timing and profiling. + +The global interpreter lock (GIL) in Python serializes access to the +interpreter, so if the majority of your processing is done in Python +code (walking trees, modifying elements, etc.), your gain will be +close to zero. The more of your XML processing moves into lxml, +however, the higher your gain. If your application is bound by XML +parsing and serialisation, or by very selective XPath expressions and +complex XSLTs, your speedup on multi-processor machines can be +substantial. + +See the question above to learn which operations free the GIL to support +multi-threading. + + +Would my single-threaded program run faster if I turned off threading? +---------------------------------------------------------------------- + +Possibly, yes. You can see for yourself by compiling lxml entirely +without threading support. Pass the ``--without-threading`` option to +setup.py when building lxml from source. You can also build libxml2 +without pthread support (``--without-pthreads`` option), which may add +another bit of performance. Note that this will leave internal data +structures entirely without thread protection, so make sure you really +do not use lxml outside of the main application thread in this case. + + +Why can't I reuse XSLT stylesheets in other threads? +---------------------------------------------------- + +Since later lxml 2.0 versions, you can do this. There is some +overhead involved as the result document needs an additional cleanup +traversal when the input document and/or the stylesheet were created +in other threads. However, on a multi-processor machine, the gain of +freeing the GIL easily covers this drawback. + +If you need even the last bit of performance, consider keeping (a copy +of) the stylesheet in thread-local storage, and try creating the input +document(s) in the same thread. And do not forget to benchmark your +code to see if the increased code complexity is really worth it. + + +My program crashes when run with mod_python/Pyro/Zope/Plone/... +--------------------------------------------------------------- + +These environments can use threads in a way that may not make it obvious when +threads are created and what happens in which thread. This makes it hard to +ensure lxml's threading support is used in a reliable way. Sadly, if problems +arise, they are as diverse as the applications, so it is difficult to provide +any generally applicable solution. Also, these environments are so complex +that problems become hard to debug and even harder to reproduce in a +predictable way. If you encounter crashes in one of these systems, but your +code runs perfectly when started by hand, the following gives you a few hints +for possible approaches to solve your specific problem: + +* make sure you use recent versions of libxml2, libxslt and lxml. The + libxml2 developers keep fixing bugs in each release, and lxml also + tries to become more robust against possible pitfalls. So newer + versions might already fix your problem in a reliable way. Version + 2.2 of lxml contains many improvements. + +* make sure the library versions you installed are really used. Do + not rely on what your operating system tells you! Print the version + constants in ``lxml.etree`` from within your runtime environment to + make sure it is the case. This is especially a problem under + MacOS-X when newer library versions were installed in addition to + the outdated system libraries. Please read the bugs section + regarding MacOS-X in this FAQ. + +* if you use ``mod_python``, try setting this option: + + PythonInterpreter main_interpreter + + There was a discussion on the mailing list about this problem: + + http://comments.gmane.org/gmane.comp.python.lxml.devel/2942 + +* compile lxml without threading support by running ``setup.py`` with the + ``--without-threading`` option. While this might be slower in certain + scenarios on multi-processor systems, it *might* also keep your application + from crashing, which should be worth more to you than peek performance. + Remember that lxml is fast anyway, so concurrency may not even be worth it. + +* look out for fancy XSLT stuff like foreign document access or + passing in subtrees trough XSLT variables. This might or might not + work, depending on your specific usage. Again, later versions of + lxml and libxslt provide safer support here. + +* try copying trees at suspicious places in your code and working with + those instead of a tree shared between threads. Note that the + copying must happen inside the target thread to be effective, not in + the thread that created the tree. Serialising in one thread and + parsing in another is also a simple (and fast) way of separating + thread contexts. + +* try keeping thread-local copies of XSLT stylesheets, i.e. one per thread, + instead of sharing one. Also see the question above. + +* you can try to serialise suspicious parts of your code with explicit thread + locks, thus disabling the concurrency of the runtime system. + +* report back on the mailing list to see if there are other ways to work + around your specific problems. Do not forget to report the version numbers + of lxml, libxml2 and libxslt you are using (see the question on reporting + a bug). + +Note that most of these options will degrade performance and/or your +code quality. If you are unsure what to do, please ask on the mailing +list. + + +Parsing and Serialisation +========================= + +.. + making doctest happy: + + >>> try: from StringIO import StringIO + ... except ImportError: from io import StringIO # Py3 + >>> filename = StringIO("") + + +Why doesn't the ``pretty_print`` option reformat my XML output? +--------------------------------------------------------------- + +Pretty printing (or formatting) an XML document means adding white space to +the content. These modifications are harmless if they only impact elements in +the document that do not carry (text) data. They corrupt your data if they +impact elements that contain data. If lxml cannot distinguish between +whitespace and data, it will not alter your data. Whitespace is therefore +only added between nodes that do not contain data. This is always the case +for trees constructed element-by-element, so no problems should be expected +here. For parsed trees, a good way to assure that no conflicting whitespace +is left in the tree is the ``remove_blank_text`` option: + +.. sourcecode:: pycon + + >>> parser = etree.XMLParser(remove_blank_text=True) + >>> tree = etree.parse(filename, parser) + +This will allow the parser to drop blank text nodes when constructing the +tree. If you now call a serialization function to pretty print this tree, +lxml can add fresh whitespace to the XML tree to indent it. + +Fredrik Lundh also has a Python-level function for indenting XML by +appending whitespace to tags. It can be found on his `element +library`_ recipe page. + + +Why can't lxml parse my XML from unicode strings? +------------------------------------------------- + +lxml can read Python unicode strings and even tries to support them if libxml2 +does not. However, if the unicode string declares an XML encoding internally +(````), parsing is bound to fail, as this encoding is +most likely not the real encoding used in Python unicode. The same is true +for HTML unicode strings that contain charset meta tags, although the problems +may be more subtle here. The libxml2 HTML parser may not be able to parse the +meta tags in broken HTML and may end up ignoring them, so even if parsing +succeeds, later handling may still fail with character encoding errors. + +Note that Python uses different encodings for unicode on different platforms, +so even specifying the real internal unicode encoding is not portable between +Python interpreters. Don't do it. + +Python unicode strings with XML data or HTML data that carry encoding +information are broken. lxml will not parse them. You must provide parsable +data in a valid encoding. + + +What is the difference between str(xslt(doc)) and xslt(doc).write() ? +--------------------------------------------------------------------- + +The str() implementation of the XSLTResultTree class (a subclass of the +ElementTree class) knows about the output method chosen in the stylesheet +(xsl:output), write() doesn't. If you call write(), the result will be a +normal XML tree serialization in the requested encoding. Calling this method +may also fail for XSLT results that are not XML trees (e.g. string results). + +If you call str(), it will return the serialized result as specified by the +XSL transform. This correctly serializes string results to encoded Python +strings and honours ``xsl:output`` options like ``indent``. This almost +certainly does what you want, so you should only use ``write()`` if you are +sure that the XSLT result is an XML tree and you want to override the encoding +and indentation options requested by the stylesheet. + + +Why can't I just delete parents or clear the root node in iterparse()? +---------------------------------------------------------------------- + +The ``iterparse()`` implementation is based on the libxml2 parser. It +requires the tree to be intact to finish parsing. If you delete or modify +parents of the current node, chances are you modify the structure in a way +that breaks the parser. Normally, this will result in a segfault. Please +refer to the `iterparse section`_ of the lxml API documentation to find out +what you can do and what you can't do. + +.. _`iterparse section`: parsing.html#iterparse-and-iterwalk + + +How do I output null characters in XML text? +-------------------------------------------- + +Don't. What you would produce is not well-formed XML. XML parsers +will refuse to parse a document that contains null characters. The +right way to embed binary data in XML is using a text encoding such as +uuencode or base64. + + +XPath and Document Traversal +============================ + +What are the ``findall()`` and ``xpath()`` methods on Element(Tree)? +-------------------------------------------------------------------- + +``findall()`` is part of the original `ElementTree API`_. It supports a +`simple subset of the XPath language`_, without predicates, conditions and +other advanced features. It is very handy for finding specific tags in a +tree. Another important difference is namespace handling, which uses the +``{namespace}tagname`` notation. This is not supported by XPath. The +findall, find and findtext methods are compatible with other ElementTree +implementations and allow writing portable code that runs on ElementTree, +cElementTree and lxml.etree. + +``xpath()``, on the other hand, supports the complete power of the XPath +language, including predicates, XPath functions and Python extension +functions. The syntax is defined by the `XPath specification`_. If you need +the expressiveness and selectivity of XPath, the ``xpath()`` method, the +``XPath`` class and the ``XPathEvaluator`` are the best choice_. + +.. _`simple subset of the XPath language`: http://effbot.org/zone/element-xpath.htm +.. _`XPath specification`: http://www.w3.org/TR/xpath +.. _choice: performance.html#xpath + + +Why doesn't ``findall()`` support full XPath expressions? +--------------------------------------------------------- + +It was decided that it is more important to keep compatibility with +ElementTree_ to simplify code migration between the libraries. The main +difference compared to XPath is the ``{namespace}tagname`` notation used in +``findall()``, which is not valid XPath. + +ElementTree and lxml.etree use the same implementation, which assures 100% +compatibility. Note that ``findall()`` is `so fast`_ in lxml that a native +implementation would not bring any performance benefits. + +.. _`so fast`: performance.html#tree-traversal + + +How can I find out which namespace prefixes are used in a document? +------------------------------------------------------------------- + +You can traverse the document (``root.iter()``) and collect the prefix +attributes from all Elements into a set. However, it is unlikely that you +really want to do that. You do not need these prefixes, honestly. You only +need the namespace URIs. All namespace comparisons use these, so feel free to +make up your own prefixes when you use XPath expressions or extension +functions. + +The only place where you might consider specifying prefixes is the +serialization of Elements that were created through the API. Here, you can +specify a prefix mapping through the ``nsmap`` argument when creating the root +Element. Its children will then inherit this prefix for serialization. + + +How can I specify a default namespace for XPath expressions? +------------------------------------------------------------ + +You can't. In XPath, there is no such thing as a default namespace. Just use +an arbitrary prefix and let the namespace dictionary of the XPath evaluators +map it to your namespace. See also the question above. diff --git a/doc/api.txt b/doc/api.txt new file mode 100644 index 0000000..0f68b4c --- /dev/null +++ b/doc/api.txt @@ -0,0 +1,528 @@ +=========================== +APIs specific to lxml.etree +=========================== + +lxml.etree tries to follow established APIs wherever possible. Sometimes, +however, the need to expose a feature in an easy way led to the invention of a +new API. This page describes the major differences and a few additions to the +main ElementTree API. + +For a complete reference of the API, see the `generated API +documentation`_. + +Separate pages describe the support for `parsing XML`_, executing `XPath and +XSLT`_, `validating XML`_ and interfacing with other XML tools through the +`SAX-API`_. + +lxml is extremely extensible through `XPath functions in Python`_, custom +`Python element classes`_, custom `URL resolvers`_ and even `at the C-level`_. + +.. _`parsing XML`: parsing.html +.. _`XPath and XSLT`: xpathxslt.html +.. _`validating XML`: validation.html +.. _`SAX-API`: sax.html +.. _`XPath functions in Python`: extensions.html +.. _`Python element classes`: element_classes.html +.. _`at the C-level`: capi.html +.. _`URL resolvers`: resolvers.html +.. _`generated API documentation`: api/index.html + + +.. contents:: +.. + 1 lxml.etree + 2 Other Element APIs + 3 Trees and Documents + 4 Iteration + 5 Error handling on exceptions + 6 Error logging + 7 Serialisation + 8 CDATA + 9 XInclude and ElementInclude + 10 write_c14n on ElementTree + +.. + >>> try: from StringIO import StringIO + ... except ImportError: + ... from io import BytesIO + ... def StringIO(s=None): + ... if isinstance(s, str): s = s.encode("UTF-8") + ... return BytesIO(s) + + >>> try: from collections import deque + ... except ImportError: + ... class deque(list): + ... def popleft(self): return self.pop(0) + + >>> try: unicode = __builtins__["unicode"] + ... except (NameError, KeyError): unicode = str + + +lxml.etree +---------- + +lxml.etree tries to follow the `ElementTree API`_ wherever it can. There are +however some incompatibilities (see `compatibility`_). The extensions are +documented here. + +.. _`ElementTree API`: http://effbot.org/zone/element-index.htm +.. _`compatibility`: compatibility.html + +If you need to know which version of lxml is installed, you can access the +``lxml.etree.LXML_VERSION`` attribute to retrieve a version tuple. Note, +however, that it did not exist before version 1.0, so you will get an +AttributeError in older versions. The versions of libxml2 and libxslt are +available through the attributes ``LIBXML_VERSION`` and ``LIBXSLT_VERSION``. + +The following examples usually assume this to be executed first: + +.. sourcecode:: pycon + + >>> from lxml import etree + +.. + >>> import sys + >>> from lxml import etree as _etree + >>> if sys.version_info[0] >= 3: + ... class etree_mock(object): + ... def __getattr__(self, name): return getattr(_etree, name) + ... def tostring(self, *args, **kwargs): + ... s = _etree.tostring(*args, **kwargs) + ... if isinstance(s, bytes) and bytes([10]) in s: s = s.decode("utf-8") # CR + ... if s[-1] == '\n': s = s[:-1] + ... return s + ... else: + ... class etree_mock(object): + ... def __getattr__(self, name): return getattr(_etree, name) + ... def tostring(self, *args, **kwargs): + ... s = _etree.tostring(*args, **kwargs) + ... if s[-1] == '\n': s = s[:-1] + ... return s + >>> etree = etree_mock() + + +Other Element APIs +------------------ + +While lxml.etree itself uses the ElementTree API, it is possible to replace +the Element implementation by `custom element subclasses`_. This has been +used to implement well-known XML APIs on top of lxml. For example, lxml ships +with a data-binding implementation called `objectify`_, which is similar to +the `Amara bindery`_ tool. + +lxml.etree comes with a number of `different lookup schemes`_ to customize the +mapping between libxml2 nodes and the Element classes used by lxml.etree. + +.. _`custom element subclasses`: element_classes.html +.. _`objectify`: objectify.html +.. _`different lookup schemes`: element_classes.html#setting-up-a-class-lookup-scheme +.. _`Amara bindery`: http://uche.ogbuji.net/tech/4suite/amara/ + + +Trees and Documents +------------------- + +Compared to the original ElementTree API, lxml.etree has an extended tree +model. It knows about parents and siblings of elements: + +.. sourcecode:: pycon + + >>> root = etree.Element("root") + >>> a = etree.SubElement(root, "a") + >>> b = etree.SubElement(root, "b") + >>> c = etree.SubElement(root, "c") + >>> d = etree.SubElement(root, "d") + >>> e = etree.SubElement(d, "e") + >>> b.getparent() == root + True + >>> print(b.getnext().tag) + c + >>> print(c.getprevious().tag) + b + +Elements always live within a document context in lxml. This implies that +there is also a notion of an absolute document root. You can retrieve an +ElementTree for the root node of a document from any of its elements. + +.. sourcecode:: pycon + + >>> tree = d.getroottree() + >>> print(tree.getroot().tag) + root + +Note that this is different from wrapping an Element in an ElementTree. You +can use ElementTrees to create XML trees with an explicit root node: + +.. sourcecode:: pycon + + >>> tree = etree.ElementTree(d) + >>> print(tree.getroot().tag) + d + >>> etree.tostring(tree) + b'' + +ElementTree objects are serialised as complete documents, including +preceding or trailing processing instructions and comments. + +All operations that you run on such an ElementTree (like XPath, XSLT, etc.) +will understand the explicitly chosen root as root node of a document. They +will not see any elements outside the ElementTree. However, ElementTrees do +not modify their Elements: + +.. sourcecode:: pycon + + >>> element = tree.getroot() + >>> print(element.tag) + d + >>> print(element.getparent().tag) + root + >>> print(element.getroottree().getroot().tag) + root + +The rule is that all operations that are applied to Elements use either the +Element itself as reference point, or the absolute root of the document that +contains this Element (e.g. for absolute XPath expressions). All operations +on an ElementTree use its explicit root node as reference. + + +Iteration +--------- + +The ElementTree API makes Elements iterable to supports iteration over their +children. Using the tree defined above, we get: + +.. sourcecode:: pycon + + >>> [ child.tag for child in root ] + ['a', 'b', 'c', 'd'] + +To iterate in the opposite direction, use the ``reversed()`` function +that exists in Python 2.4 and later. + +Tree traversal should use the ``element.iter()`` method: + +.. sourcecode:: pycon + + >>> [ el.tag for el in root.iter() ] + ['root', 'a', 'b', 'c', 'd', 'e'] + +lxml.etree also supports this, but additionally features an extended API for +iteration over the children, following/preceding siblings, ancestors and +descendants of an element, as defined by the respective XPath axis: + +.. sourcecode:: pycon + + >>> [ child.tag for child in root.iterchildren() ] + ['a', 'b', 'c', 'd'] + >>> [ child.tag for child in root.iterchildren(reversed=True) ] + ['d', 'c', 'b', 'a'] + >>> [ sibling.tag for sibling in b.itersiblings() ] + ['c', 'd'] + >>> [ sibling.tag for sibling in c.itersiblings(preceding=True) ] + ['b', 'a'] + >>> [ ancestor.tag for ancestor in e.iterancestors() ] + ['d', 'root'] + >>> [ el.tag for el in root.iterdescendants() ] + ['a', 'b', 'c', 'd', 'e'] + +Note how ``element.iterdescendants()`` does not include the element +itself, as opposed to ``element.iter()``. The latter effectively +implements the 'descendant-or-self' axis in XPath. + +All of these iterators support an additional ``tag`` keyword argument that +filters the generated elements by tag name: + +.. sourcecode:: pycon + + >>> [ child.tag for child in root.iterchildren(tag='a') ] + ['a'] + >>> [ child.tag for child in d.iterchildren(tag='a') ] + [] + >>> [ el.tag for el in root.iterdescendants(tag='d') ] + ['d'] + >>> [ el.tag for el in root.iter(tag='d') ] + ['d'] + +The most common way to traverse an XML tree is depth-first, which +traverses the tree in document order. This is implemented by the +``.iter()`` method. While there is no dedicated method for +breadth-first traversal, it is almost as simple if you use the +``collections.deque`` type from Python 2.4. + +.. sourcecode:: pycon + + >>> root = etree.XML('') + >>> print(etree.tostring(root, pretty_print=True, encoding=unicode)) + + + + + + + + + + + >>> queue = deque([root]) + >>> while queue: + ... el = queue.popleft() # pop next element + ... queue.extend(el) # append its children + ... print(el.tag) + root + a + d + b + c + e + +See also the section on the utility functions ``iterparse()`` and +``iterwalk()`` in the `parser documentation`_. + +.. _`parser documentation`: parsing.html#iterparse-and-iterwalk + + +Error handling on exceptions +---------------------------- + +Libxml2 provides error messages for failures, be it during parsing, XPath +evaluation or schema validation. The preferred way of accessing them is +through the local ``error_log`` property of the respective evaluator or +transformer object. See their documentation for details. + +However, lxml also keeps a global error log of all errors that occurred at the +application level. Whenever an exception is raised, you can retrieve the +errors that occured and "might have" lead to the problem from the error log +copy attached to the exception: + +.. sourcecode:: pycon + + >>> etree.clear_error_log() + >>> broken_xml = ''' + ... + ... + ... + ... ''' + >>> try: + ... etree.parse(StringIO(broken_xml)) + ... except etree.XMLSyntaxError, e: + ... pass # just put the exception into e + +.. + >>> etree.clear_error_log() + >>> try: + ... etree.parse(StringIO(broken_xml)) + ... except etree.XMLSyntaxError: + ... import sys; e = sys.exc_info()[1] + +Once you have caught this exception, you can access its ``error_log`` property +to retrieve the log entries or filter them by a specific type, error domain or +error level: + +.. sourcecode:: pycon + + >>> log = e.error_log.filter_from_level(etree.ErrorLevels.FATAL) + >>> print(log) + :4:8:FATAL:PARSER:ERR_TAG_NAME_MISMATCH: Opening and ending tag mismatch: a line 3 and root + :5:1:FATAL:PARSER:ERR_TAG_NOT_FINISHED: Premature end of data in tag root line 2 + +This might look a little cryptic at first, but it is the information that +libxml2 gives you. At least the message at the end should give you a hint +what went wrong and you can see that the fatal errors (FATAL) happened during +parsing (PARSER) lines 4, column 8 and line 5, column 1 of a string (, +or the filename if available). Here, PARSER is the so-called error domain, +see ``lxml.etree.ErrorDomains`` for that. You can get it from a log entry +like this: + +.. sourcecode:: pycon + + >>> entry = log[0] + >>> print(entry.domain_name) + PARSER + >>> print(entry.type_name) + ERR_TAG_NAME_MISMATCH + >>> print(entry.filename) + + +There is also a convenience attribute ``last_error`` that returns the last +error or fatal error that occurred: + +.. sourcecode:: pycon + + >>> entry = e.error_log.last_error + >>> print(entry.domain_name) + PARSER + >>> print(entry.type_name) + ERR_TAG_NOT_FINISHED + >>> print(entry.filename) + + + +Error logging +------------- + +lxml.etree supports logging libxml2 messages to the Python stdlib logging +module. This is done through the ``etree.PyErrorLog`` class. It disables the +error reporting from exceptions and forwards log messages to a Python logger. +To use it, see the descriptions of the function ``etree.useGlobalPythonLog`` +and the class ``etree.PyErrorLog`` for help. Note that this does not affect +the local error logs of XSLT, XMLSchema, etc. + + +Serialisation +------------- + +lxml.etree has direct support for pretty printing XML output. Functions like +``ElementTree.write()`` and ``tostring()`` support it through a keyword +argument: + +.. sourcecode:: pycon + + >>> root = etree.XML("") + >>> etree.tostring(root) + b'' + + >>> print(etree.tostring(root, pretty_print=True)) + + + + +Note the newline that is appended at the end when pretty printing the +output. It was added in lxml 2.0. + +By default, lxml (just as ElementTree) outputs the XML declaration only if it +is required by the standard: + +.. sourcecode:: pycon + + >>> unicode_root = etree.Element( u"t\u3120st" ) + >>> unicode_root.text = u"t\u0A0Ast" + >>> etree.tostring(unicode_root, encoding="utf-8") + b't\xe0\xa8\x8ast' + + >>> print(etree.tostring(unicode_root, encoding="iso-8859-1")) + + tਊst + +Also see the general remarks on `Unicode support`_. + +.. _`Unicode support`: parsing.html#python-unicode-strings + +You can enable or disable the declaration explicitly by passing another +keyword argument for the serialisation: + +.. sourcecode:: pycon + + >>> print(etree.tostring(root, xml_declaration=True)) + + + + >>> unicode_root.clear() + >>> etree.tostring(unicode_root, encoding="UTF-16LE", + ... xml_declaration=False) + b'<\x00t\x00 1s\x00t\x00/\x00>\x00' + +Note that a standard compliant XML parser will not consider the last line +well-formed XML if the encoding is not explicitly provided somehow, e.g. in an +underlying transport protocol: + +.. sourcecode:: pycon + + >>> notxml = etree.tostring(unicode_root, encoding="UTF-16LE", + ... xml_declaration=False) + >>> root = etree.XML(notxml) #doctest: +ELLIPSIS + Traceback (most recent call last): + ... + lxml.etree.XMLSyntaxError: ... + + +CDATA +----- + +By default, lxml's parser will strip CDATA sections from the tree and +replace them by their plain text content. As real applications for +CDATA are rare, this is the best way to deal with this issue. + +However, in some cases, keeping CDATA sections or creating them in a +document is required to adhere to existing XML language definitions. +For these special cases, you can instruct the parser to leave CDATA +sections in the document: + +.. sourcecode:: pycon + + >>> parser = etree.XMLParser(strip_cdata=False) + >>> root = etree.XML('', parser) + >>> root.text + 'test' + + >>> etree.tostring(root) + b'' + +Note how the ``.text`` property does not give any indication that the +text content is wrapped by a CDATA section. If you want to make sure +your data is wrapped by a CDATA block, you can use the ``CDATA()`` +text wrapper: + +.. sourcecode:: pycon + + >>> root.text = 'test' + + >>> root.text + 'test' + >>> etree.tostring(root) + b'test' + + >>> root.text = etree.CDATA(root.text) + + >>> root.text + 'test' + >>> etree.tostring(root) + b'' + + +XInclude and ElementInclude +--------------------------- + +You can let lxml process xinclude statements in a document by calling the +xinclude() method on a tree: + +.. sourcecode:: pycon + + >>> data = StringIO('''\ + ... + ... + ... + ... ''') + + >>> tree = etree.parse(data) + >>> tree.xinclude() + >>> print(etree.tostring(tree.getroot())) + + + + + +Note that the ElementTree compatible ElementInclude_ module is also supported +as ``lxml.ElementInclude``. It has the additional advantage of supporting +custom `URL resolvers`_ at the Python level. The normal XInclude mechanism +cannot deploy these. If you need ElementTree compatibility or custom +resolvers, you have to stick to the external Python module. + +.. _ElementInclude: http://effbot.org/zone/element-xinclude.htm + + +write_c14n on ElementTree +------------------------- + +The lxml.etree.ElementTree class has a method write_c14n, which takes a file +object as argument. This file object will receive an UTF-8 representation of +the canonicalized form of the XML, following the W3C C14N recommendation. For +example: + +.. sourcecode:: pycon + + >>> f = StringIO('') + >>> tree = etree.parse(f) + >>> f2 = StringIO() + >>> tree.write_c14n(f2) + >>> print(f2.getvalue().decode("utf-8")) + diff --git a/doc/build.txt b/doc/build.txt new file mode 100644 index 0000000..ecac0dc --- /dev/null +++ b/doc/build.txt @@ -0,0 +1,320 @@ +How to build lxml from source +============================= + +To build lxml from source, you need libxml2 and libxslt properly +installed, *including the header files*. These are likely shipped in +separate ``-dev`` or ``-devel`` packages like ``libxml2-dev``, which +you must install before trying to build lxml. The build process also +requires setuptools_. The lxml source distribution comes with a +script called ``ez_setup.py`` that can be used to install them. + +.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools + +.. contents:: +.. + 1 Cython + 2 Subversion + 3 Setuptools + 4 Running the tests and reporting errors + 5 Building an egg + 6 Building lxml on MacOS-X + 7 Static linking on Windows + 8 Building Debian packages from SVN sources + + +Cython +------ + +.. _EasyInstall: http://peak.telecommunity.com/DevCenter/EasyInstall +.. _Cython: http://www.cython.org + +The lxml.etree and lxml.objectify modules are written in Cython_. +Since we distribute the Cython-generated .c files with lxml releases, +however, you do not need Cython to build lxml from the normal release +sources. We even encourage you to *not install Cython* for a normal +release build, as the generated C code can vary quite heavily between +Cython versions, which may or may not generate correct code for lxml. +The pre-generated release sources were tested and therefore are known +to work. + +So, if you want a reliable build of lxml, we suggest to a) use a +source release of lxml and b) disable or uninstall Cython for the +build. + +*Only* if you are interested in building lxml from a Subversion +checkout (e.g. to test a bug fix that has not been release yet) or if +want to be an lxml developer, then you do need a working Cython +installation. You can use EasyInstall_ to install it:: + + easy_install Cython==0.11 + +lxml currently requires Cython 0.11, later release versions should +work as well. + + +Subversion +---------- + +The lxml package is developed in a Subversion repository. You can retrieve +the current developer version by calling:: + + svn co http://codespeak.net/svn/lxml/trunk lxml + +This will create a directory ``lxml`` and download the source into it. +You can also browse the `Subversion repository`_ through the web, use +your favourite SVN client to access it, or browse the `Subversion +history`_. + +.. _`Subversion repository`: http://codespeak.net/svn/lxml/ +.. _`Subversion history`: https://codespeak.net/viewvc/lxml/ + + +Setuptools +---------- + +Usually, building lxml is done through setuptools. Do a Subversion checkout +(or download the source tar-ball and unpack it) and then type:: + + python setup.py build + +or:: + + python setup.py bdist_egg + +If you want to test lxml from the source directory, it is better to build it +in-place like this:: + + python setup.py build_ext -i + +or, in Unix-like environments:: + + make + +If you get errors about missing header files (e.g. ``libxml/xmlversion.h``) +then you need to make sure the development packages of both libxml2 +and libxslt are properly installed. Try passing the following option to +setup.py to make sure the right config is found:: + + python setup.py build --with-xslt-config=/path/to/xslt-config + +If this doesn't help, you may have to add the location of the header +files to the include path like:: + + python setup.py build_ext -i -I /usr/include/libxml2 + +where the file is in ``/usr/include/libxml2/libxml/xmlversion.h`` + +To use lxml.etree in-place, you can place lxml's ``src`` directory on your +Python module search path (PYTHONPATH) and then import ``lxml.etree`` to play +with it:: + + # cd lxml + # PYTHONPATH=src python + Python 2.5.1 + Type "help", "copyright", "credits" or "license" for more information. + >>> from lxml import etree + >>> + +To recompile after changes, note that you may have to run ``make clean`` or +delete the file ``src/lxml/etree.c``. Distutils do not automatically pick up +changes that affect files other than the main file ``src/lxml/etree.pyx``. + + +Running the tests and reporting errors +-------------------------------------- + +The source distribution (tgz) and the Subversion repository contain a test +suite for lxml. You can run it from the top-level directory:: + + python test.py + +Note that the test script only tests the in-place build (see distutils +building above), as it searches the ``src`` directory. You can use the +following one-step command to trigger an in-place build and test it:: + + make test + +This also runs the ElementTree and cElementTree compatibility tests. To call +them separately, make sure you have lxml on your PYTHONPATH first, then run:: + + python selftest.py + +and:: + + python selftest2.py + +If the tests give failures, errors, or worse, segmentation faults, we'd really +like to know. Please contact us on the `mailing list`_, and please specify +the version of lxml, libxml2, libxslt and Python you were using, as well as +your operating system type (Linux, Windows, MacOs, ...). + +.. _`mailing list`: http://codespeak.net/mailman/listinfo/lxml-dev + + +Building an egg +--------------- + +This is the procedure to make an lxml egg for your platform (assuming +that you have setuptools_ installed): + +* Download the lxml-x.y.tar.gz release. This contains the pregenerated C so + that you can be sure you build exactly from the release sources. Unpack + them and cd into the resulting directory. + +* python setup.py build + +* If you're on a unixy platform, cd into ``build/lib.your.platform`` and strip + any ``.so`` file you find there. This reduces the size of the egg + considerably. + +* ``python setup.py bdist_egg`` + +This will put the egg into the ``dist`` directory. + + +Building lxml on MacOS-X +------------------------ + +Apple regularly ships new system releases with horribly outdated +system libraries. This is specifically the case for libxml2 and +libxslt, where the system provided versions are too old to build lxml. + +While the Unix environment in MacOS-X makes it relatively easy to +install Unix/Linux style package management tools and new software, it +actually seems to be hard to get libraries set up for exclusive usage +that MacOS-X ships in an older version. Alternative distributions +(like macports) install their libraries in addition to the system +libraries, but the compiler and the runtime loader on MacOS still sees +the system libraries before the new libraries. This can lead to +undebuggable crashes where the newer library seems to be loaded but +the older system library is used. + +Apple discourages static building against libraries, which would help +working around this problem. Apple does not ship static library +binaries with its system and several package management systems follow +this decision. Therefore, building static binaries requires building +the dependencies first. The ``setup.py`` script does this +automatically when you call it like this:: + + python setup.py build --static-deps + +This will download and build the latest versions of libxml2 and +libxslt from the official FTP download site. If you want to use +specific versions, or want to prevent any online access, you can +download both ``tar.gz`` release files yourself, place them into a +subdirectory ``libs`` in the lxml distribution, and call ``setup.py`` +with the desired target versions like this:: + + python setup.py build --static-deps \ + --libxml2-version=2.7.3 \ + --libxslt-version=1.1.24 \ + +Instead of ``build``, you can use any target, like ``bdist_egg`` if +you want to use setuptools to build an installable egg. + +Note that this also works with EasyInstall_. Since you can't pass +command line options in this case, you have to use an environment +variable instead:: + + STATIC_DEPS=true easy_install lxml + +Some machines may require an additional run with "sudo" to install the +package into the Python package directory:: + + STATIC_DEPS=true sudo easy_install lxml + + + +Static linking on Windows +------------------------- + +Most operating systems have proper package management that makes installing +current versions of libxml2 and libxslt easy. The most famous exception is +Microsoft Windows, which entirely lacks these capabilities. It can therefore +be interesting to statically link the external libraries into lxml.etree to +avoid having to install them separately. + +Download lxml and all required libraries to the same directory. The iconv, +libxml2, libxslt, and zlib libraries are all available from the ftp site +ftp://ftp.zlatkovic.com/pub/libxml/. + +Your directory should now have the following files in it (although most likely +different versions):: + + iconv-1.9.1.win32.zip + libxml2-2.6.23.win32.zip + libxslt-1.1.15.win32.zip + lxml-1.0.0.tgz + zlib-1.2.3.win32.zip + +Now extract each of those files in the *same* directory. This should give you +something like this:: + + iconv-1.9.1.win32/ + iconv-1.9.1.win32.zip + libxml2-2.6.23.win32/ + libxml2-2.6.23.win32.zip + libxslt-1.1.15.win32/ + libxslt-1.1.15.win32.zip + lxml-1.0.0/ + lxml-1.0.0.tgz + zlib-1.2.3.win32/ + zlib-1.2.3.win32.zip + +Go to the lxml directory and edit the file ``setup.py``. There should +be a section near the top that looks like this:: + + STATIC_INCLUDE_DIRS = [] + STATIC_LIBRARY_DIRS = [] + STATIC_CFLAGS = [] + +Change this section to something like this, but take care to use the correct +version numbers:: + + STATIC_INCLUDE_DIRS = [ + "..\\libxml2-2.6.23.win32\\include", + "..\\libxslt-1.1.15.win32\\include", + "..\\zlib-1.2.3.win32\\include", + "..\\iconv-1.9.1.win32\\include" + ] + + STATIC_LIBRARY_DIRS = [ + "..\\libxml2-2.6.23.win32\\lib", + "..\\libxslt-1.1.15.win32\\lib", + "..\\zlib-1.2.3.win32\\lib", + "..\\iconv-1.9.1.win32\\lib" + ] + + STATIC_CFLAGS = [] + +Add any CFLAGS you might consider useful to the third list. Now you +should be able to pass the ``--static`` option to setup.py and +everything should work well. Try calling:: + + python setup.py bdist_wininst --static + +This will create a windows installer in the ``pkg`` directory. + + +Building Debian packages from SVN sources +----------------------------------------- + +`Andreas Pakulat`_ proposed the following approach. + +.. _`Andreas Pakulat`: http://codespeak.net/pipermail/lxml-dev/2006-May/001254.html + +* ``apt-get source lxml`` +* remove the unpacked directory +* tar.gz the lxml SVN version and replace the orig.tar.gz that lies in the + directory +* check md5sum of created tar.gz file and place new sum and size in dsc file +* do ``dpkg-source -x lxml-[VERSION].dsc`` and cd into the newly created directory +* run ``dch -i`` and add a comment like "use trunk version", this will + increase the debian version number so apt/dpkg won't get confused +* run ``dpkg-buildpackage -rfakeroot -us -uc`` to build the package + +In case ``dpkg-buildpackage`` tells you that some dependecies are missing, you +can either install them manually or run ``apt-get build-dep lxml``. + +That will give you .deb packages in the parent directory which can be +installed using ``dpkg -i``. diff --git a/doc/capi.txt b/doc/capi.txt new file mode 100644 index 0000000..4b9c808 --- /dev/null +++ b/doc/capi.txt @@ -0,0 +1,94 @@ +============================== +The public C-API of lxml.etree +============================== + +As of version 1.1, lxml.etree provides a public C-API. This allows external +C extensions to efficiently access public functions and classes of lxml, +without going through the Python API. + +The API is described in the file `etreepublic.pxd`_, which is directly +c-importable by extension modules implemented in Pyrex_ or Cython_. + +.. _`etreepublic.pxd`: http://codespeak.net/svn/lxml/trunk/src/lxml/etreepublic.pxd +.. _Cython: http://www.cython.org +.. _Pyrex: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ + +.. contents:: +.. + 1 Writing external modules in Cython + 2 Writing external modules in C + + +Writing external modules in Cython +---------------------------------- + +This is the easiest way of extending lxml at the C level. A Cython_ +(or Pyrex_) module should start like this:: + + # My Cython extension + + # import the public functions and classes of lxml.etree + cimport etreepublic as cetree + + # import the lxml.etree module in Python + cdef object etree + from lxml import etree + + # initialize the access to the C-API of lxml.etree + cetree.import_lxml__etree() + +From this line on, you can access all public functions of lxml.etree +from the ``cetree`` namespace like this:: + + # build a tag name from namespace and element name + py_tag = cetree.namespacedNameFromNsName("http://some/url", "myelement") + +Public lxml classes are easily subclassed. For example, to implement +and set a new default element class, you can write Cython code like +the following:: + + from etreepublic cimport ElementBase + cdef class NewElementClass(ElementBase): + def set_value(self, myval): + self.set("my_attribute", myval) + + etree.set_element_class_lookup( + etree.DefaultElementClassLookup(element=NewElementClass)) + + +Writing external modules in C +----------------------------- + +If you really feel like it, you can also interface with lxml.etree straight +from C code. All you have to do is include the header file for the public +API, import the ``lxml.etree`` module and then call the import function: + +.. sourcecode:: c + + /* My C extension */ + + /* common includes */ + #include "Python.h" + #include "stdio.h" + #include "string.h" + #include "stdarg.h" + #include "libxml/xmlversion.h" + #include "libxml/encoding.h" + #include "libxml/hash.h" + #include "libxml/tree.h" + #include "libxml/xmlIO.h" + #include "libxml/xmlsave.h" + #include "libxml/globals.h" + #include "libxml/xmlstring.h" + + /* lxml.etree specific includes */ + #include "lxml-version.h" + #include "etree_defs.h" + #include "etree.h" + + /* setup code */ + import_lxml__etree() + +Note that including ``etree.h`` does not automatically include the +header files it requires. Note also that the above list of common +includes may not be sufficient. diff --git a/doc/compatibility.txt b/doc/compatibility.txt new file mode 100644 index 0000000..e23d181 --- /dev/null +++ b/doc/compatibility.txt @@ -0,0 +1,196 @@ +======================================= +ElementTree compatibility of lxml.etree +======================================= + +A lot of care has been taken to ensure compatibility between etree and +ElementTree. Nonetheless, some differences and incompatibilities exist: + +* Importing etree is obviously different; etree uses a lower-case + package name, while ElementTree uses a combination of upper-case and + lower case in imports: + + .. sourcecode:: python + + # etree + from lxml.etree import Element + + # ElementTree + from elementtree.ElementTree import Element + + # ElementTree in the Python 2.5 standard library + from xml.etree.ElementTree import Element + + When switching over code from ElementTree to lxml.etree, and you're using + the package name prefix 'ElementTree', you can do the following: + + .. sourcecode:: python + + # instead of + from elementtree import ElementTree + # use + from lxml import etree as ElementTree + +* lxml.etree offers a lot more functionality, such as XPath, XSLT, Relax NG, + and XML Schema support, which (c)ElementTree does not offer. + +* etree has a different idea about Python unicode strings than ElementTree. + In most parts of the API, ElementTree uses plain strings and unicode strings + as what they are. This includes Element.text, Element.tail and many other + places. However, the ElementTree parsers assume by default that any string + (`str` or `unicode`) contains ASCII data. They raise an exception if + strings do not match the expected encoding. + + etree has the same idea about plain strings (`str`) as ElementTree. For + unicode strings, however, etree assumes throughout the API that they are + Python unicode encoded strings rather than byte data. This includes the + parsers. It is therefore perfectly correct to pass XML unicode data into + the etree parsers in form of Python unicode strings. It is an error, on the + other hand, if unicode strings specify an encoding in their XML declaration, + as this conflicts with the characteristic encoding of Python unicode + strings. + +* ElementTree allows you to place an Element in two different trees at the + same time. Thus, this: + + .. sourcecode:: python + + a = Element('a') + b = SubElement(a, 'b') + c = Element('c') + c.append(b) + + will result in the following tree a: + + .. sourcecode:: xml + + + + and the following tree c: + + .. sourcecode:: xml + + + + In lxml, this behavior is different, because lxml is built on top of a tree + that maintains parent relationships for elements (like W3C DOM). This means + an element can only exist in a single tree at the same time. Adding an + element in some tree to another tree will cause this element to be moved. + + So, for tree a we will get: + + .. sourcecode:: xml + + + + and for tree c we will get: + + .. sourcecode:: xml + + + + Unfortunately this is a rather fundamental difference in behavior, which is + hard to change. It won't affect some applications, but if you want to port + code you must unfortunately make sure that it doesn't affect yours. + +* etree allows navigation to the parent of a node by the ``getparent()`` + method and to the siblings by calling ``getnext()`` and ``getprevious()``. + This is not possible in ElementTree as the underlying tree model does not + have this information. + +* When trying to set a subelement using __setitem__ that is in fact not an + Element but some other object, etree raises a TypeError, and ElementTree + raises an AssertionError. This also applies to some other places of the + API. In general, etree tries to avoid AssertionErrors in favour of being + more specific about the reason for the exception. + +* When parsing fails in ``iterparse()``, ElementTree up to version + 1.2.x raises a low-level ``ExpatError`` instead of a ``SyntaxError`` + as the other parsers. Both lxml and ElementTree 1.3 raise a + ``ParseError`` for parser errors. + +* The ``iterparse()`` function in lxml is implemented based on the libxml2 + parser and tree generator. This means that modifications of the document + root or the ancestors of the current element during parsing can irritate the + parser and even segfault. While this is not a problem in the Python object + structure used by ElementTree, the C tree underlying lxml suffers from it. + The golden rule for ``iterparse()`` on lxml therefore is: do not touch + anything that will have to be touched again by the parser later on. See the + lxml parser documentation on this. + +* ElementTree ignores comments and processing instructions when parsing XML, + while etree will read them in and treat them as Comment or + ProcessingInstruction elements respectively. This is especially visible + where comments are found inside text content, which is then split by the + Comment element. + + You can disable this behaviour by passing the boolean ``remove_comments`` + and/or ``remove_pis`` keyword arguments to the parser you use. For + convenience and to support portable code, you can also use the + ``etree.ETCompatXMLParser`` instead of the default ``etree.XMLParser``. It + tries to provide a default setup that is as close to the ElementTree parser + as possible. + +* The ``TreeBuilder`` class of ``lxml.etree`` uses a different + signature for the ``start()`` method. It accepts an additional + argument ``nsmap`` to propagate the namespace declarations of an + element in addition to its own namespace. To assure compatibility + with ElementTree (which does not support this argument), lxml checks + if the method accepts 3 arguments before calling it, and otherwise + drops the namespace mapping. This should work with most existing + ElementTree code, although there may still be conflicting cases. + +* ElementTree 1.2 has a bug when serializing an empty Comment (no text + argument given) to XML, etree serializes this successfully. + +* ElementTree adds whitespace around comments on serialization, lxml does + not. This means that a comment text "text" that ElementTree serializes as + "" will become "" in lxml. + +* When the string '*' is used as tag filter in the ``Element.getiterator()`` + method, ElementTree returns all elements in the tree, including comments and + processing instructions. lxml.etree only returns real Elements, i.e. tree + nodes that have a string tag name. Without a filter, both libraries iterate + over all nodes. + + Note that currently only lxml.etree supports passing the ``Element`` factory + function as filter to select only Elements. Both libraries support passing + the ``Comment`` and ``ProcessingInstruction`` factories to select the + respective tree nodes. + +* ElementTree merges the target of a processing instruction into ``PI.text``, + while lxml.etree puts it into the ``.target`` property and leaves it out of + the ``.text`` property. The ``pi.text`` in ElementTree therefore + correspondents to ``pi.target + " " + pi.text`` in lxml.etree. + +* Because etree is built on top of libxml2, which is namespace prefix aware, + etree preserves namespaces declarations and prefixes while ElementTree tends + to come up with its own prefixes (ns0, ns1, etc). When no namespace prefix + is given, however, etree creates ElementTree style prefixes as well. + +* etree has a 'prefix' attribute (read-only) on elements giving the Element's + prefix, if this is known, and None otherwise (in case of no namespace at + all, or default namespace). + +* etree further allows passing an 'nsmap' dictionary to the Element and + SubElement element factories to explicitly map namespace prefixes to + namespace URIs. These will be translated into namespace declarations on + that element. This means that in the probably rare case that you need to + construct an attribute called 'nsmap', you need to be aware that unlike in + ElementTree, you cannot pass it as a keyword argument to the Element and + SubElement factories directly. + +* ElementTree allows QName objects as attribute values and resolves their + prefix on serialisation (e.g. an attribute value ``QName("{myns}myname")`` + becomes "p:myname" if "p" is the namespace prefix of "myns"). lxml.etree + also allows you to set attribute values from QName instances (and also .text + values), but it resolves their prefix immediately and stores the plain text + value. So, if prefixes are modified later on, e.g. by moving a subtree to a + different tree (which reassigns the prefix mappings), the text values will + not be updated and you might end up with an undefined prefix. + +* etree elements can be copied using ``copy.deepcopy()`` and ``copy.copy()``, + just like ElementTree's. However, ``copy.copy()`` does *not* create a + shallow copy where elements are shared between trees, as this makes no sense + in the context of libxml2 trees. Note that lxml can deep-copy trees + considerably faster than ElementTree, so a deep copy might still be fast + enough to replace a shallow copy in your case. diff --git a/doc/cssselect.txt b/doc/cssselect.txt new file mode 100644 index 0000000..10fd0bd --- /dev/null +++ b/doc/cssselect.txt @@ -0,0 +1,108 @@ +============== +lxml.cssselect +============== + +lxml supports a number of interesting languages for tree traversal and element +selection. The most important is obviously XPath_, but there is also +ObjectPath_ in the `lxml.objectify`_ module. The newest child of this family +is `CSS selection`_, which is implemented in the new ``lxml.cssselect`` module. + +.. _XPath: xpathxslt.html#xpath +.. _ObjectPath: objectify.html#objectpath +.. _`lxml.objectify`: objectify.html +.. _`CSS selection`: http://www.w3.org/TR/CSS21/selector.html + +.. contents:: +.. + 1 The CSSSelector class + 2 CSS Selectors + 2.1 Namespaces + 3 Limitations + + +The CSSSelector class +===================== + +The most important class in the ``cssselect`` module is ``CSSSelector``. It +provides the same interface as the XPath_ class, but accepts a CSS selector +expression as input: + +.. sourcecode:: pycon + + >>> from lxml.cssselect import CSSSelector + >>> sel = CSSSelector('div.content') + >>> sel #doctest: +ELLIPSIS + + >>> sel.css + 'div.content' + +The selector actually compiles to XPath, and you can see the +expression by inspecting the object: + +.. sourcecode:: pycon + + >>> sel.path + "descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]" + +To use the selector, simply call it with a document or element +object: + +.. sourcecode:: pycon + + >>> from lxml.etree import fromstring + >>> h = fromstring('''
+ ...
+ ... text + ...
''') + >>> [e.get('id') for e in sel(h)] + ['inner'] + + +CSS Selectors +============= + +This libraries attempts to implement CSS selectors `as described in +the w3c specification +`_. Many of +the pseudo-classes do not apply in this context, including all +`dynamic pseudo-classes +`_. +In particular these will not be available: + +* link state: ``:link``, ``:visited``, ``:target`` +* actions: ``:hover``, ``:active``, ``:focus`` +* UI states: ``:enabled``, ``:disabled``, ``:indeterminate`` + (``:checked`` and ``:unchecked`` *are* available) + +Also, none of the psuedo-elements apply, because the selector only +returns elements and psuedo-elements select portions of text, like +``::first-line``. + + +Namespaces +========== + +In CSS you can use ``namespace-prefix|element``, similar to +``namespace-prefix:element`` in an XPath expression. In fact, it maps +one-to-one, and the same rules are used to map namespace prefixes to +namespace URIs. + + +Limitations +=========== + +These applicable pseudoclasses are not yet implemented: + +* ``:lang(language)`` +* ``:root`` +* ``*:first-of-type``, ``*:last-of-type``, ``*:nth-of-type``, + ``*:nth-last-of-type``, ``*:only-of-type``. All of these work when + you specify an element type, but not with ``*`` + +Unlike XPath you cannot provide parameters in your expressions -- all +expressions are completely static. + +XPath has underspecified string quoting rules (there seems to be no +string quoting at all), so if you use expressions that contain +characters that requiring quoting you might have problems with the +translation from CSS to XPath. diff --git a/doc/docstructure.py b/doc/docstructure.py new file mode 100644 index 0000000..ac5f993 --- /dev/null +++ b/doc/docstructure.py @@ -0,0 +1,25 @@ + +SITE_STRUCTURE = [ + ('lxml', ('main.txt', 'intro.txt', '../INSTALL.txt', 'lxml2.txt', + 'performance.txt', 'compatibility.txt', 'FAQ.txt')), + ('Developing with lxml', ('tutorial.txt', '@API reference', + 'api.txt', 'parsing.txt', + 'validation.txt', 'xpathxslt.txt', + 'objectify.txt', 'lxmlhtml.txt', + 'cssselect.txt', 'elementsoup.txt', + 'html5parser.txt')), + ('Extending lxml', ('resolvers.txt', 'extensions.txt', + 'element_classes.txt', 'sax.txt', 'capi.txt')), + ('Developing lxml', ('build.txt', 'lxml-source-howto.txt', + '@Release Changelog', '../CREDITS.txt')), + ] + +HREF_MAP = { + "API reference" : "api/index.html" +} + +BASENAME_MAP = { + 'main' : 'index', + 'INSTALL' : 'installation', + 'CREDITS' : 'credits', +} diff --git a/doc/element_classes.txt b/doc/element_classes.txt new file mode 100644 index 0000000..77accfc --- /dev/null +++ b/doc/element_classes.txt @@ -0,0 +1,511 @@ +==================================== +Using custom Element classes in lxml +==================================== + +lxml has very sophisticated support for custom Element classes. You +can provide your own classes for Elements and have lxml use them by +default for all elements generated by a specific parser, only for a +specific tag name in a specific namespace or even for an exact element +at a specific position in the tree. + +Custom Elements must inherit from the ``lxml.etree.ElementBase`` class, which +provides the Element interface for subclasses: + +.. sourcecode:: pycon + + >>> from lxml import etree + + >>> class honk(etree.ElementBase): + ... def honking(self): + ... return self.get('honking') == 'true' + ... honking = property(honking) + +This defines a new Element class ``honk`` with a property ``honking``. + +The following document describes how you can make lxml.etree use these +custom Element classes. + +.. contents:: +.. + 1 Background on Element proxies + 2 Element initialization + 3 Setting up a class lookup scheme + 3.1 Default class lookup + 3.2 Namespace class lookup + 3.3 Attribute based lookup + 3.4 Custom element class lookup + 3.5 Tree based element class lookup in Python + 4 Generating XML with custom classes + 5 Implementing namespaces + +.. + >>> try: _ = unicode + ... except NameError: unicode = str + + +Background on Element proxies +============================= + +Being based on libxml2, lxml.etree holds the entire XML tree in a C +structure. To communicate with Python code, it creates Python proxy +objects for the XML elements on demand. + + .. image:: proxies.png + +The mapping between C elements and Python Element classes is +completely configurable. When you ask lxml.etree for an Element by +using its API, it will instantiate your classes for you. All you have +to do is tell lxml which class to use for which kind of Element. This +is done through a class lookup scheme, as described in the sections +below. + + +Element initialization +====================== + +There is one thing to know up front. Element classes *must not* have +an ``__init___`` or ``__new__`` method. There should not be any +internal state either, except for the data stored in the underlying +XML tree. Element instances are created and garbage collected at +need, so there is no way to predict when and how often a proxy is +created for them. Even worse, when the ``__init__`` method is called, +the object is not even initialized yet to represent the XML tag, so +there is not much use in providing an ``__init__`` method in +subclasses. + +Most use cases will not require any class initialisation, so you can content +yourself with skipping to the next section for now. However, if you really +need to set up your element class on instantiation, there is one possible way +to do so. ElementBase classes have an ``_init()`` method that can be +overridden. It can be used to modify the XML tree, e.g. to construct special +children or verify and update attributes. + +The semantics of ``_init()`` are as follows: + +* It is called once on Element class instantiation time. That is, + when a Python representation of the element is created by lxml. At + that time, the element object is completely initialized to represent + a specific XML element within the tree. + +* The method has complete access to the XML tree. Modifications can be done + in exactly the same way as anywhere else in the program. + +* Python representations of elements may be created multiple times during the + lifetime of an XML element in the underlying C tree. The ``_init()`` code + provided by subclasses must take special care by itself that multiple + executions either are harmless or that they are prevented by some kind of + flag in the XML tree. The latter can be achieved by modifying an attribute + value or by removing or adding a specific child node and then verifying this + before running through the init process. + +* Any exceptions raised in ``_init()`` will be propagated throught the API + call that lead to the creation of the Element. So be careful with the code + you write here as its exceptions may turn up in various unexpected places. + + +Setting up a class lookup scheme +================================ + +The first thing to do when deploying custom element classes is to register a +class lookup scheme on a parser. lxml.etree provides quite a number of +different schemes that also support class lookup based on namespaces or +attribute values. Most lookups support fallback chaining, which allows the +next lookup mechanism to take over when the previous one fails to find a +class. + +For example, setting the ``honk`` Element as a default element class +for a parser works as follows: + +.. sourcecode:: pycon + + >>> parser_lookup = etree.ElementDefaultClassLookup(element=honk) + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(parser_lookup) + +There is one drawback of the parser based scheme: the ``Element()`` factory +does not know about your specialised parser and creates a new document that +deploys the default parser: + +.. sourcecode:: pycon + + >>> el = etree.Element("root") + >>> print(isinstance(el, honk)) + False + +You should therefore avoid using this factory function in code that +uses custom classes. The ``makeelement()`` method of parsers provides +a simple replacement: + +.. sourcecode:: pycon + + >>> el = parser.makeelement("root") + >>> print(isinstance(el, honk)) + True + +If you use a parser at the module level, you can easily redirect a module +level ``Element()`` factory to the parser method by adding code like this: + +.. sourcecode:: pycon + + >>> module_level_parser = etree.XMLParser() + >>> Element = module_level_parser.makeelement + +While the ``XML()`` and ``HTML()`` factories also depend on the default +parser, you can pass them a different parser as second argument: + +.. sourcecode:: pycon + + >>> element = etree.XML("") + >>> print(isinstance(element, honk)) + False + + >>> element = etree.XML("", parser) + >>> print(isinstance(element, honk)) + True + +Whenever you create a document with a parser, it will inherit the lookup +scheme and all subsequent element instantiations for this document will use +it: + +.. sourcecode:: pycon + + >>> element = etree.fromstring("", parser) + >>> print(isinstance(element, honk)) + True + >>> el = etree.SubElement(element, "subel") + >>> print(isinstance(el, honk)) + True + +For testing code in the Python interpreter and for small projects, you +may also consider setting a lookup scheme on the default parser. To +avoid interfering with other modules, however, it is usually a better +idea to use a dedicated parser for each module (or a parser pool when +using threads) and then register the required lookup scheme only for +this parser. + + +Default class lookup +-------------------- + +This is the most simple lookup mechanism. It always returns the default +element class. Consequently, no further fallbacks are supported, but this +scheme is a nice fallback for other custom lookup mechanisms. + +Usage: + +.. sourcecode:: pycon + + >>> lookup = etree.ElementDefaultClassLookup() + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(lookup) + +Note that the default for new parsers is to use the global fallback, which is +also the default lookup (if not configured otherwise). + +To change the default element implementation, you can pass your new class to +the constructor. While it accepts classes for ``element``, ``comment`` and +``pi`` nodes, most use cases will only override the element class: + +.. sourcecode:: pycon + + >>> el = parser.makeelement("myelement") + >>> print(isinstance(el, honk)) + False + + >>> lookup = etree.ElementDefaultClassLookup(element=honk) + >>> parser.set_element_class_lookup(lookup) + + >>> el = parser.makeelement("myelement") + >>> print(isinstance(el, honk)) + True + >>> el.honking + False + >>> el = parser.makeelement("myelement", honking='true') + >>> etree.tostring(el) + b'' + >>> el.honking + True + + +Namespace class lookup +---------------------- + +This is an advanced lookup mechanism that supports namespace/tag-name specific +element classes. You can select it by calling: + +.. sourcecode:: pycon + + >>> lookup = etree.ElementNamespaceClassLookup() + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(lookup) + +See the separate section on `implementing namespaces`_ below to learn how to +make use of it. + +.. _`implementing namespaces`: #implementing-namespaces + +This scheme supports a fallback mechanism that is used in the case where the +namespace is not found or no class was registered for the element name. +Normally, the default class lookup is used here. To change it, pass the +desired fallback lookup scheme to the constructor: + +.. sourcecode:: pycon + + >>> fallback = etree.ElementDefaultClassLookup(element=honk) + >>> lookup = etree.ElementNamespaceClassLookup(fallback) + >>> parser.set_element_class_lookup(lookup) + + +Attribute based lookup +---------------------- + +This scheme uses a mapping from attribute values to classes. An attribute +name is set at initialisation time and is then used to find the corresponding +value in a dictionary. It is set up as follows: + +.. sourcecode:: pycon + + >>> id_class_mapping = {'1234' : honk} # maps attribute values to classes + + >>> lookup = etree.AttributeBasedElementClassLookup( + ... 'id', id_class_mapping) + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(lookup) + +This class uses its fallback if the attribute is not found or its value is not +in the mapping. Normally, the default class lookup is used here. If you want +to use the namespace lookup, for example, you can use this code: + +.. sourcecode:: pycon + + >>> fallback = etree.ElementNamespaceClassLookup() + >>> lookup = etree.AttributeBasedElementClassLookup( + ... 'id', id_class_mapping, fallback) + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(lookup) + + +Custom element class lookup +--------------------------- + +This is the most customisable way of finding element classes on a per-element +basis. It allows you to implement a custom lookup scheme in a subclass: + +.. sourcecode:: pycon + + >>> class MyLookup(etree.CustomElementClassLookup): + ... def lookup(self, node_type, document, namespace, name): + ... return honk # be a bit more selective here ... + + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(MyLookup()) + +The ``.lookup()`` method must return either None (which triggers the +fallback mechanism) or a subclass of ``lxml.etree.ElementBase``. It +can take any decision it wants based on the node type (one of +"element", "comment", "PI", "entity"), the XML document of the +element, or its namespace or tag name. + + +Tree based element class lookup in Python +----------------------------------------- + +Taking more elaborate decisions than allowed by the custom scheme is +difficult to achieve in pure Python, as it results in a +chicken-and-egg problem. It would require access to the tree - before +the elements in the tree have been instantiated as Python Element +proxies. + +Luckily, there is a way to do this. The ``PythonElementClassLookup`` +works similar to the custom lookup scheme: + +.. sourcecode:: pycon + + >>> class MyLookup(etree.PythonElementClassLookup): + ... def lookup(self, document, element): + ... return MyElementClass # defined elsewhere + + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(MyLookup()) + +As before, the first argument to the ``lookup()`` method is the opaque +document instance that contains the Element. The second arguments is a +lightweight Element proxy implementation that is only valid during the lookup. +Do not try to keep a reference to it. Once the lookup is finished, the proxy +will become invalid. You will get an ``AssertionError`` if you access any of +the properties or methods outside the scope of the lookup call where they were +instantiated. + +During the lookup, the element object behaves mostly like a normal Element +instance. It provides the properties ``tag``, ``text``, ``tail`` etc. and +supports indexing, slicing and the ``getchildren()``, ``getparent()`` +etc. methods. It does *not* support iteration, nor does it support any kind +of modification. All of its properties are read-only and it cannot be removed +or inserted into other trees. You can use it as a starting point to freely +traverse the tree and collect any kind of information that its elements +provide. Once you have taken the decision which class to use for this +element, you can simply return it and have lxml take care of cleaning up the +instantiated proxy classes. + +Sidenote: this lookup scheme originally lived in a separate module called +``lxml.pyclasslookup``. + + +Generating XML with custom classes +================================== + +Up to lxml 2.1, you could not instantiate proxy classes yourself. +Only lxml.etree could do that when creating an object representation +of an existing XML element. Since lxml 2.2, however, instantiating +this class will simply create a new Element: + +.. sourcecode:: pycon + + >>> el = honk(honking = 'true') + >>> el.tag + 'honk' + >>> el.honking + True + +Note, however, that the proxy you create here will be garbage +collected just like any other proxy. You can therefore not count on +lxml.etree using the same class that you instantiated when you access +this Element a second time after letting its reference go. You should +therefore always use a corresponding class lookup scheme that returns +your Element proxy classes for the elements that they create. The +``ElementNamespaceClassLookup`` is generally a good match. + +You can use custom Element classes to quickly create XML fragments: + +.. sourcecode:: pycon + + >>> class hale(etree.ElementBase): pass + >>> class bopp(etree.ElementBase): pass + + >>> el = hale( "some ", honk(honking = 'true'), bopp, " text" ) + + >>> print(etree.tostring(el, encoding=unicode)) + some text + + +Implementing namespaces +======================= + +lxml allows you to implement namespaces, in a rather literal sense. After +setting up the namespace class lookup mechanism as described above, you can +build a new element namespace (or retrieve an existing one) by calling the +``get_namespace(uri)`` method of the lookup: + +.. sourcecode:: pycon + + >>> lookup = etree.ElementNamespaceClassLookup() + >>> parser = etree.XMLParser() + >>> parser.set_element_class_lookup(lookup) + + >>> namespace = lookup.get_namespace('http://hui.de/honk') + +and then register the new element type with that namespace, say, under the tag +name ``honk``: + +.. sourcecode:: pycon + + >>> namespace['honk'] = honk + +If you have many Element classes declared in one module, and they are +all named like the elements they create, you can simply use +``namespace.update(vars())`` at the end of your module to declare them +automatically. The implementation is smart enough to ignore +everything that is not an Element class. + +After this, you create and use your XML elements through the normal API of +lxml: + +.. sourcecode:: pycon + + >>> xml = '' + >>> honk_element = etree.XML(xml, parser) + >>> print(honk_element.honking) + True + +The same works when creating elements by hand: + +.. sourcecode:: pycon + + >>> honk_element = parser.makeelement('{http://hui.de/honk}honk', + ... honking='true') + >>> print(honk_element.honking) + True + +Essentially, what this allows you to do, is to give Elements a custom API +based on their namespace and tag name. + +A somewhat related topic are `extension functions`_ which use a similar +mechanism for registering extension functions in XPath and XSLT. + +.. _`extension functions`: extensions.html + +In the setup example above, we associated the ``honk`` Element class +only with the 'honk' element. If an XML tree contains different +elements in the same namespace, they do not pick up the same +implementation: + +.. sourcecode:: pycon + + >>> xml = '' + >>> honk_element = etree.XML(xml, parser) + >>> print(honk_element.honking) + True + >>> print(honk_element[0].honking) + Traceback (most recent call last): + ... + AttributeError: 'lxml.etree._Element' object has no attribute 'honking' + +You can therefore provide one implementation per element name in each +namespace and have lxml select the right one on the fly. If you want one +element implementation per namespace (ignoring the element name) or prefer +having a common class for most elements except a few, you can specify a +default implementation for an entire namespace by registering that class with +the empty element name (None). + +You may consider following an object oriented approach here. If you build a +class hierarchy of element classes, you can also implement a base class for a +namespace that is used if no specific element class is provided. Again, you +can just pass None as an element name: + +.. sourcecode:: pycon + + >>> class HonkNSElement(etree.ElementBase): + ... def honk(self): + ... return "HONK" + >>> namespace[None] = HonkNSElement # default Element for namespace + + >>> class HonkElement(HonkNSElement): + ... def honking(self): + ... return self.get('honking') == 'true' + ... honking = property(honking) + >>> namespace['honk'] = HonkElement # Element for specific tag + +Now you can rely on lxml to always return objects of type HonkNSElement or its +subclasses for elements of this namespace: + +.. sourcecode:: pycon + + >>> xml = '' + >>> honk_element = etree.XML(xml, parser) + + >>> print(type(honk_element)) + + >>> print(type(honk_element[0])) + + + >>> print(honk_element.honking) + True + >>> print(honk_element.honk()) + HONK + + >>> print(honk_element[0].honk()) + HONK + >>> print(honk_element[0].honking) + Traceback (most recent call last): + ... + AttributeError: 'HonkNSElement' object has no attribute 'honking' diff --git a/doc/elementsoup.txt b/doc/elementsoup.txt new file mode 100644 index 0000000..82ff4b4 --- /dev/null +++ b/doc/elementsoup.txt @@ -0,0 +1,201 @@ +==================== +BeautifulSoup Parser +==================== + +BeautifulSoup_ is a Python package that parses broken HTML, just like +lxml supports it based on the parser of libxml2. BeautifulSoup uses a +different parsing approach. It is not a real HTML parser but uses +regular expressions to dive through tag soup. It is therefore more +forgiving in some cases and less good in others. It is not uncommon +that lxml/libxml2 parses and fixes broken HTML better, but +BeautifulSoup has superiour `support for encoding detection`_. It +very much depends on the input which parser works better. + +.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/ +.. _`support for encoding detection`: http://www.crummy.com/software/BeautifulSoup/documentation.html#Beautiful%20Soup%20Gives%20You%20Unicode%2C%20Dammit +.. _ElementSoup: http://effbot.org/zone/element-soup.htm + +To prevent users from having to choose their parser library in +advance, lxml can interface to the parsing capabilities of +BeautifulSoup through the ``lxml.html.soupparser`` module. It +provides three main functions: ``fromstring()`` and ``parse()`` to +parse a string or file using BeautifulSoup into an ``lxml.html`` +document, and ``convert_tree()`` to convert an existing BeautifulSoup +tree into a list of top-level Elements. + +.. contents:: +.. + 1 Parsing with the soupparser + 2 Entity handling + 3 Using soupparser as a fallback + 4 Using only the encoding detection + + +Parsing with the soupparser +=========================== + +The functions ``fromstring()`` and ``parse()`` behave as known from +ElementTree. The first returns a root Element, the latter returns an +ElementTree. + +There is also a legacy module called ``lxml.html.ElementSoup``, which +mimics the interface provided by ElementTree's own ElementSoup_ +module. Note that the ``soupparser`` module was added in lxml 2.0.3. +Previous versions of lxml 2.0.x only have the ``ElementSoup`` module. + +Here is a document full of tag soup, similar to, but not quite like, HTML: + +.. sourcecode:: pycon + + >>> tag_soup = 'Hello</head<body onload=crash()>Hi all<p>' + +all you need to do is pass it to the ``fromstring()`` function: + +.. sourcecode:: pycon + + >>> from lxml.html.soupparser import fromstring + >>> root = fromstring(tag_soup) + +To see what we have here, you can serialise it: + +.. sourcecode:: pycon + + >>> from lxml.etree import tostring + >>> print tostring(root, pretty_print=True), + <html> + <meta/> + <head> + <title>Hello + + Hi all

+ + +Not quite what you'd expect from an HTML page, but, well, it was broken +already, right? BeautifulSoup did its best, and so now it's a tree. + +To control which Element implementation is used, you can pass a +``makeelement`` factory function to ``parse()`` and ``fromstring()``. +By default, this is based on the HTML parser defined in ``lxml.html``. + +For a quick comparison, libxml2 2.6.32 parses the same tag soup as +follows. The main difference is that libxml2 tries harder to adhere +to the structure of an HTML document and moves misplaced tags where +they (likely) belong. Note, however, that the result can vary between +parser versions. + +.. sourcecode:: html + + + + + Hello + + +

Hi all

+

+ + + + +Entity handling +=============== + +By default, the BeautifulSoup parser also replaces the entities it +finds by their character equivalent. + +.. sourcecode:: pycon + + >>> tag_soup = '©€-õƽ

' + >>> body = fromstring(tag_soup).find('.//body') + >>> body.text + u'\xa9\u20ac-\xf5\u01bd' + +If you want them back on the way out, you can just serialise with the +default encoding, which is 'US-ASCII'. + +.. sourcecode:: pycon + + >>> tostring(body) + '©€-õƽ

' + + >>> tostring(body, method="html") + '©€-õƽ

' + +Any other encoding will output the respective byte sequences. + +.. sourcecode:: pycon + + >>> tostring(body, encoding="utf-8") + '\xc2\xa9\xe2\x82\xac-\xc3\xb5\xc6\xbd

' + + >>> tostring(body, method="html", encoding="utf-8") + '\xc2\xa9\xe2\x82\xac-\xc3\xb5\xc6\xbd

' + + >>> tostring(body, encoding=unicode) + u'\xa9\u20ac-\xf5\u01bd

' + + >>> tostring(body, method="html", encoding=unicode) + u'\xa9\u20ac-\xf5\u01bd

' + + +Using soupparser as a fallback +============================== + +The downside of using this parser is that it is `much slower`_ than +the HTML parser of lxml. So if performance matters, you might want to +consider using ``soupparser`` only as a fallback for certain cases. + +.. _`much slower`: http://blog.ianbicking.org/2008/03/30/python-html-parser-performance/ + +One common problem of lxml's parser is that it might not get the +encoding right in cases where the document contains a ```` tag +at the wrong place. In this case, you can exploit the fact that lxml +serialises much faster than most other HTML libraries for Python. +Just serialise the document to unicode and if that gives you an +exception, re-parse it with BeautifulSoup to see if that works +better. + +.. sourcecode:: pycon + + >>> tag_soup = '''\ + ... + ... + ... + ... Hello W\xc3\xb6rld! + ... + ... Hi all + ... ''' + + >>> import lxml.html + >>> import lxml.html.soupparser + + >>> root = lxml.html.fromstring(tag_soup) + >>> try: + ... ignore = tostring(root, encoding=unicode) + ... except UnicodeDecodeError: + ... root = lxml.html.soupparser.fromstring(tag_soup) + + +Using only the encoding detection +================================= + +If you prefer a 'real' (and fast) HTML parser instead of the regular +expression based one in BeautifulSoup, you can still benefit from +BeautifulSoup's `support for encoding detection`_ in the +``UnicodeDammit`` class. + +.. sourcecode:: pycon + + >>> from BeautifulSoup import UnicodeDammit + + >>> def decode_html(html_string): + ... converted = UnicodeDammit(html_string, isHTML=True) + ... if not converted.unicode: + ... raise UnicodeDecodeError( + ... "Failed to detect encoding, tried [%s]", + ... ', '.join(converted.triedEncodings)) + ... # print converted.originalEncoding + ... return converted.unicode + + >>> root = lxml.html.fromstring(decode_html(tag_soup)) diff --git a/doc/extensions.txt b/doc/extensions.txt new file mode 100644 index 0000000..61c4179 --- /dev/null +++ b/doc/extensions.txt @@ -0,0 +1,587 @@ +==================================== +Python extensions for XPath and XSLT +==================================== + +This document describes how to use Python extension functions in XPath +and XSLT like this: + +.. sourcecode:: xml + + + +and extension elements in XSLT as in the following example: + +.. sourcecode:: xml + + + + + + + + +.. contents:: +.. + 1 XPath Extension functions + 1.1 The FunctionNamespace + 1.2 Global prefix assignment + 1.3 The XPath context + 1.4 Evaluators and XSLT + 1.5 Evaluator-local extensions + 1.6 What to return from a function + 2 XSLT extension elements + 2.1 Declaring extension elements + 2.2 Applying XSL templates + 2.3 Working with read-only elements + +.. + >>> try: from StringIO import StringIO + ... except ImportError: + ... from io import BytesIO + ... def StringIO(s): + ... if isinstance(s, str): s = s.encode("UTF-8") + ... return BytesIO(s) + + +XPath Extension functions +========================= + +Here is how an extension function looks like. As the first argument, +it always receives a context object (see below). The other arguments +are provided by the respective call in the XPath expression, one in +the following examples. Any number of arguments is allowed: + +.. sourcecode:: pycon + + >>> def hello(dummy, a): + ... return "Hello %s" % a + >>> def ola(dummy, a): + ... return "Ola %s" % a + >>> def loadsofargs(dummy, *args): + ... return "Got %d arguments." % len(args) + + +The FunctionNamespace +--------------------- + +In order to use a function in XPath or XSLT, it needs to have a +(namespaced) name by which it can be called during evaluation. This +is done using the FunctionNamespace class. For simplicity, we choose +the empty namespace (None): + +.. sourcecode:: pycon + + >>> from lxml import etree + >>> ns = etree.FunctionNamespace(None) + >>> ns['hello'] = hello + >>> ns['countargs'] = loadsofargs + +This registers the function `hello` with the name `hello` in the default +namespace (None), and the function `loadsofargs` with the name `countargs`. +Now we're going to create a document that we can run XPath expressions +against: + +.. sourcecode:: pycon + + >>> root = etree.XML('Haegar') + >>> doc = etree.ElementTree(root) + +Done. Now we can have XPath expressions call our new function: + +.. sourcecode:: pycon + + >>> print(root.xpath("hello('world')")) + Hello world + >>> print(root.xpath('hello(local-name(*))')) + Hello b + >>> print(root.xpath('hello(string(b))')) + Hello Haegar + >>> print(root.xpath('countargs(., b, ./*)')) + Got 3 arguments. + +Note how we call both a Python function (`hello`) and an XPath built-in +function (`string`) in exactly the same way. Normally, however, you would +want to separate the two in different namespaces. The FunctionNamespace class +allows you to do this: + +.. sourcecode:: pycon + + >>> ns = etree.FunctionNamespace('http://mydomain.org/myfunctions') + >>> ns['hello'] = hello + >>> prefixmap = {'f' : 'http://mydomain.org/myfunctions'} + >>> print(root.xpath('f:hello(local-name(*))', namespaces=prefixmap)) + Hello b + + +Global prefix assignment +------------------------ + +In the last example, you had to specify a prefix for the function namespace. +If you always use the same prefix for a function namespace, you can also +register it with the namespace: + +.. sourcecode:: pycon + + >>> ns = etree.FunctionNamespace('http://mydomain.org/myother/functions') + >>> ns.prefix = 'es' + >>> ns['hello'] = ola + >>> print(root.xpath('es:hello(local-name(*))')) + Ola b + +This is a global assignment, so take care not to assign the same prefix to +more than one namespace. The resulting behaviour in that case is completely +undefined. It is always a good idea to consistently use the same meaningful +prefix for each namespace throughout your application. + +The prefix assignment only works with functions and FunctionNamespace objects, +not with the general Namespace object that registers element classes. The +reasoning is that elements in lxml do not care about prefixes anyway, so it +would rather complicate things than be of any help. + + +The XPath context +----------------- + +Functions get a context object as first parameter. In lxml 1.x, this value +was None, but since lxml 2.0 it provides two properties: ``eval_context`` and +``context_node``. The context node is the Element where the current function +is called: + +.. sourcecode:: pycon + + >>> def print_tag(context, nodes): + ... print("%s: %s" % (context.context_node.tag, [ n.tag for n in nodes ])) + + >>> ns = etree.FunctionNamespace('http://mydomain.org/printtag') + >>> ns.prefix = "pt" + >>> ns["print_tag"] = print_tag + + >>> ignore = root.xpath("//*[pt:print_tag(.//*)]") + a: ['b'] + b: [] + +The ``eval_context`` is a dictionary that is local to the evaluation. It +allows functions to keep state: + +.. sourcecode:: pycon + + >>> def print_context(context): + ... context.eval_context[context.context_node.tag] = "done" + ... entries = list(context.eval_context.items()) + ... entries.sort() + ... print(entries) + >>> ns["print_context"] = print_context + + >>> ignore = root.xpath("//*[pt:print_context()]") + [('a', 'done')] + [('a', 'done'), ('b', 'done')] + + +Evaluators and XSLT +------------------- + +Extension functions work for all ways of evaluating XPath expressions and for +XSL transformations: + +.. sourcecode:: pycon + + >>> e = etree.XPathEvaluator(doc) + >>> print(e('es:hello(local-name(/a))')) + Ola a + + >>> namespaces = {'f' : 'http://mydomain.org/myfunctions'} + >>> e = etree.XPathEvaluator(doc, namespaces=namespaces) + >>> print(e('f:hello(local-name(/a))')) + Hello a + + >>> xslt = etree.XSLT(etree.XML(''' + ... + ... + ... + ... + ... ''')) + >>> print(xslt(doc)) + Ola Haegar + +It is also possible to register namespaces with a single evaluator after its +creation. While the following example involves no functions, the idea should +still be clear: + +.. sourcecode:: pycon + + >>> f = StringIO('') + >>> ns_doc = etree.parse(f) + >>> e = etree.XPathEvaluator(ns_doc) + >>> e('/a') + [] + +This returns nothing, as we did not ask for the right namespace. When we +register the namespace with the evaluator, however, we can access it via a +prefix: + +.. sourcecode:: pycon + + >>> e.register_namespace('foo', 'http://mydomain.org/myfunctions') + >>> e('/foo:a')[0].tag + '{http://mydomain.org/myfunctions}a' + +Note that this prefix mapping is only known to this evaluator, as opposed to +the global mapping of the FunctionNamespace objects: + +.. sourcecode:: pycon + + >>> e2 = etree.XPathEvaluator(ns_doc) + >>> e2('/foo:a') + Traceback (most recent call last): + ... + lxml.etree.XPathEvalError: Undefined namespace prefix + + +Evaluator-local extensions +-------------------------- + +Apart from the global registration of extension functions, there is also a way +of making extensions known to a single Evaluator or XSLT. All evaluators and +the XSLT object accept a keyword argument ``extensions`` in their constructor. +The value is a dictionary mapping (namespace, name) tuples to functions: + +.. sourcecode:: pycon + + >>> extensions = {('local-ns', 'local-hello') : hello} + >>> namespaces = {'l' : 'local-ns'} + + >>> e = etree.XPathEvaluator(doc, namespaces=namespaces, extensions=extensions) + >>> print(e('l:local-hello(string(b))')) + Hello Haegar + +For larger numbers of extension functions, you can define classes or modules +and use the ``Extension`` helper: + +.. sourcecode:: pycon + + >>> class MyExt: + ... def function1(self, _, arg): + ... return '1'+arg + ... def function2(self, _, arg): + ... return '2'+arg + ... def function3(self, _, arg): + ... return '3'+arg + + >>> ext_module = MyExt() + >>> functions = ('function1', 'function2') + >>> extensions = etree.Extension( ext_module, functions, ns='local-ns' ) + + >>> e = etree.XPathEvaluator(doc, namespaces=namespaces, extensions=extensions) + >>> print(e('l:function1(string(b))')) + 1Haegar + +The optional second argument to ``Extension`` can either be be a +sequence of names to select from the module, a dictionary that +explicitly maps function names to their XPath alter-ego or ``None`` +(explicitly passed) to take all available functions under their +original name (if their name does not start with '_'). + +The additional ``ns`` keyword argument takes a namespace URI or +``None`` (also if left out) for the default namespace. The following +examples will therefore all do the same thing: + +.. sourcecode:: pycon + + >>> functions = ('function1', 'function2', 'function3') + >>> extensions = etree.Extension( ext_module, functions ) + >>> e = etree.XPathEvaluator(doc, extensions=extensions) + >>> print(e('function1(function2(function3(string(b))))')) + 123Haegar + + >>> extensions = etree.Extension( ext_module, functions, ns=None ) + >>> e = etree.XPathEvaluator(doc, extensions=extensions) + >>> print(e('function1(function2(function3(string(b))))')) + 123Haegar + + >>> extensions = etree.Extension(ext_module) + >>> e = etree.XPathEvaluator(doc, extensions=extensions) + >>> print(e('function1(function2(function3(string(b))))')) + 123Haegar + + >>> functions = { + ... 'function1' : 'function1', + ... 'function2' : 'function2', + ... 'function3' : 'function3' + ... } + >>> extensions = etree.Extension(ext_module, functions) + >>> e = etree.XPathEvaluator(doc, extensions=extensions) + >>> print(e('function1(function2(function3(string(b))))')) + 123Haegar + +For convenience, you can also pass a sequence of extensions: + +.. sourcecode:: pycon + + >>> extensions1 = etree.Extension(ext_module) + >>> extensions2 = etree.Extension(ext_module, ns='local-ns') + >>> e = etree.XPathEvaluator(doc, extensions=[extensions1, extensions2], + ... namespaces=namespaces) + >>> print(e('function1(l:function2(function3(string(b))))')) + 123Haegar + + +What to return from a function +------------------------------ + +.. _`XPath return values`: xpathxslt.html#xpath-return-values + +Extension functions can return any data type for which there is an XPath +equivalent (see the documentation on `XPath return values`). This includes +numbers, boolean values, elements and lists of elements. Note that integers +will also be returned as floats: + +.. sourcecode:: pycon + + >>> def returnsFloat(_): + ... return 1.7 + >>> def returnsInteger(_): + ... return 1 + >>> def returnsBool(_): + ... return True + >>> def returnFirstNode(_, nodes): + ... return nodes[0] + + >>> ns = etree.FunctionNamespace(None) + >>> ns['float'] = returnsFloat + >>> ns['int'] = returnsInteger + >>> ns['bool'] = returnsBool + >>> ns['first'] = returnFirstNode + + >>> e = etree.XPathEvaluator(doc) + >>> e("float()") + 1.7 + >>> e("int()") + 1.0 + >>> int( e("int()") ) + 1 + >>> e("bool()") + True + >>> e("count(first(//b))") + 1.0 + +As the last example shows, you can pass the results of functions back into +the XPath expression. Elements and sequences of elements are treated as +XPath node-sets: + +.. sourcecode:: pycon + + >>> def returnsNodeSet(_): + ... results1 = etree.Element('results1') + ... etree.SubElement(results1, 'result').text = "Alpha" + ... etree.SubElement(results1, 'result').text = "Beta" + ... + ... results2 = etree.Element('results2') + ... etree.SubElement(results2, 'result').text = "Gamma" + ... etree.SubElement(results2, 'result').text = "Delta" + ... + ... results3 = etree.SubElement(results2, 'subresult') + ... return [results1, results2, results3] + + >>> ns['new-node-set'] = returnsNodeSet + + >>> e = etree.XPathEvaluator(doc) + + >>> r = e("new-node-set()/result") + >>> print([ t.text for t in r ]) + ['Alpha', 'Beta', 'Gamma', 'Delta'] + + >>> r = e("new-node-set()") + >>> print([ t.tag for t in r ]) + ['results1', 'results2', 'subresult'] + >>> print([ len(t) for t in r ]) + [2, 3, 0] + >>> r[0][0].text + 'Alpha' + + >>> etree.tostring(r[0]) + b'AlphaBeta' + + >>> etree.tostring(r[1]) + b'GammaDelta' + + >>> etree.tostring(r[2]) + b'' + +The current implementation deep-copies newly created elements in node-sets. +Only the elements and their children are passed on, no outlying parents or +tail texts will be available in the result. This also means that in the above +example, the `subresult` elements in `results2` and `results3` are no longer +identical within the node-set, they belong to independent trees: + +.. sourcecode:: pycon + + >>> print("%s - %s" % (r[1][-1].tag, r[2].tag)) + subresult - subresult + >>> print(r[1][-1] == r[2]) + False + >>> print(r[1][-1].getparent().tag) + results2 + >>> print(r[2].getparent()) + None + +This is an implementation detail that you should be aware of, but you should +avoid relying on it in your code. Note that elements taken from the source +document (the most common case) do not suffer from this restriction. They +will always be passed unchanged. + + +XSLT extension elements +======================= + +Just like the XPath extension functions described above, lxml supports +custom extension *elements* in XSLT. This means, you can write XSLT +code like this: + +.. sourcecode:: xml + + + + + + + +And then you can implement the element in Python like this: + +.. sourcecode:: pycon + + >>> class MyExtElement(etree.XSLTExtension): + ... def execute(self, context, self_node, input_node, output_parent): + ... print("Hello from XSLT!") + ... output_parent.text = "I did it!" + ... # just copy own content input to output + ... output_parent.extend( list(self_node) ) + +The arguments passed to the ``.execute()`` method are + +context + The opaque evaluation context. You need this when calling back + into the XSLT processor. + +self_node + A read-only Element object that represents the extension element + in the stylesheet. + +input_node + The current context Element in the input document (also read-only). + +output_parent + The current insertion point in the output document. You can + append elements or set the text value (not the tail). Apart from + that, the Element is read-only. + + +Declaring extension elements +---------------------------- + +In XSLT, extension elements can be used like any other XSLT element, +except that they must be declared as extensions using the standard +XSLT ``extension-element-prefixes`` option: + +.. sourcecode:: pycon + + >>> xslt_ext_tree = etree.XML(''' + ... + ... + ... XYZ + ... + ... + ... --xyz-- + ... + ... ''') + +To register the extension, add its namespace and name to the extension +mapping of the XSLT object: + +.. sourcecode:: pycon + + >>> my_extension = MyExtElement() + >>> extensions = { ('testns', 'ext') : my_extension } + >>> transform = etree.XSLT(xslt_ext_tree, extensions = extensions) + +Note how we pass an instance here, not the class of the extension. +Now we can run the transformation and see how our extension is +called: + +.. sourcecode:: pycon + + >>> root = etree.XML('') + >>> result = transform(root) + Hello from XSLT! + >>> str(result) + '\nI did it!XYZ\n' + + +Applying XSL templates +---------------------- + +XSLT extensions are a very powerful feature that allows you to +interact directly with the XSLT processor. You have full read-only +access to the input document and the stylesheet, and you can even call +back into the XSLT processor to process templates. Here is an example +that passes an Element into the ``.apply_templates()`` method of the +``XSLTExtension`` instance: + +.. sourcecode:: pycon + + >>> class MyExtElement(etree.XSLTExtension): + ... def execute(self, context, self_node, input_node, output_parent): + ... child = self_node[0] + ... results = self.apply_templates(context, child) + ... output_parent.append(results[0]) + + >>> my_extension = MyExtElement() + >>> extensions = { ('testns', 'ext') : my_extension } + >>> transform = etree.XSLT(xslt_ext_tree, extensions = extensions) + + >>> root = etree.XML('') + >>> result = transform(root) + >>> str(result) + '\n--xyz--\n' + +Note how we applied the templates to a child of the extension element +itself, i.e. to an element inside the stylesheet instead of an element +of the input document. + + +Working with read-only elements +------------------------------- + +There is one important thing to keep in mind: all Elements that the +``execute()`` method gets to deal with are read-only Elements, so you +cannot modify them. They also will not easily work in the API. For +example, you cannot pass them to the ``tostring()`` function or wrap +them in an ``ElementTree``. + +What you can do, however, is to deepcopy them to make them normal +Elements, and then modify them using the normal etree API. So this +will work: + +.. sourcecode:: pycon + + >>> from copy import deepcopy + >>> class MyExtElement(etree.XSLTExtension): + ... def execute(self, context, self_node, input_node, output_parent): + ... child = deepcopy(self_node[0]) + ... child.text = "NEW TEXT" + ... output_parent.append(child) + + >>> my_extension = MyExtElement() + >>> extensions = { ('testns', 'ext') : my_extension } + >>> transform = etree.XSLT(xslt_ext_tree, extensions = extensions) + + >>> root = etree.XML('') + >>> result = transform(root) + >>> str(result) + '\nNEW TEXT\n' diff --git a/doc/html/FAQ.html b/doc/html/FAQ.html new file mode 100644 index 0000000..1ef9acc --- /dev/null +++ b/doc/html/FAQ.html @@ -0,0 +1,759 @@ + + + + + +lxml FAQ - Frequently Asked Questions + + + + + +
+

lxml FAQ - Frequently Asked Questions

+ +

Frequently asked questions on lxml. See also the notes on compatibility to +ElementTree.

+
+

Contents

+ +
+
+

General Questions

+
+

Is there a tutorial?

+

Read the lxml.etree Tutorial. While this is still work in progress +(just as any good documentation), it provides an overview of the most +important concepts in lxml.etree. If you want to help out, +improving the tutorial is a very good place to start.

+

There is also a tutorial for ElementTree which works for +lxml.etree. The documentation of the extended etree API also +contains many examples for lxml.etree. Fredrik Lundh's element +library contains a lot of nice recipes that show how to solve common +tasks in ElementTree and lxml.etree. To learn using +lxml.objectify, read the objectify documentation.

+

John Shipman has written another tutorial called Python XML +processing with lxml that contains lots of examples. Liza Daly +wrote a nice article about high-performance aspects when parsing +large files with lxml.

+
+
+

Where can I find more documentation about lxml?

+

There is a lot of documentation on the web and also in the Python +standard library documentation, as lxml implements the well-known +ElementTree API and tries to follow its documentation as closely as +possible. The recipes in Fredrik Lundh's element library are +generally worth taking a look at. There are a couple of issues where +lxml cannot keep up compatibility. They are described in the +compatibility documentation.

+

The lxml specific extensions to the API are described by individual +files in the doc directory of the source distribution and on the +web page.

+

The generated API documentation is a comprehensive API reference +for the lxml package.

+
+
+

What standards does lxml implement?

+

The compliance to XML Standards depends on the support in libxml2 and libxslt. +Here is a quote from http://xmlsoft.org/:

+
+In most cases libxml2 tries to implement the specifications in a relatively +strictly compliant way. As of release 2.4.16, libxml2 passed all 1800+ tests +from the OASIS XML Tests Suite.
+

lxml currently supports libxml2 2.6.20 or later, which has even better +support for various XML standards. The important ones are:

+
    +
  • XML 1.0
  • +
  • HTML 4
  • +
  • XML namespaces
  • +
  • XML Schema 1.0
  • +
  • XPath 1.0
  • +
  • XInclude 1.0
  • +
  • XSLT 1.0
  • +
  • EXSLT
  • +
  • XML catalogs
  • +
  • canonical XML
  • +
  • RelaxNG
  • +
  • xml:id
  • +
  • xml:base
  • +
+

Support for XML Schema is currently not 100% complete in libxml2, but +is definitely very close to compliance. Schematron is supported, +although not necessarily complete. libxml2 also supports loading +documents through HTTP and FTP.

+
+
+

Who uses lxml?

+

As an XML library, lxml is often used under the hood of in-house +server applications, such as web servers or applications that +facilitate some kind of document management. Many people who deploy +Zope or Plone use it together with lxml. Therefore, it is hard to +get an idea of who uses it, and the following list of 'users and +projects we know of' is definitely not a complete list of lxml's +users.

+

Also note that the compatibility to the ElementTree library does not +require projects to set a hard dependency on lxml - as long as they do +not take advantage of lxml's enhanced feature set.

+
    +
  • cssutils, a CSS parser and toolkit, can be used with lxml.cssselect
  • +
  • Deliverance, a content theming tool
  • +
  • Enfold Proxy 4, a web server accelerator with on-the-fly XSLT processing
  • +
  • Inteproxy, a secure HTTP proxy
  • +
  • lwebstring, an XML template engine
  • +
  • OpenXMLlib, a library for handling OpenXML document meta data
  • +
  • Pycoon, a WSGI web development framework based on XML pipelines
  • +
  • PyQuery, a query framework for XML/HTML, similar to jQuery for JavaScript
  • +
  • Rambler, a meta search engine that aggregates different data sources
  • +
  • rdfadict, an RDFa parser with a simple dictionary-like interface.
  • +
+

Zope3 and some of its extensions have good support for lxml:

+
    +
  • gocept.lxml, Zope3 interface bindings for lxml
  • +
  • z3c.rml, an implementation of ReportLab's RML format
  • +
  • zif.sedna, an XQuery based interface to the Sedna OpenSource XML database
  • +
+

And don't miss the quotes by our generally happy users, and other +sites that link to lxml. As Liza Daly puts it: "Many software +products come with the pick-two caveat, meaning that you must choose +only two: speed, flexibility, or readability. When used carefully, +lxml can provide all three."

+
+
+

What is the difference between lxml.etree and lxml.objectify?

+

The two modules provide different ways of handling XML. However, objectify +builds on top of lxml.etree and therefore inherits most of its capabilities +and a large portion of its API.

+
    +
  • lxml.etree is a generic API for XML and HTML handling. It aims for +ElementTree compatibility and supports the entire XML infoset. It is well +suited for both mixed content and data centric XML. Its generality makes it +the best choice for most applications.

    +
  • +
  • lxml.objectify is a specialized API for XML data handling in a Python object +syntax. It provides a very natural way to deal with data fields stored in a +structurally well defined XML format. Data is automatically converted to +Python data types and can be manipulated with normal Python operators. Look +at the examples in the objectify documentation to see what it feels like +to use it.

    +

    Objectify is not well suited for mixed contents or HTML documents. As it is +built on top of lxml.etree, however, it inherits the normal support for +XPath, XSLT or validation.

    +
  • +
+
+
+

How can I make my application run faster?

+

lxml.etree is a very fast library for processing XML. There are, however, a +few caveats involved in the mapping of the powerful libxml2 library to the +simple and convenient ElementTree API. Not all operations are as fast as the +simplicity of the API might suggest, while some use cases can heavily benefit +from finding the right way of doing them. The benchmark page has a +comparison to other ElementTree implementations and a number of tips for +performance tweaking. As with any Python application, the rule of thumb is: +the more of your processing runs in C, the faster your application gets. See +also the section on threading.

+
+
+

What about that trailing text on serialised Elements?

+

The ElementTree tree model defines an Element as a container with a tag name, +contained text, child Elements and a tail text. This means that whenever you +serialise an Element, you will get all parts of that Element:

+
>>> root = etree.XML("<root><tag>text<child/></tag>tail</root>")
+>>> print(etree.tostring(root[0]))
+<tag>text<child/></tag>tail
+
+

Here is an example that shows why not serialising the tail would be +even more surprising from an object point of view:

+
>>> root = etree.Element("test")
+
+>>> root.text = "TEXT"
+>>> print(etree.tostring(root))
+<test>TEXT</test>
+
+>>> root.tail = "TAIL"
+>>> print(etree.tostring(root))
+<test>TEXT</test>TAIL
+
+>>> root.tail = None
+>>> print(etree.tostring(root))
+<test>TEXT</test>
+
+

Just imagine a Python list where you append an item and it doesn't +show up when you look at the list.

+

The .tail property is a huge simplification for the tree model as +it avoids text nodes to appear in the list of children and makes +access to them quick and simple. So this is a benefit in most +applications and simplifies many, many XML tree algorithms.

+

However, in document-like XML (and especially HTML), the above result can be +unexpected to new users and can sometimes require a bit more overhead. A good +way to deal with this is to use helper functions that copy the Element without +its tail. The lxml.html package also deals with this in a couple of +places, as most HTML algorithms benefit from a tail-free behaviour.

+
+
+

How can I find out if an Element is a comment or PI?

+
>>> root = etree.XML("<?my PI?><root><!-- empty --></root>")
+
+>>> root.tag
+'root'
+>>> root.getprevious().tag is etree.PI
+True
+>>> root[0].tag is etree.Comment
+True
+
+
+
+

How can I map an XML tree into a dict of dicts?

+

I'm glad you asked.

+
def recursive_dict(element):
+     return element.tag, \
+            dict(map(recursive_dict, element)) or element.text
+
+
+
+
+

Installation

+
+

Which version of libxml2 and libxslt should I use or require?

+

It really depends on your application, but the rule of thumb is: more recent +versions contain less bugs and provide more features.

+
    +
  • Do not use libxml2 2.6.27 if you want to use XPath (including XSLT). You +will get crashes when XPath errors occur during the evaluation (e.g. for +unknown functions). This happens inside the evaluation call to libxml2, so +there is nothing that lxml can do about it.
  • +
  • Try to use versions of both libraries that were released together. At least +the libxml2 version should not be older than the libxslt version.
  • +
  • If you use XML Schema or Schematron which are still under development, the +most recent version of libxml2 is usually a good bet.
  • +
  • The same applies to XPath, where a substantial number of bugs and memory +leaks were fixed over time. If you encounter crashes or memory leaks in +XPath applications, try a more recent version of libxml2.
  • +
  • For parsing and fixing broken HTML, lxml requires at least libxml2 2.6.21.
  • +
  • For the normal tree handling, however, any libxml2 version starting with +2.6.20 should do.
  • +
+

Read the release notes of libxml2 and the release notes of libxslt to +see when (or if) a specific bug has been fixed.

+
+
+

Where are the binary builds?

+

Sidnei da Silva regularly contributes Windows binaries for new +releases. This is because two of the major problems of Microsoft +Windows make it non-trivial for users to build lxml on this platform: +the lack of a pre-installed standard compiler and the missing package +management.

+

If there is not currently a binary distribution of the most recent +lxml release for this platform available from the Python Package Index +(PyPI), please look through the older versions to see if they provide +a binary build. This is done by appending the version number to the +PyPI URL, e.g.:

+
+http://pypi.python.org/pypi/lxml/2.1.5
+
+

Apart from that, we generally do not provide binary builds of lxml, as +most of the other operating systems out there can build lxml without +problems (with the exception of MacOS-X), and the sheer mass of +variations between platforms makes it futile to provide builds for +everyone.

+
+
+

Why do I get errors about missing UCS4 symbols when installing lxml?

+

Most likely, you use a Python installation that was configured for internal +use of UCS2 unicode, meaning 16-bit unicode. The lxml egg distributions are +generally compiled on platforms that use UCS4, a 32-bit unicode encoding, as +this is used on the majority of platforms. Sadly, both are not compatible, so +the eggs can only support the one they were compiled with.

+

This means that you have to compile lxml from sources for your system. Note +that you do not need Cython for this, the lxml source distribution is directly +compilable on both platform types. See the build instructions on how to do +this.

+
+
+
+

Contributing

+
+

Why is lxml not written in Python?

+

It almost is.

+

lxml is not written in plain Python, because it interfaces with two C +libraries: libxml2 and libxslt. Accessing them at the C-level is +required for performance reasons.

+

However, to avoid writing plain C-code and caring too much about the +details of built-in types and reference counting, lxml is written in +Cython, a Python-like language that is translated into C-code. +Chances are that if you know Python, you can write code that Cython +accepts. Again, the C-ish style used in the lxml code is just for +performance optimisations. If you want to contribute, don't bother +with the details, a Python implementation of your contribution is +better than none. And keep in mind that lxml's flexible API often +favours an implementation of features in pure Python, without +bothering with C-code at all. For example, the lxml.html package +is entirely written in Python.

+

Please contact the mailing list if you need any help.

+
+
+

How can I contribute?

+

If you find something that you would like lxml to do (or do better), +then please tell us about it on the mailing list. Patches are +always appreciated, especially when accompanied by unit tests and +documentation (doctests would be great). See the tests +subdirectories in the lxml source tree (below the src directory) +and the ReST text files in the doc directory.

+

We also have a list of missing features that we would like to +implement but didn't due to lack if time. If you find the time, +patches are very welcome.

+

Besides enhancing the code, there are a lot of places where you can help the +project and its user base. You can

+
    +
  • spread the word and write about lxml. Many users (especially new Python +users) have not yet heared about lxml, although our user base is constantly +growing. If you write your own blog and feel like saying something about +lxml, go ahead and do so. If we think your contribution or criticism is +valuable to other users, we may even put a link or a quote on the project +page.
  • +
  • provide code examples for the general usage of lxml or specific problems +solved with lxml. Readable code is a very good way of showing how a library +can be used and what great things you can do with it. Again, if we hear +about it, we can set a link on the project page.
  • +
  • work on the documentation. The web page is generated from a set of ReST +text files. It is meant both as a representative project page for lxml +and as a site for documenting lxml's API and usage. If you have questions +or an idea how to make it more readable and accessible while you are reading +it, please send a comment to the mailing list.
  • +
  • enhance the web site. We put some work into making the web site +usable, understandable and also easy to find, but there's always +things that can be done better. You may notice that we are not +top-ranked when searching the web for "Python and XML", so maybe you +have an idea how to improve that.
  • +
  • help with the tutorial. A tutorial is the most important stating point for +new users, so it is important for us to provide an easy to understand guide +into lxml. As allo documentation, the tutorial is work in progress, so we +appreciate every helping hand.
  • +
  • improve the docstrings. lxml uses docstrings to support Python's integrated +online help() function. However, sometimes these are not sufficient to +grasp the details of the function in question. If you find such a place, +you can try to write up a better description and send it to the mailing +list.
  • +
+
+
+
+

Bugs

+
+

My application crashes!

+

One of the goals of lxml is "no segfaults", so if there is no clear +warning in the documentation that you were doing something potentially +harmful, you have found a bug and we would like to hear about it. +Please report this bug to the mailing list. See the section on bug +reporting to learn how to do that.

+

If your application (or e.g. your web container) uses threads, please +see the FAQ section on threading to check if you touch on one of the +potential pitfalls.

+

In any case, try to reproduce the problem with the latest versions of +libxml2 and libxslt. From time to time, bugs and race conditions are found +in these libraries, so a more recent version might already contain a fix for +your problem.

+

Remember: even if you see lxml appear in a crash stack trace, it is +not necessarily lxml that caused the crash.

+
+
+

My application crashes on MacOS-X!

+

This was a common problem up to lxml 2.1.x. Since lxml 2.2, the only +officially supported way to use it on this platform is through a +static build against freshly downloaded versions of libxml2 and +libxslt. See the build instructions for MacOS-X.

+
+
+

I think I have found a bug in lxml. What should I do?

+

First, you should look at the current developer changelog to see if this +is a known problem that has already been fixed in the SVN trunk since the +release you are using.

+

Also, the 'crash' section above has a few good advices what to try to see if +the problem is really in lxml - and not in your setup. Believe it or not, +that happens more often than you might think, especially when old libraries +or even multiple library versions are installed.

+

You should always try to reproduce the problem with the latest +versions of libxml2 and libxslt - and make sure they are used. +lxml.etree can tell you what it runs with:

+
from lxml import etree
+print "lxml.etree:       ", etree.LXML_VERSION
+print "libxml used:      ", etree.LIBXML_VERSION
+print "libxml compiled:  ", etree.LIBXML_COMPILED_VERSION
+print "libxslt used:     ", etree.LIBXSLT_VERSION
+print "libxslt compiled: ", etree.LIBXSLT_COMPILED_VERSION
+
+

If you can figure that the problem is not in lxml but in the +underlying libxml2 or libxslt, you can ask right on the respective +mailing lists, which may considerably reduce the time to find a fix or +work-around. See the next question for some hints on how to do that.

+

Otherwise, we would really like to hear about it. Please report it to +the mailing list so that we can fix it. It is very helpful in this +case if you can come up with a short code snippet that demonstrates +your problem. If others can reproduce and see the problem, it is much +easier for them to fix it - and maybe even easier for you to describe +it and get people convinced that it really is a problem to fix.

+

It is important that you always report the version of lxml, libxml2 +and libxslt that you get from the code snippet above. If we do not +know the library versions you are using, we will ask back, so it will +take longer for you to get a helpful answer.

+

Since as a user of lxml you are likely a programmer, you might find +this article on bug reports an interesting read.

+
+
+

How do I know a bug is really in lxml and not in libxml2?

+

A large part of lxml's functionality is implemented by libxml2 and +libxslt, so problems that you encounter may be in one or the other. +Knowing the right place to ask will reduce the time it takes to fix +the problem, or to find a work-around.

+

Both libxml2 and libxslt come with their own command line frontends, +namely xmllint and xsltproc. If you encounter problems with +XSLT processing for specific stylesheets or with validation for +specific schemas, try to run the XSLT with xsltproc or the +validation with xmllint respectively to find out if it fails there +as well. If it does, please report directly to the mailing lists of +the respective project, namely:

+ +

On the other hand, everything that seems to be related to Python code, +including custom resolvers, custom XPath functions, etc. is likely +outside of the scope of libxml2/libxslt. If you encounter problems +here or you are not sure where there the problem may come from, please +ask on the lxml mailing list first.

+

In any case, a good explanation of the problem including some simple +test code and some input data will help us (or the libxml2 developers) +see and understand the problem, which largely increases your chance of +getting help. See the question above for a few hints on what is +helpful here.

+
+
+
+

Threading

+
+

Can I use threads to concurrently access the lxml API?

+

Short answer: yes, if you use lxml 2.2 and later.

+

Since version 1.1, lxml frees the GIL (Python's global interpreter +lock) internally when parsing from disk and memory, as long as you use +either the default parser (which is replicated for each thread) or +create a parser for each thread yourself. lxml also allows +concurrency during validation (RelaxNG and XMLSchema) and XSL +transformation. You can share RelaxNG, XMLSchema and XSLT objects +between threads.

+

While you can also share parsers between threads, this will serialize +the access to each of them, so it is better to .copy() parsers or +to just use the default parser if you do not need any special +configuration. The same applies to the XPath evaluators, which use an +internal lock to protect their prepared evaluation contexts. It is +therefore best to use separate evaluator instances in threads.

+

Warning: Before lxml 2.2, and especially before 2.1, there were +various issues when moving subtrees between different threads, or when +applying XSLT objects from one thread to trees parsed or modified in +another. If you need code to run with older versions, you should +generally avoid modifying trees in other threads than the one it was +generated in. Although this should work in many cases, there are +certain scenarios where the termination of a thread that parsed a tree +can crash the application if subtrees of this tree were moved to other +documents. You should be on the safe side when passing trees between +threads if you either

+
    +
  • do not modify these trees and do not move their elements to other +trees, or
  • +
  • do not terminate threads while the trees they parsed are still in +use (e.g. by using a fixed size thread-pool or long-running threads +in processing chains)
  • +
+

Since lxml 2.2, even multi-thread pipelines are supported. However, +note that it is more efficient to do all tree work inside one thread, +than to let multiple threads work on a tree one after the other. This +is because trees inherit state from the thread that created them, +which must be maintained when the tree is modified inside another +thread.

+
+
+

Does my program run faster if I use threads?

+

Depends. The best way to answer this is timing and profiling.

+

The global interpreter lock (GIL) in Python serializes access to the +interpreter, so if the majority of your processing is done in Python +code (walking trees, modifying elements, etc.), your gain will be +close to zero. The more of your XML processing moves into lxml, +however, the higher your gain. If your application is bound by XML +parsing and serialisation, or by very selective XPath expressions and +complex XSLTs, your speedup on multi-processor machines can be +substantial.

+

See the question above to learn which operations free the GIL to support +multi-threading.

+
+
+

Would my single-threaded program run faster if I turned off threading?

+

Possibly, yes. You can see for yourself by compiling lxml entirely +without threading support. Pass the --without-threading option to +setup.py when building lxml from source. You can also build libxml2 +without pthread support (--without-pthreads option), which may add +another bit of performance. Note that this will leave internal data +structures entirely without thread protection, so make sure you really +do not use lxml outside of the main application thread in this case.

+
+
+

Why can't I reuse XSLT stylesheets in other threads?

+

Since later lxml 2.0 versions, you can do this. There is some +overhead involved as the result document needs an additional cleanup +traversal when the input document and/or the stylesheet were created +in other threads. However, on a multi-processor machine, the gain of +freeing the GIL easily covers this drawback.

+

If you need even the last bit of performance, consider keeping (a copy +of) the stylesheet in thread-local storage, and try creating the input +document(s) in the same thread. And do not forget to benchmark your +code to see if the increased code complexity is really worth it.

+
+
+

My program crashes when run with mod_python/Pyro/Zope/Plone/...

+

These environments can use threads in a way that may not make it obvious when +threads are created and what happens in which thread. This makes it hard to +ensure lxml's threading support is used in a reliable way. Sadly, if problems +arise, they are as diverse as the applications, so it is difficult to provide +any generally applicable solution. Also, these environments are so complex +that problems become hard to debug and even harder to reproduce in a +predictable way. If you encounter crashes in one of these systems, but your +code runs perfectly when started by hand, the following gives you a few hints +for possible approaches to solve your specific problem:

+
    +
  • make sure you use recent versions of libxml2, libxslt and lxml. The +libxml2 developers keep fixing bugs in each release, and lxml also +tries to become more robust against possible pitfalls. So newer +versions might already fix your problem in a reliable way. Version +2.2 of lxml contains many improvements.

    +
  • +
  • make sure the library versions you installed are really used. Do +not rely on what your operating system tells you! Print the version +constants in lxml.etree from within your runtime environment to +make sure it is the case. This is especially a problem under +MacOS-X when newer library versions were installed in addition to +the outdated system libraries. Please read the bugs section +regarding MacOS-X in this FAQ.

    +
  • +
  • if you use mod_python, try setting this option:

    +
    +

    PythonInterpreter main_interpreter

    +
    +

    There was a discussion on the mailing list about this problem:

    +
    +

    http://comments.gmane.org/gmane.comp.python.lxml.devel/2942

    +
    +
  • +
  • compile lxml without threading support by running setup.py with the +--without-threading option. While this might be slower in certain +scenarios on multi-processor systems, it might also keep your application +from crashing, which should be worth more to you than peek performance. +Remember that lxml is fast anyway, so concurrency may not even be worth it.

    +
  • +
  • look out for fancy XSLT stuff like foreign document access or +passing in subtrees trough XSLT variables. This might or might not +work, depending on your specific usage. Again, later versions of +lxml and libxslt provide safer support here.

    +
  • +
  • try copying trees at suspicious places in your code and working with +those instead of a tree shared between threads. Note that the +copying must happen inside the target thread to be effective, not in +the thread that created the tree. Serialising in one thread and +parsing in another is also a simple (and fast) way of separating +thread contexts.

    +
  • +
  • try keeping thread-local copies of XSLT stylesheets, i.e. one per thread, +instead of sharing one. Also see the question above.

    +
  • +
  • you can try to serialise suspicious parts of your code with explicit thread +locks, thus disabling the concurrency of the runtime system.

    +
  • +
  • report back on the mailing list to see if there are other ways to work +around your specific problems. Do not forget to report the version numbers +of lxml, libxml2 and libxslt you are using (see the question on reporting +a bug).

    +
  • +
+

Note that most of these options will degrade performance and/or your +code quality. If you are unsure what to do, please ask on the mailing +list.

+
+
+
+

Parsing and Serialisation

+
+

Why doesn't the pretty_print option reformat my XML output?

+

Pretty printing (or formatting) an XML document means adding white space to +the content. These modifications are harmless if they only impact elements in +the document that do not carry (text) data. They corrupt your data if they +impact elements that contain data. If lxml cannot distinguish between +whitespace and data, it will not alter your data. Whitespace is therefore +only added between nodes that do not contain data. This is always the case +for trees constructed element-by-element, so no problems should be expected +here. For parsed trees, a good way to assure that no conflicting whitespace +is left in the tree is the remove_blank_text option:

+
>>> parser = etree.XMLParser(remove_blank_text=True)
+>>> tree = etree.parse(filename, parser)
+
+

This will allow the parser to drop blank text nodes when constructing the +tree. If you now call a serialization function to pretty print this tree, +lxml can add fresh whitespace to the XML tree to indent it.

+

Fredrik Lundh also has a Python-level function for indenting XML by +appending whitespace to tags. It can be found on his element +library recipe page.

+
+
+

Why can't lxml parse my XML from unicode strings?

+

lxml can read Python unicode strings and even tries to support them if libxml2 +does not. However, if the unicode string declares an XML encoding internally +(<?xml encoding="..."?>), parsing is bound to fail, as this encoding is +most likely not the real encoding used in Python unicode. The same is true +for HTML unicode strings that contain charset meta tags, although the problems +may be more subtle here. The libxml2 HTML parser may not be able to parse the +meta tags in broken HTML and may end up ignoring them, so even if parsing +succeeds, later handling may still fail with character encoding errors.

+

Note that Python uses different encodings for unicode on different platforms, +so even specifying the real internal unicode encoding is not portable between +Python interpreters. Don't do it.

+

Python unicode strings with XML data or HTML data that carry encoding +information are broken. lxml will not parse them. You must provide parsable +data in a valid encoding.

+
+
+

What is the difference between str(xslt(doc)) and xslt(doc).write() ?

+

The str() implementation of the XSLTResultTree class (a subclass of the +ElementTree class) knows about the output method chosen in the stylesheet +(xsl:output), write() doesn't. If you call write(), the result will be a +normal XML tree serialization in the requested encoding. Calling this method +may also fail for XSLT results that are not XML trees (e.g. string results).

+

If you call str(), it will return the serialized result as specified by the +XSL transform. This correctly serializes string results to encoded Python +strings and honours xsl:output options like indent. This almost +certainly does what you want, so you should only use write() if you are +sure that the XSLT result is an XML tree and you want to override the encoding +and indentation options requested by the stylesheet.

+
+
+

Why can't I just delete parents or clear the root node in iterparse()?

+

The iterparse() implementation is based on the libxml2 parser. It +requires the tree to be intact to finish parsing. If you delete or modify +parents of the current node, chances are you modify the structure in a way +that breaks the parser. Normally, this will result in a segfault. Please +refer to the iterparse section of the lxml API documentation to find out +what you can do and what you can't do.

+
+
+

How do I output null characters in XML text?

+

Don't. What you would produce is not well-formed XML. XML parsers +will refuse to parse a document that contains null characters. The +right way to embed binary data in XML is using a text encoding such as +uuencode or base64.

+
+
+
+

XPath and Document Traversal

+
+

What are the findall() and xpath() methods on Element(Tree)?

+

findall() is part of the original ElementTree API. It supports a +simple subset of the XPath language, without predicates, conditions and +other advanced features. It is very handy for finding specific tags in a +tree. Another important difference is namespace handling, which uses the +{namespace}tagname notation. This is not supported by XPath. The +findall, find and findtext methods are compatible with other ElementTree +implementations and allow writing portable code that runs on ElementTree, +cElementTree and lxml.etree.

+

xpath(), on the other hand, supports the complete power of the XPath +language, including predicates, XPath functions and Python extension +functions. The syntax is defined by the XPath specification. If you need +the expressiveness and selectivity of XPath, the xpath() method, the +XPath class and the XPathEvaluator are the best choice.

+
+
+

Why doesn't findall() support full XPath expressions?

+

It was decided that it is more important to keep compatibility with +ElementTree to simplify code migration between the libraries. The main +difference compared to XPath is the {namespace}tagname notation used in +findall(), which is not valid XPath.

+

ElementTree and lxml.etree use the same implementation, which assures 100% +compatibility. Note that findall() is so fast in lxml that a native +implementation would not bring any performance benefits.

+
+
+

How can I find out which namespace prefixes are used in a document?

+

You can traverse the document (root.iter()) and collect the prefix +attributes from all Elements into a set. However, it is unlikely that you +really want to do that. You do not need these prefixes, honestly. You only +need the namespace URIs. All namespace comparisons use these, so feel free to +make up your own prefixes when you use XPath expressions or extension +functions.

+

The only place where you might consider specifying prefixes is the +serialization of Elements that were created through the API. Here, you can +specify a prefix mapping through the nsmap argument when creating the root +Element. Its children will then inherit this prefix for serialization.

+
+
+

How can I specify a default namespace for XPath expressions?

+

You can't. In XPath, there is no such thing as a default namespace. Just use +an arbitrary prefix and let the namespace dictionary of the XPath evaluators +map it to your namespace. See also the question above.

+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/api.html b/doc/html/api.html new file mode 100644 index 0000000..d4889fe --- /dev/null +++ b/doc/html/api.html @@ -0,0 +1,384 @@ + + + + + +APIs specific to lxml.etree + + + +
+

APIs specific to lxml.etree

+ +

lxml.etree tries to follow established APIs wherever possible. Sometimes, +however, the need to expose a feature in an easy way led to the invention of a +new API. This page describes the major differences and a few additions to the +main ElementTree API.

+

For a complete reference of the API, see the generated API +documentation.

+

Separate pages describe the support for parsing XML, executing XPath and +XSLT, validating XML and interfacing with other XML tools through the +SAX-API.

+

lxml is extremely extensible through XPath functions in Python, custom +Python element classes, custom URL resolvers and even at the C-level.

+ +
+

lxml.etree

+

lxml.etree tries to follow the ElementTree API wherever it can. There are +however some incompatibilities (see compatibility). The extensions are +documented here.

+

If you need to know which version of lxml is installed, you can access the +lxml.etree.LXML_VERSION attribute to retrieve a version tuple. Note, +however, that it did not exist before version 1.0, so you will get an +AttributeError in older versions. The versions of libxml2 and libxslt are +available through the attributes LIBXML_VERSION and LIBXSLT_VERSION.

+

The following examples usually assume this to be executed first:

+
>>> from lxml import etree
+
+
+
+

Other Element APIs

+

While lxml.etree itself uses the ElementTree API, it is possible to replace +the Element implementation by custom element subclasses. This has been +used to implement well-known XML APIs on top of lxml. For example, lxml ships +with a data-binding implementation called objectify, which is similar to +the Amara bindery tool.

+

lxml.etree comes with a number of different lookup schemes to customize the +mapping between libxml2 nodes and the Element classes used by lxml.etree.

+
+
+

Trees and Documents

+

Compared to the original ElementTree API, lxml.etree has an extended tree +model. It knows about parents and siblings of elements:

+
>>> root = etree.Element("root")
+>>> a = etree.SubElement(root, "a")
+>>> b = etree.SubElement(root, "b")
+>>> c = etree.SubElement(root, "c")
+>>> d = etree.SubElement(root, "d")
+>>> e = etree.SubElement(d,    "e")
+>>> b.getparent() == root
+True
+>>> print(b.getnext().tag)
+c
+>>> print(c.getprevious().tag)
+b
+
+

Elements always live within a document context in lxml. This implies that +there is also a notion of an absolute document root. You can retrieve an +ElementTree for the root node of a document from any of its elements.

+
>>> tree = d.getroottree()
+>>> print(tree.getroot().tag)
+root
+
+

Note that this is different from wrapping an Element in an ElementTree. You +can use ElementTrees to create XML trees with an explicit root node:

+
>>> tree = etree.ElementTree(d)
+>>> print(tree.getroot().tag)
+d
+>>> etree.tostring(tree)
+b'<d><e/></d>'
+
+

ElementTree objects are serialised as complete documents, including +preceding or trailing processing instructions and comments.

+

All operations that you run on such an ElementTree (like XPath, XSLT, etc.) +will understand the explicitly chosen root as root node of a document. They +will not see any elements outside the ElementTree. However, ElementTrees do +not modify their Elements:

+
>>> element = tree.getroot()
+>>> print(element.tag)
+d
+>>> print(element.getparent().tag)
+root
+>>> print(element.getroottree().getroot().tag)
+root
+
+

The rule is that all operations that are applied to Elements use either the +Element itself as reference point, or the absolute root of the document that +contains this Element (e.g. for absolute XPath expressions). All operations +on an ElementTree use its explicit root node as reference.

+
+
+

Iteration

+

The ElementTree API makes Elements iterable to supports iteration over their +children. Using the tree defined above, we get:

+
>>> [ child.tag for child in root ]
+['a', 'b', 'c', 'd']
+
+

To iterate in the opposite direction, use the reversed() function +that exists in Python 2.4 and later.

+

Tree traversal should use the element.iter() method:

+
>>> [ el.tag for el in root.iter() ]
+['root', 'a', 'b', 'c', 'd', 'e']
+
+

lxml.etree also supports this, but additionally features an extended API for +iteration over the children, following/preceding siblings, ancestors and +descendants of an element, as defined by the respective XPath axis:

+
>>> [ child.tag for child in root.iterchildren() ]
+['a', 'b', 'c', 'd']
+>>> [ child.tag for child in root.iterchildren(reversed=True) ]
+['d', 'c', 'b', 'a']
+>>> [ sibling.tag for sibling in b.itersiblings() ]
+['c', 'd']
+>>> [ sibling.tag for sibling in c.itersiblings(preceding=True) ]
+['b', 'a']
+>>> [ ancestor.tag for ancestor in e.iterancestors() ]
+['d', 'root']
+>>> [ el.tag for el in root.iterdescendants() ]
+['a', 'b', 'c', 'd', 'e']
+
+

Note how element.iterdescendants() does not include the element +itself, as opposed to element.iter(). The latter effectively +implements the 'descendant-or-self' axis in XPath.

+

All of these iterators support an additional tag keyword argument that +filters the generated elements by tag name:

+
>>> [ child.tag for child in root.iterchildren(tag='a') ]
+['a']
+>>> [ child.tag for child in d.iterchildren(tag='a') ]
+[]
+>>> [ el.tag for el in root.iterdescendants(tag='d') ]
+['d']
+>>> [ el.tag for el in root.iter(tag='d') ]
+['d']
+
+

The most common way to traverse an XML tree is depth-first, which +traverses the tree in document order. This is implemented by the +.iter() method. While there is no dedicated method for +breadth-first traversal, it is almost as simple if you use the +collections.deque type from Python 2.4.

+
>>> root = etree.XML('<root><a><b/><c/></a><d><e/></d></root>')
+>>> print(etree.tostring(root, pretty_print=True, encoding=unicode))
+<root>
+  <a>
+    <b/>
+    <c/>
+  </a>
+  <d>
+    <e/>
+  </d>
+</root>
+
+>>> queue = deque([root])
+>>> while queue:
+...    el = queue.popleft()  # pop next element
+...    queue.extend(el)      # append its children
+...    print(el.tag)
+root
+a
+d
+b
+c
+e
+
+

See also the section on the utility functions iterparse() and +iterwalk() in the parser documentation.

+
+
+

Error handling on exceptions

+

Libxml2 provides error messages for failures, be it during parsing, XPath +evaluation or schema validation. The preferred way of accessing them is +through the local error_log property of the respective evaluator or +transformer object. See their documentation for details.

+

However, lxml also keeps a global error log of all errors that occurred at the +application level. Whenever an exception is raised, you can retrieve the +errors that occured and "might have" lead to the problem from the error log +copy attached to the exception:

+
>>> etree.clear_error_log()
+>>> broken_xml = '''
+... <root>
+...   <a>
+... </root>
+... '''
+>>> try:
+...   etree.parse(StringIO(broken_xml))
+... except etree.XMLSyntaxError, e:
+...   pass # just put the exception into e
+
+

Once you have caught this exception, you can access its error_log property +to retrieve the log entries or filter them by a specific type, error domain or +error level:

+
>>> log = e.error_log.filter_from_level(etree.ErrorLevels.FATAL)
+>>> print(log)
+<string>:4:8:FATAL:PARSER:ERR_TAG_NAME_MISMATCH: Opening and ending tag mismatch: a line 3 and root
+<string>:5:1:FATAL:PARSER:ERR_TAG_NOT_FINISHED: Premature end of data in tag root line 2
+
+

This might look a little cryptic at first, but it is the information that +libxml2 gives you. At least the message at the end should give you a hint +what went wrong and you can see that the fatal errors (FATAL) happened during +parsing (PARSER) lines 4, column 8 and line 5, column 1 of a string (<string>, +or the filename if available). Here, PARSER is the so-called error domain, +see lxml.etree.ErrorDomains for that. You can get it from a log entry +like this:

+
>>> entry = log[0]
+>>> print(entry.domain_name)
+PARSER
+>>> print(entry.type_name)
+ERR_TAG_NAME_MISMATCH
+>>> print(entry.filename)
+<string>
+
+

There is also a convenience attribute last_error that returns the last +error or fatal error that occurred:

+
>>> entry = e.error_log.last_error
+>>> print(entry.domain_name)
+PARSER
+>>> print(entry.type_name)
+ERR_TAG_NOT_FINISHED
+>>> print(entry.filename)
+<string>
+
+
+
+

Error logging

+

lxml.etree supports logging libxml2 messages to the Python stdlib logging +module. This is done through the etree.PyErrorLog class. It disables the +error reporting from exceptions and forwards log messages to a Python logger. +To use it, see the descriptions of the function etree.useGlobalPythonLog +and the class etree.PyErrorLog for help. Note that this does not affect +the local error logs of XSLT, XMLSchema, etc.

+
+
+

Serialisation

+

lxml.etree has direct support for pretty printing XML output. Functions like +ElementTree.write() and tostring() support it through a keyword +argument:

+
>>> root = etree.XML("<root><test/></root>")
+>>> etree.tostring(root)
+b'<root><test/></root>'
+
+>>> print(etree.tostring(root, pretty_print=True))
+<root>
+  <test/>
+</root>
+
+

Note the newline that is appended at the end when pretty printing the +output. It was added in lxml 2.0.

+

By default, lxml (just as ElementTree) outputs the XML declaration only if it +is required by the standard:

+
>>> unicode_root = etree.Element( u"t\u3120st" )
+>>> unicode_root.text = u"t\u0A0Ast"
+>>> etree.tostring(unicode_root, encoding="utf-8")
+b'<t\xe3\x84\xa0st>t\xe0\xa8\x8ast</t\xe3\x84\xa0st>'
+
+>>> print(etree.tostring(unicode_root, encoding="iso-8859-1"))
+<?xml version='1.0' encoding='iso-8859-1'?>
+<t&#12576;st>t&#2570;st</t&#12576;st>
+
+

Also see the general remarks on Unicode support.

+

You can enable or disable the declaration explicitly by passing another +keyword argument for the serialisation:

+
>>> print(etree.tostring(root, xml_declaration=True))
+<?xml version='1.0' encoding='ASCII'?>
+<root><test/></root>
+
+>>> unicode_root.clear()
+>>> etree.tostring(unicode_root, encoding="UTF-16LE",
+...                              xml_declaration=False)
+b'<\x00t\x00 1s\x00t\x00/\x00>\x00'
+
+

Note that a standard compliant XML parser will not consider the last line +well-formed XML if the encoding is not explicitly provided somehow, e.g. in an +underlying transport protocol:

+
>>> notxml = etree.tostring(unicode_root, encoding="UTF-16LE",
+...                                       xml_declaration=False)
+>>> root = etree.XML(notxml)        #doctest: +ELLIPSIS
+Traceback (most recent call last):
+  ...
+lxml.etree.XMLSyntaxError: ...
+
+
+
+

CDATA

+

By default, lxml's parser will strip CDATA sections from the tree and +replace them by their plain text content. As real applications for +CDATA are rare, this is the best way to deal with this issue.

+

However, in some cases, keeping CDATA sections or creating them in a +document is required to adhere to existing XML language definitions. +For these special cases, you can instruct the parser to leave CDATA +sections in the document:

+
>>> parser = etree.XMLParser(strip_cdata=False)
+>>> root = etree.XML('<root><![CDATA[test]]></root>', parser)
+>>> root.text
+'test'
+
+>>> etree.tostring(root)
+b'<root><![CDATA[test]]></root>'
+
+

Note how the .text property does not give any indication that the +text content is wrapped by a CDATA section. If you want to make sure +your data is wrapped by a CDATA block, you can use the CDATA() +text wrapper:

+
>>> root.text = 'test'
+
+>>> root.text
+'test'
+>>> etree.tostring(root)
+b'<root>test</root>'
+
+>>> root.text = etree.CDATA(root.text)
+
+>>> root.text
+'test'
+>>> etree.tostring(root)
+b'<root><![CDATA[test]]></root>'
+
+
+
+

XInclude and ElementInclude

+

You can let lxml process xinclude statements in a document by calling the +xinclude() method on a tree:

+
>>> data = StringIO('''\
+... <doc xmlns:xi="http://www.w3.org/2001/XInclude">
+... <foo/>
+... <xi:include href="doc/test.xml" />
+... </doc>''')
+
+>>> tree = etree.parse(data)
+>>> tree.xinclude()
+>>> print(etree.tostring(tree.getroot()))
+<doc xmlns:xi="http://www.w3.org/2001/XInclude">
+<foo/>
+<a xml:base="doc/test.xml"/>
+</doc>
+
+

Note that the ElementTree compatible ElementInclude module is also supported +as lxml.ElementInclude. It has the additional advantage of supporting +custom URL resolvers at the Python level. The normal XInclude mechanism +cannot deploy these. If you need ElementTree compatibility or custom +resolvers, you have to stick to the external Python module.

+
+
+

write_c14n on ElementTree

+

The lxml.etree.ElementTree class has a method write_c14n, which takes a file +object as argument. This file object will receive an UTF-8 representation of +the canonicalized form of the XML, following the W3C C14N recommendation. For +example:

+
>>> f = StringIO('<a><b/></a>')
+>>> tree = etree.parse(f)
+>>> f2 = StringIO()
+>>> tree.write_c14n(f2)
+>>> print(f2.getvalue().decode("utf-8"))
+<a><b></b></a>
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/api/api-objects.txt b/doc/html/api/api-objects.txt new file mode 100644 index 0000000..b7c0ee9 --- /dev/null +++ b/doc/html/api/api-objects.txt @@ -0,0 +1,7065 @@ +elementtree.ElementTree elementtree.ElementTree-module.html +elementtree.ElementTree.XMLID elementtree.ElementTree-module.html#XMLID +elementtree.ElementTree.register_namespace elementtree.ElementTree-module.html#register_namespace +elementtree.ElementTree.dump elementtree.ElementTree-module.html#dump +elementtree.ElementTree._raise_serialization_error elementtree.ElementTree-module.html#_raise_serialization_error +elementtree.ElementTree.HTML_EMPTY elementtree.ElementTree-module.html#HTML_EMPTY +elementtree.ElementTree._serialize_text elementtree.ElementTree-module.html#_serialize_text +elementtree.ElementTree.parse elementtree.ElementTree-module.html#parse +elementtree.ElementTree._encode elementtree.ElementTree-module.html#_encode +elementtree.ElementTree._namespace_map elementtree.ElementTree-module.html#_namespace_map +elementtree.ElementTree.fromstringlist elementtree.ElementTree-module.html#fromstringlist +elementtree.ElementTree._serialize_xml elementtree.ElementTree-module.html#_serialize_xml +elementtree.ElementTree.PI elementtree.ElementTree-module.html#PI +elementtree.ElementTree.XML elementtree.ElementTree-module.html#XML +elementtree.ElementTree._namespaces elementtree.ElementTree-module.html#_namespaces +elementtree.ElementTree._escape_cdata elementtree.ElementTree-module.html#_escape_cdata +elementtree.ElementTree._serialize_html elementtree.ElementTree-module.html#_serialize_html +elementtree.ElementTree._escape_attrib_html elementtree.ElementTree-module.html#_escape_attrib_html +elementtree.ElementTree._escape_attrib elementtree.ElementTree-module.html#_escape_attrib +elementtree.ElementTree.VERSION elementtree.ElementTree-module.html#VERSION +elementtree.ElementTree.tostring elementtree.ElementTree-module.html#tostring +elementtree.ElementTree.iselement elementtree.ElementTree-module.html#iselement +elementtree.ElementTree.Comment elementtree.ElementTree-module.html#Comment +elementtree.ElementTree.ProcessingInstruction elementtree.ElementTree-module.html#ProcessingInstruction +elementtree.ElementTree.tostringlist elementtree.ElementTree-module.html#tostringlist +elementtree.ElementTree.fromstring elementtree.ElementTree-module.html#fromstring +elementtree.ElementTree.iterparse elementtree.ElementTree-module.html#iterparse +elementtree.ElementTree.SubElement elementtree.ElementTree-module.html#SubElement +lxml lxml-module.html +lxml.ElementInclude lxml.ElementInclude-module.html +lxml.ElementInclude.include lxml.ElementInclude-module.html#include +lxml.ElementInclude.XINCLUDE_INCLUDE lxml.ElementInclude-module.html#XINCLUDE_INCLUDE +lxml.ElementInclude.XINCLUDE_FALLBACK lxml.ElementInclude-module.html#XINCLUDE_FALLBACK +lxml.ElementInclude._include lxml.ElementInclude-module.html#_include +lxml.ElementInclude._lxml_default_loader lxml.ElementInclude-module.html#_lxml_default_loader +lxml.ElementInclude.XINCLUDE lxml.ElementInclude-module.html#XINCLUDE +lxml.ElementInclude._wrap_et_loader lxml.ElementInclude-module.html#_wrap_et_loader +lxml.ElementInclude.default_loader lxml.ElementInclude-module.html#default_loader +lxml.builder lxml.builder-module.html +lxml.builder.E lxml.builder-module.html#E +lxml.builder.callable lxml.builder-module.html#callable +lxml.cssselect lxml.cssselect-module.html +lxml.cssselect._el_re lxml.cssselect-module.html#_el_re +lxml.cssselect.parse_attrib lxml.cssselect-module.html#parse_attrib +lxml.cssselect.parse_selector_group lxml.cssselect-module.html#parse_selector_group +lxml.cssselect.css_to_xpath lxml.cssselect-module.html#css_to_xpath +lxml.cssselect._whitespace_re lxml.cssselect-module.html#_whitespace_re +lxml.cssselect.parse_series lxml.cssselect-module.html#parse_series +lxml.cssselect._comment_re lxml.cssselect-module.html#_comment_re +lxml.cssselect.xpath_literal lxml.cssselect-module.html#xpath_literal +lxml.cssselect.tokenize lxml.cssselect-module.html#tokenize +lxml.cssselect._illegal_symbol lxml.cssselect-module.html#_illegal_symbol +lxml.cssselect.parse lxml.cssselect-module.html#parse +lxml.cssselect.ns lxml.cssselect-module.html#ns +lxml.cssselect._id_re lxml.cssselect-module.html#_id_re +lxml.cssselect.parse_simple_selector lxml.cssselect-module.html#parse_simple_selector +lxml.cssselect.is_int lxml.cssselect-module.html#is_int +lxml.cssselect.split_at_string_escapes lxml.cssselect-module.html#split_at_string_escapes +lxml.cssselect.unescape_string_literal lxml.cssselect-module.html#unescape_string_literal +lxml.cssselect.tokenize_escaped_string lxml.cssselect-module.html#tokenize_escaped_string +lxml.cssselect._count_re lxml.cssselect-module.html#_count_re +lxml.cssselect._make_lower_case lxml.cssselect-module.html#_make_lower_case +lxml.cssselect._class_re lxml.cssselect-module.html#_class_re +lxml.cssselect.split_at_single_quotes lxml.cssselect-module.html#split_at_single_quotes +lxml.cssselect.tokenize_symbol lxml.cssselect-module.html#tokenize_symbol +lxml.cssselect.parse_selector lxml.cssselect-module.html#parse_selector +lxml.doctestcompare lxml.doctestcompare-module.html +lxml.doctestcompare._norm_whitespace_re lxml.doctestcompare-module.html#_norm_whitespace_re +lxml.doctestcompare.norm_whitespace lxml.doctestcompare-module.html#norm_whitespace +lxml.doctestcompare.PARSE_XML lxml.doctestcompare-module.html#PARSE_XML +lxml.doctestcompare._IS_PYTHON_3 lxml.doctestcompare-module.html#_IS_PYTHON_3 +lxml.doctestcompare._find_doctest_frame lxml.doctestcompare-module.html#_find_doctest_frame +lxml.doctestcompare.strip lxml.doctestcompare-module.html#strip +lxml.doctestcompare._repr_re lxml.doctestcompare-module.html#_repr_re +lxml.doctestcompare._html_parser lxml.doctestcompare-module.html#_html_parser +lxml.doctestcompare.NOPARSE_MARKUP lxml.doctestcompare-module.html#NOPARSE_MARKUP +lxml.doctestcompare.html_fromstring lxml.doctestcompare-module.html#html_fromstring +lxml.doctestcompare.temp_install lxml.doctestcompare-module.html#temp_install +lxml.doctestcompare.__test__ lxml.doctestcompare-module.html#__test__ +lxml.doctestcompare.install lxml.doctestcompare-module.html#install +lxml.doctestcompare.PARSE_HTML lxml.doctestcompare-module.html#PARSE_HTML +lxml.etree lxml.etree-module.html +lxml.etree.XPathEvaluator lxml.etree-module.html#XPathEvaluator +lxml.etree.XMLID lxml.etree-module.html#XMLID +lxml.etree.LIBXSLT_VERSION lxml.etree-module.html#LIBXSLT_VERSION +lxml.etree.XMLDTDID lxml.etree-module.html#XMLDTDID +lxml.etree.ElementTree lxml.etree-module.html#ElementTree +lxml.etree.cleanup_namespaces lxml.etree-module.html#cleanup_namespaces +lxml.etree.set_default_parser lxml.etree-module.html#set_default_parser +lxml.etree.parseid lxml.etree-module.html#parseid +lxml.etree.tostring lxml.etree-module.html#tostring +lxml.etree.iselement lxml.etree-module.html#iselement +lxml.etree.FunctionNamespace lxml.etree-module.html#FunctionNamespace +lxml.etree.strip_attributes lxml.etree-module.html#strip_attributes +lxml.etree.Entity lxml.etree-module.html#Entity +lxml.etree.strip_elements lxml.etree-module.html#strip_elements +lxml.etree.HTML lxml.etree-module.html#HTML +lxml.etree.PI lxml.etree-module.html#PI +lxml.etree.Extension lxml.etree-module.html#Extension +lxml.etree.DEBUG lxml.etree-module.html#DEBUG +lxml.etree.Comment lxml.etree-module.html#Comment +lxml.etree.ProcessingInstruction lxml.etree-module.html#ProcessingInstruction +lxml.etree.LXML_VERSION lxml.etree-module.html#LXML_VERSION +lxml.etree.LIBXML_COMPILED_VERSION lxml.etree-module.html#LIBXML_COMPILED_VERSION +lxml.etree.strip_tags lxml.etree-module.html#strip_tags +lxml.etree.tounicode lxml.etree-module.html#tounicode +lxml.etree.LIBXSLT_COMPILED_VERSION lxml.etree-module.html#LIBXSLT_COMPILED_VERSION +lxml.etree.dump lxml.etree-module.html#dump +lxml.etree.__pyx_capi__ lxml.etree-module.html#__pyx_capi__ +lxml.etree.XML lxml.etree-module.html#XML +lxml.etree.use_global_python_log lxml.etree-module.html#use_global_python_log +lxml.etree.LIBXML_VERSION lxml.etree-module.html#LIBXML_VERSION +lxml.etree.tostringlist lxml.etree-module.html#tostringlist +lxml.etree.SubElement lxml.etree-module.html#SubElement +lxml.etree.get_default_parser lxml.etree-module.html#get_default_parser +lxml.etree.parse lxml.etree-module.html#parse +lxml.etree.set_element_class_lookup lxml.etree-module.html#set_element_class_lookup +lxml.etree.clear_error_log lxml.etree-module.html#clear_error_log +lxml.etree.fromstringlist lxml.etree-module.html#fromstringlist +lxml.etree.Element lxml.etree-module.html#Element +lxml.etree.fromstring lxml.etree-module.html#fromstring +lxml.html lxml.html-module.html +lxml.html._css_import_re lxml.html-module.html#_css_import_re +lxml.html._css_url_re lxml.html-module.html#_css_url_re +lxml.html.parse lxml.html-module.html#parse +lxml.html._nons lxml.html-module.html#_nons +lxml.html._forms_xpath lxml.html-module.html#_forms_xpath +lxml.html._contains_block_level_tag lxml.html-module.html#_contains_block_level_tag +lxml.html._element_name lxml.html-module.html#_element_name +lxml.html._archive_re lxml.html-module.html#_archive_re +lxml.html.iterlinks lxml.html-module.html#iterlinks +lxml.html.open_http_urllib lxml.html-module.html#open_http_urllib +lxml.html._collect_string_content lxml.html-module.html#_collect_string_content +lxml.html.submit_form lxml.html-module.html#submit_form +lxml.html.xhtml_parser lxml.html-module.html#xhtml_parser +lxml.html.XHTML_NAMESPACE lxml.html-module.html#XHTML_NAMESPACE +lxml.html._id_xpath lxml.html-module.html#_id_xpath +lxml.html.make_links_absolute lxml.html-module.html#make_links_absolute +lxml.html.resolve_base_href lxml.html-module.html#resolve_base_href +lxml.html.__bytes_replace_meta_content_type lxml.html-module.html#__bytes_replace_meta_content_type +lxml.html.rewrite_links lxml.html-module.html#rewrite_links +lxml.html.fragment_fromstring lxml.html-module.html#fragment_fromstring +lxml.html.html_to_xhtml lxml.html-module.html#html_to_xhtml +lxml.html._unquote_match lxml.html-module.html#_unquote_match +lxml.html.fragments_fromstring lxml.html-module.html#fragments_fromstring +lxml.html.__str_replace_meta_content_type lxml.html-module.html#__str_replace_meta_content_type +lxml.html._options_xpath lxml.html-module.html#_options_xpath +lxml.html.document_fromstring lxml.html-module.html#document_fromstring +lxml.html.Element lxml.html-module.html#Element +lxml.html.__fix_docstring lxml.html-module.html#__fix_docstring +lxml.html._class_xpath lxml.html-module.html#_class_xpath +lxml.html._rel_links_xpath lxml.html-module.html#_rel_links_xpath +lxml.html.tostring lxml.html-module.html#tostring +lxml.html.find_class lxml.html-module.html#find_class +lxml.html.find_rel_links lxml.html-module.html#find_rel_links +lxml.html.html_parser lxml.html-module.html#html_parser +lxml.html.open_in_browser lxml.html-module.html#open_in_browser +lxml.html.fromstring lxml.html-module.html#fromstring +lxml.html._label_xpath lxml.html-module.html#_label_xpath +lxml.html._transform_result lxml.html-module.html#_transform_result +lxml.html.xhtml_to_html lxml.html-module.html#xhtml_to_html +lxml.html.ElementSoup lxml.html.ElementSoup-module.html +lxml.html.ElementSoup.parse lxml.html.ElementSoup-module.html#parse +lxml.html.ElementSoup._parse lxml.html.soupparser-module.html#parse +lxml.html.ElementSoup.convert_tree lxml.html.ElementSoup-module.html#convert_tree +lxml.html.ElementSoup.__doc__ lxml.html.ElementSoup-module.html#__doc__ +lxml.html.builder lxml.html.builder-module.html +lxml.html.builder.BLOCKQUOTE lxml.html.builder-module.html#BLOCKQUOTE +lxml.html.builder.OBJECT lxml.html.builder-module.html#OBJECT +lxml.html.builder.LINK lxml.html.builder-module.html#LINK +lxml.html.builder.BR lxml.html.builder-module.html#BR +lxml.html.builder.OPTGROUP lxml.html.builder-module.html#OPTGROUP +lxml.html.builder.SUB lxml.html.builder-module.html#SUB +lxml.html.builder.PRE lxml.html.builder-module.html#PRE +lxml.html.builder.FRAME lxml.html.builder-module.html#FRAME +lxml.html.builder.BODY lxml.html.builder-module.html#BODY +lxml.html.builder.TH lxml.html.builder-module.html#TH +lxml.html.builder.P lxml.html.builder-module.html#P +lxml.html.builder.BASE lxml.html.builder-module.html#BASE +lxml.html.builder.TFOOT lxml.html.builder-module.html#TFOOT +lxml.html.builder.VAR lxml.html.builder-module.html#VAR +lxml.html.builder.MAP lxml.html.builder-module.html#MAP +lxml.html.builder.OL lxml.html.builder-module.html#OL +lxml.html.builder.TEXTAREA lxml.html.builder-module.html#TEXTAREA +lxml.html.builder.ACRONYM lxml.html.builder-module.html#ACRONYM +lxml.html.builder.MENU lxml.html.builder-module.html#MENU +lxml.html.builder.DT lxml.html.builder-module.html#DT +lxml.html.builder.ADDRESS lxml.html.builder-module.html#ADDRESS +lxml.html.builder.CODE lxml.html.builder-module.html#CODE +lxml.html.builder.HR lxml.html.builder-module.html#HR +lxml.html.builder.ISINDEX lxml.html.builder-module.html#ISINDEX +lxml.html.builder.HEAD lxml.html.builder-module.html#HEAD +lxml.html.builder.LABEL lxml.html.builder-module.html#LABEL +lxml.html.builder.META lxml.html.builder-module.html#META +lxml.html.builder.DEL lxml.html.builder-module.html#DEL +lxml.html.builder.FONT lxml.html.builder-module.html#FONT +lxml.html.builder.SELECT lxml.html.builder-module.html#SELECT +lxml.html.builder.NOFRAMES lxml.html.builder-module.html#NOFRAMES +lxml.html.builder.CENTER lxml.html.builder-module.html#CENTER +lxml.html.builder.KBD lxml.html.builder-module.html#KBD +lxml.html.builder.HTML lxml.html.builder-module.html#HTML +lxml.html.builder.EM lxml.html.builder-module.html#EM +lxml.html.builder.FRAMESET lxml.html.builder-module.html#FRAMESET +lxml.html.builder.FIELDSET lxml.html.builder-module.html#FIELDSET +lxml.html.builder.FOR lxml.html.builder-module.html#FOR +lxml.html.builder.BASEFONT lxml.html.builder-module.html#BASEFONT +lxml.html.builder.BDO lxml.html.builder-module.html#BDO +lxml.html.builder.PARAM lxml.html.builder-module.html#PARAM +lxml.html.builder.S lxml.html.builder-module.html#S +lxml.html.builder.INPUT lxml.html.builder-module.html#INPUT +lxml.html.builder.H2 lxml.html.builder-module.html#H2 +lxml.html.builder.H3 lxml.html.builder-module.html#H3 +lxml.html.builder.BUTTON lxml.html.builder-module.html#BUTTON +lxml.html.builder.SCRIPT lxml.html.builder-module.html#SCRIPT +lxml.html.builder.H6 lxml.html.builder-module.html#H6 +lxml.html.builder.H4 lxml.html.builder-module.html#H4 +lxml.html.builder.INS lxml.html.builder-module.html#INS +lxml.html.builder.UL lxml.html.builder-module.html#UL +lxml.html.builder.STRIKE lxml.html.builder-module.html#STRIKE +lxml.html.builder.OPTION lxml.html.builder-module.html#OPTION +lxml.html.builder.TITLE lxml.html.builder-module.html#TITLE +lxml.html.builder.SUP lxml.html.builder-module.html#SUP +lxml.html.builder.SMALL lxml.html.builder-module.html#SMALL +lxml.html.builder.STRONG lxml.html.builder-module.html#STRONG +lxml.html.builder.COL lxml.html.builder-module.html#COL +lxml.html.builder.AREA lxml.html.builder-module.html#AREA +lxml.html.builder.APPLET lxml.html.builder-module.html#APPLET +lxml.html.builder.TABLE lxml.html.builder-module.html#TABLE +lxml.html.builder.B lxml.html.builder-module.html#B +lxml.html.builder.IMG lxml.html.builder-module.html#IMG +lxml.html.builder.DFN lxml.html.builder-module.html#DFN +lxml.html.builder.SPAN lxml.html.builder-module.html#SPAN +lxml.html.builder.DL lxml.html.builder-module.html#DL +lxml.html.builder.H1 lxml.html.builder-module.html#H1 +lxml.html.builder.DD lxml.html.builder-module.html#DD +lxml.html.builder.TBODY lxml.html.builder-module.html#TBODY +lxml.html.builder.DIV lxml.html.builder-module.html#DIV +lxml.html.builder.H5 lxml.html.builder-module.html#H5 +lxml.html.builder.LEGEND lxml.html.builder-module.html#LEGEND +lxml.html.builder.DIR lxml.html.builder-module.html#DIR +lxml.html.builder.NOSCRIPT lxml.html.builder-module.html#NOSCRIPT +lxml.html.builder.COLGROUP lxml.html.builder-module.html#COLGROUP +lxml.html.builder.BIG lxml.html.builder-module.html#BIG +lxml.html.builder.TT lxml.html.builder-module.html#TT +lxml.html.builder.TR lxml.html.builder-module.html#TR +lxml.html.builder.LI lxml.html.builder-module.html#LI +lxml.html.builder.IFRAME lxml.html.builder-module.html#IFRAME +lxml.html.builder.TD lxml.html.builder-module.html#TD +lxml.html.builder.CLASS lxml.html.builder-module.html#CLASS +lxml.html.builder.A lxml.html.builder-module.html#A +lxml.html.builder.STYLE lxml.html.builder-module.html#STYLE +lxml.html.builder.E lxml.html.builder-module.html#E +lxml.html.builder.FORM lxml.html.builder-module.html#FORM +lxml.html.builder.I lxml.html.builder-module.html#I +lxml.html.builder.Q lxml.html.builder-module.html#Q +lxml.html.builder.CAPTION lxml.html.builder-module.html#CAPTION +lxml.html.builder.U lxml.html.builder-module.html#U +lxml.html.builder.ABBR lxml.html.builder-module.html#ABBR +lxml.html.builder.THEAD lxml.html.builder-module.html#THEAD +lxml.html.builder.SAMP lxml.html.builder-module.html#SAMP +lxml.html.builder.CITE lxml.html.builder-module.html#CITE +lxml.html.clean lxml.html.clean-module.html +lxml.html.clean._css_import_re lxml.html.clean-module.html#_css_import_re +lxml.html.clean.word_break_html lxml.html.clean-module.html#word_break_html +lxml.html.clean._link_regexes lxml.html.clean-module.html#_link_regexes +lxml.html.clean._substitute_whitespace lxml.html.clean-module.html#_substitute_whitespace +lxml.html.clean._nons lxml.html-module.html#_nons +lxml.html.clean._find_styled_elements lxml.html.clean-module.html#_find_styled_elements +lxml.html.clean._break_text lxml.html.clean-module.html#_break_text +lxml.html.clean._avoid_word_break_classes lxml.html.clean-module.html#_avoid_word_break_classes +lxml.html.clean._javascript_scheme_re lxml.html.clean-module.html#_javascript_scheme_re +lxml.html.clean._avoid_elements lxml.html.clean-module.html#_avoid_elements +lxml.html.clean._find_external_links lxml.html.clean-module.html#_find_external_links +lxml.html.clean._insert_break lxml.html.clean-module.html#_insert_break +lxml.html.clean._transform_result lxml.html-module.html#_transform_result +lxml.html.clean.autolink lxml.html.clean-module.html#autolink +lxml.html.clean._conditional_comment_re lxml.html.clean-module.html#_conditional_comment_re +lxml.html.clean._link_text lxml.html.clean-module.html#_link_text +lxml.html.clean._avoid_hosts lxml.html.clean-module.html#_avoid_hosts +lxml.html.clean.autolink_html lxml.html.clean-module.html#autolink_html +lxml.html.clean.tostring lxml.html-module.html#tostring +lxml.html.clean.clean_html lxml.html.clean-module.html#clean_html +lxml.html.clean._avoid_classes lxml.html.clean-module.html#_avoid_classes +lxml.html.clean._css_javascript_re lxml.html.clean-module.html#_css_javascript_re +lxml.html.clean.fromstring lxml.html-module.html#fromstring +lxml.html.clean.word_break lxml.html.clean-module.html#word_break +lxml.html.clean._break_prefer_re lxml.html.clean-module.html#_break_prefer_re +lxml.html.clean.clean lxml.html.clean-module.html#clean +lxml.html.clean._avoid_word_break_elements lxml.html.clean-module.html#_avoid_word_break_elements +lxml.html.defs lxml.html.defs-module.html +lxml.html.defs.block_tags lxml.html.defs-module.html#block_tags +lxml.html.defs.link_attrs lxml.html.defs-module.html#link_attrs +lxml.html.defs.tags lxml.html.defs-module.html#tags +lxml.html.defs.font_style_tags lxml.html.defs-module.html#font_style_tags +lxml.html.defs.event_attrs lxml.html.defs-module.html#event_attrs +lxml.html.defs.safe_attrs lxml.html.defs-module.html#safe_attrs +lxml.html.defs.table_tags lxml.html.defs-module.html#table_tags +lxml.html.defs.frame_tags lxml.html.defs-module.html#frame_tags +lxml.html.defs.top_level_tags lxml.html.defs-module.html#top_level_tags +lxml.html.defs.form_tags lxml.html.defs-module.html#form_tags +lxml.html.defs.phrase_tags lxml.html.defs-module.html#phrase_tags +lxml.html.defs.deprecated_tags lxml.html.defs-module.html#deprecated_tags +lxml.html.defs.head_tags lxml.html.defs-module.html#head_tags +lxml.html.defs.list_tags lxml.html.defs-module.html#list_tags +lxml.html.defs.special_inline_tags lxml.html.defs-module.html#special_inline_tags +lxml.html.defs.empty_tags lxml.html.defs-module.html#empty_tags +lxml.html.defs.general_block_tags lxml.html.defs-module.html#general_block_tags +lxml.html.defs.nonstandard_tags lxml.html.defs-module.html#nonstandard_tags +lxml.html.diff lxml.html.diff-module.html +lxml.html.diff._move_el_inside_block lxml.html.diff-module.html#_move_el_inside_block +lxml.html.diff.compress_merge_back lxml.html.diff-module.html#compress_merge_back +lxml.html.diff.serialize_html_fragment lxml.html.diff-module.html#serialize_html_fragment +lxml.html.diff.split_delete lxml.html.diff-module.html#split_delete +lxml.html.diff.split_unbalanced lxml.html.diff-module.html#split_unbalanced +lxml.html.diff.is_word lxml.html.diff-module.html#is_word +lxml.html.diff._contains_block_level_tag lxml.html.diff-module.html#_contains_block_level_tag +lxml.html.diff.empty_tags lxml.html.diff-module.html#empty_tags +lxml.html.diff.is_start_tag lxml.html.diff-module.html#is_start_tag +lxml.html.diff.end_tag lxml.html.diff-module.html#end_tag +lxml.html.diff.fixup_chunks lxml.html.diff-module.html#fixup_chunks +lxml.html.diff.html_annotate lxml.html.diff-module.html#html_annotate +lxml.html.diff.cleanup_delete lxml.html.diff-module.html#cleanup_delete +lxml.html.diff.htmldiff lxml.html.diff-module.html#htmldiff +lxml.html.diff._fixup_ins_del_tags lxml.html.diff-module.html#_fixup_ins_del_tags +lxml.html.diff.htmldiff_tokens lxml.html.diff-module.html#htmldiff_tokens +lxml.html.diff.expand_tokens lxml.html.diff-module.html#expand_tokens +lxml.html.diff.is_end_tag lxml.html.diff-module.html#is_end_tag +lxml.html.diff.block_level_tags lxml.html.diff-module.html#block_level_tags +lxml.html.diff.compress_tokens lxml.html.diff-module.html#compress_tokens +lxml.html.diff.html_annotate_merge_annotations lxml.html.diff-module.html#html_annotate_merge_annotations +lxml.html.diff._merge_element_contents lxml.html.diff-module.html#_merge_element_contents +lxml.html.diff.split_words lxml.html.diff-module.html#split_words +lxml.html.diff.block_level_container_tags lxml.html.diff-module.html#block_level_container_tags +lxml.html.diff.flatten_el lxml.html.diff-module.html#flatten_el +lxml.html.diff.markup_serialize_tokens lxml.html.diff-module.html#markup_serialize_tokens +lxml.html.diff._body_re lxml.html.diff-module.html#_body_re +lxml.html.diff.locate_unbalanced_start lxml.html.diff-module.html#locate_unbalanced_start +lxml.html.diff.fragment_fromstring lxml.html-module.html#fragment_fromstring +lxml.html.diff.fixup_ins_del_tags lxml.html.diff-module.html#fixup_ins_del_tags +lxml.html.diff.default_markup lxml.html.diff-module.html#default_markup +lxml.html.diff.tokenize lxml.html.diff-module.html#tokenize +lxml.html.diff.cleanup_html lxml.html.diff-module.html#cleanup_html +lxml.html.diff.tokenize_annotated lxml.html.diff-module.html#tokenize_annotated +lxml.html.diff.parse_html lxml.html.diff-module.html#parse_html +lxml.html.diff.merge_insert lxml.html.diff-module.html#merge_insert +lxml.html.diff.merge_delete lxml.html.diff-module.html#merge_delete +lxml.html.diff._ins_del_re lxml.html.diff-module.html#_ins_del_re +lxml.html.diff.locate_unbalanced_end lxml.html.diff-module.html#locate_unbalanced_end +lxml.html.diff.start_tag lxml.html.diff-module.html#start_tag +lxml.html.diff._end_body_re lxml.html.diff-module.html#_end_body_re +lxml.html.diff.copy_annotations lxml.html.diff-module.html#copy_annotations +lxml.html.diff.end_whitespace_re lxml.html.diff-module.html#end_whitespace_re +lxml.html.diff.start_whitespace_re lxml.html.diff-module.html#start_whitespace_re +lxml.html.formfill lxml.html.formfill-module.html +lxml.html.formfill._fill_single lxml.html.formfill-module.html#_fill_single +lxml.html.formfill._input_xpath lxml.html.formfill-module.html#_input_xpath +lxml.html.formfill._nons lxml.html-module.html#_nons +lxml.html.formfill._insert_error lxml.html.formfill-module.html#_insert_error +lxml.html.formfill._fill_form lxml.html.formfill-module.html#_fill_form +lxml.html.formfill._check lxml.html.formfill-module.html#_check +lxml.html.formfill._takes_multiple lxml.html.formfill-module.html#_takes_multiple +lxml.html.formfill.fill_form lxml.html.formfill-module.html#fill_form +lxml.html.formfill.insert_errors_html lxml.html.formfill-module.html#insert_errors_html +lxml.html.formfill._form_name_xpath lxml.html.formfill-module.html#_form_name_xpath +lxml.html.formfill._name_xpath lxml.html.formfill-module.html#_name_xpath +lxml.html.formfill.fill_form_html lxml.html.formfill-module.html#fill_form_html +lxml.html.formfill._add_class lxml.html.formfill-module.html#_add_class +lxml.html.formfill._transform_result lxml.html-module.html#_transform_result +lxml.html.formfill.default_error_creator lxml.html.formfill-module.html#default_error_creator +lxml.html.formfill._find_elements_for_name lxml.html.formfill-module.html#_find_elements_for_name +lxml.html.formfill._label_for_xpath lxml.html.formfill-module.html#_label_for_xpath +lxml.html.formfill._fill_multiple lxml.html.formfill-module.html#_fill_multiple +lxml.html.formfill._select lxml.html.formfill-module.html#_select +lxml.html.formfill.insert_errors lxml.html.formfill-module.html#insert_errors +lxml.html.formfill._find_form_ids lxml.html.formfill-module.html#_find_form_ids +lxml.html.formfill.fromstring lxml.html-module.html#fromstring +lxml.html.formfill._tag lxml.html.formfill-module.html#_tag +lxml.html.formfill._find_form lxml.html.formfill-module.html#_find_form +lxml.html.formfill.tostring lxml.html-module.html#tostring +lxml.html.html5parser lxml.html.html5parser-module.html +lxml.html.html5parser.fragment_fromstring lxml.html.html5parser-module.html#fragment_fromstring +lxml.html.html5parser.xhtml_parser lxml.html.html5parser-module.html#xhtml_parser +lxml.html.html5parser.fragments_fromstring lxml.html.html5parser-module.html#fragments_fromstring +lxml.html.html5parser.parse lxml.html.html5parser-module.html#parse +lxml.html.html5parser.html_parser lxml.html.html5parser-module.html#html_parser +lxml.html.html5parser.document_fromstring lxml.html.html5parser-module.html#document_fromstring +lxml.html.html5parser._find_tag lxml.html.html5parser-module.html#_find_tag +lxml.html.html5parser.fromstring lxml.html.html5parser-module.html#fromstring +lxml.html.html5parser._contains_block_level_tag lxml.html-module.html#_contains_block_level_tag +lxml.html.soupparser lxml.html.soupparser-module.html +lxml.html.soupparser._convert_tree lxml.html.soupparser-module.html#_convert_tree +lxml.html.soupparser.fromstring lxml.html.soupparser-module.html#fromstring +lxml.html.soupparser._append_text lxml.html.soupparser-module.html#_append_text +lxml.html.soupparser.parse lxml.html.soupparser-module.html#parse +lxml.html.soupparser.convert_tree lxml.html.soupparser-module.html#convert_tree +lxml.html.soupparser.__doc__ lxml.html.soupparser-module.html#__doc__ +lxml.html.soupparser.unescape lxml.html.soupparser-module.html#unescape +lxml.html.soupparser._parse lxml.html.soupparser-module.html#_parse +lxml.html.soupparser._convert_children lxml.html.soupparser-module.html#_convert_children +lxml.html.soupparser.handle_entities lxml.html.soupparser-module.html#handle_entities +lxml.html.usedoctest lxml.html.usedoctest-module.html +lxml.objectify lxml.objectify-module.html +lxml.objectify.enable_recursive_str lxml.objectify-module.html#enable_recursive_str +lxml.objectify.dump lxml.objectify-module.html#dump +lxml.objectify.__parseBool lxml.objectify-module.html#__parseBool +lxml.objectify.annotate lxml.objectify-module.html#annotate +lxml.objectify.set_default_parser lxml.objectify-module.html#set_default_parser +lxml.objectify.pyannotate lxml.objectify-module.html#pyannotate +lxml.objectify.getRegisteredTypes lxml.objectify-module.html#getRegisteredTypes +lxml.objectify.xsiannotate lxml.objectify-module.html#xsiannotate +lxml.objectify.PYTYPE_ATTRIBUTE lxml.objectify-module.html#PYTYPE_ATTRIBUTE +lxml.objectify.pytypename lxml.objectify-module.html#pytypename +lxml.objectify.makeparser lxml.objectify-module.html#makeparser +lxml.objectify.XML lxml.objectify-module.html#XML +lxml.objectify.deannotate lxml.objectify-module.html#deannotate +lxml.objectify.E lxml.objectify-module.html#E +lxml.objectify.Element lxml.objectify-module.html#Element +lxml.objectify.__unpickleElementTree lxml.objectify-module.html#__unpickleElementTree +lxml.objectify.__lower_bool lxml.objectify-module.html#__lower_bool +lxml.objectify.parse lxml.objectify-module.html#parse +lxml.objectify.set_pytype_attribute_tag lxml.objectify-module.html#set_pytype_attribute_tag +lxml.objectify.__checkBool lxml.objectify-module.html#__checkBool +lxml.objectify.fromstring lxml.objectify-module.html#fromstring +lxml.objectify.DataElement lxml.objectify-module.html#DataElement +lxml.pyclasslookup lxml.pyclasslookup-module.html +lxml.sax lxml.sax-module.html +lxml.sax.Comment lxml.etree-module.html#Comment +lxml.sax.ProcessingInstruction lxml.etree-module.html#PI +lxml.sax.SubElement lxml.etree-module.html#SubElement +lxml.sax.saxify lxml.sax-module.html#saxify +lxml.sax._getNsTag lxml.sax-module.html#_getNsTag +lxml.sax.ElementTree lxml.etree-module.html#ElementTree +lxml.tests lxml.tests-module.html +lxml.tests.common_imports lxml.tests.common_imports-module.html +lxml.tests.common_imports.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.common_imports._str lxml.tests.common_imports-module.html#_str +lxml.tests.common_imports._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.common_imports.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.common_imports._fix_unicode lxml.tests.common_imports-module.html#_fix_unicode +lxml.tests.common_imports._get_caller_relative_path lxml.tests.common_imports-module.html#_get_caller_relative_path +lxml.tests.common_imports.unentitify lxml.tests.common_imports-module.html#unentitify +lxml.tests.common_imports.doctest_parser lxml.tests.common_imports-module.html#doctest_parser +lxml.tests.common_imports._fix_bytes lxml.tests.common_imports-module.html#_fix_bytes +lxml.tests.common_imports.cElementTree lxml.tests.common_imports-module.html#cElementTree +lxml.tests.common_imports._fix_exceptions lxml.tests.common_imports-module.html#_fix_exceptions +lxml.tests.common_imports.make_version_tuple lxml.tests.common_imports-module.html#make_version_tuple +lxml.tests.common_imports.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.common_imports._fix_traceback lxml.tests.common_imports-module.html#_fix_traceback +lxml.tests.test_classlookup lxml.tests.test_classlookup-module.html +lxml.tests.test_classlookup.xml_str lxml.tests.test_classlookup-module.html#xml_str +lxml.tests.test_classlookup.this_dir lxml.tests.test_classlookup-module.html#this_dir +lxml.tests.test_classlookup._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_classlookup.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_classlookup._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_classlookup.test_suite lxml.tests.test_classlookup-module.html#test_suite +lxml.tests.test_classlookup.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.test_css lxml.tests.test_css-module.html +lxml.tests.test_css.doc_fn lxml.tests.test_css-module.html#doc_fn +lxml.tests.test_css.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_css.test_suite lxml.tests.test_css-module.html#test_suite +lxml.tests.test_css.unique lxml.tests.test_css-module.html#unique +lxml.tests.test_dtd lxml.tests.test_dtd-module.html +lxml.tests.test_dtd.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_dtd.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_dtd._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_dtd.test_suite lxml.tests.test_dtd-module.html#test_suite +lxml.tests.test_dtd.this_dir lxml.tests.test_dtd-module.html#this_dir +lxml.tests.test_elementtree lxml.tests.test_elementtree-module.html +lxml.tests.test_elementtree._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_elementtree._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_elementtree.this_dir lxml.tests.test_elementtree-module.html#this_dir +lxml.tests.test_elementtree.reversed lxml.tests.test_elementtree-module.html#reversed +lxml.tests.test_elementtree.cElementTree lxml.tests.test_elementtree-module.html#cElementTree +lxml.tests.test_elementtree.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_elementtree.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.test_elementtree.test_suite lxml.tests.test_elementtree-module.html#test_suite +lxml.tests.test_errors lxml.tests.test_errors-module.html +lxml.tests.test_errors.test_suite lxml.tests.test_errors-module.html#test_suite +lxml.tests.test_errors.this_dir lxml.tests.test_errors-module.html#this_dir +lxml.tests.test_etree lxml.tests.test_etree-module.html +lxml.tests.test_etree.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_etree._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_etree._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_etree.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.test_etree.this_dir lxml.tests.test_etree-module.html#this_dir +lxml.tests.test_etree.sorted lxml.tests.common_imports-module.html#sorted +lxml.tests.test_etree.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_etree.test_suite lxml.tests.test_etree-module.html#test_suite +lxml.tests.test_htmlparser lxml.tests.test_htmlparser-module.html +lxml.tests.test_htmlparser._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_htmlparser.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_htmlparser._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_htmlparser.test_suite lxml.tests.test_htmlparser-module.html#test_suite +lxml.tests.test_htmlparser.this_dir lxml.tests.test_htmlparser-module.html#this_dir +lxml.tests.test_io lxml.tests.test_io-module.html +lxml.tests.test_io._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_io.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_io.this_dir lxml.tests.test_io-module.html#this_dir +lxml.tests.test_io._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_io.test_suite lxml.tests.test_io-module.html#test_suite +lxml.tests.test_nsclasses lxml.tests.test_nsclasses-module.html +lxml.tests.test_nsclasses.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_nsclasses._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_nsclasses.test_suite lxml.tests.test_nsclasses-module.html#test_suite +lxml.tests.test_nsclasses.this_dir lxml.tests.test_nsclasses-module.html#this_dir +lxml.tests.test_objectify lxml.tests.test_objectify-module.html +lxml.tests.test_objectify.xsitype2objclass lxml.tests.test_objectify-module.html#xsitype2objclass +lxml.tests.test_objectify.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_objectify._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_objectify._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_objectify.PYTYPE_NAMESPACE lxml.tests.test_objectify-module.html#PYTYPE_NAMESPACE +lxml.tests.test_objectify.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.test_objectify.xml_str lxml.tests.test_objectify-module.html#xml_str +lxml.tests.test_objectify.DEFAULT_NSMAP lxml.tests.test_objectify-module.html#DEFAULT_NSMAP +lxml.tests.test_objectify.XML_SCHEMA_NS lxml.tests.test_objectify-module.html#XML_SCHEMA_NS +lxml.tests.test_objectify.TREE_PYTYPE lxml.tests.test_objectify-module.html#TREE_PYTYPE +lxml.tests.test_objectify.pytype2objclass lxml.tests.test_objectify-module.html#pytype2objclass +lxml.tests.test_objectify.XML_SCHEMA_INSTANCE_TYPE_ATTR lxml.tests.test_objectify-module.html#XML_SCHEMA_INSTANCE_TYPE_ATTR +lxml.tests.test_objectify.XML_SCHEMA_NIL_ATTR lxml.tests.test_objectify-module.html#XML_SCHEMA_NIL_ATTR +lxml.tests.test_objectify.this_dir lxml.tests.test_objectify-module.html#this_dir +lxml.tests.test_objectify.XML_SCHEMA_INSTANCE_NS lxml.tests.test_objectify-module.html#XML_SCHEMA_INSTANCE_NS +lxml.tests.test_objectify.objectclass2xsitype lxml.tests.test_objectify-module.html#objectclass2xsitype +lxml.tests.test_objectify.v lxml.tests.test_objectify-module.html#v +lxml.tests.test_objectify.objectclass2pytype lxml.tests.test_objectify-module.html#objectclass2pytype +lxml.tests.test_objectify.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_objectify.test_suite lxml.tests.test_objectify-module.html#test_suite +lxml.tests.test_pyclasslookup lxml.tests.test_pyclasslookup-module.html +lxml.tests.test_pyclasslookup.xml_str lxml.tests.test_pyclasslookup-module.html#xml_str +lxml.tests.test_pyclasslookup.this_dir lxml.tests.test_pyclasslookup-module.html#this_dir +lxml.tests.test_pyclasslookup.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_pyclasslookup._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_pyclasslookup.test_suite lxml.tests.test_pyclasslookup-module.html#test_suite +lxml.tests.test_pyclasslookup.canonicalize lxml.tests.common_imports-module.html#canonicalize +lxml.tests.test_relaxng lxml.tests.test_relaxng-module.html +lxml.tests.test_relaxng.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_relaxng.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_relaxng._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_relaxng.test_suite lxml.tests.test_relaxng-module.html#test_suite +lxml.tests.test_relaxng.this_dir lxml.tests.test_relaxng-module.html#this_dir +lxml.tests.test_sax lxml.tests.test_sax-module.html +lxml.tests.test_sax.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_sax._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_sax.test_suite lxml.tests.test_sax-module.html#test_suite +lxml.tests.test_sax.this_dir lxml.tests.test_sax-module.html#this_dir +lxml.tests.test_schematron lxml.tests.test_schematron-module.html +lxml.tests.test_schematron.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_schematron.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_schematron.test_suite lxml.tests.test_schematron-module.html#test_suite +lxml.tests.test_schematron.this_dir lxml.tests.test_schematron-module.html#this_dir +lxml.tests.test_threading lxml.tests.test_threading-module.html +lxml.tests.test_threading._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_threading.test_suite lxml.tests.test_threading-module.html#test_suite +lxml.tests.test_threading.this_dir lxml.tests.test_threading-module.html#this_dir +lxml.tests.test_unicode lxml.tests.test_unicode-module.html +lxml.tests.test_unicode.uxml lxml.tests.test_unicode-module.html#uxml +lxml.tests.test_unicode.klingon lxml.tests.test_unicode-module.html#klingon +lxml.tests.test_unicode.invalid_tag lxml.tests.test_unicode-module.html#invalid_tag +lxml.tests.test_unicode._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_unicode._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_unicode.test_suite lxml.tests.test_unicode-module.html#test_suite +lxml.tests.test_unicode.this_dir lxml.tests.test_unicode-module.html#this_dir +lxml.tests.test_unicode.uni lxml.tests.test_unicode-module.html#uni +lxml.tests.test_unicode.ascii_uni lxml.tests.test_unicode-module.html#ascii_uni +lxml.tests.test_xmlschema lxml.tests.test_xmlschema-module.html +lxml.tests.test_xmlschema.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_xmlschema.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_xmlschema.test_suite lxml.tests.test_xmlschema-module.html#test_suite +lxml.tests.test_xmlschema.this_dir lxml.tests.test_xmlschema-module.html#this_dir +lxml.tests.test_xpathevaluator lxml.tests.test_xpathevaluator-module.html +lxml.tests.test_xpathevaluator.argsTest1 lxml.tests.test_xpathevaluator-module.html#argsTest1 +lxml.tests.test_xpathevaluator.argsTest2 lxml.tests.test_xpathevaluator-module.html#argsTest2 +lxml.tests.test_xpathevaluator.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_xpathevaluator.stringTest lxml.tests.test_xpathevaluator-module.html#stringTest +lxml.tests.test_xpathevaluator._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_xpathevaluator.booleanTest lxml.tests.test_xpathevaluator-module.html#booleanTest +lxml.tests.test_xpathevaluator.this_dir lxml.tests.test_xpathevaluator-module.html#this_dir +lxml.tests.test_xpathevaluator.setTest lxml.tests.test_xpathevaluator-module.html#setTest +lxml.tests.test_xpathevaluator.resultTypesTest2 lxml.tests.test_xpathevaluator-module.html#resultTypesTest2 +lxml.tests.test_xpathevaluator.SAMPLE_XML lxml.tests.test_xpathevaluator-module.html#SAMPLE_XML +lxml.tests.test_xpathevaluator.test_suite lxml.tests.test_xpathevaluator-module.html#test_suite +lxml.tests.test_xpathevaluator.floatTest lxml.tests.test_xpathevaluator-module.html#floatTest +lxml.tests.test_xpathevaluator.xpath lxml.tests.test_xpathevaluator-module.html#xpath +lxml.tests.test_xpathevaluator.resultTypesTest lxml.tests.test_xpathevaluator-module.html#resultTypesTest +lxml.tests.test_xpathevaluator.extension lxml.tests.test_xpathevaluator-module.html#extension +lxml.tests.test_xpathevaluator.uri lxml.tests.test_xpathevaluator-module.html#uri +lxml.tests.test_xpathevaluator.setTest2 lxml.tests.test_xpathevaluator-module.html#setTest2 +lxml.tests.test_xpathevaluator.tag lxml.tests.test_xpathevaluator-module.html#tag +lxml.tests.test_xslt lxml.tests.test_xslt-module.html +lxml.tests.test_xslt.make_doctest lxml.tests.common_imports-module.html#make_doctest +lxml.tests.test_xslt._str lxml.tests.common_imports-module.html#_str +lxml.tests.test_xslt.fileInTestDir lxml.tests.common_imports-module.html#fileInTestDir +lxml.tests.test_xslt.is_python3 lxml.tests.test_xslt-module.html#is_python3 +lxml.tests.test_xslt._bytes lxml.tests.common_imports-module.html#_bytes +lxml.tests.test_xslt.test_suite lxml.tests.test_xslt-module.html#test_suite +lxml.tests.test_xslt.this_dir lxml.tests.test_xslt-module.html#this_dir +lxml.usedoctest lxml.usedoctest-module.html +elementtree.ElementTree.Element elementtree.ElementTree.Element-class.html +elementtree.ElementTree.Element.set elementtree.ElementTree.Element-class.html#set +elementtree.ElementTree.Element.__getslice__ elementtree.ElementTree.Element-class.html#__getslice__ +elementtree.ElementTree.Element.text elementtree.ElementTree.Element-class.html#text +elementtree.ElementTree.Element.tag elementtree.ElementTree.Element-class.html#tag +elementtree.ElementTree.Element.iter elementtree.ElementTree.Element-class.html#iter +elementtree.ElementTree.Element.findall elementtree.ElementTree.Element-class.html#findall +elementtree.ElementTree.Element.__init__ elementtree.ElementTree.Element-class.html#__init__ +elementtree.ElementTree.Element.__delslice__ elementtree.ElementTree.Element-class.html#__delslice__ +elementtree.ElementTree.Element.__getitem__ elementtree.ElementTree.Element-class.html#__getitem__ +elementtree.ElementTree.Element.itertext elementtree.ElementTree.Element-class.html#itertext +elementtree.ElementTree.Element.findtext elementtree.ElementTree.Element-class.html#findtext +elementtree.ElementTree.Element.getchildren elementtree.ElementTree.Element-class.html#getchildren +elementtree.ElementTree.Element.find elementtree.ElementTree.Element-class.html#find +elementtree.ElementTree.Element.tail elementtree.ElementTree.Element-class.html#tail +elementtree.ElementTree.Element.append elementtree.ElementTree.Element-class.html#append +elementtree.ElementTree.Element.__len__ elementtree.ElementTree.Element-class.html#__len__ +elementtree.ElementTree.Element.extend elementtree.ElementTree.Element-class.html#extend +elementtree.ElementTree.Element.get elementtree.ElementTree.Element-class.html#get +elementtree.ElementTree.Element.keys elementtree.ElementTree.Element-class.html#keys +elementtree.ElementTree.Element.makeelement elementtree.ElementTree.Element-class.html#makeelement +elementtree.ElementTree.Element.__setitem__ elementtree.ElementTree.Element-class.html#__setitem__ +elementtree.ElementTree.Element.insert elementtree.ElementTree.Element-class.html#insert +elementtree.ElementTree.Element.__delitem__ elementtree.ElementTree.Element-class.html#__delitem__ +elementtree.ElementTree.Element.__nonzero__ elementtree.ElementTree.Element-class.html#__nonzero__ +elementtree.ElementTree.Element.items elementtree.ElementTree.Element-class.html#items +elementtree.ElementTree.Element.__setslice__ elementtree.ElementTree.Element-class.html#__setslice__ +elementtree.ElementTree.Element.remove elementtree.ElementTree.Element-class.html#remove +elementtree.ElementTree.Element.__repr__ elementtree.ElementTree.Element-class.html#__repr__ +elementtree.ElementTree.Element.getiterator elementtree.ElementTree.Element-class.html#getiterator +elementtree.ElementTree.Element.attrib elementtree.ElementTree.Element-class.html#attrib +elementtree.ElementTree.Element.clear elementtree.ElementTree.Element-class.html#clear +elementtree.ElementTree.ElementTree elementtree.ElementTree.ElementTree-class.html +elementtree.ElementTree.ElementTree.write elementtree.ElementTree.ElementTree-class.html#write +elementtree.ElementTree.ElementTree.getroot elementtree.ElementTree.ElementTree-class.html#getroot +elementtree.ElementTree.ElementTree.getiterator elementtree.ElementTree.ElementTree-class.html#getiterator +elementtree.ElementTree.ElementTree.findtext elementtree.ElementTree.ElementTree-class.html#findtext +elementtree.ElementTree.ElementTree.iter elementtree.ElementTree.ElementTree-class.html#iter +elementtree.ElementTree.ElementTree.findall elementtree.ElementTree.ElementTree-class.html#findall +elementtree.ElementTree.ElementTree.parse elementtree.ElementTree.ElementTree-class.html#parse +elementtree.ElementTree.ElementTree._setroot elementtree.ElementTree.ElementTree-class.html#_setroot +elementtree.ElementTree.ElementTree.find elementtree.ElementTree.ElementTree-class.html#find +elementtree.ElementTree.ElementTree.__init__ elementtree.ElementTree.ElementTree-class.html#__init__ +elementtree.ElementTree.ParseError elementtree.ElementTree.ParseError-class.html +elementtree.ElementTree.QName elementtree.ElementTree.QName-class.html +elementtree.ElementTree.QName.__str__ elementtree.ElementTree.QName-class.html#__str__ +elementtree.ElementTree.QName.__cmp__ elementtree.ElementTree.QName-class.html#__cmp__ +elementtree.ElementTree.QName.__hash__ elementtree.ElementTree.QName-class.html#__hash__ +elementtree.ElementTree.QName.__init__ elementtree.ElementTree.QName-class.html#__init__ +elementtree.ElementTree.TreeBuilder elementtree.ElementTree.TreeBuilder-class.html +elementtree.ElementTree.TreeBuilder.end elementtree.ElementTree.TreeBuilder-class.html#end +elementtree.ElementTree.TreeBuilder.start elementtree.ElementTree.TreeBuilder-class.html#start +elementtree.ElementTree.TreeBuilder._flush elementtree.ElementTree.TreeBuilder-class.html#_flush +elementtree.ElementTree.TreeBuilder.close elementtree.ElementTree.TreeBuilder-class.html#close +elementtree.ElementTree.TreeBuilder.data elementtree.ElementTree.TreeBuilder-class.html#data +elementtree.ElementTree.TreeBuilder.__init__ elementtree.ElementTree.TreeBuilder-class.html#__init__ +elementtree.ElementTree.XMLParser elementtree.ElementTree.XMLParser-class.html +elementtree.ElementTree.XMLParser.feed elementtree.ElementTree.XMLParser-class.html#feed +elementtree.ElementTree.XMLParser._start_list elementtree.ElementTree.XMLParser-class.html#_start_list +elementtree.ElementTree.XMLParser._end elementtree.ElementTree.XMLParser-class.html#_end +elementtree.ElementTree.XMLParser._fixtext elementtree.ElementTree.XMLParser-class.html#_fixtext +elementtree.ElementTree.XMLParser.close elementtree.ElementTree.XMLParser-class.html#close +elementtree.ElementTree.XMLParser._fixname elementtree.ElementTree.XMLParser-class.html#_fixname +elementtree.ElementTree.XMLParser._data elementtree.ElementTree.XMLParser-class.html#_data +elementtree.ElementTree.XMLParser._start elementtree.ElementTree.XMLParser-class.html#_start +elementtree.ElementTree.XMLParser._default elementtree.ElementTree.XMLParser-class.html#_default +elementtree.ElementTree.XMLParser.__init__ elementtree.ElementTree.XMLParser-class.html#__init__ +elementtree.ElementTree.XMLParser._raiseerror elementtree.ElementTree.XMLParser-class.html#_raiseerror +elementtree.ElementTree._IterParseIterator elementtree.ElementTree._IterParseIterator-class.html +elementtree.ElementTree._IterParseIterator.next elementtree.ElementTree._IterParseIterator-class.html#next +elementtree.ElementTree._IterParseIterator.__iter__ elementtree.ElementTree._IterParseIterator-class.html#__iter__ +elementtree.ElementTree._IterParseIterator.__init__ elementtree.ElementTree._IterParseIterator-class.html#__init__ +elementtree.ElementTree._SimpleElementPath elementtree.ElementTree._SimpleElementPath-class.html +elementtree.ElementTree._SimpleElementPath.findtext elementtree.ElementTree._SimpleElementPath-class.html#findtext +elementtree.ElementTree._SimpleElementPath.find elementtree.ElementTree._SimpleElementPath-class.html#find +elementtree.ElementTree._SimpleElementPath.findall elementtree.ElementTree._SimpleElementPath-class.html#findall +exceptions.AssertionError exceptions.AssertionError-class.html +exceptions.AssertionError.__init__ exceptions.AssertionError-class.html#__init__ +exceptions.AssertionError.__new__ exceptions.AssertionError-class.html#__new__ +lxml.ElementInclude.FatalIncludeError lxml.ElementInclude.FatalIncludeError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.builder.ElementMaker lxml.builder.ElementMaker-class.html +lxml.builder.ElementMaker.__getattr__ lxml.builder.ElementMaker-class.html#__getattr__ +lxml.builder.ElementMaker.__call__ lxml.builder.ElementMaker-class.html#__call__ +lxml.builder.ElementMaker.__init__ lxml.builder.ElementMaker-class.html#__init__ +lxml.cssselect.Attrib lxml.cssselect.Attrib-class.html +lxml.cssselect.Attrib.xpath lxml.cssselect.Attrib-class.html#xpath +lxml.cssselect.Attrib._xpath_attrib lxml.cssselect.Attrib-class.html#_xpath_attrib +lxml.cssselect.Attrib.__repr__ lxml.cssselect.Attrib-class.html#__repr__ +lxml.cssselect.Attrib.__init__ lxml.cssselect.Attrib-class.html#__init__ +lxml.cssselect.Attrib._format_attrib lxml.cssselect.Attrib-class.html#_format_attrib +lxml.cssselect.CSSSelector lxml.cssselect.CSSSelector-class.html +lxml.etree.XPath.__new__ lxml.etree.XPath-class.html#__new__ +lxml.etree._XPathEvaluatorBase.evaluate lxml.etree._XPathEvaluatorBase-class.html#evaluate +lxml.etree._XPathEvaluatorBase.error_log lxml.etree._XPathEvaluatorBase-class.html#error_log +lxml.cssselect.CSSSelector.__repr__ lxml.cssselect.CSSSelector-class.html#__repr__ +lxml.etree.XPath.__call__ lxml.etree.XPath-class.html#__call__ +lxml.etree.XPath.path lxml.etree.XPath-class.html#path +lxml.cssselect.CSSSelector.__init__ lxml.cssselect.CSSSelector-class.html#__init__ +lxml.cssselect.Class lxml.cssselect.Class-class.html +lxml.cssselect.Class.xpath lxml.cssselect.Class-class.html#xpath +lxml.cssselect.Class.__repr__ lxml.cssselect.Class-class.html#__repr__ +lxml.cssselect.Class.__init__ lxml.cssselect.Class-class.html#__init__ +lxml.cssselect.CombinedSelector lxml.cssselect.CombinedSelector-class.html +lxml.cssselect.CombinedSelector.xpath lxml.cssselect.CombinedSelector-class.html#xpath +lxml.cssselect.CombinedSelector._xpath_descendant lxml.cssselect.CombinedSelector-class.html#_xpath_descendant +lxml.cssselect.CombinedSelector._xpath_indirect_adjacent lxml.cssselect.CombinedSelector-class.html#_xpath_indirect_adjacent +lxml.cssselect.CombinedSelector._xpath_child lxml.cssselect.CombinedSelector-class.html#_xpath_child +lxml.cssselect.CombinedSelector.__repr__ lxml.cssselect.CombinedSelector-class.html#__repr__ +lxml.cssselect.CombinedSelector._xpath_direct_adjacent lxml.cssselect.CombinedSelector-class.html#_xpath_direct_adjacent +lxml.cssselect.CombinedSelector._method_mapping lxml.cssselect.CombinedSelector-class.html#_method_mapping +lxml.cssselect.CombinedSelector.__init__ lxml.cssselect.CombinedSelector-class.html#__init__ +lxml.cssselect.Element lxml.cssselect.Element-class.html +lxml.cssselect.Element.xpath lxml.cssselect.Element-class.html#xpath +lxml.cssselect.Element._format_element lxml.cssselect.Element-class.html#_format_element +lxml.cssselect.Element.__repr__ lxml.cssselect.Element-class.html#__repr__ +lxml.cssselect.Element.__init__ lxml.cssselect.Element-class.html#__init__ +lxml.cssselect.ExpressionError lxml.cssselect.ExpressionError-class.html +lxml.cssselect.Function lxml.cssselect.Function-class.html +lxml.cssselect.Function.xpath lxml.cssselect.Function-class.html#xpath +lxml.cssselect.Function._xpath_nth_child lxml.cssselect.Function-class.html#_xpath_nth_child +lxml.cssselect.Function._xpath_contains lxml.cssselect.Function-class.html#_xpath_contains +lxml.cssselect.Function._xpath_nth_last_child lxml.cssselect.Function-class.html#_xpath_nth_last_child +lxml.cssselect.Function._xpath_nth_of_type lxml.cssselect.Function-class.html#_xpath_nth_of_type +lxml.cssselect.Function.unsupported lxml.cssselect.Function-class.html#unsupported +lxml.cssselect.Function.__repr__ lxml.cssselect.Function-class.html#__repr__ +lxml.cssselect.Function._xpath_not lxml.cssselect.Function-class.html#_xpath_not +lxml.cssselect.Function._xpath_nth_last_of_type lxml.cssselect.Function-class.html#_xpath_nth_last_of_type +lxml.cssselect.Function.__init__ lxml.cssselect.Function-class.html#__init__ +lxml.cssselect.Hash lxml.cssselect.Hash-class.html +lxml.cssselect.Hash.xpath lxml.cssselect.Hash-class.html#xpath +lxml.cssselect.Hash.__repr__ lxml.cssselect.Hash-class.html#__repr__ +lxml.cssselect.Hash.__init__ lxml.cssselect.Hash-class.html#__init__ +lxml.cssselect.Or lxml.cssselect.Or-class.html +lxml.cssselect.Or.xpath lxml.cssselect.Or-class.html#xpath +lxml.cssselect.Or.__repr__ lxml.cssselect.Or-class.html#__repr__ +lxml.cssselect.Or.__init__ lxml.cssselect.Or-class.html#__init__ +lxml.cssselect.Pseudo lxml.cssselect.Pseudo-class.html +lxml.cssselect.Pseudo.unsupported lxml.cssselect.Pseudo-class.html#unsupported +lxml.cssselect.Pseudo._xpath_first_child lxml.cssselect.Pseudo-class.html#_xpath_first_child +lxml.cssselect.Pseudo._xpath_checked lxml.cssselect.Pseudo-class.html#_xpath_checked +lxml.cssselect.Pseudo.__init__ lxml.cssselect.Pseudo-class.html#__init__ +lxml.cssselect.Pseudo._xpath_first_of_type lxml.cssselect.Pseudo-class.html#_xpath_first_of_type +lxml.cssselect.Pseudo._xpath_only_child lxml.cssselect.Pseudo-class.html#_xpath_only_child +lxml.cssselect.Pseudo._xpath_empty lxml.cssselect.Pseudo-class.html#_xpath_empty +lxml.cssselect.Pseudo._xpath_root lxml.cssselect.Pseudo-class.html#_xpath_root +lxml.cssselect.Pseudo.xpath lxml.cssselect.Pseudo-class.html#xpath +lxml.cssselect.Pseudo._xpath_only_of_type lxml.cssselect.Pseudo-class.html#_xpath_only_of_type +lxml.cssselect.Pseudo.__repr__ lxml.cssselect.Pseudo-class.html#__repr__ +lxml.cssselect.Pseudo._xpath_last_of_type lxml.cssselect.Pseudo-class.html#_xpath_last_of_type +lxml.cssselect.Pseudo._xpath_last_child lxml.cssselect.Pseudo-class.html#_xpath_last_child +lxml.cssselect.SelectorSyntaxError lxml.cssselect.SelectorSyntaxError-class.html +lxml.cssselect.String lxml.cssselect.String-class.html +lxml.cssselect._UniToken.__new__ lxml.cssselect._UniToken-class.html#__new__ +lxml.cssselect._UniToken.__repr__ lxml.cssselect._UniToken-class.html#__repr__ +lxml.cssselect.Symbol lxml.cssselect.Symbol-class.html +lxml.cssselect._UniToken.__new__ lxml.cssselect._UniToken-class.html#__new__ +lxml.cssselect._UniToken.__repr__ lxml.cssselect._UniToken-class.html#__repr__ +lxml.cssselect.Token lxml.cssselect.Token-class.html +lxml.cssselect._UniToken.__new__ lxml.cssselect._UniToken-class.html#__new__ +lxml.cssselect._UniToken.__repr__ lxml.cssselect._UniToken-class.html#__repr__ +lxml.cssselect.TokenStream lxml.cssselect.TokenStream-class.html +lxml.cssselect.TokenStream.peek lxml.cssselect.TokenStream-class.html#peek +lxml.cssselect.TokenStream.next lxml.cssselect.TokenStream-class.html#next +lxml.cssselect.TokenStream.__iter__ lxml.cssselect.TokenStream-class.html#__iter__ +lxml.cssselect.TokenStream.__init__ lxml.cssselect.TokenStream-class.html#__init__ +lxml.cssselect.XPathExpr lxml.cssselect.XPathExpr-class.html +lxml.cssselect.XPathExpr.add_star_prefix lxml.cssselect.XPathExpr-class.html#add_star_prefix +lxml.cssselect.XPathExpr.join lxml.cssselect.XPathExpr-class.html#join +lxml.cssselect.XPathExpr.add_path lxml.cssselect.XPathExpr-class.html#add_path +lxml.cssselect.XPathExpr.__str__ lxml.cssselect.XPathExpr-class.html#__str__ +lxml.cssselect.XPathExpr.add_name_test lxml.cssselect.XPathExpr-class.html#add_name_test +lxml.cssselect.XPathExpr.__repr__ lxml.cssselect.XPathExpr-class.html#__repr__ +lxml.cssselect.XPathExpr.add_condition lxml.cssselect.XPathExpr-class.html#add_condition +lxml.cssselect.XPathExpr.add_prefix lxml.cssselect.XPathExpr-class.html#add_prefix +lxml.cssselect.XPathExpr.__init__ lxml.cssselect.XPathExpr-class.html#__init__ +lxml.cssselect.XPathExprOr lxml.cssselect.XPathExprOr-class.html +lxml.cssselect.XPathExpr.add_star_prefix lxml.cssselect.XPathExpr-class.html#add_star_prefix +lxml.cssselect.XPathExpr.join lxml.cssselect.XPathExpr-class.html#join +lxml.cssselect.XPathExpr.add_path lxml.cssselect.XPathExpr-class.html#add_path +lxml.cssselect.XPathExprOr.__str__ lxml.cssselect.XPathExprOr-class.html#__str__ +lxml.cssselect.XPathExpr.add_name_test lxml.cssselect.XPathExpr-class.html#add_name_test +lxml.cssselect.XPathExpr.__repr__ lxml.cssselect.XPathExpr-class.html#__repr__ +lxml.cssselect.XPathExpr.add_condition lxml.cssselect.XPathExpr-class.html#add_condition +lxml.cssselect.XPathExpr.add_prefix lxml.cssselect.XPathExpr-class.html#add_prefix +lxml.cssselect.XPathExprOr.__init__ lxml.cssselect.XPathExprOr-class.html#__init__ +lxml.cssselect._UniToken lxml.cssselect._UniToken-class.html +lxml.cssselect._UniToken.__new__ lxml.cssselect._UniToken-class.html#__new__ +lxml.cssselect._UniToken.__repr__ lxml.cssselect._UniToken-class.html#__repr__ +lxml.doctestcompare.LHTMLOutputChecker lxml.doctestcompare.LHTMLOutputChecker-class.html +lxml.doctestcompare.LXMLOutputChecker.collect_diff_end_tag lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff_end_tag +lxml.doctestcompare.LXMLOutputChecker.text_compare lxml.doctestcompare.LXMLOutputChecker-class.html#text_compare +lxml.doctestcompare.LHTMLOutputChecker.get_default_parser lxml.doctestcompare.LHTMLOutputChecker-class.html#get_default_parser +lxml.doctestcompare.LXMLOutputChecker.collect_diff_tag lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff_tag +lxml.doctestcompare.LXMLOutputChecker.collect_diff_text lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff_text +lxml.doctestcompare.LXMLOutputChecker.get_parser lxml.doctestcompare.LXMLOutputChecker-class.html#get_parser +lxml.doctestcompare.LXMLOutputChecker.collect_diff lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff +lxml.doctestcompare.LXMLOutputChecker.html_empty_tag lxml.doctestcompare.LXMLOutputChecker-class.html#html_empty_tag +lxml.doctestcompare.LXMLOutputChecker._looks_like_markup lxml.doctestcompare.LXMLOutputChecker-class.html#_looks_like_markup +lxml.doctestcompare.LXMLOutputChecker.format_tag lxml.doctestcompare.LXMLOutputChecker-class.html#format_tag +lxml.doctestcompare.LXMLOutputChecker.check_output lxml.doctestcompare.LXMLOutputChecker-class.html#check_output +lxml.doctestcompare.LXMLOutputChecker.compare_docs lxml.doctestcompare.LXMLOutputChecker-class.html#compare_docs +lxml.doctestcompare.LXMLOutputChecker.format_doc lxml.doctestcompare.LXMLOutputChecker-class.html#format_doc +lxml.doctestcompare.LXMLOutputChecker.output_difference lxml.doctestcompare.LXMLOutputChecker-class.html#output_difference +lxml.doctestcompare.LXMLOutputChecker.format_end_tag lxml.doctestcompare.LXMLOutputChecker-class.html#format_end_tag +lxml.doctestcompare.LXMLOutputChecker.format_text lxml.doctestcompare.LXMLOutputChecker-class.html#format_text +lxml.doctestcompare.LXMLOutputChecker.empty_tags lxml.doctestcompare.LXMLOutputChecker-class.html#empty_tags +lxml.doctestcompare.LXMLOutputChecker.tag_compare lxml.doctestcompare.LXMLOutputChecker-class.html#tag_compare +lxml.doctestcompare.LXMLOutputChecker lxml.doctestcompare.LXMLOutputChecker-class.html +lxml.doctestcompare.LXMLOutputChecker.text_compare lxml.doctestcompare.LXMLOutputChecker-class.html#text_compare +lxml.doctestcompare.LXMLOutputChecker._looks_like_markup lxml.doctestcompare.LXMLOutputChecker-class.html#_looks_like_markup +lxml.doctestcompare.LXMLOutputChecker.empty_tags lxml.doctestcompare.LXMLOutputChecker-class.html#empty_tags +lxml.doctestcompare.LXMLOutputChecker.collect_diff_tag lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff_tag +lxml.doctestcompare.LXMLOutputChecker.compare_docs lxml.doctestcompare.LXMLOutputChecker-class.html#compare_docs +lxml.doctestcompare.LXMLOutputChecker.get_parser lxml.doctestcompare.LXMLOutputChecker-class.html#get_parser +lxml.doctestcompare.LXMLOutputChecker.html_empty_tag lxml.doctestcompare.LXMLOutputChecker-class.html#html_empty_tag +lxml.doctestcompare.LXMLOutputChecker.get_default_parser lxml.doctestcompare.LXMLOutputChecker-class.html#get_default_parser +lxml.doctestcompare.LXMLOutputChecker.format_tag lxml.doctestcompare.LXMLOutputChecker-class.html#format_tag +lxml.doctestcompare.LXMLOutputChecker.check_output lxml.doctestcompare.LXMLOutputChecker-class.html#check_output +lxml.doctestcompare.LXMLOutputChecker.collect_diff lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff +lxml.doctestcompare.LXMLOutputChecker.tag_compare lxml.doctestcompare.LXMLOutputChecker-class.html#tag_compare +lxml.doctestcompare.LXMLOutputChecker.format_doc lxml.doctestcompare.LXMLOutputChecker-class.html#format_doc +lxml.doctestcompare.LXMLOutputChecker.output_difference lxml.doctestcompare.LXMLOutputChecker-class.html#output_difference +lxml.doctestcompare.LXMLOutputChecker.format_end_tag lxml.doctestcompare.LXMLOutputChecker-class.html#format_end_tag +lxml.doctestcompare.LXMLOutputChecker.format_text lxml.doctestcompare.LXMLOutputChecker-class.html#format_text +lxml.doctestcompare.LXMLOutputChecker.collect_diff_end_tag lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff_end_tag +lxml.doctestcompare.LXMLOutputChecker.collect_diff_text lxml.doctestcompare.LXMLOutputChecker-class.html#collect_diff_text +lxml.doctestcompare._RestoreChecker lxml.doctestcompare._RestoreChecker-class.html +lxml.doctestcompare._RestoreChecker.uninstall_dt_self lxml.doctestcompare._RestoreChecker-class.html#uninstall_dt_self +lxml.doctestcompare._RestoreChecker.install_clone lxml.doctestcompare._RestoreChecker-class.html#install_clone +lxml.doctestcompare._RestoreChecker.uninstall_module lxml.doctestcompare._RestoreChecker-class.html#uninstall_module +lxml.doctestcompare._RestoreChecker.uninstall_clone lxml.doctestcompare._RestoreChecker-class.html#uninstall_clone +lxml.doctestcompare._RestoreChecker.install_dt_self lxml.doctestcompare._RestoreChecker-class.html#install_dt_self +lxml.doctestcompare._RestoreChecker.__call__ lxml.doctestcompare._RestoreChecker-class.html#__call__ +lxml.doctestcompare._RestoreChecker.call_super lxml.doctestcompare._RestoreChecker-class.html#call_super +lxml.doctestcompare._RestoreChecker.__init__ lxml.doctestcompare._RestoreChecker-class.html#__init__ +lxml.etree.AncestorsIterator lxml.etree.AncestorsIterator-class.html +lxml.etree.AncestorsIterator.__new__ lxml.etree.AncestorsIterator-class.html#__new__ +lxml.etree._ElementIterator.__next__ lxml.etree._ElementIterator-class.html#__next__ +lxml.etree._ElementIterator.next lxml.etree._ElementIterator-class.html#next +lxml.etree._ElementIterator.__iter__ lxml.etree._ElementIterator-class.html#__iter__ +lxml.etree.AncestorsIterator.__init__ lxml.etree.AncestorsIterator-class.html#__init__ +lxml.etree.AttributeBasedElementClassLookup lxml.etree.AttributeBasedElementClassLookup-class.html +lxml.etree.AttributeBasedElementClassLookup.__new__ lxml.etree.AttributeBasedElementClassLookup-class.html#__new__ +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.etree.AttributeBasedElementClassLookup.__init__ lxml.etree.AttributeBasedElementClassLookup-class.html#__init__ +lxml.etree.C14NError lxml.etree.C14NError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.CDATA lxml.etree.CDATA-class.html +lxml.etree.CDATA.__new__ lxml.etree.CDATA-class.html#__new__ +lxml.etree.CDATA.__init__ lxml.etree.CDATA-class.html#__init__ +lxml.etree.CommentBase lxml.etree.CommentBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Comment.tag lxml.etree._Comment-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.CommentBase.__new__ lxml.etree.CommentBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Comment.__repr__ lxml.etree._Comment-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.CustomElementClassLookup lxml.etree.CustomElementClassLookup-class.html +lxml.etree.CustomElementClassLookup.__new__ lxml.etree.CustomElementClassLookup-class.html#__new__ +lxml.etree.CustomElementClassLookup.lookup lxml.etree.CustomElementClassLookup-class.html#lookup +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.etree.FallbackElementClassLookup.__init__ lxml.etree.FallbackElementClassLookup-class.html#__init__ +lxml.etree.DTD lxml.etree.DTD-class.html +lxml.etree.DTD.__new__ lxml.etree.DTD-class.html#__new__ +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.etree.DTD.__call__ lxml.etree.DTD-class.html#__call__ +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree.DTD.__init__ lxml.etree.DTD-class.html#__init__ +lxml.etree.DTDError lxml.etree.DTDError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DTDParseError lxml.etree.DTDParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DTDValidateError lxml.etree.DTDValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.DocInfo lxml.etree.DocInfo-class.html +lxml.etree.DocInfo.xml_version lxml.etree.DocInfo-class.html#xml_version +lxml.etree.DocInfo.public_id lxml.etree.DocInfo-class.html#public_id +lxml.etree.DocInfo.__new__ lxml.etree.DocInfo-class.html#__new__ +lxml.etree.DocInfo.encoding lxml.etree.DocInfo-class.html#encoding +lxml.etree.DocInfo.URL lxml.etree.DocInfo-class.html#URL +lxml.etree.DocInfo.root_name lxml.etree.DocInfo-class.html#root_name +lxml.etree.DocInfo.doctype lxml.etree.DocInfo-class.html#doctype +lxml.etree.DocInfo.internalDTD lxml.etree.DocInfo-class.html#internalDTD +lxml.etree.DocInfo.standalone lxml.etree.DocInfo-class.html#standalone +lxml.etree.DocInfo.externalDTD lxml.etree.DocInfo-class.html#externalDTD +lxml.etree.DocInfo.system_url lxml.etree.DocInfo-class.html#system_url +lxml.etree.DocInfo.__init__ lxml.etree.DocInfo-class.html#__init__ +lxml.etree.DocumentInvalid lxml.etree.DocumentInvalid-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.ETCompatXMLParser lxml.etree.ETCompatXMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree.ETCompatXMLParser.__new__ lxml.etree.ETCompatXMLParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.etree.ETCompatXMLParser.__init__ lxml.etree.ETCompatXMLParser-class.html#__init__ +lxml.etree.ETXPath lxml.etree.ETXPath-class.html +lxml.etree.ETXPath.__new__ lxml.etree.ETXPath-class.html#__new__ +lxml.etree._XPathEvaluatorBase.evaluate lxml.etree._XPathEvaluatorBase-class.html#evaluate +lxml.etree._XPathEvaluatorBase.error_log lxml.etree._XPathEvaluatorBase-class.html#error_log +lxml.etree.XPath.__repr__ lxml.etree.XPath-class.html#__repr__ +lxml.etree.XPath.__call__ lxml.etree.XPath-class.html#__call__ +lxml.etree.XPath.path lxml.etree.XPath-class.html#path +lxml.etree.ETXPath.__init__ lxml.etree.ETXPath-class.html#__init__ +lxml.etree.ElementBase lxml.etree.ElementBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.ElementChildIterator lxml.etree.ElementChildIterator-class.html +lxml.etree.ElementChildIterator.__new__ lxml.etree.ElementChildIterator-class.html#__new__ +lxml.etree._ElementIterator.__next__ lxml.etree._ElementIterator-class.html#__next__ +lxml.etree._ElementIterator.next lxml.etree._ElementIterator-class.html#next +lxml.etree._ElementIterator.__iter__ lxml.etree._ElementIterator-class.html#__iter__ +lxml.etree.ElementChildIterator.__init__ lxml.etree.ElementChildIterator-class.html#__init__ +lxml.etree.ElementClassLookup lxml.etree.ElementClassLookup-class.html +lxml.etree.ElementClassLookup.__new__ lxml.etree.ElementClassLookup-class.html#__new__ +lxml.etree.ElementDefaultClassLookup lxml.etree.ElementDefaultClassLookup-class.html +lxml.etree.ElementDefaultClassLookup.entity_class lxml.etree.ElementDefaultClassLookup-class.html#entity_class +lxml.etree.ElementDefaultClassLookup.__new__ lxml.etree.ElementDefaultClassLookup-class.html#__new__ +lxml.etree.ElementDefaultClassLookup.element_class lxml.etree.ElementDefaultClassLookup-class.html#element_class +lxml.etree.ElementDefaultClassLookup.pi_class lxml.etree.ElementDefaultClassLookup-class.html#pi_class +lxml.etree.ElementDefaultClassLookup.comment_class lxml.etree.ElementDefaultClassLookup-class.html#comment_class +lxml.etree.ElementDefaultClassLookup.__init__ lxml.etree.ElementDefaultClassLookup-class.html#__init__ +lxml.etree.ElementDepthFirstIterator lxml.etree.ElementDepthFirstIterator-class.html +lxml.etree.ElementDepthFirstIterator.__new__ lxml.etree.ElementDepthFirstIterator-class.html#__new__ +lxml.etree.ElementDepthFirstIterator.__next__ lxml.etree.ElementDepthFirstIterator-class.html#__next__ +lxml.etree.ElementDepthFirstIterator.next lxml.etree.ElementDepthFirstIterator-class.html#next +lxml.etree.ElementDepthFirstIterator.__iter__ lxml.etree.ElementDepthFirstIterator-class.html#__iter__ +lxml.etree.ElementDepthFirstIterator.__init__ lxml.etree.ElementDepthFirstIterator-class.html#__init__ +lxml.etree.ElementNamespaceClassLookup lxml.etree.ElementNamespaceClassLookup-class.html +lxml.etree.ElementNamespaceClassLookup.__new__ lxml.etree.ElementNamespaceClassLookup-class.html#__new__ +lxml.etree.ElementNamespaceClassLookup.get_namespace lxml.etree.ElementNamespaceClassLookup-class.html#get_namespace +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.etree.ElementNamespaceClassLookup.__init__ lxml.etree.ElementNamespaceClassLookup-class.html#__init__ +lxml.etree.ElementTextIterator lxml.etree.ElementTextIterator-class.html +lxml.etree.ElementTextIterator.__new__ lxml.etree.ElementTextIterator-class.html#__new__ +lxml.etree.ElementTextIterator.__next__ lxml.etree.ElementTextIterator-class.html#__next__ +lxml.etree.ElementTextIterator.next lxml.etree.ElementTextIterator-class.html#next +lxml.etree.ElementTextIterator.__iter__ lxml.etree.ElementTextIterator-class.html#__iter__ +lxml.etree.ElementTextIterator.__init__ lxml.etree.ElementTextIterator-class.html#__init__ +lxml.etree.EntityBase lxml.etree.EntityBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Entity.text lxml.etree._Entity-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Entity.tag lxml.etree._Entity-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.EntityBase.__new__ lxml.etree.EntityBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Entity.name lxml.etree._Entity-class.html#name +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Entity.__repr__ lxml.etree._Entity-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.Error lxml.etree.Error-class.html +lxml.etree.ErrorDomains lxml.etree.ErrorDomains-class.html +lxml.etree.ErrorDomains.HTTP lxml.etree.ErrorDomains-class.html#HTTP +lxml.etree.ErrorDomains.SCHEMATRONV lxml.etree.ErrorDomains-class.html#SCHEMATRONV +lxml.etree.ErrorDomains.DTD lxml.etree.ErrorDomains-class.html#DTD +lxml.etree.ErrorDomains.VALID lxml.etree.ErrorDomains-class.html#VALID +lxml.etree.ErrorDomains.I18N lxml.etree.ErrorDomains-class.html#I18N +lxml.etree.ErrorDomains._getName lxml.etree.ErrorDomains-class.html#_getName +lxml.etree.ErrorDomains.C14N lxml.etree.ErrorDomains-class.html#C14N +lxml.etree.ErrorDomains.NONE lxml.etree.ErrorDomains-class.html#NONE +lxml.etree.ErrorDomains.DATATYPE lxml.etree.ErrorDomains-class.html#DATATYPE +lxml.etree.ErrorDomains.XINCLUDE lxml.etree.ErrorDomains-class.html#XINCLUDE +lxml.etree.ErrorDomains.HTML lxml.etree.ErrorDomains-class.html#HTML +lxml.etree.ErrorDomains.CHECK lxml.etree.ErrorDomains-class.html#CHECK +lxml.etree.ErrorDomains.FTP lxml.etree.ErrorDomains-class.html#FTP +lxml.etree.ErrorDomains._names lxml.etree.ErrorDomains-class.html#_names +lxml.etree.ErrorDomains.XSLT lxml.etree.ErrorDomains-class.html#XSLT +lxml.etree.ErrorDomains.PARSER lxml.etree.ErrorDomains-class.html#PARSER +lxml.etree.ErrorDomains.NAMESPACE lxml.etree.ErrorDomains-class.html#NAMESPACE +lxml.etree.ErrorDomains.MODULE lxml.etree.ErrorDomains-class.html#MODULE +lxml.etree.ErrorDomains.IO lxml.etree.ErrorDomains-class.html#IO +lxml.etree.ErrorDomains.REGEXP lxml.etree.ErrorDomains-class.html#REGEXP +lxml.etree.ErrorDomains.XPATH lxml.etree.ErrorDomains-class.html#XPATH +lxml.etree.ErrorDomains.RELAXNGV lxml.etree.ErrorDomains-class.html#RELAXNGV +lxml.etree.ErrorDomains.RELAXNGP lxml.etree.ErrorDomains-class.html#RELAXNGP +lxml.etree.ErrorDomains.WRITER lxml.etree.ErrorDomains-class.html#WRITER +lxml.etree.ErrorDomains.TREE lxml.etree.ErrorDomains-class.html#TREE +lxml.etree.ErrorDomains.SCHEMASP lxml.etree.ErrorDomains-class.html#SCHEMASP +lxml.etree.ErrorDomains.CATALOG lxml.etree.ErrorDomains-class.html#CATALOG +lxml.etree.ErrorDomains.SCHEMASV lxml.etree.ErrorDomains-class.html#SCHEMASV +lxml.etree.ErrorDomains.MEMORY lxml.etree.ErrorDomains-class.html#MEMORY +lxml.etree.ErrorDomains.OUTPUT lxml.etree.ErrorDomains-class.html#OUTPUT +lxml.etree.ErrorDomains.XPOINTER lxml.etree.ErrorDomains-class.html#XPOINTER +lxml.etree.ErrorLevels lxml.etree.ErrorLevels-class.html +lxml.etree.ErrorLevels.NONE lxml.etree.ErrorLevels-class.html#NONE +lxml.etree.ErrorLevels._names lxml.etree.ErrorLevels-class.html#_names +lxml.etree.ErrorLevels.WARNING lxml.etree.ErrorLevels-class.html#WARNING +lxml.etree.ErrorLevels.ERROR lxml.etree.ErrorLevels-class.html#ERROR +lxml.etree.ErrorLevels.FATAL lxml.etree.ErrorLevels-class.html#FATAL +lxml.etree.ErrorLevels._getName lxml.etree.ErrorLevels-class.html#_getName +lxml.etree.ErrorTypes lxml.etree.ErrorTypes-class.html +lxml.etree.ErrorTypes.I18N_CONV_FAILED lxml.etree.ErrorTypes-class.html#I18N_CONV_FAILED +lxml.etree.ErrorTypes.SCHEMAP_ATTRFORMDEFAULT_VALUE lxml.etree.ErrorTypes-class.html#SCHEMAP_ATTRFORMDEFAULT_VALUE +lxml.etree.ErrorTypes.SCHEMAP_REDEFINED_NOTATION lxml.etree.ErrorTypes-class.html#SCHEMAP_REDEFINED_NOTATION +lxml.etree.ErrorTypes.RNGP_EXCEPT_MULTIPLE lxml.etree.ErrorTypes-class.html#RNGP_EXCEPT_MULTIPLE +lxml.etree.ErrorTypes.SCHEMAP_AU_PROPS_CORRECT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_AU_PROPS_CORRECT_2 +lxml.etree.ErrorTypes.IO_EINVAL lxml.etree.ErrorTypes-class.html#IO_EINVAL +lxml.etree.ErrorTypes.ERR_VERSION_MISMATCH lxml.etree.ErrorTypes-class.html#ERR_VERSION_MISMATCH +lxml.etree.ErrorTypes.ERR_ELEMCONTENT_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_ELEMCONTENT_NOT_STARTED +lxml.etree.ErrorTypes.SCHEMAP_TYPE_AND_SUBTYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_TYPE_AND_SUBTYPE +lxml.etree.ErrorTypes.FTP_URL_SYNTAX lxml.etree.ErrorTypes-class.html#FTP_URL_SYNTAX +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP +lxml.etree.ErrorTypes.SCHEMAP_INVALID_ATTR_USE lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_ATTR_USE +lxml.etree.ErrorTypes.CHECK_WRONG_PREV lxml.etree.ErrorTypes-class.html#CHECK_WRONG_PREV +lxml.etree.ErrorTypes.CHECK_NS_SCOPE lxml.etree.ErrorTypes-class.html#CHECK_NS_SCOPE +lxml.etree.ErrorTypes.CHECK_NOT_NS_DECL lxml.etree.ErrorTypes-class.html#CHECK_NOT_NS_DECL +lxml.etree.ErrorTypes.XINCLUDE_XPTR_RESULT lxml.etree.ErrorTypes-class.html#XINCLUDE_XPTR_RESULT +lxml.etree.ErrorTypes.ERR_PEREF_IN_EPILOG lxml.etree.ErrorTypes-class.html#ERR_PEREF_IN_EPILOG +lxml.etree.ErrorTypes.IO_EMLINK lxml.etree.ErrorTypes-class.html#IO_EMLINK +lxml.etree.ErrorTypes.RNGP_PARAM_NAME_MISSING lxml.etree.ErrorTypes-class.html#RNGP_PARAM_NAME_MISSING +lxml.etree.ErrorTypes.WAR_NS_URI_RELATIVE lxml.etree.ErrorTypes-class.html#WAR_NS_URI_RELATIVE +lxml.etree.ErrorTypes.SCHEMAP_SRC_ELEMENT_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ELEMENT_2_2 +lxml.etree.ErrorTypes.RNGP_PARENTREF_NO_NAME lxml.etree.ErrorTypes-class.html#RNGP_PARENTREF_NO_NAME +lxml.etree.ErrorTypes.SCHEMATRONV_ASSERT lxml.etree.ErrorTypes-class.html#SCHEMATRONV_ASSERT +lxml.etree.ErrorTypes.FTP_ACCNT lxml.etree.ErrorTypes-class.html#FTP_ACCNT +lxml.etree.ErrorTypes.RNGP_PAT_START_GROUP lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_GROUP +lxml.etree.ErrorTypes.SCHEMAV_MISSING lxml.etree.ErrorTypes-class.html#SCHEMAV_MISSING +lxml.etree.ErrorTypes.MODULE_OPEN lxml.etree.ErrorTypes-class.html#MODULE_OPEN +lxml.etree.ErrorTypes.XPATH_INVALID_OPERAND lxml.etree.ErrorTypes-class.html#XPATH_INVALID_OPERAND +lxml.etree.ErrorTypes.CHECK_FOUND_NOTATION lxml.etree.ErrorTypes-class.html#CHECK_FOUND_NOTATION +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_1_1 +lxml.etree.ErrorTypes.ERR_UNPARSED_ENTITY lxml.etree.ErrorTypes-class.html#ERR_UNPARSED_ENTITY +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_NOTATION_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_NOTATION_CHILD +lxml.etree.ErrorTypes.CHECK_OUTSIDE_DICT lxml.etree.ErrorTypes-class.html#CHECK_OUTSIDE_DICT +lxml.etree.ErrorTypes.SCHEMAV_NOTEMPTY lxml.etree.ErrorTypes-class.html#SCHEMAV_NOTEMPTY +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_GROUP lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_GROUP +lxml.etree.ErrorTypes.ERR_PEREF_SEMICOL_MISSING lxml.etree.ErrorTypes-class.html#ERR_PEREF_SEMICOL_MISSING +lxml.etree.ErrorTypes.DTD_LOAD_ERROR lxml.etree.ErrorTypes-class.html#DTD_LOAD_ERROR +lxml.etree.ErrorTypes.SCHEMAP_INVALID_BOOLEAN lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_BOOLEAN +lxml.etree.ErrorTypes.DTD_NOT_STANDALONE lxml.etree.ErrorTypes-class.html#DTD_NOT_STANDALONE +lxml.etree.ErrorTypes.SCHEMAP_ST_PROPS_CORRECT_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_ST_PROPS_CORRECT_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ATTRIBUTE_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ATTRIBUTE_1 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ATTRIBUTE_3 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ATTRIBUTE_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ATTRIBUTE_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ATTRIBUTE_2 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ATTRIBUTE_4 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ATTRIBUTE_4 +lxml.etree.ErrorTypes.C14N_INVALID_NODE lxml.etree.ErrorTypes-class.html#C14N_INVALID_NODE +lxml.etree.ErrorTypes.XPATH_START_LITERAL_ERROR lxml.etree.ErrorTypes-class.html#XPATH_START_LITERAL_ERROR +lxml.etree.ErrorTypes.RNGP_TEXT_HAS_CHILD lxml.etree.ErrorTypes-class.html#RNGP_TEXT_HAS_CHILD +lxml.etree.ErrorTypes.SCHEMAV_CVC_WILDCARD lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_WILDCARD +lxml.etree.ErrorTypes.XPATH_UNDEF_VARIABLE_ERROR lxml.etree.ErrorTypes-class.html#XPATH_UNDEF_VARIABLE_ERROR +lxml.etree.ErrorTypes.SCHEMAP_S4S_ATTR_MISSING lxml.etree.ErrorTypes-class.html#SCHEMAP_S4S_ATTR_MISSING +lxml.etree.ErrorTypes.SCHEMAP_INTERNAL lxml.etree.ErrorTypes-class.html#SCHEMAP_INTERNAL +lxml.etree.ErrorTypes.RNGP_EXCEPT_MISSING lxml.etree.ErrorTypes-class.html#RNGP_EXCEPT_MISSING +lxml.etree.ErrorTypes.TREE_INVALID_HEX lxml.etree.ErrorTypes-class.html#TREE_INVALID_HEX +lxml.etree.ErrorTypes.RNGP_DEFINE_CREATE_FAILED lxml.etree.ErrorTypes-class.html#RNGP_DEFINE_CREATE_FAILED +lxml.etree.ErrorTypes.XPATH_ENCODING_ERROR lxml.etree.ErrorTypes-class.html#XPATH_ENCODING_ERROR +lxml.etree.ErrorTypes.SCHEMAV_CVC_IDC lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_IDC +lxml.etree.ErrorTypes.CHECK_NO_ELEM lxml.etree.ErrorTypes-class.html#CHECK_NO_ELEM +lxml.etree.ErrorTypes.IO_EXDEV lxml.etree.ErrorTypes-class.html#IO_EXDEV +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_TYPE +lxml.etree.ErrorTypes.ERR_LT_IN_ATTRIBUTE lxml.etree.ErrorTypes-class.html#ERR_LT_IN_ATTRIBUTE +lxml.etree.ErrorTypes.SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE +lxml.etree.ErrorTypes.IO_EMFILE lxml.etree.ErrorTypes-class.html#IO_EMFILE +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_3_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_3_2_2 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_3_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_3_2_1 +lxml.etree.ErrorTypes.XINCLUDE_XPTR_FAILED lxml.etree.ErrorTypes-class.html#XINCLUDE_XPTR_FAILED +lxml.etree.ErrorTypes.ERR_MISPLACED_CDATA_END lxml.etree.ErrorTypes-class.html#ERR_MISPLACED_CDATA_END +lxml.etree.ErrorTypes.RNGP_ELEMENT_NO_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_ELEMENT_NO_CONTENT +lxml.etree.ErrorTypes.IO_ENOENT lxml.etree.ErrorTypes-class.html#IO_ENOENT +lxml.etree.ErrorTypes.RNGP_ATTRIBUTE_NOOP lxml.etree.ErrorTypes-class.html#RNGP_ATTRIBUTE_NOOP +lxml.etree.ErrorTypes.SCHEMAP_SRC_REDEFINE lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_REDEFINE +lxml.etree.ErrorTypes.ERR_CHARREF_IN_PROLOG lxml.etree.ErrorTypes-class.html#ERR_CHARREF_IN_PROLOG +lxml.etree.ErrorTypes.RNGP_REF_NAME_INVALID lxml.etree.ErrorTypes-class.html#RNGP_REF_NAME_INVALID +lxml.etree.ErrorTypes.ERR_NOTATION_PROCESSING lxml.etree.ErrorTypes-class.html#ERR_NOTATION_PROCESSING +lxml.etree.ErrorTypes.RNGP_INCLUDE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_INCLUDE_EMPTY +lxml.etree.ErrorTypes.RNGP_INCLUDE_RECURSE lxml.etree.ErrorTypes-class.html#RNGP_INCLUDE_RECURSE +lxml.etree.ErrorTypes.SCHEMAP_ELEM_NONAME_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_ELEM_NONAME_NOREF +lxml.etree.ErrorTypes.RNGP_EMPTY_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_EMPTY_CONTENT +lxml.etree.ErrorTypes.XPTR_EVAL_FAILED lxml.etree.ErrorTypes-class.html#XPTR_EVAL_FAILED +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_2_1 +lxml.etree.ErrorTypes.XPATH_INVALID_CTXT_POSITION lxml.etree.ErrorTypes-class.html#XPATH_INVALID_CTXT_POSITION +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_2_3 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_2_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_2_4 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_2_4 +lxml.etree.ErrorTypes.ERR_INTERNAL_ERROR lxml.etree.ErrorTypes-class.html#ERR_INTERNAL_ERROR +lxml.etree.ErrorTypes.ERR_DOCTYPE_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_DOCTYPE_NOT_FINISHED +lxml.etree.ErrorTypes.RNGP_PAT_NSNAME_EXCEPT_ANYNAME lxml.etree.ErrorTypes-class.html#RNGP_PAT_NSNAME_EXCEPT_ANYNAME +lxml.etree.ErrorTypes.RNGP_EMPTY_NOT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_EMPTY_NOT_EMPTY +lxml.etree.ErrorTypes.SCHEMAP_NO_XMLNS lxml.etree.ErrorTypes-class.html#SCHEMAP_NO_XMLNS +lxml.etree.ErrorTypes.RNGP_PAT_LIST_ATTR lxml.etree.ErrorTypes-class.html#RNGP_PAT_LIST_ATTR +lxml.etree.ErrorTypes.ERR_NO_DTD lxml.etree.ErrorTypes-class.html#ERR_NO_DTD +lxml.etree.ErrorTypes.ERR_ENTITY_LOOP lxml.etree.ErrorTypes-class.html#ERR_ENTITY_LOOP +lxml.etree.ErrorTypes.IO_EINTR lxml.etree.ErrorTypes-class.html#IO_EINTR +lxml.etree.ErrorTypes.ERR_MISSING_ENCODING lxml.etree.ErrorTypes-class.html#ERR_MISSING_ENCODING +lxml.etree.ErrorTypes.DTD_STANDALONE_WHITE_SPACE lxml.etree.ErrorTypes-class.html#DTD_STANDALONE_WHITE_SPACE +lxml.etree.ErrorTypes.DTD_ENTITY_TYPE lxml.etree.ErrorTypes-class.html#DTD_ENTITY_TYPE +lxml.etree.ErrorTypes.IO_ENOTEMPTY lxml.etree.ErrorTypes-class.html#IO_ENOTEMPTY +lxml.etree.ErrorTypes.RNGP_REF_NO_NAME lxml.etree.ErrorTypes-class.html#RNGP_REF_NO_NAME +lxml.etree.ErrorTypes.XINCLUDE_MULTIPLE_ROOT lxml.etree.ErrorTypes-class.html#XINCLUDE_MULTIPLE_ROOT +lxml.etree.ErrorTypes.SCHEMAV_NOTYPE lxml.etree.ErrorTypes-class.html#SCHEMAV_NOTYPE +lxml.etree.ErrorTypes.RNGP_ELEMENT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_ELEMENT_EMPTY +lxml.etree.ErrorTypes.IO_ECANCELED lxml.etree.ErrorTypes-class.html#IO_ECANCELED +lxml.etree.ErrorTypes.RNGP_EXCEPT_NO_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_EXCEPT_NO_CONTENT +lxml.etree.ErrorTypes.WAR_NS_COLUMN lxml.etree.ErrorTypes-class.html#WAR_NS_COLUMN +lxml.etree.ErrorTypes.IO_ENOTSOCK lxml.etree.ErrorTypes-class.html#IO_ENOTSOCK +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_DERIVED_OK_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_DERIVED_OK_2_1 +lxml.etree.ErrorTypes.ERR_URI_FRAGMENT lxml.etree.ErrorTypes-class.html#ERR_URI_FRAGMENT +lxml.etree.ErrorTypes.SCHEMAV_NOTNILLABLE lxml.etree.ErrorTypes-class.html#SCHEMAV_NOTNILLABLE +lxml.etree.ErrorTypes.RNGP_PAT_LIST_TEXT lxml.etree.ErrorTypes-class.html#RNGP_PAT_LIST_TEXT +lxml.etree.ErrorTypes.SCHEMAV_UNDECLAREDELEM lxml.etree.ErrorTypes-class.html#SCHEMAV_UNDECLAREDELEM +lxml.etree.ErrorTypes.SCHEMAP_AG_PROPS_CORRECT lxml.etree.ErrorTypes-class.html#SCHEMAP_AG_PROPS_CORRECT +lxml.etree.ErrorTypes.IO_ENOMEM lxml.etree.ErrorTypes-class.html#IO_ENOMEM +lxml.etree.ErrorTypes.ERR_NOTATION_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_NOTATION_NOT_STARTED +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_ELEM_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_ELEM_CHILD +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_4_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_4_1 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_4_3 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_4_3 +lxml.etree.ErrorTypes.DTD_NO_DOC lxml.etree.ErrorTypes-class.html#DTD_NO_DOC +lxml.etree.ErrorTypes.RNGP_TYPE_NOT_FOUND lxml.etree.ErrorTypes-class.html#RNGP_TYPE_NOT_FOUND +lxml.etree.ErrorTypes.DTD_NO_ROOT lxml.etree.ErrorTypes-class.html#DTD_NO_ROOT +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_ATTRGRP_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_ATTRGRP_CHILD +lxml.etree.ErrorTypes.IO_EACCES lxml.etree.ErrorTypes-class.html#IO_EACCES +lxml.etree.ErrorTypes._names lxml.etree.ErrorTypes-class.html#_names +lxml.etree.ErrorTypes.SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES +lxml.etree.ErrorTypes.ERR_RESERVED_XML_NAME lxml.etree.ErrorTypes-class.html#ERR_RESERVED_XML_NAME +lxml.etree.ErrorTypes.RNGP_TEXT_EXPECTED lxml.etree.ErrorTypes-class.html#RNGP_TEXT_EXPECTED +lxml.etree.ErrorTypes.RNGP_CHOICE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_CHOICE_EMPTY +lxml.etree.ErrorTypes.ERR_TAG_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_TAG_NOT_FINISHED +lxml.etree.ErrorTypes.CHECK_FOUND_TEXT lxml.etree.ErrorTypes-class.html#CHECK_FOUND_TEXT +lxml.etree.ErrorTypes.IO_ENFILE lxml.etree.ErrorTypes-class.html#IO_ENFILE +lxml.etree.ErrorTypes.RNGP_PAT_ONEMORE_GROUP_ATTR lxml.etree.ErrorTypes-class.html#RNGP_PAT_ONEMORE_GROUP_ATTR +lxml.etree.ErrorTypes.SCHEMAV_CVC_ENUMERATION_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ENUMERATION_VALID +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_RESTRICTION_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_RESTRICTION_CHILD +lxml.etree.ErrorTypes.DTD_ELEM_REDEFINED lxml.etree.ErrorTypes-class.html#DTD_ELEM_REDEFINED +lxml.etree.ErrorTypes.RNGP_MISSING_HREF lxml.etree.ErrorTypes-class.html#RNGP_MISSING_HREF +lxml.etree.ErrorTypes.IO_ERANGE lxml.etree.ErrorTypes-class.html#IO_ERANGE +lxml.etree.ErrorTypes.HTTP_UNKNOWN_HOST lxml.etree.ErrorTypes-class.html#HTTP_UNKNOWN_HOST +lxml.etree.ErrorTypes.RNGP_PAT_START_ATTR lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_ATTR +lxml.etree.ErrorTypes.SCHEMAP_NOTATION_NO_NAME lxml.etree.ErrorTypes-class.html#SCHEMAP_NOTATION_NO_NAME +lxml.etree.ErrorTypes.NS_ERR_COLON lxml.etree.ErrorTypes-class.html#NS_ERR_COLON +lxml.etree.ErrorTypes.ERR_PEREF_IN_INT_SUBSET lxml.etree.ErrorTypes-class.html#ERR_PEREF_IN_INT_SUBSET +lxml.etree.ErrorTypes.RNGP_VALUE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_VALUE_EMPTY +lxml.etree.ErrorTypes.WAR_UNKNOWN_VERSION lxml.etree.ErrorTypes-class.html#WAR_UNKNOWN_VERSION +lxml.etree.ErrorTypes.SCHEMAV_ISABSTRACT lxml.etree.ErrorTypes-class.html#SCHEMAV_ISABSTRACT +lxml.etree.ErrorTypes.IO_EMSGSIZE lxml.etree.ErrorTypes-class.html#IO_EMSGSIZE +lxml.etree.ErrorTypes.CATALOG_ENTRY_BROKEN lxml.etree.ErrorTypes-class.html#CATALOG_ENTRY_BROKEN +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_1_2 +lxml.etree.ErrorTypes.RNGP_CREATE_FAILURE lxml.etree.ErrorTypes-class.html#RNGP_CREATE_FAILURE +lxml.etree.ErrorTypes.ERR_NAME_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_NAME_REQUIRED +lxml.etree.ErrorTypes.SCHEMAP_S4S_ATTR_NOT_ALLOWED lxml.etree.ErrorTypes-class.html#SCHEMAP_S4S_ATTR_NOT_ALLOWED +lxml.etree.ErrorTypes.ERR_ATTLIST_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_ATTLIST_NOT_FINISHED +lxml.etree.ErrorTypes._getName lxml.etree.ErrorTypes-class.html#_getName +lxml.etree.ErrorTypes.XPTR_EXTRA_OBJECTS lxml.etree.ErrorTypes-class.html#XPTR_EXTRA_OBJECTS +lxml.etree.ErrorTypes.IO_EISCONN lxml.etree.ErrorTypes-class.html#IO_EISCONN +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_CHOICE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_CHOICE_CHILD +lxml.etree.ErrorTypes.ERR_PUBID_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_PUBID_REQUIRED +lxml.etree.ErrorTypes.SCHEMAP_NOTHING_TO_PARSE lxml.etree.ErrorTypes-class.html#SCHEMAP_NOTHING_TO_PARSE +lxml.etree.ErrorTypes.RNGP_NOTALLOWED_NOT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_NOTALLOWED_NOT_EMPTY +lxml.etree.ErrorTypes.RNGP_REF_NOT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_REF_NOT_EMPTY +lxml.etree.ErrorTypes.SCHEMAP_DEF_AND_PREFIX lxml.etree.ErrorTypes-class.html#SCHEMAP_DEF_AND_PREFIX +lxml.etree.ErrorTypes.ERR_NOTATION_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_NOTATION_NOT_FINISHED +lxml.etree.ErrorTypes.RNGP_ATTRIBUTE_CHILDREN lxml.etree.ErrorTypes-class.html#RNGP_ATTRIBUTE_CHILDREN +lxml.etree.ErrorTypes.RNGP_PAT_START_DATA lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_DATA +lxml.etree.ErrorTypes.RNGP_ELEMENT_NAME lxml.etree.ErrorTypes-class.html#RNGP_ELEMENT_NAME +lxml.etree.ErrorTypes.XPATH_UNKNOWN_FUNC_ERROR lxml.etree.ErrorTypes-class.html#XPATH_UNKNOWN_FUNC_ERROR +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_INTERLEAVE lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_INTERLEAVE +lxml.etree.ErrorTypes.ERR_VERSION_MISSING lxml.etree.ErrorTypes-class.html#ERR_VERSION_MISSING +lxml.etree.ErrorTypes.RNGP_DEFINE_MISSING lxml.etree.ErrorTypes-class.html#RNGP_DEFINE_MISSING +lxml.etree.ErrorTypes.CATALOG_NOT_CATALOG lxml.etree.ErrorTypes-class.html#CATALOG_NOT_CATALOG +lxml.etree.ErrorTypes.XINCLUDE_TEXT_DOCUMENT lxml.etree.ErrorTypes-class.html#XINCLUDE_TEXT_DOCUMENT +lxml.etree.ErrorTypes.DTD_NO_ELEM_NAME lxml.etree.ErrorTypes-class.html#DTD_NO_ELEM_NAME +lxml.etree.ErrorTypes.ERR_UNSUPPORTED_ENCODING lxml.etree.ErrorTypes-class.html#ERR_UNSUPPORTED_ENCODING +lxml.etree.ErrorTypes.ERR_ENTITY_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_ENTITY_NOT_STARTED +lxml.etree.ErrorTypes.SCHEMAV_ATTRUNKNOWN lxml.etree.ErrorTypes-class.html#SCHEMAV_ATTRUNKNOWN +lxml.etree.ErrorTypes.DTD_ELEM_DEFAULT_NAMESPACE lxml.etree.ErrorTypes-class.html#DTD_ELEM_DEFAULT_NAMESPACE +lxml.etree.ErrorTypes.IO_EDOM lxml.etree.ErrorTypes-class.html#IO_EDOM +lxml.etree.ErrorTypes.ERR_NO_MEMORY lxml.etree.ErrorTypes-class.html#ERR_NO_MEMORY +lxml.etree.ErrorTypes.RNGP_GROUP_ATTR_CONFLICT lxml.etree.ErrorTypes-class.html#RNGP_GROUP_ATTR_CONFLICT +lxml.etree.ErrorTypes.FTP_EPSV_ANSWER lxml.etree.ErrorTypes-class.html#FTP_EPSV_ANSWER +lxml.etree.ErrorTypes.IO_ENOTTY lxml.etree.ErrorTypes-class.html#IO_ENOTTY +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 +lxml.etree.ErrorTypes.IO_EFAULT lxml.etree.ErrorTypes-class.html#IO_EFAULT +lxml.etree.ErrorTypes.SCHEMAP_COS_CT_EXTENDS_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_CT_EXTENDS_1_1 +lxml.etree.ErrorTypes.SCHEMAV_ELEMCONT lxml.etree.ErrorTypes-class.html#SCHEMAV_ELEMCONT +lxml.etree.ErrorTypes.IO_ECHILD lxml.etree.ErrorTypes-class.html#IO_ECHILD +lxml.etree.ErrorTypes.ERR_VALUE_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_VALUE_REQUIRED +lxml.etree.ErrorTypes.SCHEMAP_COS_VALID_DEFAULT_2_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_VALID_DEFAULT_2_2_1 +lxml.etree.ErrorTypes.ERR_PCDATA_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_PCDATA_REQUIRED +lxml.etree.ErrorTypes.RNGP_PAT_START_TEXT lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_TEXT +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_1_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_1_3_1 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_1_3_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_1_3_2 +lxml.etree.ErrorTypes.RNGP_INTERLEAVE_CREATE_FAILED lxml.etree.ErrorTypes-class.html#RNGP_INTERLEAVE_CREATE_FAILED +lxml.etree.ErrorTypes.CHECK_WRONG_NAME lxml.etree.ErrorTypes-class.html#CHECK_WRONG_NAME +lxml.etree.ErrorTypes.XPATH_INVALID_CHAR_ERROR lxml.etree.ErrorTypes-class.html#XPATH_INVALID_CHAR_ERROR +lxml.etree.ErrorTypes.DTD_UNKNOWN_ID lxml.etree.ErrorTypes-class.html#DTD_UNKNOWN_ID +lxml.etree.ErrorTypes.ERR_INVALID_HEX_CHARREF lxml.etree.ErrorTypes-class.html#ERR_INVALID_HEX_CHARREF +lxml.etree.ErrorTypes.SCHEMAV_CVC_MAXLENGTH_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_MAXLENGTH_VALID +lxml.etree.ErrorTypes.ERR_ENTITY_CHAR_ERROR lxml.etree.ErrorTypes-class.html#ERR_ENTITY_CHAR_ERROR +lxml.etree.ErrorTypes.DTD_ID_SUBSET lxml.etree.ErrorTypes-class.html#DTD_ID_SUBSET +lxml.etree.ErrorTypes.IO_LOAD_ERROR lxml.etree.ErrorTypes-class.html#IO_LOAD_ERROR +lxml.etree.ErrorTypes.ERR_INVALID_ENCODING lxml.etree.ErrorTypes-class.html#ERR_INVALID_ENCODING +lxml.etree.ErrorTypes.SCHEMAP_COS_ALL_LIMITED lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ALL_LIMITED +lxml.etree.ErrorTypes.IO_EIO lxml.etree.ErrorTypes-class.html#IO_EIO +lxml.etree.ErrorTypes.RNGP_DEFINE_NAME_MISSING lxml.etree.ErrorTypes-class.html#RNGP_DEFINE_NAME_MISSING +lxml.etree.ErrorTypes.IO_ENOTDIR lxml.etree.ErrorTypes-class.html#IO_ENOTDIR +lxml.etree.ErrorTypes.XINCLUDE_TEXT_FRAGMENT lxml.etree.ErrorTypes-class.html#XINCLUDE_TEXT_FRAGMENT +lxml.etree.ErrorTypes.SCHEMAP_MISSING_SIMPLETYPE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_MISSING_SIMPLETYPE_CHILD +lxml.etree.ErrorTypes.DTD_NOT_PCDATA lxml.etree.ErrorTypes-class.html#DTD_NOT_PCDATA +lxml.etree.ErrorTypes.ERR_INVALID_URI lxml.etree.ErrorTypes-class.html#ERR_INVALID_URI +lxml.etree.ErrorTypes.SCHEMAV_VALUE lxml.etree.ErrorTypes-class.html#SCHEMAV_VALUE +lxml.etree.ErrorTypes.XPATH_INVALID_PREDICATE_ERROR lxml.etree.ErrorTypes-class.html#XPATH_INVALID_PREDICATE_ERROR +lxml.etree.ErrorTypes.IO_ENOEXEC lxml.etree.ErrorTypes-class.html#IO_ENOEXEC +lxml.etree.ErrorTypes.RNGP_GRAMMAR_NO_START lxml.etree.ErrorTypes-class.html#RNGP_GRAMMAR_NO_START +lxml.etree.ErrorTypes.ERR_XMLDECL_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_XMLDECL_NOT_FINISHED +lxml.etree.ErrorTypes.RNGP_REF_NO_DEF lxml.etree.ErrorTypes-class.html#RNGP_REF_NO_DEF +lxml.etree.ErrorTypes.RNGP_NEED_COMBINE lxml.etree.ErrorTypes-class.html#RNGP_NEED_COMBINE +lxml.etree.ErrorTypes.ERR_STANDALONE_VALUE lxml.etree.ErrorTypes-class.html#ERR_STANDALONE_VALUE +lxml.etree.ErrorTypes.SCHEMAP_INVALID_ATTR_NAME lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_ATTR_NAME +lxml.etree.ErrorTypes.SCHEMAP_CT_PROPS_CORRECT_4 lxml.etree.ErrorTypes-class.html#SCHEMAP_CT_PROPS_CORRECT_4 +lxml.etree.ErrorTypes.IO_ENOSYS lxml.etree.ErrorTypes-class.html#IO_ENOSYS +lxml.etree.ErrorTypes.SCHEMAP_ELEMFORMDEFAULT_VALUE lxml.etree.ErrorTypes-class.html#SCHEMAP_ELEMFORMDEFAULT_VALUE +lxml.etree.ErrorTypes.ERR_STRING_NOT_CLOSED lxml.etree.ErrorTypes-class.html#ERR_STRING_NOT_CLOSED +lxml.etree.ErrorTypes.SCHEMAP_CT_PROPS_CORRECT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_CT_PROPS_CORRECT_2 +lxml.etree.ErrorTypes.SCHEMAP_CT_PROPS_CORRECT_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_CT_PROPS_CORRECT_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_AU lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_AU +lxml.etree.ErrorTypes.RNGP_FORBIDDEN_ATTRIBUTE lxml.etree.ErrorTypes-class.html#RNGP_FORBIDDEN_ATTRIBUTE +lxml.etree.ErrorTypes.ERR_PI_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_PI_NOT_FINISHED +lxml.etree.ErrorTypes.XPATH_EXPR_ERROR lxml.etree.ErrorTypes-class.html#XPATH_EXPR_ERROR +lxml.etree.ErrorTypes.RNGP_NSNAME_NO_NS lxml.etree.ErrorTypes-class.html#RNGP_NSNAME_NO_NS +lxml.etree.ErrorTypes.NS_ERR_EMPTY lxml.etree.ErrorTypes-class.html#NS_ERR_EMPTY +lxml.etree.ErrorTypes.ERR_HYPHEN_IN_COMMENT lxml.etree.ErrorTypes-class.html#ERR_HYPHEN_IN_COMMENT +lxml.etree.ErrorTypes.XPATH_NUMBER_ERROR lxml.etree.ErrorTypes-class.html#XPATH_NUMBER_ERROR +lxml.etree.ErrorTypes.RNGP_PARENTREF_NOT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_PARENTREF_NOT_EMPTY +lxml.etree.ErrorTypes.ERR_PI_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_PI_NOT_STARTED +lxml.etree.ErrorTypes.RNGP_TYPE_MISSING lxml.etree.ErrorTypes-class.html#RNGP_TYPE_MISSING +lxml.etree.ErrorTypes.IO_EPERM lxml.etree.ErrorTypes-class.html#IO_EPERM +lxml.etree.ErrorTypes.ERR_COMMENT_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_COMMENT_NOT_FINISHED +lxml.etree.ErrorTypes.DTD_CONTENT_ERROR lxml.etree.ErrorTypes-class.html#DTD_CONTENT_ERROR +lxml.etree.ErrorTypes.DTD_NOTATION_VALUE lxml.etree.ErrorTypes-class.html#DTD_NOTATION_VALUE +lxml.etree.ErrorTypes.RNGP_URI_NOT_ABSOLUTE lxml.etree.ErrorTypes-class.html#RNGP_URI_NOT_ABSOLUTE +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_3_1 +lxml.etree.ErrorTypes.XPATH_VARIABLE_REF_ERROR lxml.etree.ErrorTypes-class.html#XPATH_VARIABLE_REF_ERROR +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_3_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_3_2 +lxml.etree.ErrorTypes.RNGP_INTERLEAVE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_INTERLEAVE_EMPTY +lxml.etree.ErrorTypes.C14N_UNKNOW_NODE lxml.etree.ErrorTypes-class.html#C14N_UNKNOW_NODE +lxml.etree.ErrorTypes.SCHEMAP_INVALID_MAXOCCURS lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_MAXOCCURS +lxml.etree.ErrorTypes.SCHEMAV_NOTTOPLEVEL lxml.etree.ErrorTypes-class.html#SCHEMAV_NOTTOPLEVEL +lxml.etree.ErrorTypes.SCHEMAP_WILDCARD_INVALID_NS_MEMBER lxml.etree.ErrorTypes-class.html#SCHEMAP_WILDCARD_INVALID_NS_MEMBER +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_LIST_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_LIST_CHILD +lxml.etree.ErrorTypes.WAR_LANG_VALUE lxml.etree.ErrorTypes-class.html#WAR_LANG_VALUE +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_PREFIX lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_PREFIX +lxml.etree.ErrorTypes.ERR_STRING_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_STRING_NOT_STARTED +lxml.etree.ErrorTypes.SCHEMAP_RECURSIVE lxml.etree.ErrorTypes-class.html#SCHEMAP_RECURSIVE +lxml.etree.ErrorTypes.CHECK_ENTITY_TYPE lxml.etree.ErrorTypes-class.html#CHECK_ENTITY_TYPE +lxml.etree.ErrorTypes.RNGP_EMPTY_CONSTRUCT lxml.etree.ErrorTypes-class.html#RNGP_EMPTY_CONSTRUCT +lxml.etree.ErrorTypes.RNGP_CHOICE_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_CHOICE_CONTENT +lxml.etree.ErrorTypes.XINCLUDE_RECURSION lxml.etree.ErrorTypes-class.html#XINCLUDE_RECURSION +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_INCLUDE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_INCLUDE_CHILD +lxml.etree.ErrorTypes.ERR_ENTITY_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_ENTITY_NOT_FINISHED +lxml.etree.ErrorTypes.IO_ENAMETOOLONG lxml.etree.ErrorTypes-class.html#IO_ENAMETOOLONG +lxml.etree.ErrorTypes.DTD_EMPTY_NOTATION lxml.etree.ErrorTypes-class.html#DTD_EMPTY_NOTATION +lxml.etree.ErrorTypes.ERR_EXT_SUBSET_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_EXT_SUBSET_NOT_FINISHED +lxml.etree.ErrorTypes.SCHEMAP_REGEXP_INVALID lxml.etree.ErrorTypes-class.html#SCHEMAP_REGEXP_INVALID +lxml.etree.ErrorTypes.SCHEMAV_CVC_MINEXCLUSIVE_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_MINEXCLUSIVE_VALID +lxml.etree.ErrorTypes.RNGP_PREFIX_UNDEFINED lxml.etree.ErrorTypes-class.html#RNGP_PREFIX_UNDEFINED +lxml.etree.ErrorTypes.DTD_CONTENT_MODEL lxml.etree.ErrorTypes-class.html#DTD_CONTENT_MODEL +lxml.etree.ErrorTypes.ERR_ENTITY_PROCESSING lxml.etree.ErrorTypes-class.html#ERR_ENTITY_PROCESSING +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_TEXT lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_TEXT +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_4 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_4 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_2 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_1 +lxml.etree.ErrorTypes.SCHEMAP_INCLUDE_SCHEMA_NO_URI lxml.etree.ErrorTypes-class.html#SCHEMAP_INCLUDE_SCHEMA_NO_URI +lxml.etree.ErrorTypes.CHECK_X lxml.etree.ErrorTypes-class.html#CHECK_X +lxml.etree.ErrorTypes.SCHEMAP_COS_CT_EXTENDS_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_CT_EXTENDS_1_2 +lxml.etree.ErrorTypes.SCHEMAP_COS_CT_EXTENDS_1_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_CT_EXTENDS_1_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_3_1 +lxml.etree.ErrorTypes.DTD_CONTENT_NOT_DETERMINIST lxml.etree.ErrorTypes-class.html#DTD_CONTENT_NOT_DETERMINIST +lxml.etree.ErrorTypes.SCHEMAV_NOROLLBACK lxml.etree.ErrorTypes-class.html#SCHEMAV_NOROLLBACK +lxml.etree.ErrorTypes.ERR_DOCUMENT_END lxml.etree.ErrorTypes-class.html#ERR_DOCUMENT_END +lxml.etree.ErrorTypes.ERR_ENTITYREF_IN_EPILOG lxml.etree.ErrorTypes-class.html#ERR_ENTITYREF_IN_EPILOG +lxml.etree.ErrorTypes.XINCLUDE_INVALID_CHAR lxml.etree.ErrorTypes-class.html#XINCLUDE_INVALID_CHAR +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_FACET_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_FACET_CHILD +lxml.etree.ErrorTypes.RNGP_DEFINE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_DEFINE_EMPTY +lxml.etree.ErrorTypes.RNGP_PAT_ATTR_ELEM lxml.etree.ErrorTypes-class.html#RNGP_PAT_ATTR_ELEM +lxml.etree.ErrorTypes.SCHEMAP_INVALID_ATTR_INLINE_COMBINATION lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_ATTR_INLINE_COMBINATION +lxml.etree.ErrorTypes.RNGP_PAT_START_INTERLEAVE lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_INTERLEAVE +lxml.etree.ErrorTypes.I18N_EXCESS_HANDLER lxml.etree.ErrorTypes-class.html#I18N_EXCESS_HANDLER +lxml.etree.ErrorTypes.IO_ENETUNREACH lxml.etree.ErrorTypes-class.html#IO_ENETUNREACH +lxml.etree.ErrorTypes.RNGP_INVALID_VALUE lxml.etree.ErrorTypes-class.html#RNGP_INVALID_VALUE +lxml.etree.ErrorTypes.IO_NO_INPUT lxml.etree.ErrorTypes-class.html#IO_NO_INPUT +lxml.etree.ErrorTypes.RNGP_PAT_START_LIST lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_LIST +lxml.etree.ErrorTypes.SCHEMAP_P_PROPS_CORRECT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_P_PROPS_CORRECT_1 +lxml.etree.ErrorTypes.ERR_ATTRIBUTE_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_ATTRIBUTE_NOT_STARTED +lxml.etree.ErrorTypes.CHECK_NOT_ATTR lxml.etree.ErrorTypes-class.html#CHECK_NOT_ATTR +lxml.etree.ErrorTypes.CHECK_NOT_ENTITY_DECL lxml.etree.ErrorTypes-class.html#CHECK_NOT_ENTITY_DECL +lxml.etree.ErrorTypes.ERR_ENTITYREF_IN_PROLOG lxml.etree.ErrorTypes-class.html#ERR_ENTITYREF_IN_PROLOG +lxml.etree.ErrorTypes.ERR_PEREF_NO_NAME lxml.etree.ErrorTypes-class.html#ERR_PEREF_NO_NAME +lxml.etree.ErrorTypes.RNGP_FOREIGN_ELEMENT lxml.etree.ErrorTypes-class.html#RNGP_FOREIGN_ELEMENT +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 +lxml.etree.ErrorTypes.CHECK_NOT_ATTR_DECL lxml.etree.ErrorTypes-class.html#CHECK_NOT_ATTR_DECL +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_FACET_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_FACET_TYPE +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_2 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 +lxml.etree.ErrorTypes.XINCLUDE_HREF_URI lxml.etree.ErrorTypes-class.html#XINCLUDE_HREF_URI +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 +lxml.etree.ErrorTypes.ERR_SEPARATOR_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_SEPARATOR_REQUIRED +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 +lxml.etree.ErrorTypes.FTP_PASV_ANSWER lxml.etree.ErrorTypes-class.html#FTP_PASV_ANSWER +lxml.etree.ErrorTypes.SAVE_NO_DOCTYPE lxml.etree.ErrorTypes-class.html#SAVE_NO_DOCTYPE +lxml.etree.ErrorTypes.DTD_NO_PREFIX lxml.etree.ErrorTypes-class.html#DTD_NO_PREFIX +lxml.etree.ErrorTypes.ERR_MIXED_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_MIXED_NOT_STARTED +lxml.etree.ErrorTypes.ERR_ENTITYREF_SEMICOL_MISSING lxml.etree.ErrorTypes-class.html#ERR_ENTITYREF_SEMICOL_MISSING +lxml.etree.ErrorTypes.ERR_CONDSEC_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_CONDSEC_NOT_FINISHED +lxml.etree.ErrorTypes.RNGP_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_EMPTY +lxml.etree.ErrorTypes.RNGP_PARENTREF_NO_PARENT lxml.etree.ErrorTypes-class.html#RNGP_PARENTREF_NO_PARENT +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_ELEM lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_ELEM +lxml.etree.ErrorTypes.WAR_SPACE_VALUE lxml.etree.ErrorTypes-class.html#WAR_SPACE_VALUE +lxml.etree.ErrorTypes.ERR_MIXED_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_MIXED_NOT_FINISHED +lxml.etree.ErrorTypes.SCHEMAP_WARN_ATTR_POINTLESS_PROH lxml.etree.ErrorTypes-class.html#SCHEMAP_WARN_ATTR_POINTLESS_PROH +lxml.etree.ErrorTypes.RNGP_START_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_START_CONTENT +lxml.etree.ErrorTypes.RNGP_DEF_CHOICE_AND_INTERLEAVE lxml.etree.ErrorTypes-class.html#RNGP_DEF_CHOICE_AND_INTERLEAVE +lxml.etree.ErrorTypes.SCHEMAV_CVC_MAXINCLUSIVE_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_MAXINCLUSIVE_VALID +lxml.etree.ErrorTypes.CATALOG_MISSING_ATTR lxml.etree.ErrorTypes-class.html#CATALOG_MISSING_ATTR +lxml.etree.ErrorTypes.SCHEMAV_CONSTRUCT lxml.etree.ErrorTypes-class.html#SCHEMAV_CONSTRUCT +lxml.etree.ErrorTypes.ERR_ATTRIBUTE_REDEFINED lxml.etree.ErrorTypes-class.html#ERR_ATTRIBUTE_REDEFINED +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_REF lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_REF +lxml.etree.ErrorTypes.SCHEMAV_CVC_MAXEXCLUSIVE_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_MAXEXCLUSIVE_VALID +lxml.etree.ErrorTypes.RNGP_ANYNAME_ATTR_ANCESTOR lxml.etree.ErrorTypes-class.html#RNGP_ANYNAME_ATTR_ANCESTOR +lxml.etree.ErrorTypes.DTD_DIFFERENT_PREFIX lxml.etree.ErrorTypes-class.html#DTD_DIFFERENT_PREFIX +lxml.etree.ErrorTypes.RNGP_EXTERNAL_REF_FAILURE lxml.etree.ErrorTypes-class.html#RNGP_EXTERNAL_REF_FAILURE +lxml.etree.ErrorTypes.CATALOG_PREFER_VALUE lxml.etree.ErrorTypes-class.html#CATALOG_PREFER_VALUE +lxml.etree.ErrorTypes.XPTR_RESOURCE_ERROR lxml.etree.ErrorTypes-class.html#XPTR_RESOURCE_ERROR +lxml.etree.ErrorTypes.DTD_ATTRIBUTE_REDEFINED lxml.etree.ErrorTypes-class.html#DTD_ATTRIBUTE_REDEFINED +lxml.etree.ErrorTypes.XPATH_MEMORY_ERROR lxml.etree.ErrorTypes-class.html#XPATH_MEMORY_ERROR +lxml.etree.ErrorTypes.IO_EBADMSG lxml.etree.ErrorTypes-class.html#IO_EBADMSG +lxml.etree.ErrorTypes.IO_ENCODER lxml.etree.ErrorTypes-class.html#IO_ENCODER +lxml.etree.ErrorTypes.RNGP_ELEM_TEXT_CONFLICT lxml.etree.ErrorTypes-class.html#RNGP_ELEM_TEXT_CONFLICT +lxml.etree.ErrorTypes.ERR_INVALID_CHARREF lxml.etree.ErrorTypes-class.html#ERR_INVALID_CHARREF +lxml.etree.ErrorTypes.SCHEMAP_ST_PROPS_CORRECT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_ST_PROPS_CORRECT_1 +lxml.etree.ErrorTypes.SCHEMAP_ST_PROPS_CORRECT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_ST_PROPS_CORRECT_2 +lxml.etree.ErrorTypes.ERR_ENTITYREF_IN_DTD lxml.etree.ErrorTypes-class.html#ERR_ENTITYREF_IN_DTD +lxml.etree.ErrorTypes.SCHEMAP_S4S_ATTR_INVALID_VALUE lxml.etree.ErrorTypes-class.html#SCHEMAP_S4S_ATTR_INVALID_VALUE +lxml.etree.ErrorTypes.RNGP_INVALID_URI lxml.etree.ErrorTypes-class.html#RNGP_INVALID_URI +lxml.etree.ErrorTypes.RNGP_XMLNS_NAME lxml.etree.ErrorTypes-class.html#RNGP_XMLNS_NAME +lxml.etree.ErrorTypes.IO_ESPIPE lxml.etree.ErrorTypes-class.html#IO_ESPIPE +lxml.etree.ErrorTypes.CHECK_FOUND_ENTITY lxml.etree.ErrorTypes-class.html#CHECK_FOUND_ENTITY +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD +lxml.etree.ErrorTypes.RNGP_GRAMMAR_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_GRAMMAR_EMPTY +lxml.etree.ErrorTypes.RNGP_REF_CREATE_FAILED lxml.etree.ErrorTypes-class.html#RNGP_REF_CREATE_FAILED +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 +lxml.etree.ErrorTypes.ERR_CDATA_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_CDATA_NOT_FINISHED +lxml.etree.ErrorTypes.ERR_LTSLASH_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_LTSLASH_REQUIRED +lxml.etree.ErrorTypes.SCHEMAV_NOTDETERMINIST lxml.etree.ErrorTypes-class.html#SCHEMAV_NOTDETERMINIST +lxml.etree.ErrorTypes.IO_FLUSH lxml.etree.ErrorTypes-class.html#IO_FLUSH +lxml.etree.ErrorTypes.ERR_CHARREF_AT_EOF lxml.etree.ErrorTypes-class.html#ERR_CHARREF_AT_EOF +lxml.etree.ErrorTypes.HTML_STRUCURE_ERROR lxml.etree.ErrorTypes-class.html#HTML_STRUCURE_ERROR +lxml.etree.ErrorTypes.IO_EBADF lxml.etree.ErrorTypes-class.html#IO_EBADF +lxml.etree.ErrorTypes.SCHEMAP_ATTR_NONAME_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_ATTR_NONAME_NOREF +lxml.etree.ErrorTypes.SCHEMAP_FAILED_BUILD_IMPORT lxml.etree.ErrorTypes-class.html#SCHEMAP_FAILED_BUILD_IMPORT +lxml.etree.ErrorTypes.CHECK_WRONG_PARENT lxml.etree.ErrorTypes-class.html#CHECK_WRONG_PARENT +lxml.etree.ErrorTypes.DTD_NOTATION_REDEFINED lxml.etree.ErrorTypes-class.html#DTD_NOTATION_REDEFINED +lxml.etree.ErrorTypes.ERR_ATTLIST_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_ATTLIST_NOT_STARTED +lxml.etree.ErrorTypes.XPATH_UNCLOSED_ERROR lxml.etree.ErrorTypes-class.html#XPATH_UNCLOSED_ERROR +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_2 +lxml.etree.ErrorTypes.RNGP_PAT_NSNAME_EXCEPT_NSNAME lxml.etree.ErrorTypes-class.html#RNGP_PAT_NSNAME_EXCEPT_NSNAME +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_1 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_6 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_6 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_7 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_7 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_5_2_2_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_5_2_2_2_1 +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_2_1 +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT_2_2 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_5_2_2_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_5_2_2_2_2 +lxml.etree.ErrorTypes.RNGP_ELEMENT_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_ELEMENT_CONTENT +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_ATTR_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_ATTR_CHILD +lxml.etree.ErrorTypes.ERR_CONDSEC_INVALID_KEYWORD lxml.etree.ErrorTypes-class.html#ERR_CONDSEC_INVALID_KEYWORD +lxml.etree.ErrorTypes.RNGP_START_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_START_EMPTY +lxml.etree.ErrorTypes.IO_EAGAIN lxml.etree.ErrorTypes-class.html#IO_EAGAIN +lxml.etree.ErrorTypes.SCHEMAV_CVC_MININCLUSIVE_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_MININCLUSIVE_VALID +lxml.etree.ErrorTypes.SCHEMAV_ELEMENT_CONTENT lxml.etree.ErrorTypes-class.html#SCHEMAV_ELEMENT_CONTENT +lxml.etree.ErrorTypes.XINCLUDE_FRAGMENT_ID lxml.etree.ErrorTypes-class.html#XINCLUDE_FRAGMENT_ID +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 +lxml.etree.ErrorTypes.I18N_NO_NAME lxml.etree.ErrorTypes-class.html#I18N_NO_NAME +lxml.etree.ErrorTypes.SCHEMAP_IMPORT_SCHEMA_NOT_URI lxml.etree.ErrorTypes-class.html#SCHEMAP_IMPORT_SCHEMA_NOT_URI +lxml.etree.ErrorTypes.NS_ERR_QNAME lxml.etree.ErrorTypes-class.html#NS_ERR_QNAME +lxml.etree.ErrorTypes.SCHEMAP_UNION_NOT_EXPRESSIBLE lxml.etree.ErrorTypes-class.html#SCHEMAP_UNION_NOT_EXPRESSIBLE +lxml.etree.ErrorTypes.SCHEMAP_SRC_CT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_CT_1 +lxml.etree.ErrorTypes.RNGP_PAT_LIST_REF lxml.etree.ErrorTypes-class.html#RNGP_PAT_LIST_REF +lxml.etree.ErrorTypes.SCHEMAP_IMPORT_REDEFINE_NSNAME lxml.etree.ErrorTypes-class.html#SCHEMAP_IMPORT_REDEFINE_NSNAME +lxml.etree.ErrorTypes.SCHEMAV_ATTRINVALID lxml.etree.ErrorTypes-class.html#SCHEMAV_ATTRINVALID +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_ATTR lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_ATTR +lxml.etree.ErrorTypes.IO_ESRCH lxml.etree.ErrorTypes-class.html#IO_ESRCH +lxml.etree.ErrorTypes.DTD_UNKNOWN_ELEM lxml.etree.ErrorTypes-class.html#DTD_UNKNOWN_ELEM +lxml.etree.ErrorTypes.XINCLUDE_DEPRECATED_NS lxml.etree.ErrorTypes-class.html#XINCLUDE_DEPRECATED_NS +lxml.etree.ErrorTypes.ERR_CHARREF_IN_EPILOG lxml.etree.ErrorTypes-class.html#ERR_CHARREF_IN_EPILOG +lxml.etree.ErrorTypes.RNGP_UNKNOWN_TYPE_LIB lxml.etree.ErrorTypes-class.html#RNGP_UNKNOWN_TYPE_LIB +lxml.etree.ErrorTypes.ERR_NMTOKEN_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_NMTOKEN_REQUIRED +lxml.etree.ErrorTypes.DTD_NOT_EMPTY lxml.etree.ErrorTypes-class.html#DTD_NOT_EMPTY +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_2_1 +lxml.etree.ErrorTypes.ERR_PEREF_IN_PROLOG lxml.etree.ErrorTypes-class.html#ERR_PEREF_IN_PROLOG +lxml.etree.ErrorTypes.SCHEMAP_NOT_DETERMINISTIC lxml.etree.ErrorTypes-class.html#SCHEMAP_NOT_DETERMINISTIC +lxml.etree.ErrorTypes.SCHEMAP_E_PROPS_CORRECT_6 lxml.etree.ErrorTypes-class.html#SCHEMAP_E_PROPS_CORRECT_6 +lxml.etree.ErrorTypes.SCHEMAP_E_PROPS_CORRECT_5 lxml.etree.ErrorTypes-class.html#SCHEMAP_E_PROPS_CORRECT_5 +lxml.etree.ErrorTypes.SCHEMAP_E_PROPS_CORRECT_4 lxml.etree.ErrorTypes-class.html#SCHEMAP_E_PROPS_CORRECT_4 +lxml.etree.ErrorTypes.SCHEMAP_E_PROPS_CORRECT_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_E_PROPS_CORRECT_3 +lxml.etree.ErrorTypes.SCHEMAP_E_PROPS_CORRECT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_E_PROPS_CORRECT_2 +lxml.etree.ErrorTypes.IO_EROFS lxml.etree.ErrorTypes-class.html#IO_EROFS +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_ONEMORE lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_ONEMORE +lxml.etree.ErrorTypes.SCHEMAP_IMPORT_NAMESPACE_NOT_URI lxml.etree.ErrorTypes-class.html#SCHEMAP_IMPORT_NAMESPACE_NOT_URI +lxml.etree.ErrorTypes.SCHEMAP_FAILED_PARSE lxml.etree.ErrorTypes-class.html#SCHEMAP_FAILED_PARSE +lxml.etree.ErrorTypes.XPTR_SYNTAX_ERROR lxml.etree.ErrorTypes-class.html#XPTR_SYNTAX_ERROR +lxml.etree.ErrorTypes.MODULE_CLOSE lxml.etree.ErrorTypes-class.html#MODULE_CLOSE +lxml.etree.ErrorTypes.CHECK_NO_PARENT lxml.etree.ErrorTypes-class.html#CHECK_NO_PARENT +lxml.etree.ErrorTypes.SCHEMAP_REDEFINED_GROUP lxml.etree.ErrorTypes-class.html#SCHEMAP_REDEFINED_GROUP +lxml.etree.ErrorTypes.IO_EEXIST lxml.etree.ErrorTypes-class.html#IO_EEXIST +lxml.etree.ErrorTypes.REGEXP_COMPILE_ERROR lxml.etree.ErrorTypes-class.html#REGEXP_COMPILE_ERROR +lxml.etree.ErrorTypes.CATALOG_RECURSION lxml.etree.ErrorTypes-class.html#CATALOG_RECURSION +lxml.etree.ErrorTypes.WAR_CATALOG_PI lxml.etree.ErrorTypes-class.html#WAR_CATALOG_PI +lxml.etree.ErrorTypes.ERR_ELEMCONTENT_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_ELEMCONTENT_NOT_FINISHED +lxml.etree.ErrorTypes.ERR_LT_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_LT_REQUIRED +lxml.etree.ErrorTypes.RNGP_PARSE_ERROR lxml.etree.ErrorTypes-class.html#RNGP_PARSE_ERROR +lxml.etree.ErrorTypes.RNGP_HREF_ERROR lxml.etree.ErrorTypes-class.html#RNGP_HREF_ERROR +lxml.etree.ErrorTypes.RNGP_START_MISSING lxml.etree.ErrorTypes-class.html#RNGP_START_MISSING +lxml.etree.ErrorTypes.ERR_EXT_ENTITY_STANDALONE lxml.etree.ErrorTypes-class.html#ERR_EXT_ENTITY_STANDALONE +lxml.etree.ErrorTypes.ERR_ENTITY_IS_PARAMETER lxml.etree.ErrorTypes-class.html#ERR_ENTITY_IS_PARAMETER +lxml.etree.ErrorTypes.RNGP_URI_FRAGMENT lxml.etree.ErrorTypes-class.html#RNGP_URI_FRAGMENT +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_5_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_5_1_2 +lxml.etree.ErrorTypes.ERR_XMLDECL_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_XMLDECL_NOT_STARTED +lxml.etree.ErrorTypes.XINCLUDE_NO_HREF lxml.etree.ErrorTypes-class.html#XINCLUDE_NO_HREF +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_5_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_5_1_1 +lxml.etree.ErrorTypes.CHECK_FOUND_ATTRIBUTE lxml.etree.ErrorTypes-class.html#CHECK_FOUND_ATTRIBUTE +lxml.etree.ErrorTypes.SCHEMAP_SIMPLETYPE_NONAME lxml.etree.ErrorTypes-class.html#SCHEMAP_SIMPLETYPE_NONAME +lxml.etree.ErrorTypes.SCHEMAP_SRC_INCLUDE lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_INCLUDE +lxml.etree.ErrorTypes.RNGP_INTERLEAVE_ADD lxml.etree.ErrorTypes-class.html#RNGP_INTERLEAVE_ADD +lxml.etree.ErrorTypes.CHECK_NO_HREF lxml.etree.ErrorTypes-class.html#CHECK_NO_HREF +lxml.etree.ErrorTypes.RNGP_TYPE_VALUE lxml.etree.ErrorTypes-class.html#RNGP_TYPE_VALUE +lxml.etree.ErrorTypes.SCHEMAP_EXTENSION_NO_BASE lxml.etree.ErrorTypes-class.html#SCHEMAP_EXTENSION_NO_BASE +lxml.etree.ErrorTypes.RNGP_PAT_ANYNAME_EXCEPT_ANYNAME lxml.etree.ErrorTypes-class.html#RNGP_PAT_ANYNAME_EXCEPT_ANYNAME +lxml.etree.ErrorTypes.SCHEMAP_REDEFINED_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_REDEFINED_TYPE +lxml.etree.ErrorTypes.ERR_ENTITYREF_AT_EOF lxml.etree.ErrorTypes-class.html#ERR_ENTITYREF_AT_EOF +lxml.etree.ErrorTypes.C14N_CREATE_CTXT lxml.etree.ErrorTypes-class.html#C14N_CREATE_CTXT +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 +lxml.etree.ErrorTypes.RNGP_PAT_START_ONEMORE lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_ONEMORE +lxml.etree.ErrorTypes.ERR_ENTITY_BOUNDARY lxml.etree.ErrorTypes-class.html#ERR_ENTITY_BOUNDARY +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 +lxml.etree.ErrorTypes.ERR_UNKNOWN_ENCODING lxml.etree.ErrorTypes-class.html#ERR_UNKNOWN_ENCODING +lxml.etree.ErrorTypes.HTML_UNKNOWN_TAG lxml.etree.ErrorTypes-class.html#HTML_UNKNOWN_TAG +lxml.etree.ErrorTypes.CHECK_ lxml.etree.ErrorTypes-class.html#CHECK_ +lxml.etree.ErrorTypes.SCHEMAP_INVALID_REF_AND_SUBTYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_REF_AND_SUBTYPE +lxml.etree.ErrorTypes.DTD_INVALID_DEFAULT lxml.etree.ErrorTypes-class.html#DTD_INVALID_DEFAULT +lxml.etree.ErrorTypes.C14N_RELATIVE_NAMESPACE lxml.etree.ErrorTypes-class.html#C14N_RELATIVE_NAMESPACE +lxml.etree.ErrorTypes.SCHEMAP_FACET_NO_VALUE lxml.etree.ErrorTypes-class.html#SCHEMAP_FACET_NO_VALUE +lxml.etree.ErrorTypes.CHECK_NO_DOC lxml.etree.ErrorTypes-class.html#CHECK_NO_DOC +lxml.etree.ErrorTypes.IO_EFBIG lxml.etree.ErrorTypes-class.html#IO_EFBIG +lxml.etree.ErrorTypes.SCHEMAP_INVALID_WHITE_SPACE lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_WHITE_SPACE +lxml.etree.ErrorTypes.RNGP_NSNAME_ATTR_ANCESTOR lxml.etree.ErrorTypes-class.html#RNGP_NSNAME_ATTR_ANCESTOR +lxml.etree.ErrorTypes.SCHEMAP_S4S_ELEM_NOT_ALLOWED lxml.etree.ErrorTypes-class.html#SCHEMAP_S4S_ELEM_NOT_ALLOWED +lxml.etree.ErrorTypes.RNGP_START_CHOICE_AND_INTERLEAVE lxml.etree.ErrorTypes-class.html#RNGP_START_CHOICE_AND_INTERLEAVE +lxml.etree.ErrorTypes.DTD_UNKNOWN_NOTATION lxml.etree.ErrorTypes-class.html#DTD_UNKNOWN_NOTATION +lxml.etree.ErrorTypes.ERR_NS_DECL_ERROR lxml.etree.ErrorTypes-class.html#ERR_NS_DECL_ERROR +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_GROUP_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_GROUP_CHILD +lxml.etree.ErrorTypes.RNGP_PAT_LIST_LIST lxml.etree.ErrorTypes-class.html#RNGP_PAT_LIST_LIST +lxml.etree.ErrorTypes.CHECK_WRONG_DOC lxml.etree.ErrorTypes-class.html#CHECK_WRONG_DOC +lxml.etree.ErrorTypes.ERR_LITERAL_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_LITERAL_NOT_FINISHED +lxml.etree.ErrorTypes.CHECK_FOUND_CDATA lxml.etree.ErrorTypes-class.html#CHECK_FOUND_CDATA +lxml.etree.ErrorTypes.SAVE_UNKNOWN_ENCODING lxml.etree.ErrorTypes-class.html#SAVE_UNKNOWN_ENCODING +lxml.etree.ErrorTypes.RNGP_GRAMMAR_MISSING lxml.etree.ErrorTypes-class.html#RNGP_GRAMMAR_MISSING +lxml.etree.ErrorTypes.SCHEMAV_NOTSIMPLE lxml.etree.ErrorTypes-class.html#SCHEMAV_NOTSIMPLE +lxml.etree.ErrorTypes.DTD_ID_REDEFINED lxml.etree.ErrorTypes-class.html#DTD_ID_REDEFINED +lxml.etree.ErrorTypes.SCHEMAP_REDEFINED_ATTR lxml.etree.ErrorTypes-class.html#SCHEMAP_REDEFINED_ATTR +lxml.etree.ErrorTypes.RNGP_ERROR_TYPE_LIB lxml.etree.ErrorTypes-class.html#RNGP_ERROR_TYPE_LIB +lxml.etree.ErrorTypes.CHECK_NAME_NOT_NULL lxml.etree.ErrorTypes-class.html#CHECK_NAME_NOT_NULL +lxml.etree.ErrorTypes.IO_UNKNOWN lxml.etree.ErrorTypes-class.html#IO_UNKNOWN +lxml.etree.ErrorTypes.HTTP_URL_SYNTAX lxml.etree.ErrorTypes-class.html#HTTP_URL_SYNTAX +lxml.etree.ErrorTypes.RNGP_NAME_MISSING lxml.etree.ErrorTypes-class.html#RNGP_NAME_MISSING +lxml.etree.ErrorTypes.CHECK_WRONG_NEXT lxml.etree.ErrorTypes-class.html#CHECK_WRONG_NEXT +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD +lxml.etree.ErrorTypes.SCHEMAP_NOATTR_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_NOATTR_NOREF +lxml.etree.ErrorTypes.SAVE_NOT_UTF8 lxml.etree.ErrorTypes-class.html#SAVE_NOT_UTF8 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 +lxml.etree.ErrorTypes.CHECK_NOT_UTF8 lxml.etree.ErrorTypes-class.html#CHECK_NOT_UTF8 +lxml.etree.ErrorTypes.DTD_NO_DTD lxml.etree.ErrorTypes-class.html#DTD_NO_DTD +lxml.etree.ErrorTypes.RNGP_PAT_LIST_INTERLEAVE lxml.etree.ErrorTypes-class.html#RNGP_PAT_LIST_INTERLEAVE +lxml.etree.ErrorTypes.ERR_ENTITY_PE_INTERNAL lxml.etree.ErrorTypes-class.html#ERR_ENTITY_PE_INTERNAL +lxml.etree.ErrorTypes.RNGP_INTERLEAVE_NO_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_INTERLEAVE_NO_CONTENT +lxml.etree.ErrorTypes.ERR_CONDSEC_INVALID lxml.etree.ErrorTypes-class.html#ERR_CONDSEC_INVALID +lxml.etree.ErrorTypes.RNGP_ELEM_CONTENT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_ELEM_CONTENT_EMPTY +lxml.etree.ErrorTypes.SCHEMAP_NOROOT lxml.etree.ErrorTypes-class.html#SCHEMAP_NOROOT +lxml.etree.ErrorTypes.CHECK_UNKNOWN_NODE lxml.etree.ErrorTypes-class.html#CHECK_UNKNOWN_NODE +lxml.etree.ErrorTypes.XINCLUDE_UNKNOWN_ENCODING lxml.etree.ErrorTypes-class.html#XINCLUDE_UNKNOWN_ENCODING +lxml.etree.ErrorTypes.XPATH_INVALID_TYPE lxml.etree.ErrorTypes-class.html#XPATH_INVALID_TYPE +lxml.etree.ErrorTypes.RNGP_PARENTREF_CREATE_FAILED lxml.etree.ErrorTypes-class.html#RNGP_PARENTREF_CREATE_FAILED +lxml.etree.ErrorTypes.CHECK_NO_PREV lxml.etree.ErrorTypes-class.html#CHECK_NO_PREV +lxml.etree.ErrorTypes.XPATH_INVALID_CTXT_SIZE lxml.etree.ErrorTypes-class.html#XPATH_INVALID_CTXT_SIZE +lxml.etree.ErrorTypes.RNGP_DATA_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_DATA_CONTENT +lxml.etree.ErrorTypes.SCHEMAP_S4S_ELEM_MISSING lxml.etree.ErrorTypes-class.html#SCHEMAP_S4S_ELEM_MISSING +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_BASE_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_BASE_TYPE +lxml.etree.ErrorTypes.XINCLUDE_NO_FALLBACK lxml.etree.ErrorTypes-class.html#XINCLUDE_NO_FALLBACK +lxml.etree.ErrorTypes.IO_WRITE lxml.etree.ErrorTypes-class.html#IO_WRITE +lxml.etree.ErrorTypes.SCHEMAP_SRC_RESOLVE lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_RESOLVE +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_1 +lxml.etree.ErrorTypes.SCHEMAV_DOCUMENT_ELEMENT_MISSING lxml.etree.ErrorTypes-class.html#SCHEMAV_DOCUMENT_ELEMENT_MISSING +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_REF lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_REF +lxml.etree.ErrorTypes.CHECK_NO_NAME lxml.etree.ErrorTypes-class.html#CHECK_NO_NAME +lxml.etree.ErrorTypes.IO_ENOSPC lxml.etree.ErrorTypes-class.html#IO_ENOSPC +lxml.etree.ErrorTypes.SCHEMAP_AU_PROPS_CORRECT lxml.etree.ErrorTypes-class.html#SCHEMAP_AU_PROPS_CORRECT +lxml.etree.ErrorTypes.TREE_NOT_UTF8 lxml.etree.ErrorTypes-class.html#TREE_NOT_UTF8 +lxml.etree.ErrorTypes.RNGP_PAT_LIST_ELEM lxml.etree.ErrorTypes-class.html#RNGP_PAT_LIST_ELEM +lxml.etree.ErrorTypes.XPATH_EXPRESSION_OK lxml.etree.ErrorTypes-class.html#XPATH_EXPRESSION_OK +lxml.etree.ErrorTypes.XPTR_SUB_RESOURCE_ERROR lxml.etree.ErrorTypes-class.html#XPTR_SUB_RESOURCE_ERROR +lxml.etree.ErrorTypes.SCHEMAP_ELEM_DEFAULT_FIXED lxml.etree.ErrorTypes-class.html#SCHEMAP_ELEM_DEFAULT_FIXED +lxml.etree.ErrorTypes.WAR_ENTITY_REDEFINED lxml.etree.ErrorTypes-class.html#WAR_ENTITY_REDEFINED +lxml.etree.ErrorTypes.DTD_XMLID_VALUE lxml.etree.ErrorTypes-class.html#DTD_XMLID_VALUE +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_2_2 +lxml.etree.ErrorTypes.RNGP_GRAMMAR_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_GRAMMAR_CONTENT +lxml.etree.ErrorTypes.ERR_CHARREF_IN_DTD lxml.etree.ErrorTypes-class.html#ERR_CHARREF_IN_DTD +lxml.etree.ErrorTypes.I18N_NO_HANDLER lxml.etree.ErrorTypes-class.html#I18N_NO_HANDLER +lxml.etree.ErrorTypes.SCHEMAV_CVC_FACET_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_FACET_VALID +lxml.etree.ErrorTypes.DTD_MIXED_CORRUPT lxml.etree.ErrorTypes-class.html#DTD_MIXED_CORRUPT +lxml.etree.ErrorTypes.ERR_INVALID_DEC_CHARREF lxml.etree.ErrorTypes-class.html#ERR_INVALID_DEC_CHARREF +lxml.etree.ErrorTypes.SCHEMAV_CVC_TOTALDIGITS_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_TOTALDIGITS_VALID +lxml.etree.ErrorTypes.CHECK_NOT_NCNAME lxml.etree.ErrorTypes-class.html#CHECK_NOT_NCNAME +lxml.etree.ErrorTypes.SCHEMAP_INVALID_ENUM lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_ENUM +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_MEMBER_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_MEMBER_TYPE +lxml.etree.ErrorTypes.ERR_SPACE_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_SPACE_REQUIRED +lxml.etree.ErrorTypes.SCHEMAP_COMPLEXTYPE_NONAME_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_COMPLEXTYPE_NONAME_NOREF +lxml.etree.ErrorTypes.RNGP_PAT_START_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_EMPTY +lxml.etree.ErrorTypes.ERR_DOCUMENT_EMPTY lxml.etree.ErrorTypes-class.html#ERR_DOCUMENT_EMPTY +lxml.etree.ErrorTypes.SCHEMAV_EXTRACONTENT lxml.etree.ErrorTypes-class.html#SCHEMAV_EXTRACONTENT +lxml.etree.ErrorTypes.SAVE_CHAR_INVALID lxml.etree.ErrorTypes-class.html#SAVE_CHAR_INVALID +lxml.etree.ErrorTypes.RNGP_XML_NS lxml.etree.ErrorTypes-class.html#RNGP_XML_NS +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD +lxml.etree.ErrorTypes.DTD_ATTRIBUTE_DEFAULT lxml.etree.ErrorTypes-class.html#DTD_ATTRIBUTE_DEFAULT +lxml.etree.ErrorTypes.IO_ENOTSUP lxml.etree.ErrorTypes-class.html#IO_ENOTSUP +lxml.etree.ErrorTypes.DTD_UNKNOWN_ATTRIBUTE lxml.etree.ErrorTypes-class.html#DTD_UNKNOWN_ATTRIBUTE +lxml.etree.ErrorTypes.XINCLUDE_INCLUDE_IN_INCLUDE lxml.etree.ErrorTypes-class.html#XINCLUDE_INCLUDE_IN_INCLUDE +lxml.etree.ErrorTypes.XPATH_UNFINISHED_LITERAL_ERROR lxml.etree.ErrorTypes-class.html#XPATH_UNFINISHED_LITERAL_ERROR +lxml.etree.ErrorTypes.SCHEMAP_ATTRGRP_NONAME_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_ATTRGRP_NONAME_NOREF +lxml.etree.ErrorTypes.SCHEMAV_WRONGELEM lxml.etree.ErrorTypes-class.html#SCHEMAV_WRONGELEM +lxml.etree.ErrorTypes.SCHEMAP_INVALID_MINOCCURS lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_MINOCCURS +lxml.etree.ErrorTypes.RNGP_PARENTREF_NAME_INVALID lxml.etree.ErrorTypes-class.html#RNGP_PARENTREF_NAME_INVALID +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_1_1 +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_1_2 +lxml.etree.ErrorTypes.IO_ENODEV lxml.etree.ErrorTypes-class.html#IO_ENODEV +lxml.etree.ErrorTypes.SCHEMAP_COS_VALID_DEFAULT_2_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_VALID_DEFAULT_2_2_2 +lxml.etree.ErrorTypes.IO_EBUSY lxml.etree.ErrorTypes-class.html#IO_EBUSY +lxml.etree.ErrorTypes.C14N_REQUIRES_UTF8 lxml.etree.ErrorTypes-class.html#C14N_REQUIRES_UTF8 +lxml.etree.ErrorTypes.SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE +lxml.etree.ErrorTypes.ERR_URI_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_URI_REQUIRED +lxml.etree.ErrorTypes.IO_EADDRINUSE lxml.etree.ErrorTypes-class.html#IO_EADDRINUSE +lxml.etree.ErrorTypes.SCHEMAV_INTERNAL lxml.etree.ErrorTypes-class.html#SCHEMAV_INTERNAL +lxml.etree.ErrorTypes.RNGP_VALUE_NO_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_VALUE_NO_CONTENT +lxml.etree.ErrorTypes.NS_ERR_UNDEFINED_NAMESPACE lxml.etree.ErrorTypes-class.html#NS_ERR_UNDEFINED_NAMESPACE +lxml.etree.ErrorTypes.SCHEMAP_A_PROPS_CORRECT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_A_PROPS_CORRECT_2 +lxml.etree.ErrorTypes.CHECK_FOUND_ELEMENT lxml.etree.ErrorTypes-class.html#CHECK_FOUND_ELEMENT +lxml.etree.ErrorTypes.RNGP_ELEM_CONTENT_ERROR lxml.etree.ErrorTypes-class.html#RNGP_ELEM_CONTENT_ERROR +lxml.etree.ErrorTypes.SCHEMAP_RESTRICTION_NONAME_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_RESTRICTION_NONAME_NOREF +lxml.etree.ErrorTypes.HTTP_USE_IP lxml.etree.ErrorTypes-class.html#HTTP_USE_IP +lxml.etree.ErrorTypes.SCHEMAP_SRC_ELEMENT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ELEMENT_1 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ELEMENT_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ELEMENT_3 +lxml.etree.ErrorTypes.ERR_ATTRIBUTE_NOT_FINISHED lxml.etree.ErrorTypes-class.html#ERR_ATTRIBUTE_NOT_FINISHED +lxml.etree.ErrorTypes.SCHEMAV_CVC_TYPE_3_1_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_TYPE_3_1_1 +lxml.etree.ErrorTypes.SCHEMAV_CVC_TYPE_3_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_TYPE_3_1_2 +lxml.etree.ErrorTypes.SCHEMATRONV_REPORT lxml.etree.ErrorTypes-class.html#SCHEMATRONV_REPORT +lxml.etree.ErrorTypes.SCHEMAV_MISC lxml.etree.ErrorTypes-class.html#SCHEMAV_MISC +lxml.etree.ErrorTypes.IO_EPIPE lxml.etree.ErrorTypes-class.html#IO_EPIPE +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_GROUP_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_GROUP_1 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_GROUP_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_GROUP_3 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_GROUP_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_GROUP_2 +lxml.etree.ErrorTypes.IO_EAFNOSUPPORT lxml.etree.ErrorTypes-class.html#IO_EAFNOSUPPORT +lxml.etree.ErrorTypes.SCHEMAP_WARN_SKIP_SCHEMA lxml.etree.ErrorTypes-class.html#SCHEMAP_WARN_SKIP_SCHEMA +lxml.etree.ErrorTypes.SCHEMAP_A_PROPS_CORRECT_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_A_PROPS_CORRECT_3 +lxml.etree.ErrorTypes.CHECK_FOUND_DOCTYPE lxml.etree.ErrorTypes-class.html#CHECK_FOUND_DOCTYPE +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD +lxml.etree.ErrorTypes.TREE_UNTERMINATED_ENTITY lxml.etree.ErrorTypes-class.html#TREE_UNTERMINATED_ENTITY +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_1 +lxml.etree.ErrorTypes.WAR_UNDECLARED_ENTITY lxml.etree.ErrorTypes-class.html#WAR_UNDECLARED_ENTITY +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_4 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_4 +lxml.etree.ErrorTypes.RNGP_UNKNOWN_CONSTRUCT lxml.etree.ErrorTypes-class.html#RNGP_UNKNOWN_CONSTRUCT +lxml.etree.ErrorTypes.SCHEMAP_WARN_ATTR_REDECL_PROH lxml.etree.ErrorTypes-class.html#SCHEMAP_WARN_ATTR_REDECL_PROH +lxml.etree.ErrorTypes.ERR_ENTITY_IS_EXTERNAL lxml.etree.ErrorTypes-class.html#ERR_ENTITY_IS_EXTERNAL +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 +lxml.etree.ErrorTypes.RNGP_INVALID_DEFINE_NAME lxml.etree.ErrorTypes-class.html#RNGP_INVALID_DEFINE_NAME +lxml.etree.ErrorTypes.SCHEMAP_PREFIX_UNDEFINED lxml.etree.ErrorTypes-class.html#SCHEMAP_PREFIX_UNDEFINED +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_EMPTY +lxml.etree.ErrorTypes.SCHEMAV_INVALIDELEM lxml.etree.ErrorTypes-class.html#SCHEMAV_INVALIDELEM +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_IMPORT_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_IMPORT_CHILD +lxml.etree.ErrorTypes.RNGP_EXTERNALREF_EMTPY lxml.etree.ErrorTypes-class.html#RNGP_EXTERNALREF_EMTPY +lxml.etree.ErrorTypes.SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE lxml.etree.ErrorTypes-class.html#SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE +lxml.etree.ErrorTypes.IO_EALREADY lxml.etree.ErrorTypes-class.html#IO_EALREADY +lxml.etree.ErrorTypes.WAR_NS_URI lxml.etree.ErrorTypes-class.html#WAR_NS_URI +lxml.etree.ErrorTypes.SCHEMAP_REF_AND_CONTENT lxml.etree.ErrorTypes-class.html#SCHEMAP_REF_AND_CONTENT +lxml.etree.ErrorTypes.ERR_UNDECLARED_ENTITY lxml.etree.ErrorTypes-class.html#ERR_UNDECLARED_ENTITY +lxml.etree.ErrorTypes.IO_NETWORK_ATTEMPT lxml.etree.ErrorTypes-class.html#IO_NETWORK_ATTEMPT +lxml.etree.ErrorTypes.ERR_INVALID_CHAR lxml.etree.ErrorTypes-class.html#ERR_INVALID_CHAR +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_5_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_5_2_1 +lxml.etree.ErrorTypes.SCHEMAP_GROUP_NONAME_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_GROUP_NONAME_NOREF +lxml.etree.ErrorTypes.ERR_LITERAL_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_LITERAL_NOT_STARTED +lxml.etree.ErrorTypes.SCHEMAP_CT_PROPS_CORRECT_5 lxml.etree.ErrorTypes-class.html#SCHEMAP_CT_PROPS_CORRECT_5 +lxml.etree.ErrorTypes.SCHEMAP_REDEFINED_ELEMENT lxml.etree.ErrorTypes-class.html#SCHEMAP_REDEFINED_ELEMENT +lxml.etree.ErrorTypes.SCHEMAP_CVC_SIMPLE_TYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_CVC_SIMPLE_TYPE +lxml.etree.ErrorTypes.ERR_UNKNOWN_VERSION lxml.etree.ErrorTypes-class.html#ERR_UNKNOWN_VERSION +lxml.etree.ErrorTypes.SCHEMAP_NOT_SCHEMA lxml.etree.ErrorTypes-class.html#SCHEMAP_NOT_SCHEMA +lxml.etree.ErrorTypes.RNGP_UNKNOWN_COMBINE lxml.etree.ErrorTypes-class.html#RNGP_UNKNOWN_COMBINE +lxml.etree.ErrorTypes.SCHEMAP_SRC_ELEMENT_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ELEMENT_2_1 +lxml.etree.ErrorTypes.CHECK_NOT_DTD lxml.etree.ErrorTypes-class.html#CHECK_NOT_DTD +lxml.etree.ErrorTypes.CHECK_NO_NEXT lxml.etree.ErrorTypes-class.html#CHECK_NO_NEXT +lxml.etree.ErrorTypes.ERR_NOT_WELL_BALANCED lxml.etree.ErrorTypes-class.html#ERR_NOT_WELL_BALANCED +lxml.etree.ErrorTypes.RNGP_REF_CYCLE lxml.etree.ErrorTypes-class.html#RNGP_REF_CYCLE +lxml.etree.ErrorTypes.SCHEMAP_CT_PROPS_CORRECT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_CT_PROPS_CORRECT_1 +lxml.etree.ErrorTypes.SCHEMAV_FACET lxml.etree.ErrorTypes-class.html#SCHEMAV_FACET +lxml.etree.ErrorTypes.ERR_ENCODING_NAME lxml.etree.ErrorTypes-class.html#ERR_ENCODING_NAME +lxml.etree.ErrorTypes.SCHEMAV_NOROOT lxml.etree.ErrorTypes-class.html#SCHEMAV_NOROOT +lxml.etree.ErrorTypes.DTD_XMLID_TYPE lxml.etree.ErrorTypes-class.html#DTD_XMLID_TYPE +lxml.etree.ErrorTypes.C14N_CREATE_STACK lxml.etree.ErrorTypes-class.html#C14N_CREATE_STACK +lxml.etree.ErrorTypes.SCHEMAV_CVC_TYPE_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_TYPE_2 +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_SEQUENCE_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_SEQUENCE_CHILD +lxml.etree.ErrorTypes.SCHEMAV_CVC_TYPE_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_TYPE_1 +lxml.etree.ErrorTypes.IO_ENXIO lxml.etree.ErrorTypes-class.html#IO_ENXIO +lxml.etree.ErrorTypes.SCHEMAV_CVC_PATTERN_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_PATTERN_VALID +lxml.etree.ErrorTypes.ERR_ATTRIBUTE_WITHOUT_VALUE lxml.etree.ErrorTypes-class.html#ERR_ATTRIBUTE_WITHOUT_VALUE +lxml.etree.ErrorTypes.SCHEMAP_INCLUDE_SCHEMA_NOT_URI lxml.etree.ErrorTypes-class.html#SCHEMAP_INCLUDE_SCHEMA_NOT_URI +lxml.etree.ErrorTypes.SCHEMAP_REDEFINED_ATTRGROUP lxml.etree.ErrorTypes-class.html#SCHEMAP_REDEFINED_ATTRGROUP +lxml.etree.ErrorTypes.SCHEMAV_INVALIDATTR lxml.etree.ErrorTypes-class.html#SCHEMAV_INVALIDATTR +lxml.etree.ErrorTypes.ERR_OK lxml.etree.ErrorTypes-class.html#ERR_OK +lxml.etree.ErrorTypes.ERR_EQUAL_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_EQUAL_REQUIRED +lxml.etree.ErrorTypes.NS_ERR_XML_NAMESPACE lxml.etree.ErrorTypes-class.html#NS_ERR_XML_NAMESPACE +lxml.etree.ErrorTypes.ERR_EXTRA_CONTENT lxml.etree.ErrorTypes-class.html#ERR_EXTRA_CONTENT +lxml.etree.ErrorTypes.DTD_MULTIPLE_ID lxml.etree.ErrorTypes-class.html#DTD_MULTIPLE_ID +lxml.etree.ErrorTypes.IO_ECONNREFUSED lxml.etree.ErrorTypes-class.html#IO_ECONNREFUSED +lxml.etree.ErrorTypes.XPTR_UNKNOWN_SCHEME lxml.etree.ErrorTypes-class.html#XPTR_UNKNOWN_SCHEME +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_5_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_5_2 +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_5_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_5_1 +lxml.etree.ErrorTypes.RNGP_PAT_ONEMORE_INTERLEAVE_ATTR lxml.etree.ErrorTypes-class.html#RNGP_PAT_ONEMORE_INTERLEAVE_ATTR +lxml.etree.ErrorTypes.XINCLUDE_ENTITY_DEF_MISMATCH lxml.etree.ErrorTypes-class.html#XINCLUDE_ENTITY_DEF_MISMATCH +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_RESTRICTS_3_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_RESTRICTS_3_3_1 +lxml.etree.ErrorTypes.SCHEMAP_MG_PROPS_CORRECT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_MG_PROPS_CORRECT_1 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_3_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_3_2 +lxml.etree.ErrorTypes.SCHEMAP_SRC_ATTRIBUTE_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_ATTRIBUTE_3_1 +lxml.etree.ErrorTypes.SCHEMAP_MG_PROPS_CORRECT_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_MG_PROPS_CORRECT_2 +lxml.etree.ErrorTypes.RNGP_PAT_START_VALUE lxml.etree.ErrorTypes-class.html#RNGP_PAT_START_VALUE +lxml.etree.ErrorTypes.DTD_ROOT_NAME lxml.etree.ErrorTypes-class.html#DTD_ROOT_NAME +lxml.etree.ErrorTypes.IO_EISDIR lxml.etree.ErrorTypes-class.html#IO_EISDIR +lxml.etree.ErrorTypes.IO_EINPROGRESS lxml.etree.ErrorTypes-class.html#IO_EINPROGRESS +lxml.etree.ErrorTypes.IO_EDEADLK lxml.etree.ErrorTypes-class.html#IO_EDEADLK +lxml.etree.ErrorTypes.SCHEMAP_COS_ST_DERIVED_OK_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_ST_DERIVED_OK_2_2 +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_5_2_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_5_2_2_1 +lxml.etree.ErrorTypes.SCHEMAP_P_PROPS_CORRECT_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_P_PROPS_CORRECT_2_2 +lxml.etree.ErrorTypes.SCHEMAP_INVALID_FACET lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_FACET +lxml.etree.ErrorTypes.SCHEMAP_P_PROPS_CORRECT_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_P_PROPS_CORRECT_2_1 +lxml.etree.ErrorTypes.XINCLUDE_BUILD_FAILED lxml.etree.ErrorTypes-class.html#XINCLUDE_BUILD_FAILED +lxml.etree.ErrorTypes.ERR_PEREF_AT_EOF lxml.etree.ErrorTypes-class.html#ERR_PEREF_AT_EOF +lxml.etree.ErrorTypes.IO_ENOLCK lxml.etree.ErrorTypes-class.html#IO_ENOLCK +lxml.etree.ErrorTypes.DTD_MISSING_ATTRIBUTE lxml.etree.ErrorTypes-class.html#DTD_MISSING_ATTRIBUTE +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_3_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_3_1 +lxml.etree.ErrorTypes.CHECK_FOUND_ENTITYREF lxml.etree.ErrorTypes-class.html#CHECK_FOUND_ENTITYREF +lxml.etree.ErrorTypes.RNGP_PARAM_FORBIDDEN lxml.etree.ErrorTypes-class.html#RNGP_PARAM_FORBIDDEN +lxml.etree.ErrorTypes.DTD_ELEM_NAMESPACE lxml.etree.ErrorTypes-class.html#DTD_ELEM_NAMESPACE +lxml.etree.ErrorTypes.SCHEMAP_FAILED_LOAD lxml.etree.ErrorTypes-class.html#SCHEMAP_FAILED_LOAD +lxml.etree.ErrorTypes.SCHEMAP_SRC_SIMPLE_TYPE_4 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_SIMPLE_TYPE_4 +lxml.etree.ErrorTypes.DTD_ID_FIXED lxml.etree.ErrorTypes-class.html#DTD_ID_FIXED +lxml.etree.ErrorTypes.SCHEMAP_SRC_SIMPLE_TYPE_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_SIMPLE_TYPE_1 +lxml.etree.ErrorTypes.SCHEMAP_SRC_SIMPLE_TYPE_2 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_SIMPLE_TYPE_2 +lxml.etree.ErrorTypes.SCHEMAP_SRC_SIMPLE_TYPE_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_SIMPLE_TYPE_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 +lxml.etree.ErrorTypes.XINCLUDE_PARSE_VALUE lxml.etree.ErrorTypes-class.html#XINCLUDE_PARSE_VALUE +lxml.etree.ErrorTypes.RNGP_INCLUDE_FAILURE lxml.etree.ErrorTypes-class.html#RNGP_INCLUDE_FAILURE +lxml.etree.ErrorTypes.CHECK_NO_DICT lxml.etree.ErrorTypes-class.html#CHECK_NO_DICT +lxml.etree.ErrorTypes.CHECK_NOT_ELEM_DECL lxml.etree.ErrorTypes-class.html#CHECK_NOT_ELEM_DECL +lxml.etree.ErrorTypes.XPTR_CHILDSEQ_START lxml.etree.ErrorTypes-class.html#XPTR_CHILDSEQ_START +lxml.etree.ErrorTypes.RNGP_ATTRIBUTE_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_ATTRIBUTE_EMPTY +lxml.etree.ErrorTypes.ERR_ENTITYREF_NO_NAME lxml.etree.ErrorTypes-class.html#ERR_ENTITYREF_NO_NAME +lxml.etree.ErrorTypes.RNGP_UNKNOWN_ATTRIBUTE lxml.etree.ErrorTypes-class.html#RNGP_UNKNOWN_ATTRIBUTE +lxml.etree.ErrorTypes.SCHEMAP_COS_VALID_DEFAULT_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_VALID_DEFAULT_1 +lxml.etree.ErrorTypes.DTD_INVALID_CHILD lxml.etree.ErrorTypes-class.html#DTD_INVALID_CHILD +lxml.etree.ErrorTypes.SCHEMAV_CVC_ELT_4_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_ELT_4_2 +lxml.etree.ErrorTypes.RNGP_EXCEPT_EMPTY lxml.etree.ErrorTypes-class.html#RNGP_EXCEPT_EMPTY +lxml.etree.ErrorTypes.RNGP_PAT_ATTR_ATTR lxml.etree.ErrorTypes-class.html#RNGP_PAT_ATTR_ATTR +lxml.etree.ErrorTypes.ERR_GT_REQUIRED lxml.etree.ErrorTypes-class.html#ERR_GT_REQUIRED +lxml.etree.ErrorTypes.RNGP_ATTR_CONFLICT lxml.etree.ErrorTypes-class.html#RNGP_ATTR_CONFLICT +lxml.etree.ErrorTypes.SCHEMAV_CVC_FRACTIONDIGITS_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_FRACTIONDIGITS_VALID +lxml.etree.ErrorTypes.IO_ETIMEDOUT lxml.etree.ErrorTypes-class.html#IO_ETIMEDOUT +lxml.etree.ErrorTypes.SCHEMAP_C_PROPS_CORRECT lxml.etree.ErrorTypes-class.html#SCHEMAP_C_PROPS_CORRECT +lxml.etree.ErrorTypes.I18N_NO_OUTPUT lxml.etree.ErrorTypes-class.html#I18N_NO_OUTPUT +lxml.etree.ErrorTypes.CHECK_NS_ANCESTOR lxml.etree.ErrorTypes-class.html#CHECK_NS_ANCESTOR +lxml.etree.ErrorTypes.SCHEMAP_INVALID_FACET_VALUE lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_FACET_VALUE +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_ALL_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_ALL_CHILD +lxml.etree.ErrorTypes.CHECK_FOUND_FRAGMENT lxml.etree.ErrorTypes-class.html#CHECK_FOUND_FRAGMENT +lxml.etree.ErrorTypes.ERR_DOCUMENT_START lxml.etree.ErrorTypes-class.html#ERR_DOCUMENT_START +lxml.etree.ErrorTypes.SCHEMAV_CVC_LENGTH_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_LENGTH_VALID +lxml.etree.ErrorTypes.SCHEMAV_CVC_MINLENGTH_VALID lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_MINLENGTH_VALID +lxml.etree.ErrorTypes.SCHEMAP_COS_VALID_DEFAULT_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_COS_VALID_DEFAULT_2_1 +lxml.etree.ErrorTypes.XINCLUDE_FALLBACK_NOT_IN_INCLUDE lxml.etree.ErrorTypes-class.html#XINCLUDE_FALLBACK_NOT_IN_INCLUDE +lxml.etree.ErrorTypes.RNGP_EXTERNALREF_RECURSE lxml.etree.ErrorTypes-class.html#RNGP_EXTERNALREF_RECURSE +lxml.etree.ErrorTypes.ERR_TAG_NAME_MISMATCH lxml.etree.ErrorTypes-class.html#ERR_TAG_NAME_MISMATCH +lxml.etree.ErrorTypes.SCHEMAV_CVC_DATATYPE_VALID_1_2_1 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_DATATYPE_VALID_1_2_1 +lxml.etree.ErrorTypes.SCHEMAV_CVC_DATATYPE_VALID_1_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_DATATYPE_VALID_1_2_2 +lxml.etree.ErrorTypes.SCHEMAV_CVC_DATATYPE_VALID_1_2_3 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_DATATYPE_VALID_1_2_3 +lxml.etree.ErrorTypes.SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 lxml.etree.ErrorTypes-class.html#SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 +lxml.etree.ErrorTypes.CHECK_FOUND_COMMENT lxml.etree.ErrorTypes-class.html#CHECK_FOUND_COMMENT +lxml.etree.ErrorTypes.SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE +lxml.etree.ErrorTypes.SCHEMAP_NOTYPE_NOREF lxml.etree.ErrorTypes-class.html#SCHEMAP_NOTYPE_NOREF +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_SCHEMAS_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_SCHEMAS_CHILD +lxml.etree.ErrorTypes.RNGP_ATTRIBUTE_CONTENT lxml.etree.ErrorTypes-class.html#RNGP_ATTRIBUTE_CONTENT +lxml.etree.ErrorTypes.DTD_UNKNOWN_ENTITY lxml.etree.ErrorTypes-class.html#DTD_UNKNOWN_ENTITY +lxml.etree.ErrorTypes.XPATH_UNDEF_PREFIX_ERROR lxml.etree.ErrorTypes-class.html#XPATH_UNDEF_PREFIX_ERROR +lxml.etree.ErrorTypes.NS_ERR_ATTRIBUTE_REDEFINED lxml.etree.ErrorTypes-class.html#NS_ERR_ATTRIBUTE_REDEFINED +lxml.etree.ErrorTypes.ERR_CONDSEC_NOT_STARTED lxml.etree.ErrorTypes-class.html#ERR_CONDSEC_NOT_STARTED +lxml.etree.ErrorTypes.CHECK_FOUND_PI lxml.etree.ErrorTypes-class.html#CHECK_FOUND_PI +lxml.etree.ErrorTypes.DTD_DUP_TOKEN lxml.etree.ErrorTypes-class.html#DTD_DUP_TOKEN +lxml.etree.ErrorTypes.DTD_ATTRIBUTE_VALUE lxml.etree.ErrorTypes-class.html#DTD_ATTRIBUTE_VALUE +lxml.etree.ErrorTypes.XPATH_INVALID_ARITY lxml.etree.ErrorTypes-class.html#XPATH_INVALID_ARITY +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_EXTENSION_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_EXTENSION_CHILD +lxml.etree.ErrorTypes.SCHEMAP_REF_AND_SUBTYPE lxml.etree.ErrorTypes-class.html#SCHEMAP_REF_AND_SUBTYPE +lxml.etree.ErrorTypes.SCHEMAP_SRC_IMPORT lxml.etree.ErrorTypes-class.html#SCHEMAP_SRC_IMPORT +lxml.etree.ErrorTypes.SCHEMAP_NO_XSI lxml.etree.ErrorTypes-class.html#SCHEMAP_NO_XSI +lxml.etree.ErrorTypes.SCHEMAV_HAVEDEFAULT lxml.etree.ErrorTypes-class.html#SCHEMAV_HAVEDEFAULT +lxml.etree.ErrorTypes.RNGP_PAT_DATA_EXCEPT_LIST lxml.etree.ErrorTypes-class.html#RNGP_PAT_DATA_EXCEPT_LIST +lxml.etree.ErrorTypes.SCHEMAP_WARN_UNLOCATED_SCHEMA lxml.etree.ErrorTypes-class.html#SCHEMAP_WARN_UNLOCATED_SCHEMA +lxml.etree.ErrorTypes.ERR_NOT_STANDALONE lxml.etree.ErrorTypes-class.html#ERR_NOT_STANDALONE +lxml.etree.ErrorTypes.SCHEMAP_INVALID_ATTR_COMBINATION lxml.etree.ErrorTypes-class.html#SCHEMAP_INVALID_ATTR_COMBINATION +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_3 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_3 +lxml.etree.ErrorTypes.SCHEMAP_DERIVATION_OK_RESTRICTION_1 lxml.etree.ErrorTypes-class.html#SCHEMAP_DERIVATION_OK_RESTRICTION_1 +lxml.etree.ErrorTypes.SCHEMAP_UNKNOWN_UNION_CHILD lxml.etree.ErrorTypes-class.html#SCHEMAP_UNKNOWN_UNION_CHILD +lxml.etree.ErrorTypes.XINCLUDE_FALLBACKS_IN_INCLUDE lxml.etree.ErrorTypes-class.html#XINCLUDE_FALLBACKS_IN_INCLUDE +lxml.etree.ErrorTypes.IO_BUFFER_FULL lxml.etree.ErrorTypes-class.html#IO_BUFFER_FULL +lxml.etree.ErrorTypes.TREE_INVALID_DEC lxml.etree.ErrorTypes-class.html#TREE_INVALID_DEC +lxml.etree.ErrorTypes.DTD_STANDALONE_DEFAULTED lxml.etree.ErrorTypes-class.html#DTD_STANDALONE_DEFAULTED +lxml.etree.FallbackElementClassLookup lxml.etree.FallbackElementClassLookup-class.html +lxml.etree.FallbackElementClassLookup.__new__ lxml.etree.FallbackElementClassLookup-class.html#__new__ +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.etree.FallbackElementClassLookup.__init__ lxml.etree.FallbackElementClassLookup-class.html#__init__ +lxml.etree.HTMLParser lxml.etree.HTMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree.HTMLParser.__new__ lxml.etree.HTMLParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.etree.HTMLParser.__init__ lxml.etree.HTMLParser-class.html#__init__ +lxml.etree.LxmlError lxml.etree.LxmlError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlRegistryError lxml.etree.LxmlRegistryError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.LxmlSyntaxError lxml.etree.LxmlSyntaxError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.NamespaceRegistryError lxml.etree.NamespaceRegistryError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.PIBase lxml.etree.PIBase-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._ProcessingInstruction.tag lxml.etree._ProcessingInstruction-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.PIBase.__new__ lxml.etree.PIBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._ProcessingInstruction.target lxml.etree._ProcessingInstruction-class.html#target +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._ProcessingInstruction.__repr__ lxml.etree._ProcessingInstruction-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.ParseError lxml.etree.ParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.ParserBasedElementClassLookup lxml.etree.ParserBasedElementClassLookup-class.html +lxml.etree.ParserBasedElementClassLookup.__new__ lxml.etree.ParserBasedElementClassLookup-class.html#__new__ +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.etree.FallbackElementClassLookup.__init__ lxml.etree.FallbackElementClassLookup-class.html#__init__ +lxml.etree.ParserError lxml.etree.ParserError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.PyErrorLog lxml.etree.PyErrorLog-class.html +lxml.etree.PyErrorLog.level_map lxml.etree.PyErrorLog-class.html#level_map +lxml.etree.PyErrorLog.__new__ lxml.etree.PyErrorLog-class.html#__new__ +lxml.etree.PyErrorLog.receive lxml.etree.PyErrorLog-class.html#receive +lxml.etree._BaseErrorLog.last_error lxml.etree._BaseErrorLog-class.html#last_error +lxml.etree._BaseErrorLog.__repr__ lxml.etree._BaseErrorLog-class.html#__repr__ +lxml.etree.PyErrorLog.copy lxml.etree.PyErrorLog-class.html#copy +lxml.etree.PyErrorLog.__init__ lxml.etree.PyErrorLog-class.html#__init__ +lxml.etree.PyErrorLog.log lxml.etree.PyErrorLog-class.html#log +lxml.etree.PythonElementClassLookup lxml.etree.PythonElementClassLookup-class.html +lxml.etree.PythonElementClassLookup.__new__ lxml.etree.PythonElementClassLookup-class.html#__new__ +lxml.etree.PythonElementClassLookup.lookup lxml.etree.PythonElementClassLookup-class.html#lookup +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.etree.FallbackElementClassLookup.__init__ lxml.etree.FallbackElementClassLookup-class.html#__init__ +lxml.etree.QName lxml.etree.QName-class.html +lxml.etree.QName.__ne__ lxml.etree.QName-class.html#__ne__ +lxml.etree.QName.__new__ lxml.etree.QName-class.html#__new__ +lxml.etree.QName.text lxml.etree.QName-class.html#text +lxml.etree.QName.__str__ lxml.etree.QName-class.html#__str__ +lxml.etree.QName.namespace lxml.etree.QName-class.html#namespace +lxml.etree.QName.__le__ lxml.etree.QName-class.html#__le__ +lxml.etree.QName.__ge__ lxml.etree.QName-class.html#__ge__ +lxml.etree.QName.__gt__ lxml.etree.QName-class.html#__gt__ +lxml.etree.QName.__hash__ lxml.etree.QName-class.html#__hash__ +lxml.etree.QName.localname lxml.etree.QName-class.html#localname +lxml.etree.QName.__lt__ lxml.etree.QName-class.html#__lt__ +lxml.etree.QName.__eq__ lxml.etree.QName-class.html#__eq__ +lxml.etree.QName.__init__ lxml.etree.QName-class.html#__init__ +lxml.etree.RelaxNG lxml.etree.RelaxNG-class.html +lxml.etree.RelaxNG.__new__ lxml.etree.RelaxNG-class.html#__new__ +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.etree.RelaxNG.__call__ lxml.etree.RelaxNG-class.html#__call__ +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree.RelaxNG.__init__ lxml.etree.RelaxNG-class.html#__init__ +lxml.etree.RelaxNGError lxml.etree.RelaxNGError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.RelaxNGErrorTypes lxml.etree.RelaxNGErrorTypes-class.html +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_TEXTWRONG lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_TEXTWRONG +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_EXTRACONTENT lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_EXTRACONTENT +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ELEMEXTRANS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMEXTRANS +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_INTERSEQ lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_INTERSEQ +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_NODEFINE lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_NODEFINE +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_NOTELEM lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_NOTELEM +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_TYPEVAL lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_TYPEVAL +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_TYPECMP lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_TYPECMP +lxml.etree.RelaxNGErrorTypes._getName lxml.etree.RelaxNGErrorTypes-class.html#_getName +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_LISTELEM lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_LISTELEM +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_INTERNAL lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_INTERNAL +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_DATATYPE lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_DATATYPE +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_DATAELEM lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_DATAELEM +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_INVALIDATTR lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_INVALIDATTR +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ELEMNAME lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMNAME +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_DUPID lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_DUPID +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ELEMNOTEMPTY lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMNOTEMPTY +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_NOELEM lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_NOELEM +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_TYPE lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_TYPE +lxml.etree.RelaxNGErrorTypes.RELAXNG_OK lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_OK +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ELEMNONS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMNONS +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_CONTENTVALID lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_CONTENTVALID +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_LIST lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_LIST +lxml.etree.RelaxNGErrorTypes._names lxml.etree.RelaxNGErrorTypes-class.html#_names +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_EXTRADATA lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_EXTRADATA +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_MEMORY lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_MEMORY +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_NOSTATE lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_NOSTATE +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ELEMWRONG lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMWRONG +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_LISTEXTRA lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_LISTEXTRA +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ATTRNONS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ATTRNONS +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ELEMWRONGNS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ELEMWRONGNS +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ATTRNAME lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ATTRNAME +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_VALELEM lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_VALELEM +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_INTERNODATA lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_INTERNODATA +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_NOGRAMMAR lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_NOGRAMMAR +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ATTRWRONGNS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ATTRWRONGNS +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_INTEREXTRA lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_INTEREXTRA +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ATTREXTRANS lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ATTREXTRANS +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_LACKDATA lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_LACKDATA +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_LISTEMPTY lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_LISTEMPTY +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_VALUE lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_VALUE +lxml.etree.RelaxNGErrorTypes.RELAXNG_ERR_ATTRVALID lxml.etree.RelaxNGErrorTypes-class.html#RELAXNG_ERR_ATTRVALID +lxml.etree.RelaxNGParseError lxml.etree.RelaxNGParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.RelaxNGValidateError lxml.etree.RelaxNGValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.Resolver lxml.etree.Resolver-class.html +lxml.etree.Resolver.resolve lxml.etree.Resolver-class.html#resolve +lxml.etree.Resolver.resolve_filename lxml.etree.Resolver-class.html#resolve_filename +lxml.etree.Resolver.__new__ lxml.etree.Resolver-class.html#__new__ +lxml.etree.Resolver.resolve_string lxml.etree.Resolver-class.html#resolve_string +lxml.etree.Resolver.resolve_file lxml.etree.Resolver-class.html#resolve_file +lxml.etree.Resolver.resolve_empty lxml.etree.Resolver-class.html#resolve_empty +lxml.etree.Schematron lxml.etree.Schematron-class.html +lxml.etree.Schematron.__new__ lxml.etree.Schematron-class.html#__new__ +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.etree.Schematron.__call__ lxml.etree.Schematron-class.html#__call__ +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree.Schematron.__init__ lxml.etree.Schematron-class.html#__init__ +lxml.etree.SchematronError lxml.etree.SchematronError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SchematronParseError lxml.etree.SchematronParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SchematronValidateError lxml.etree.SchematronValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SerialisationError lxml.etree.SerialisationError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.SiblingsIterator lxml.etree.SiblingsIterator-class.html +lxml.etree.SiblingsIterator.__new__ lxml.etree.SiblingsIterator-class.html#__new__ +lxml.etree._ElementIterator.__next__ lxml.etree._ElementIterator-class.html#__next__ +lxml.etree._ElementIterator.next lxml.etree._ElementIterator-class.html#next +lxml.etree._ElementIterator.__iter__ lxml.etree._ElementIterator-class.html#__iter__ +lxml.etree.SiblingsIterator.__init__ lxml.etree.SiblingsIterator-class.html#__init__ +lxml.etree.TreeBuilder lxml.etree.TreeBuilder-class.html +lxml.etree.TreeBuilder.comment lxml.etree.TreeBuilder-class.html#comment +lxml.etree.TreeBuilder.end lxml.etree.TreeBuilder-class.html#end +lxml.etree.TreeBuilder.__new__ lxml.etree.TreeBuilder-class.html#__new__ +lxml.etree.TreeBuilder.start lxml.etree.TreeBuilder-class.html#start +lxml.etree.TreeBuilder.close lxml.etree.TreeBuilder-class.html#close +lxml.etree.TreeBuilder.pi lxml.etree.TreeBuilder-class.html#pi +lxml.etree.TreeBuilder.data lxml.etree.TreeBuilder-class.html#data +lxml.etree.TreeBuilder.__init__ lxml.etree.TreeBuilder-class.html#__init__ +lxml.etree.XInclude lxml.etree.XInclude-class.html +lxml.etree.XInclude.__new__ lxml.etree.XInclude-class.html#__new__ +lxml.etree.XInclude.error_log lxml.etree.XInclude-class.html#error_log +lxml.etree.XInclude.__call__ lxml.etree.XInclude-class.html#__call__ +lxml.etree.XInclude.__init__ lxml.etree.XInclude-class.html#__init__ +lxml.etree.XIncludeError lxml.etree.XIncludeError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XMLParser lxml.etree.XMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree.XMLParser.__new__ lxml.etree.XMLParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.etree.XMLParser.__init__ lxml.etree.XMLParser-class.html#__init__ +lxml.etree.XMLSchema lxml.etree.XMLSchema-class.html +lxml.etree.XMLSchema.__new__ lxml.etree.XMLSchema-class.html#__new__ +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.etree.XMLSchema.__call__ lxml.etree.XMLSchema-class.html#__call__ +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree.XMLSchema.__init__ lxml.etree.XMLSchema-class.html#__init__ +lxml.etree.XMLSchemaError lxml.etree.XMLSchemaError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XMLSchemaParseError lxml.etree.XMLSchemaParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XMLSchemaValidateError lxml.etree.XMLSchemaValidateError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XMLSyntaxError lxml.etree.XMLSyntaxError-class.html +lxml.etree.XMLSyntaxError.__init__ lxml.etree.XMLSyntaxError-class.html#__init__ +lxml.etree.XPath lxml.etree.XPath-class.html +lxml.etree.XPath.__new__ lxml.etree.XPath-class.html#__new__ +lxml.etree._XPathEvaluatorBase.evaluate lxml.etree._XPathEvaluatorBase-class.html#evaluate +lxml.etree._XPathEvaluatorBase.error_log lxml.etree._XPathEvaluatorBase-class.html#error_log +lxml.etree.XPath.__repr__ lxml.etree.XPath-class.html#__repr__ +lxml.etree.XPath.__call__ lxml.etree.XPath-class.html#__call__ +lxml.etree.XPath.path lxml.etree.XPath-class.html#path +lxml.etree.XPath.__init__ lxml.etree.XPath-class.html#__init__ +lxml.etree.XPathDocumentEvaluator lxml.etree.XPathDocumentEvaluator-class.html +lxml.etree.XPathElementEvaluator.register_namespace lxml.etree.XPathElementEvaluator-class.html#register_namespace +lxml.etree.XPathDocumentEvaluator.__new__ lxml.etree.XPathDocumentEvaluator-class.html#__new__ +lxml.etree._XPathEvaluatorBase.evaluate lxml.etree._XPathEvaluatorBase-class.html#evaluate +lxml.etree._XPathEvaluatorBase.error_log lxml.etree._XPathEvaluatorBase-class.html#error_log +lxml.etree.XPathDocumentEvaluator.__call__ lxml.etree.XPathDocumentEvaluator-class.html#__call__ +lxml.etree.XPathElementEvaluator.register_namespaces lxml.etree.XPathElementEvaluator-class.html#register_namespaces +lxml.etree.XPathDocumentEvaluator.__init__ lxml.etree.XPathDocumentEvaluator-class.html#__init__ +lxml.etree.XPathElementEvaluator lxml.etree.XPathElementEvaluator-class.html +lxml.etree.XPathElementEvaluator.register_namespace lxml.etree.XPathElementEvaluator-class.html#register_namespace +lxml.etree.XPathElementEvaluator.__new__ lxml.etree.XPathElementEvaluator-class.html#__new__ +lxml.etree._XPathEvaluatorBase.evaluate lxml.etree._XPathEvaluatorBase-class.html#evaluate +lxml.etree._XPathEvaluatorBase.error_log lxml.etree._XPathEvaluatorBase-class.html#error_log +lxml.etree.XPathElementEvaluator.__call__ lxml.etree.XPathElementEvaluator-class.html#__call__ +lxml.etree.XPathElementEvaluator.register_namespaces lxml.etree.XPathElementEvaluator-class.html#register_namespaces +lxml.etree.XPathElementEvaluator.__init__ lxml.etree.XPathElementEvaluator-class.html#__init__ +lxml.etree.XPathError lxml.etree.XPathError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathEvalError lxml.etree.XPathEvalError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathFunctionError lxml.etree.XPathFunctionError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathResultError lxml.etree.XPathResultError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XPathSyntaxError lxml.etree.XPathSyntaxError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLT lxml.etree.XSLT-class.html +lxml.etree.XSLT.__new__ lxml.etree.XSLT-class.html#__new__ +lxml.etree.XSLT.__deepcopy__ lxml.etree.XSLT-class.html#__deepcopy__ +lxml.etree.XSLT.strparam lxml.etree.XSLT-class.html#strparam +lxml.etree.XSLT.error_log lxml.etree.XSLT-class.html#error_log +lxml.etree.XSLT.tostring lxml.etree.XSLT-class.html#tostring +lxml.etree.XSLT.__call__ lxml.etree.XSLT-class.html#__call__ +lxml.etree.XSLT.apply lxml.etree.XSLT-class.html#apply +lxml.etree.XSLT.__copy__ lxml.etree.XSLT-class.html#__copy__ +lxml.etree.XSLT.__init__ lxml.etree.XSLT-class.html#__init__ +lxml.etree.XSLTAccessControl lxml.etree.XSLTAccessControl-class.html +lxml.etree.XSLTAccessControl.DENY_WRITE lxml.etree.XSLTAccessControl-class.html#DENY_WRITE +lxml.etree.XSLTAccessControl.__new__ lxml.etree.XSLTAccessControl-class.html#__new__ +lxml.etree.XSLTAccessControl.__repr__ lxml.etree.XSLTAccessControl-class.html#__repr__ +lxml.etree.XSLTAccessControl.DENY_ALL lxml.etree.XSLTAccessControl-class.html#DENY_ALL +lxml.etree.XSLTAccessControl.options lxml.etree.XSLTAccessControl-class.html#options +lxml.etree.XSLTAccessControl.__init__ lxml.etree.XSLTAccessControl-class.html#__init__ +lxml.etree.XSLTApplyError lxml.etree.XSLTApplyError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTError lxml.etree.XSLTError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTExtension lxml.etree.XSLTExtension-class.html +lxml.etree.XSLTExtension.execute lxml.etree.XSLTExtension-class.html#execute +lxml.etree.XSLTExtension.__new__ lxml.etree.XSLTExtension-class.html#__new__ +lxml.etree.XSLTExtension.apply_templates lxml.etree.XSLTExtension-class.html#apply_templates +lxml.etree.XSLTExtensionError lxml.etree.XSLTExtensionError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTParseError lxml.etree.XSLTParseError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree.XSLTSaveError lxml.etree.XSLTSaveError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.etree._AppendOnlyElementProxy lxml.etree._AppendOnlyElementProxy-class.html +lxml.etree._ReadOnlyElementProxy.getprevious lxml.etree._ReadOnlyElementProxy-class.html#getprevious +lxml.etree._ReadOnlyElementProxy.getparent lxml.etree._ReadOnlyElementProxy-class.html#getparent +lxml.etree._ReadOnlyElementProxy.sourceline lxml.etree._ReadOnlyElementProxy-class.html#sourceline +lxml.etree._AppendOnlyElementProxy.text lxml.etree._AppendOnlyElementProxy-class.html#text +lxml.etree._ReadOnlyElementProxy.__getitem__ lxml.etree._ReadOnlyElementProxy-class.html#__getitem__ +lxml.etree._ReadOnlyElementProxy.iterchildren lxml.etree._ReadOnlyElementProxy-class.html#iterchildren +lxml.etree._ReadOnlyElementProxy.prefix lxml.etree._ReadOnlyElementProxy-class.html#prefix +lxml.etree._ReadOnlyElementProxy.tag lxml.etree._ReadOnlyElementProxy-class.html#tag +lxml.etree._AppendOnlyElementProxy.append lxml.etree._AppendOnlyElementProxy-class.html#append +lxml.etree._ReadOnlyElementProxy.getnext lxml.etree._ReadOnlyElementProxy-class.html#getnext +lxml.etree._AppendOnlyElementProxy.__new__ lxml.etree._AppendOnlyElementProxy-class.html#__new__ +lxml.etree._ReadOnlyElementProxy.getchildren lxml.etree._ReadOnlyElementProxy-class.html#getchildren +lxml.etree._ReadOnlyElementProxy.tail lxml.etree._ReadOnlyElementProxy-class.html#tail +lxml.etree._ReadOnlyElementProxy.__len__ lxml.etree._ReadOnlyElementProxy-class.html#__len__ +lxml.etree._AppendOnlyElementProxy.extend lxml.etree._AppendOnlyElementProxy-class.html#extend +lxml.etree._ReadOnlyElementProxy.get lxml.etree._ReadOnlyElementProxy-class.html#get +lxml.etree._ReadOnlyElementProxy.keys lxml.etree._ReadOnlyElementProxy-class.html#keys +lxml.etree._ReadOnlyElementProxy.__deepcopy__ lxml.etree._ReadOnlyElementProxy-class.html#__deepcopy__ +lxml.etree._ReadOnlyElementProxy.__iter__ lxml.etree._ReadOnlyElementProxy-class.html#__iter__ +lxml.etree._ReadOnlyElementProxy.__nonzero__ lxml.etree._ReadOnlyElementProxy-class.html#__nonzero__ +lxml.etree._ReadOnlyElementProxy.items lxml.etree._ReadOnlyElementProxy-class.html#items +lxml.etree._ReadOnlyElementProxy.values lxml.etree._ReadOnlyElementProxy-class.html#values +lxml.etree._ReadOnlyElementProxy.__repr__ lxml.etree._ReadOnlyElementProxy-class.html#__repr__ +lxml.etree._ReadOnlyElementProxy.attrib lxml.etree._ReadOnlyElementProxy-class.html#attrib +lxml.etree._ReadOnlyElementProxy.__copy__ lxml.etree._ReadOnlyElementProxy-class.html#__copy__ +lxml.etree._Attrib lxml.etree._Attrib-class.html +lxml.etree._Attrib.iteritems lxml.etree._Attrib-class.html#iteritems +lxml.etree._Attrib.pop lxml.etree._Attrib-class.html#pop +lxml.etree._Attrib.has_key lxml.etree._Attrib-class.html#has_key +lxml.etree._Attrib.__lt__ lxml.etree._Attrib-class.html#__lt__ +lxml.etree._Attrib.__init__ lxml.etree._Attrib-class.html#__init__ +lxml.etree._Attrib.__new__ lxml.etree._Attrib-class.html#__new__ +lxml.etree._Attrib.__contains__ lxml.etree._Attrib-class.html#__contains__ +lxml.etree._Attrib.itervalues lxml.etree._Attrib-class.html#itervalues +lxml.etree._Attrib.__len__ lxml.etree._Attrib-class.html#__len__ +lxml.etree._Attrib.__ne__ lxml.etree._Attrib-class.html#__ne__ +lxml.etree._Attrib.__getitem__ lxml.etree._Attrib-class.html#__getitem__ +lxml.etree._Attrib.get lxml.etree._Attrib-class.html#get +lxml.etree._Attrib.keys lxml.etree._Attrib-class.html#keys +lxml.etree._Attrib.update lxml.etree._Attrib-class.html#update +lxml.etree._Attrib.__setitem__ lxml.etree._Attrib-class.html#__setitem__ +lxml.etree._Attrib.__gt__ lxml.etree._Attrib-class.html#__gt__ +lxml.etree._Attrib.__eq__ lxml.etree._Attrib-class.html#__eq__ +lxml.etree._Attrib.iterkeys lxml.etree._Attrib-class.html#iterkeys +lxml.etree._Attrib.__delitem__ lxml.etree._Attrib-class.html#__delitem__ +lxml.etree._Attrib.__nonzero__ lxml.etree._Attrib-class.html#__nonzero__ +lxml.etree._Attrib.items lxml.etree._Attrib-class.html#items +lxml.etree._Attrib.clear lxml.etree._Attrib-class.html#clear +lxml.etree._Attrib.__iter__ lxml.etree._Attrib-class.html#__iter__ +lxml.etree._Attrib.__le__ lxml.etree._Attrib-class.html#__le__ +lxml.etree._Attrib.values lxml.etree._Attrib-class.html#values +lxml.etree._Attrib.__repr__ lxml.etree._Attrib-class.html#__repr__ +lxml.etree._Attrib.__ge__ lxml.etree._Attrib-class.html#__ge__ +lxml.etree._AttribIterator lxml.etree._AttribIterator-class.html +lxml.etree._AttribIterator.__new__ lxml.etree._AttribIterator-class.html#__new__ +lxml.etree._AttribIterator.__next__ lxml.etree._AttribIterator-class.html#__next__ +lxml.etree._AttribIterator.next lxml.etree._AttribIterator-class.html#next +lxml.etree._AttribIterator.__iter__ lxml.etree._AttribIterator-class.html#__iter__ +lxml.etree._BaseContext lxml.etree._BaseContext-class.html +lxml.etree._BaseContext.__new__ lxml.etree._BaseContext-class.html#__new__ +lxml.etree._BaseContext.eval_context lxml.etree._BaseContext-class.html#eval_context +lxml.etree._BaseContext.context_node lxml.etree._BaseContext-class.html#context_node +lxml.etree._BaseContext.__init__ lxml.etree._BaseContext-class.html#__init__ +lxml.etree._BaseErrorLog lxml.etree._BaseErrorLog-class.html +lxml.etree._BaseErrorLog.__new__ lxml.etree._BaseErrorLog-class.html#__new__ +lxml.etree._BaseErrorLog.last_error lxml.etree._BaseErrorLog-class.html#last_error +lxml.etree._BaseErrorLog.__repr__ lxml.etree._BaseErrorLog-class.html#__repr__ +lxml.etree._BaseErrorLog.copy lxml.etree._BaseErrorLog-class.html#copy +lxml.etree._BaseErrorLog.__init__ lxml.etree._BaseErrorLog-class.html#__init__ +lxml.etree._BaseParser lxml.etree._BaseParser-class.html +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree._BaseParser.__new__ lxml.etree._BaseParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.etree._BaseParser.__init__ lxml.etree._BaseParser-class.html#__init__ +lxml.etree._ClassNamespaceRegistry lxml.etree._ClassNamespaceRegistry-class.html +lxml.etree._ClassNamespaceRegistry.__delitem__ lxml.etree._ClassNamespaceRegistry-class.html#__delitem__ +lxml.etree._ClassNamespaceRegistry.__new__ lxml.etree._ClassNamespaceRegistry-class.html#__new__ +lxml.etree._NamespaceRegistry.__getitem__ lxml.etree._NamespaceRegistry-class.html#__getitem__ +lxml.etree._NamespaceRegistry.items lxml.etree._NamespaceRegistry-class.html#items +lxml.etree._NamespaceRegistry.clear lxml.etree._NamespaceRegistry-class.html#clear +lxml.etree._NamespaceRegistry.__iter__ lxml.etree._NamespaceRegistry-class.html#__iter__ +lxml.etree._NamespaceRegistry.update lxml.etree._NamespaceRegistry-class.html#update +lxml.etree._ClassNamespaceRegistry.__setitem__ lxml.etree._ClassNamespaceRegistry-class.html#__setitem__ +lxml.etree._ClassNamespaceRegistry.__repr__ lxml.etree._ClassNamespaceRegistry-class.html#__repr__ +lxml.etree._NamespaceRegistry.iteritems lxml.etree._NamespaceRegistry-class.html#iteritems +lxml.etree._NamespaceRegistry.__init__ lxml.etree._NamespaceRegistry-class.html#__init__ +lxml.etree._Comment lxml.etree._Comment-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Comment.tag lxml.etree._Comment-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Comment.__new__ lxml.etree._Comment-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Comment.__repr__ lxml.etree._Comment-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Document lxml.etree._Document-class.html +lxml.etree._Document.__new__ lxml.etree._Document-class.html#__new__ +lxml.etree._DomainErrorLog lxml.etree._DomainErrorLog-class.html +lxml.etree._ListErrorLog.filter_domains lxml.etree._ListErrorLog-class.html#filter_domains +lxml.etree._BaseErrorLog.last_error lxml.etree._BaseErrorLog-class.html#last_error +lxml.etree._ListErrorLog.filter_from_warnings lxml.etree._ListErrorLog-class.html#filter_from_warnings +lxml.etree._DomainErrorLog.__init__ lxml.etree._DomainErrorLog-class.html#__init__ +lxml.etree._DomainErrorLog.__new__ lxml.etree._DomainErrorLog-class.html#__new__ +lxml.etree._ListErrorLog.__contains__ lxml.etree._ListErrorLog-class.html#__contains__ +lxml.etree._ListErrorLog.filter_from_level lxml.etree._ListErrorLog-class.html#filter_from_level +lxml.etree._ListErrorLog.__len__ lxml.etree._ListErrorLog-class.html#__len__ +lxml.etree._ListErrorLog.__getitem__ lxml.etree._ListErrorLog-class.html#__getitem__ +lxml.etree._ListErrorLog.filter_levels lxml.etree._ListErrorLog-class.html#filter_levels +lxml.etree._ErrorLog.__iter__ lxml.etree._ErrorLog-class.html#__iter__ +lxml.etree._ErrorLog.copy lxml.etree._ErrorLog-class.html#copy +lxml.etree._ListErrorLog.__nonzero__ lxml.etree._ListErrorLog-class.html#__nonzero__ +lxml.etree._ListErrorLog.filter_from_fatals lxml.etree._ListErrorLog-class.html#filter_from_fatals +lxml.etree._DomainErrorLog.receive lxml.etree._DomainErrorLog-class.html#receive +lxml.etree._ErrorLog.clear lxml.etree._ErrorLog-class.html#clear +lxml.etree._ListErrorLog.filter_from_errors lxml.etree._ListErrorLog-class.html#filter_from_errors +lxml.etree._ListErrorLog.filter_types lxml.etree._ListErrorLog-class.html#filter_types +lxml.etree._ListErrorLog.__repr__ lxml.etree._ListErrorLog-class.html#__repr__ +lxml.etree._Element lxml.etree._Element-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.__new__ lxml.etree._Element-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._ElementIterator lxml.etree._ElementIterator-class.html +lxml.etree._ElementIterator.__new__ lxml.etree._ElementIterator-class.html#__new__ +lxml.etree._ElementIterator.__next__ lxml.etree._ElementIterator-class.html#__next__ +lxml.etree._ElementIterator.next lxml.etree._ElementIterator-class.html#next +lxml.etree._ElementIterator.__iter__ lxml.etree._ElementIterator-class.html#__iter__ +lxml.etree._ElementStringResult lxml.etree._ElementStringResult-class.html +str.upper str-class.html#upper +lxml.etree._ElementStringResult.getparent lxml.etree._ElementStringResult-class.html#getparent +str.__getslice__ str-class.html#__getslice__ +str.startswith str-class.html#startswith +str.lstrip str-class.html#lstrip +str.capitalize str-class.html#capitalize +str.__str__ str-class.html#__str__ +str.__getattribute__ str-class.html#__getattribute__ +str.rpartition str-class.html#rpartition +str.replace str-class.html#replace +str.isdigit str-class.html#isdigit +str.endswith str-class.html#endswith +str.splitlines str-class.html#splitlines +str.expandtabs str-class.html#expandtabs +str.strip str-class.html#strip +str.__rmul__ str-class.html#__rmul__ +str.__lt__ str-class.html#__lt__ +str.ljust str-class.html#ljust +str.__rmod__ str-class.html#__rmod__ +str.index str-class.html#index +str.__getnewargs__ str-class.html#__getnewargs__ +str.__new__ str-class.html#__new__ +str.isalnum str-class.html#isalnum +str.__contains__ str-class.html#__contains__ +str.rindex str-class.html#rindex +str.__eq__ str-class.html#__eq__ +str.find str-class.html#find +str.decode str-class.html#decode +str.isalpha str-class.html#isalpha +str.split str-class.html#split +str.rstrip str-class.html#rstrip +str.encode str-class.html#encode +str.translate str-class.html#translate +str.isspace str-class.html#isspace +str.__len__ str-class.html#__len__ +str.__mul__ str-class.html#__mul__ +str.__ne__ str-class.html#__ne__ +str.__getitem__ str-class.html#__getitem__ +str.rjust str-class.html#rjust +str.swapcase str-class.html#swapcase +str.islower str-class.html#islower +str.zfill str-class.html#zfill +str.__add__ str-class.html#__add__ +str.__gt__ str-class.html#__gt__ +str.rsplit str-class.html#rsplit +str.count str-class.html#count +str.lower str-class.html#lower +str.join str-class.html#join +str.center str-class.html#center +str.__mod__ str-class.html#__mod__ +str.partition str-class.html#partition +str.rfind str-class.html#rfind +str.istitle str-class.html#istitle +str.__le__ str-class.html#__le__ +str.__repr__ str-class.html#__repr__ +str.__hash__ str-class.html#__hash__ +str.title str-class.html#title +str.isupper str-class.html#isupper +str.__ge__ str-class.html#__ge__ +lxml.etree._ElementTagMatcher lxml.etree._ElementTagMatcher-class.html +lxml.etree._ElementTagMatcher.__new__ lxml.etree._ElementTagMatcher-class.html#__new__ +lxml.etree._ElementTree lxml.etree._ElementTree-class.html +lxml.etree._ElementTree.getroot lxml.etree._ElementTree-class.html#getroot +lxml.etree._ElementTree.iterfind lxml.etree._ElementTree-class.html#iterfind +lxml.etree._ElementTree.parse lxml.etree._ElementTree-class.html#parse +lxml.etree._ElementTree.relaxng lxml.etree._ElementTree-class.html#relaxng +lxml.etree._ElementTree.find lxml.etree._ElementTree-class.html#find +lxml.etree._ElementTree.__new__ lxml.etree._ElementTree-class.html#__new__ +lxml.etree._ElementTree.findtext lxml.etree._ElementTree-class.html#findtext +lxml.etree._ElementTree.findall lxml.etree._ElementTree-class.html#findall +lxml.etree._ElementTree.write lxml.etree._ElementTree-class.html#write +lxml.etree._ElementTree._setroot lxml.etree._ElementTree-class.html#_setroot +lxml.etree._ElementTree.xpath lxml.etree._ElementTree-class.html#xpath +lxml.etree._ElementTree.parser lxml.etree._ElementTree-class.html#parser +lxml.etree._ElementTree.xslt lxml.etree._ElementTree-class.html#xslt +lxml.etree._ElementTree.__deepcopy__ lxml.etree._ElementTree-class.html#__deepcopy__ +lxml.etree._ElementTree.getpath lxml.etree._ElementTree-class.html#getpath +lxml.etree._ElementTree.write_c14n lxml.etree._ElementTree-class.html#write_c14n +lxml.etree._ElementTree.xmlschema lxml.etree._ElementTree-class.html#xmlschema +lxml.etree._ElementTree.xinclude lxml.etree._ElementTree-class.html#xinclude +lxml.etree._ElementTree.docinfo lxml.etree._ElementTree-class.html#docinfo +lxml.etree._ElementTree.getiterator lxml.etree._ElementTree-class.html#getiterator +lxml.etree._ElementTree.iter lxml.etree._ElementTree-class.html#iter +lxml.etree._ElementTree.__copy__ lxml.etree._ElementTree-class.html#__copy__ +lxml.etree._ElementUnicodeResult lxml.etree._ElementUnicodeResult-class.html +lxml.etree._ElementUnicodeResult.getparent lxml.etree._ElementUnicodeResult-class.html#getparent +lxml.etree._ElementUnicodeResult.is_attribute lxml.etree._ElementUnicodeResult-class.html#is_attribute +lxml.etree._ElementUnicodeResult.__new__ lxml.etree._ElementUnicodeResult-class.html#__new__ +lxml.etree._ElementUnicodeResult.is_text lxml.etree._ElementUnicodeResult-class.html#is_text +lxml.etree._ElementUnicodeResult.is_tail lxml.etree._ElementUnicodeResult-class.html#is_tail +lxml.etree._Entity lxml.etree._Entity-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Entity.text lxml.etree._Entity-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Entity.tag lxml.etree._Entity-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Entity.__new__ lxml.etree._Entity-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Entity.name lxml.etree._Entity-class.html#name +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Entity.__repr__ lxml.etree._Entity-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._ErrorLog lxml.etree._ErrorLog-class.html +lxml.etree._ListErrorLog.filter_domains lxml.etree._ListErrorLog-class.html#filter_domains +lxml.etree._BaseErrorLog.last_error lxml.etree._BaseErrorLog-class.html#last_error +lxml.etree._ListErrorLog.filter_from_warnings lxml.etree._ListErrorLog-class.html#filter_from_warnings +lxml.etree._ErrorLog.__init__ lxml.etree._ErrorLog-class.html#__init__ +lxml.etree._ErrorLog.__new__ lxml.etree._ErrorLog-class.html#__new__ +lxml.etree._ListErrorLog.__contains__ lxml.etree._ListErrorLog-class.html#__contains__ +lxml.etree._ListErrorLog.filter_from_level lxml.etree._ListErrorLog-class.html#filter_from_level +lxml.etree._ListErrorLog.__len__ lxml.etree._ListErrorLog-class.html#__len__ +lxml.etree._ListErrorLog.__getitem__ lxml.etree._ListErrorLog-class.html#__getitem__ +lxml.etree._ListErrorLog.filter_levels lxml.etree._ListErrorLog-class.html#filter_levels +lxml.etree._ErrorLog.__iter__ lxml.etree._ErrorLog-class.html#__iter__ +lxml.etree._ErrorLog.copy lxml.etree._ErrorLog-class.html#copy +lxml.etree._ListErrorLog.__nonzero__ lxml.etree._ListErrorLog-class.html#__nonzero__ +lxml.etree._ListErrorLog.filter_from_fatals lxml.etree._ListErrorLog-class.html#filter_from_fatals +lxml.etree._ErrorLog.receive lxml.etree._ErrorLog-class.html#receive +lxml.etree._ErrorLog.clear lxml.etree._ErrorLog-class.html#clear +lxml.etree._ListErrorLog.filter_from_errors lxml.etree._ListErrorLog-class.html#filter_from_errors +lxml.etree._ListErrorLog.filter_types lxml.etree._ListErrorLog-class.html#filter_types +lxml.etree._ListErrorLog.__repr__ lxml.etree._ListErrorLog-class.html#__repr__ +lxml.etree._ExceptionContext lxml.etree._ExceptionContext-class.html +lxml.etree._ExceptionContext.__new__ lxml.etree._ExceptionContext-class.html#__new__ +lxml.etree._ExsltRegExp lxml.etree._ExsltRegExp-class.html +lxml.etree._ExsltRegExp.__new__ lxml.etree._ExsltRegExp-class.html#__new__ +lxml.etree._ExsltRegExp.replace lxml.etree._ExsltRegExp-class.html#replace +lxml.etree._ExsltRegExp.__init__ lxml.etree._ExsltRegExp-class.html#__init__ +lxml.etree._ExsltRegExp.test lxml.etree._ExsltRegExp-class.html#test +lxml.etree._ExsltRegExp.match lxml.etree._ExsltRegExp-class.html#match +lxml.etree._FeedParser lxml.etree._FeedParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree._FeedParser.__new__ lxml.etree._FeedParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.etree._BaseParser.__init__ lxml.etree._BaseParser-class.html#__init__ +lxml.etree._FileReaderContext lxml.etree._FileReaderContext-class.html +lxml.etree._FileReaderContext.__new__ lxml.etree._FileReaderContext-class.html#__new__ +lxml.etree._FileReaderContext.__init__ lxml.etree._FileReaderContext-class.html#__init__ +lxml.etree._FilelikeWriter lxml.etree._FilelikeWriter-class.html +lxml.etree._FilelikeWriter.__new__ lxml.etree._FilelikeWriter-class.html#__new__ +lxml.etree._FilelikeWriter.__init__ lxml.etree._FilelikeWriter-class.html#__init__ +lxml.etree._FunctionNamespaceRegistry lxml.etree._FunctionNamespaceRegistry-class.html +lxml.etree._FunctionNamespaceRegistry.__delitem__ lxml.etree._FunctionNamespaceRegistry-class.html#__delitem__ +lxml.etree._FunctionNamespaceRegistry.__new__ lxml.etree._FunctionNamespaceRegistry-class.html#__new__ +lxml.etree._NamespaceRegistry.__getitem__ lxml.etree._NamespaceRegistry-class.html#__getitem__ +lxml.etree._NamespaceRegistry.items lxml.etree._NamespaceRegistry-class.html#items +lxml.etree._NamespaceRegistry.clear lxml.etree._NamespaceRegistry-class.html#clear +lxml.etree._NamespaceRegistry.__iter__ lxml.etree._NamespaceRegistry-class.html#__iter__ +lxml.etree._NamespaceRegistry.update lxml.etree._NamespaceRegistry-class.html#update +lxml.etree._FunctionNamespaceRegistry.__setitem__ lxml.etree._FunctionNamespaceRegistry-class.html#__setitem__ +lxml.etree._FunctionNamespaceRegistry.__repr__ lxml.etree._FunctionNamespaceRegistry-class.html#__repr__ +lxml.etree._NamespaceRegistry.iteritems lxml.etree._NamespaceRegistry-class.html#iteritems +lxml.etree._NamespaceRegistry.__init__ lxml.etree._NamespaceRegistry-class.html#__init__ +lxml.etree._IDDict lxml.etree._IDDict-class.html +lxml.etree._IDDict.has_key lxml.etree._IDDict-class.html#has_key +lxml.etree._IDDict.__init__ lxml.etree._IDDict-class.html#__init__ +lxml.etree._IDDict.__new__ lxml.etree._IDDict-class.html#__new__ +lxml.etree._IDDict.__contains__ lxml.etree._IDDict-class.html#__contains__ +lxml.etree._IDDict.itervalues lxml.etree._IDDict-class.html#itervalues +lxml.etree._IDDict.__len__ lxml.etree._IDDict-class.html#__len__ +lxml.etree._IDDict.__getitem__ lxml.etree._IDDict-class.html#__getitem__ +lxml.etree._IDDict.get lxml.etree._IDDict-class.html#get +lxml.etree._IDDict.keys lxml.etree._IDDict-class.html#keys +lxml.etree._IDDict.__iter__ lxml.etree._IDDict-class.html#__iter__ +lxml.etree._IDDict.iteritems lxml.etree._IDDict-class.html#iteritems +lxml.etree._IDDict.copy lxml.etree._IDDict-class.html#copy +lxml.etree._IDDict.iterkeys lxml.etree._IDDict-class.html#iterkeys +lxml.etree._IDDict.items lxml.etree._IDDict-class.html#items +lxml.etree._IDDict.values lxml.etree._IDDict-class.html#values +lxml.etree._IDDict.__repr__ lxml.etree._IDDict-class.html#__repr__ +lxml.etree._InputDocument lxml.etree._InputDocument-class.html +lxml.etree._InputDocument.__new__ lxml.etree._InputDocument-class.html#__new__ +lxml.etree._IterparseContext lxml.etree._IterparseContext-class.html +lxml.etree._IterparseContext.__new__ lxml.etree._IterparseContext-class.html#__new__ +lxml.etree._IterparseContext.__init__ lxml.etree._IterparseContext-class.html#__init__ +lxml.etree._ListErrorLog lxml.etree._ListErrorLog-class.html +lxml.etree._ListErrorLog.filter_domains lxml.etree._ListErrorLog-class.html#filter_domains +lxml.etree._BaseErrorLog.last_error lxml.etree._BaseErrorLog-class.html#last_error +lxml.etree._ListErrorLog.filter_from_warnings lxml.etree._ListErrorLog-class.html#filter_from_warnings +lxml.etree._ListErrorLog.__init__ lxml.etree._ListErrorLog-class.html#__init__ +lxml.etree._ListErrorLog.__new__ lxml.etree._ListErrorLog-class.html#__new__ +lxml.etree._ListErrorLog.__contains__ lxml.etree._ListErrorLog-class.html#__contains__ +lxml.etree._ListErrorLog.filter_from_level lxml.etree._ListErrorLog-class.html#filter_from_level +lxml.etree._ListErrorLog.__len__ lxml.etree._ListErrorLog-class.html#__len__ +lxml.etree._ListErrorLog.__getitem__ lxml.etree._ListErrorLog-class.html#__getitem__ +lxml.etree._ListErrorLog.filter_levels lxml.etree._ListErrorLog-class.html#filter_levels +lxml.etree._ListErrorLog.__iter__ lxml.etree._ListErrorLog-class.html#__iter__ +lxml.etree._ListErrorLog.copy lxml.etree._ListErrorLog-class.html#copy +lxml.etree._ListErrorLog.__nonzero__ lxml.etree._ListErrorLog-class.html#__nonzero__ +lxml.etree._ListErrorLog.filter_from_fatals lxml.etree._ListErrorLog-class.html#filter_from_fatals +lxml.etree._ListErrorLog.filter_from_errors lxml.etree._ListErrorLog-class.html#filter_from_errors +lxml.etree._ListErrorLog.filter_types lxml.etree._ListErrorLog-class.html#filter_types +lxml.etree._ListErrorLog.__repr__ lxml.etree._ListErrorLog-class.html#__repr__ +lxml.etree._LogEntry lxml.etree._LogEntry-class.html +lxml.etree._LogEntry.domain lxml.etree._LogEntry-class.html#domain +lxml.etree._LogEntry.__new__ lxml.etree._LogEntry-class.html#__new__ +lxml.etree._LogEntry.level lxml.etree._LogEntry-class.html#level +lxml.etree._LogEntry.column lxml.etree._LogEntry-class.html#column +lxml.etree._LogEntry.message lxml.etree._LogEntry-class.html#message +lxml.etree._LogEntry.type_name lxml.etree._LogEntry-class.html#type_name +lxml.etree._LogEntry.domain_name lxml.etree._LogEntry-class.html#domain_name +lxml.etree._LogEntry.filename lxml.etree._LogEntry-class.html#filename +lxml.etree._LogEntry.__repr__ lxml.etree._LogEntry-class.html#__repr__ +lxml.etree._LogEntry.level_name lxml.etree._LogEntry-class.html#level_name +lxml.etree._LogEntry.type lxml.etree._LogEntry-class.html#type +lxml.etree._LogEntry.line lxml.etree._LogEntry-class.html#line +lxml.etree._NamespaceRegistry lxml.etree._NamespaceRegistry-class.html +lxml.etree._NamespaceRegistry.__delitem__ lxml.etree._NamespaceRegistry-class.html#__delitem__ +lxml.etree._NamespaceRegistry.__new__ lxml.etree._NamespaceRegistry-class.html#__new__ +lxml.etree._NamespaceRegistry.__getitem__ lxml.etree._NamespaceRegistry-class.html#__getitem__ +lxml.etree._NamespaceRegistry.items lxml.etree._NamespaceRegistry-class.html#items +lxml.etree._NamespaceRegistry.clear lxml.etree._NamespaceRegistry-class.html#clear +lxml.etree._NamespaceRegistry.update lxml.etree._NamespaceRegistry-class.html#update +lxml.etree._NamespaceRegistry.__iter__ lxml.etree._NamespaceRegistry-class.html#__iter__ +lxml.etree._NamespaceRegistry.iteritems lxml.etree._NamespaceRegistry-class.html#iteritems +lxml.etree._NamespaceRegistry.__setitem__ lxml.etree._NamespaceRegistry-class.html#__setitem__ +lxml.etree._NamespaceRegistry.__init__ lxml.etree._NamespaceRegistry-class.html#__init__ +lxml.etree._ParserContext lxml.etree._ParserContext-class.html +lxml.etree._ParserContext.__new__ lxml.etree._ParserContext-class.html#__new__ +lxml.etree._ParserDictionaryContext lxml.etree._ParserDictionaryContext-class.html +lxml.etree._ParserDictionaryContext.__new__ lxml.etree._ParserDictionaryContext-class.html#__new__ +lxml.etree._ParserDictionaryContext.__init__ lxml.etree._ParserDictionaryContext-class.html#__init__ +lxml.etree._ParserSchemaValidationContext lxml.etree._ParserSchemaValidationContext-class.html +lxml.etree._ParserSchemaValidationContext.__new__ lxml.etree._ParserSchemaValidationContext-class.html#__new__ +lxml.etree._ProcessingInstruction lxml.etree._ProcessingInstruction-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._ProcessingInstruction.tag lxml.etree._ProcessingInstruction-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._ProcessingInstruction.__new__ lxml.etree._ProcessingInstruction-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._ProcessingInstruction.target lxml.etree._ProcessingInstruction-class.html#target +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._ProcessingInstruction.__repr__ lxml.etree._ProcessingInstruction-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._PythonSaxParserTarget lxml.etree._PythonSaxParserTarget-class.html +lxml.etree._PythonSaxParserTarget.__new__ lxml.etree._PythonSaxParserTarget-class.html#__new__ +lxml.etree._PythonSaxParserTarget.__init__ lxml.etree._PythonSaxParserTarget-class.html#__init__ +lxml.etree._ReadOnlyElementProxy lxml.etree._ReadOnlyElementProxy-class.html +lxml.etree._ReadOnlyElementProxy.getprevious lxml.etree._ReadOnlyElementProxy-class.html#getprevious +lxml.etree._ReadOnlyElementProxy.getparent lxml.etree._ReadOnlyElementProxy-class.html#getparent +lxml.etree._ReadOnlyElementProxy.sourceline lxml.etree._ReadOnlyElementProxy-class.html#sourceline +lxml.etree._ReadOnlyElementProxy.text lxml.etree._ReadOnlyElementProxy-class.html#text +lxml.etree._ReadOnlyElementProxy.iterchildren lxml.etree._ReadOnlyElementProxy-class.html#iterchildren +lxml.etree._ReadOnlyElementProxy.prefix lxml.etree._ReadOnlyElementProxy-class.html#prefix +lxml.etree._ReadOnlyElementProxy.tag lxml.etree._ReadOnlyElementProxy-class.html#tag +lxml.etree._ReadOnlyElementProxy.getnext lxml.etree._ReadOnlyElementProxy-class.html#getnext +lxml.etree._ReadOnlyElementProxy.__new__ lxml.etree._ReadOnlyElementProxy-class.html#__new__ +lxml.etree._ReadOnlyElementProxy.getchildren lxml.etree._ReadOnlyElementProxy-class.html#getchildren +lxml.etree._ReadOnlyElementProxy.tail lxml.etree._ReadOnlyElementProxy-class.html#tail +lxml.etree._ReadOnlyElementProxy.__len__ lxml.etree._ReadOnlyElementProxy-class.html#__len__ +lxml.etree._ReadOnlyElementProxy.__getitem__ lxml.etree._ReadOnlyElementProxy-class.html#__getitem__ +lxml.etree._ReadOnlyElementProxy.get lxml.etree._ReadOnlyElementProxy-class.html#get +lxml.etree._ReadOnlyElementProxy.keys lxml.etree._ReadOnlyElementProxy-class.html#keys +lxml.etree._ReadOnlyElementProxy.__deepcopy__ lxml.etree._ReadOnlyElementProxy-class.html#__deepcopy__ +lxml.etree._ReadOnlyElementProxy.__iter__ lxml.etree._ReadOnlyElementProxy-class.html#__iter__ +lxml.etree._ReadOnlyElementProxy.__nonzero__ lxml.etree._ReadOnlyElementProxy-class.html#__nonzero__ +lxml.etree._ReadOnlyElementProxy.items lxml.etree._ReadOnlyElementProxy-class.html#items +lxml.etree._ReadOnlyElementProxy.values lxml.etree._ReadOnlyElementProxy-class.html#values +lxml.etree._ReadOnlyElementProxy.__repr__ lxml.etree._ReadOnlyElementProxy-class.html#__repr__ +lxml.etree._ReadOnlyElementProxy.attrib lxml.etree._ReadOnlyElementProxy-class.html#attrib +lxml.etree._ReadOnlyElementProxy.__copy__ lxml.etree._ReadOnlyElementProxy-class.html#__copy__ +lxml.etree._ResolverContext lxml.etree._ResolverContext-class.html +lxml.etree._ResolverContext.__new__ lxml.etree._ResolverContext-class.html#__new__ +lxml.etree._ResolverRegistry lxml.etree._ResolverRegistry-class.html +lxml.etree._ResolverRegistry.resolve lxml.etree._ResolverRegistry-class.html#resolve +lxml.etree._ResolverRegistry.__new__ lxml.etree._ResolverRegistry-class.html#__new__ +lxml.etree._ResolverRegistry.remove lxml.etree._ResolverRegistry-class.html#remove +lxml.etree._ResolverRegistry.add lxml.etree._ResolverRegistry-class.html#add +lxml.etree._ResolverRegistry.__repr__ lxml.etree._ResolverRegistry-class.html#__repr__ +lxml.etree._ResolverRegistry.copy lxml.etree._ResolverRegistry-class.html#copy +lxml.etree._ResolverRegistry.__init__ lxml.etree._ResolverRegistry-class.html#__init__ +lxml.etree._RotatingErrorLog lxml.etree._RotatingErrorLog-class.html +lxml.etree._ListErrorLog.filter_domains lxml.etree._ListErrorLog-class.html#filter_domains +lxml.etree._BaseErrorLog.last_error lxml.etree._BaseErrorLog-class.html#last_error +lxml.etree._ListErrorLog.filter_from_warnings lxml.etree._ListErrorLog-class.html#filter_from_warnings +lxml.etree._RotatingErrorLog.__init__ lxml.etree._RotatingErrorLog-class.html#__init__ +lxml.etree._RotatingErrorLog.__new__ lxml.etree._RotatingErrorLog-class.html#__new__ +lxml.etree._ListErrorLog.__contains__ lxml.etree._ListErrorLog-class.html#__contains__ +lxml.etree._ListErrorLog.filter_from_level lxml.etree._ListErrorLog-class.html#filter_from_level +lxml.etree._ListErrorLog.__len__ lxml.etree._ListErrorLog-class.html#__len__ +lxml.etree._ListErrorLog.__getitem__ lxml.etree._ListErrorLog-class.html#__getitem__ +lxml.etree._ListErrorLog.filter_levels lxml.etree._ListErrorLog-class.html#filter_levels +lxml.etree._ErrorLog.__iter__ lxml.etree._ErrorLog-class.html#__iter__ +lxml.etree._ErrorLog.copy lxml.etree._ErrorLog-class.html#copy +lxml.etree._ListErrorLog.__nonzero__ lxml.etree._ListErrorLog-class.html#__nonzero__ +lxml.etree._ListErrorLog.filter_from_fatals lxml.etree._ListErrorLog-class.html#filter_from_fatals +lxml.etree._RotatingErrorLog.receive lxml.etree._RotatingErrorLog-class.html#receive +lxml.etree._ErrorLog.clear lxml.etree._ErrorLog-class.html#clear +lxml.etree._ListErrorLog.filter_from_errors lxml.etree._ListErrorLog-class.html#filter_from_errors +lxml.etree._ListErrorLog.filter_types lxml.etree._ListErrorLog-class.html#filter_types +lxml.etree._ListErrorLog.__repr__ lxml.etree._ListErrorLog-class.html#__repr__ +lxml.etree._SaxParserContext lxml.etree._SaxParserContext-class.html +lxml.etree._SaxParserContext.__new__ lxml.etree._SaxParserContext-class.html#__new__ +lxml.etree._SaxParserTarget lxml.etree._SaxParserTarget-class.html +lxml.etree._SaxParserTarget.__new__ lxml.etree._SaxParserTarget-class.html#__new__ +lxml.etree._TargetParserContext lxml.etree._TargetParserContext-class.html +lxml.etree._TargetParserContext.__new__ lxml.etree._TargetParserContext-class.html#__new__ +lxml.etree._TargetParserResult lxml.etree._TargetParserResult-class.html +lxml.etree._TargetParserResult.__init__ lxml.etree._TargetParserResult-class.html#__init__ +lxml.etree._TempStore lxml.etree._TempStore-class.html +lxml.etree._TempStore.__new__ lxml.etree._TempStore-class.html#__new__ +lxml.etree._TempStore.__init__ lxml.etree._TempStore-class.html#__init__ +lxml.etree._Validator lxml.etree._Validator-class.html +lxml.etree._Validator.__new__ lxml.etree._Validator-class.html#__new__ +lxml.etree._Validator.assertValid lxml.etree._Validator-class.html#assertValid +lxml.etree._Validator.error_log lxml.etree._Validator-class.html#error_log +lxml.etree._Validator.assert_ lxml.etree._Validator-class.html#assert_ +lxml.etree._Validator.validate lxml.etree._Validator-class.html#validate +lxml.etree._Validator.__init__ lxml.etree._Validator-class.html#__init__ +lxml.etree._XPathContext lxml.etree._XPathContext-class.html +lxml.etree._XPathContext.__new__ lxml.etree._XPathContext-class.html#__new__ +lxml.etree._BaseContext.eval_context lxml.etree._BaseContext-class.html#eval_context +lxml.etree._BaseContext.context_node lxml.etree._BaseContext-class.html#context_node +lxml.etree._XPathContext.__init__ lxml.etree._XPathContext-class.html#__init__ +lxml.etree._XPathEvaluatorBase lxml.etree._XPathEvaluatorBase-class.html +lxml.etree._XPathEvaluatorBase.__new__ lxml.etree._XPathEvaluatorBase-class.html#__new__ +lxml.etree._XPathEvaluatorBase.evaluate lxml.etree._XPathEvaluatorBase-class.html#evaluate +lxml.etree._XPathEvaluatorBase.error_log lxml.etree._XPathEvaluatorBase-class.html#error_log +lxml.etree._XPathEvaluatorBase.__init__ lxml.etree._XPathEvaluatorBase-class.html#__init__ +lxml.etree._XPathFunctionNamespaceRegistry lxml.etree._XPathFunctionNamespaceRegistry-class.html +lxml.etree._FunctionNamespaceRegistry.__delitem__ lxml.etree._FunctionNamespaceRegistry-class.html#__delitem__ +lxml.etree._XPathFunctionNamespaceRegistry.__new__ lxml.etree._XPathFunctionNamespaceRegistry-class.html#__new__ +lxml.etree._NamespaceRegistry.__getitem__ lxml.etree._NamespaceRegistry-class.html#__getitem__ +lxml.etree._NamespaceRegistry.items lxml.etree._NamespaceRegistry-class.html#items +lxml.etree._NamespaceRegistry.clear lxml.etree._NamespaceRegistry-class.html#clear +lxml.etree._NamespaceRegistry.__iter__ lxml.etree._NamespaceRegistry-class.html#__iter__ +lxml.etree._XPathFunctionNamespaceRegistry.prefix lxml.etree._XPathFunctionNamespaceRegistry-class.html#prefix +lxml.etree._NamespaceRegistry.update lxml.etree._NamespaceRegistry-class.html#update +lxml.etree._FunctionNamespaceRegistry.__setitem__ lxml.etree._FunctionNamespaceRegistry-class.html#__setitem__ +lxml.etree._FunctionNamespaceRegistry.__repr__ lxml.etree._FunctionNamespaceRegistry-class.html#__repr__ +lxml.etree._NamespaceRegistry.iteritems lxml.etree._NamespaceRegistry-class.html#iteritems +lxml.etree._NamespaceRegistry.__init__ lxml.etree._NamespaceRegistry-class.html#__init__ +lxml.etree._XSLTContext lxml.etree._XSLTContext-class.html +lxml.etree._XSLTContext.__new__ lxml.etree._XSLTContext-class.html#__new__ +lxml.etree._BaseContext.eval_context lxml.etree._BaseContext-class.html#eval_context +lxml.etree._BaseContext.context_node lxml.etree._BaseContext-class.html#context_node +lxml.etree._XSLTContext.__init__ lxml.etree._XSLTContext-class.html#__init__ +lxml.etree._XSLTProcessingInstruction lxml.etree._XSLTProcessingInstruction-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._XSLTProcessingInstruction.set lxml.etree._XSLTProcessingInstruction-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._ProcessingInstruction.tag lxml.etree._ProcessingInstruction-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._XSLTProcessingInstruction.__new__ lxml.etree._XSLTProcessingInstruction-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree._XSLTProcessingInstruction.get lxml.etree._XSLTProcessingInstruction-class.html#get +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._ProcessingInstruction.target lxml.etree._ProcessingInstruction-class.html#target +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._ProcessingInstruction.__repr__ lxml.etree._ProcessingInstruction-class.html#__repr__ +lxml.etree._XSLTProcessingInstruction.parseXSL lxml.etree._XSLTProcessingInstruction-class.html#parseXSL +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._XSLTQuotedStringParam lxml.etree._XSLTQuotedStringParam-class.html +lxml.etree._XSLTQuotedStringParam.__new__ lxml.etree._XSLTQuotedStringParam-class.html#__new__ +lxml.etree._XSLTQuotedStringParam.__init__ lxml.etree._XSLTQuotedStringParam-class.html#__init__ +lxml.etree._XSLTResolverContext lxml.etree._XSLTResolverContext-class.html +lxml.etree._XSLTResolverContext.__new__ lxml.etree._XSLTResolverContext-class.html#__new__ +lxml.etree._XSLTResultTree lxml.etree._XSLTResultTree-class.html +lxml.etree._ElementTree.getroot lxml.etree._ElementTree-class.html#getroot +lxml.etree._XSLTResultTree.__str__ lxml.etree._XSLTResultTree-class.html#__str__ +lxml.etree._ElementTree.parser lxml.etree._ElementTree-class.html#parser +lxml.etree._ElementTree.parse lxml.etree._ElementTree-class.html#parse +lxml.etree._ElementTree.relaxng lxml.etree._ElementTree-class.html#relaxng +lxml.etree._ElementTree.findall lxml.etree._ElementTree-class.html#findall +lxml.etree._XSLTResultTree.__new__ lxml.etree._XSLTResultTree-class.html#__new__ +lxml.etree._ElementTree.findtext lxml.etree._ElementTree-class.html#findtext +lxml.etree._ElementTree.find lxml.etree._ElementTree-class.html#find +lxml.etree._ElementTree.write lxml.etree._ElementTree-class.html#write +lxml.etree._ElementTree._setroot lxml.etree._ElementTree-class.html#_setroot +lxml.etree._ElementTree.xpath lxml.etree._ElementTree-class.html#xpath +lxml.etree._ElementTree.iterfind lxml.etree._ElementTree-class.html#iterfind +lxml.etree._ElementTree.xslt lxml.etree._ElementTree-class.html#xslt +lxml.etree._ElementTree.__deepcopy__ lxml.etree._ElementTree-class.html#__deepcopy__ +lxml.etree._ElementTree.getpath lxml.etree._ElementTree-class.html#getpath +lxml.etree._ElementTree.write_c14n lxml.etree._ElementTree-class.html#write_c14n +lxml.etree._ElementTree.xmlschema lxml.etree._ElementTree-class.html#xmlschema +lxml.etree._ElementTree.xinclude lxml.etree._ElementTree-class.html#xinclude +lxml.etree._ElementTree.docinfo lxml.etree._ElementTree-class.html#docinfo +lxml.etree._XSLTResultTree.__unicode__ lxml.etree._XSLTResultTree-class.html#__unicode__ +lxml.etree._XSLTResultTree.xslt_profile lxml.etree._XSLTResultTree-class.html#xslt_profile +lxml.etree._ElementTree.iter lxml.etree._ElementTree-class.html#iter +lxml.etree._ElementTree.getiterator lxml.etree._ElementTree-class.html#getiterator +lxml.etree._ElementTree.__copy__ lxml.etree._ElementTree-class.html#__copy__ +lxml.etree.__ContentOnlyElement lxml.etree.__ContentOnlyElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.__ContentOnlyElement.__new__ lxml.etree.__ContentOnlyElement-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree.iterparse lxml.etree.iterparse-class.html +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree.iterparse.__init__ lxml.etree.iterparse-class.html#__init__ +lxml.etree.iterparse.__new__ lxml.etree.iterparse-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree.iterparse.next lxml.etree.iterparse-class.html#next +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree.iterparse.__next__ lxml.etree.iterparse-class.html#__next__ +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree.iterparse.__iter__ lxml.etree.iterparse-class.html#__iter__ +lxml.etree.iterparse.copy lxml.etree.iterparse-class.html#copy +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree.iterparse.error_log lxml.etree.iterparse-class.html#error_log +lxml.etree.iterparse.root lxml.etree.iterparse-class.html#root +lxml.etree.iterwalk lxml.etree.iterwalk-class.html +lxml.etree.iterwalk.__new__ lxml.etree.iterwalk-class.html#__new__ +lxml.etree.iterwalk.__next__ lxml.etree.iterwalk-class.html#__next__ +lxml.etree.iterwalk.next lxml.etree.iterwalk-class.html#next +lxml.etree.iterwalk.__iter__ lxml.etree.iterwalk-class.html#__iter__ +lxml.etree.iterwalk.__init__ lxml.etree.iterwalk-class.html#__init__ +lxml.html.CheckboxGroup lxml.html.CheckboxGroup-class.html +lxml.html.CheckboxGroup._value__del lxml.html.CheckboxGroup-class.html#_value__del +lxml.html.CheckboxGroup.value lxml.html.CheckboxGroup-class.html#value +lxml.html.CheckboxGroup._value__set lxml.html.CheckboxGroup-class.html#_value__set +lxml.html.CheckboxGroup.__repr__ lxml.html.CheckboxGroup-class.html#__repr__ +lxml.html.CheckboxGroup._value__get lxml.html.CheckboxGroup-class.html#_value__get +lxml.html.CheckboxValues lxml.html.CheckboxValues-class.html +lxml.html.CheckboxValues.__init__ lxml.html.CheckboxValues-class.html#__init__ +lxml.html.CheckboxValues.add lxml.html.CheckboxValues-class.html#add +lxml.html.CheckboxValues.__iter__ lxml.html.CheckboxValues-class.html#__iter__ +lxml.html.CheckboxValues.remove lxml.html.CheckboxValues-class.html#remove +lxml.html.CheckboxValues.__repr__ lxml.html.CheckboxValues-class.html#__repr__ +lxml.html.FieldsDict lxml.html.FieldsDict-class.html +lxml.html.FieldsDict.__init__ lxml.html.FieldsDict-class.html#__init__ +lxml.html.FieldsDict.__contains__ lxml.html.FieldsDict-class.html#__contains__ +lxml.html.FieldsDict.__getitem__ lxml.html.FieldsDict-class.html#__getitem__ +lxml.html.FieldsDict.keys lxml.html.FieldsDict-class.html#keys +lxml.html.FieldsDict.__delitem__ lxml.html.FieldsDict-class.html#__delitem__ +lxml.html.FieldsDict.__setitem__ lxml.html.FieldsDict-class.html#__setitem__ +lxml.html.FieldsDict.__repr__ lxml.html.FieldsDict-class.html#__repr__ +lxml.html.FormElement lxml.html.FormElement-class.html +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.FormElement._fields__get lxml.html.FormElement-class.html#_fields__get +lxml.html.FormElement.form_values lxml.html.FormElement-class.html#form_values +lxml.html.FormElement._action__del lxml.html.FormElement-class.html#_action__del +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.html.FormElement._fields__set lxml.html.FormElement-class.html#_fields__set +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.html.FormElement._method__set lxml.html.FormElement-class.html#_method__set +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.html.FormElement.fields lxml.html.FormElement-class.html#fields +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.html.FormElement.method lxml.html.FormElement-class.html#method +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.html.FormElement._action__get lxml.html.FormElement-class.html#_action__get +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.FormElement._name lxml.html.FormElement-class.html#_name +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.html.FormElement.action lxml.html.FormElement-class.html#action +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.html.FormElement._method__get lxml.html.FormElement-class.html#_method__get +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.html.FormElement._action__set lxml.html.FormElement-class.html#_action__set +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.html.FormElement.inputs lxml.html.FormElement-class.html#inputs +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.html.HTMLParser lxml.html.HTMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree.HTMLParser.__new__ lxml.etree.HTMLParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.html.HTMLParser.__init__ lxml.html.HTMLParser-class.html#__init__ +lxml.html.HtmlComment lxml.html.HtmlComment-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Comment.tag lxml.etree._Comment-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.CommentBase.__new__ lxml.etree.CommentBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Comment.__repr__ lxml.etree._Comment-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.html.HtmlElement lxml.html.HtmlElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.html.HtmlElementClassLookup lxml.html.HtmlElementClassLookup-class.html +lxml.html.HtmlElementClassLookup._default_element_classes lxml.html.HtmlElementClassLookup-class.html#_default_element_classes +lxml.etree.CustomElementClassLookup.__new__ lxml.etree.CustomElementClassLookup-class.html#__new__ +lxml.html.HtmlElementClassLookup.lookup lxml.html.HtmlElementClassLookup-class.html#lookup +lxml.etree.FallbackElementClassLookup.fallback lxml.etree.FallbackElementClassLookup-class.html#fallback +lxml.etree.FallbackElementClassLookup.set_fallback lxml.etree.FallbackElementClassLookup-class.html#set_fallback +lxml.html.HtmlElementClassLookup.__init__ lxml.html.HtmlElementClassLookup-class.html#__init__ +lxml.html.HtmlEntity lxml.html.HtmlEntity-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Entity.text lxml.etree._Entity-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Entity.tag lxml.etree._Entity-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.EntityBase.__new__ lxml.etree.EntityBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Entity.name lxml.etree._Entity-class.html#name +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._Entity.__repr__ lxml.etree._Entity-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.html.HtmlMixin lxml.html.HtmlMixin-class.html +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.html.HtmlProcessingInstruction lxml.html.HtmlProcessingInstruction-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree.__ContentOnlyElement.set lxml.etree.__ContentOnlyElement-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree.__ContentOnlyElement.text lxml.etree.__ContentOnlyElement-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._ProcessingInstruction.tag lxml.etree._ProcessingInstruction-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree.__ContentOnlyElement.append lxml.etree.__ContentOnlyElement-class.html#append +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.PIBase.__new__ lxml.etree.PIBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.__ContentOnlyElement.__delitem__ lxml.etree.__ContentOnlyElement-class.html#__delitem__ +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.etree.__ContentOnlyElement.__len__ lxml.etree.__ContentOnlyElement-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree.__ContentOnlyElement.__getitem__ lxml.etree.__ContentOnlyElement-class.html#__getitem__ +lxml.etree.__ContentOnlyElement.get lxml.etree.__ContentOnlyElement-class.html#get +lxml.etree.__ContentOnlyElement.keys lxml.etree.__ContentOnlyElement-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree.__ContentOnlyElement.__setitem__ lxml.etree.__ContentOnlyElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree.__ContentOnlyElement.insert lxml.etree.__ContentOnlyElement-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._ProcessingInstruction.target lxml.etree._ProcessingInstruction-class.html#target +lxml.etree.__ContentOnlyElement.items lxml.etree.__ContentOnlyElement-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree.__ContentOnlyElement.values lxml.etree.__ContentOnlyElement-class.html#values +lxml.etree._ProcessingInstruction.__repr__ lxml.etree._ProcessingInstruction-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree.__ContentOnlyElement.attrib lxml.etree.__ContentOnlyElement-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.html.InputElement lxml.html.InputElement-class.html +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.html.InputMixin._name__del lxml.html.InputMixin-class.html#_name__del +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.InputMixin._name__set lxml.html.InputMixin-class.html#_name__set +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +lxml.html.InputMixin._name__get lxml.html.InputMixin-class.html#_name__get +lxml.html.InputElement._type__set lxml.html.InputElement-class.html#_type__set +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.InputMixin.__repr__ lxml.html.InputMixin-class.html#__repr__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.InputElement.checked lxml.html.InputElement-class.html#checked +lxml.html.InputElement._type__get lxml.html.InputElement-class.html#_type__get +lxml.html.InputElement.type lxml.html.InputElement-class.html#type +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.html.InputElement.checkable lxml.html.InputElement-class.html#checkable +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.html.InputElement.value lxml.html.InputElement-class.html#value +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.html.InputElement._value__del lxml.html.InputElement-class.html#_value__del +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.html.InputElement._value__set lxml.html.InputElement-class.html#_value__set +lxml.html.InputElement._checked__set lxml.html.InputElement-class.html#_checked__set +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.html.InputElement._value__get lxml.html.InputElement-class.html#_value__get +lxml.html.InputElement._checked__get lxml.html.InputElement-class.html#_checked__get +lxml.html.InputGetter lxml.html.InputGetter-class.html +lxml.html.InputGetter.__getitem__ lxml.html.InputGetter-class.html#__getitem__ +lxml.html.InputGetter.__contains__ lxml.html.InputGetter-class.html#__contains__ +lxml.html.InputGetter.keys lxml.html.InputGetter-class.html#keys +lxml.html.InputGetter.__iter__ lxml.html.InputGetter-class.html#__iter__ +lxml.html.InputGetter.__repr__ lxml.html.InputGetter-class.html#__repr__ +lxml.html.InputGetter._all_xpath lxml.html.InputGetter-class.html#_all_xpath +lxml.html.InputGetter.__init__ lxml.html.InputGetter-class.html#__init__ +lxml.html.InputGetter._name_xpath lxml.html.InputGetter-class.html#_name_xpath +lxml.html.InputMixin lxml.html.InputMixin-class.html +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +lxml.html.InputMixin._name__get lxml.html.InputMixin-class.html#_name__get +lxml.html.InputMixin._name__set lxml.html.InputMixin-class.html#_name__set +lxml.html.InputMixin.__repr__ lxml.html.InputMixin-class.html#__repr__ +lxml.html.InputMixin._name__del lxml.html.InputMixin-class.html#_name__del +lxml.html.LabelElement lxml.html.LabelElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.html.LabelElement._for_element__set lxml.html.LabelElement-class.html#_for_element__set +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.html.LabelElement.for_element lxml.html.LabelElement-class.html#for_element +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.html.LabelElement._for_element__get lxml.html.LabelElement-class.html#_for_element__get +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.html.LabelElement._for_element__del lxml.html.LabelElement-class.html#_for_element__del +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.html.MultipleSelectOptions lxml.html.MultipleSelectOptions-class.html +lxml.html.MultipleSelectOptions.__init__ lxml.html.MultipleSelectOptions-class.html#__init__ +lxml.html.MultipleSelectOptions.add lxml.html.MultipleSelectOptions-class.html#add +lxml.html.MultipleSelectOptions.__iter__ lxml.html.MultipleSelectOptions-class.html#__iter__ +lxml.html.MultipleSelectOptions.remove lxml.html.MultipleSelectOptions-class.html#remove +lxml.html.MultipleSelectOptions.__repr__ lxml.html.MultipleSelectOptions-class.html#__repr__ +lxml.html.MultipleSelectOptions.options lxml.html.MultipleSelectOptions-class.html#options +lxml.html.RadioGroup lxml.html.RadioGroup-class.html +lxml.html.RadioGroup._value__del lxml.html.RadioGroup-class.html#_value__del +lxml.html.RadioGroup.value_options lxml.html.RadioGroup-class.html#value_options +lxml.html.RadioGroup._value__set lxml.html.RadioGroup-class.html#_value__set +lxml.html.RadioGroup.value lxml.html.RadioGroup-class.html#value +lxml.html.RadioGroup.__repr__ lxml.html.RadioGroup-class.html#__repr__ +lxml.html.RadioGroup._value__get lxml.html.RadioGroup-class.html#_value__get +lxml.html.SelectElement lxml.html.SelectElement-class.html +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.html.InputMixin._name__del lxml.html.InputMixin-class.html#_name__del +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.InputMixin._name__set lxml.html.InputMixin-class.html#_name__set +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +lxml.html.InputMixin._name__get lxml.html.InputMixin-class.html#_name__get +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.InputMixin.__repr__ lxml.html.InputMixin-class.html#__repr__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.html.SelectElement._multiple__set lxml.html.SelectElement-class.html#_multiple__set +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.SelectElement.value_options lxml.html.SelectElement-class.html#value_options +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.html.SelectElement.value lxml.html.SelectElement-class.html#value +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.html.SelectElement._value__del lxml.html.SelectElement-class.html#_value__del +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.html.SelectElement.multiple lxml.html.SelectElement-class.html#multiple +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.html.SelectElement._value__set lxml.html.SelectElement-class.html#_value__set +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.html.SelectElement._multiple__get lxml.html.SelectElement-class.html#_multiple__get +lxml.html.SelectElement._value__get lxml.html.SelectElement-class.html#_value__get +lxml.html.TextareaElement lxml.html.TextareaElement-class.html +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.html.InputMixin._name__del lxml.html.InputMixin-class.html#_name__del +lxml.html.HtmlMixin.drop_tag lxml.html.HtmlMixin-class.html#drop_tag +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.html.HtmlMixin.iterlinks lxml.html.HtmlMixin-class.html#iterlinks +lxml.html.HtmlMixin.base_url lxml.html.HtmlMixin-class.html#base_url +lxml.html.InputMixin._name__set lxml.html.InputMixin-class.html#_name__set +lxml.html.HtmlMixin.forms lxml.html.HtmlMixin-class.html#forms +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.html.HtmlMixin._label__get lxml.html.HtmlMixin-class.html#_label__get +lxml.html.InputMixin.name lxml.html.InputMixin-class.html#name +lxml.html.InputMixin._name__get lxml.html.InputMixin-class.html#_name__get +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.html.HtmlMixin.find_rel_links lxml.html.HtmlMixin-class.html#find_rel_links +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.html.HtmlMixin.label lxml.html.HtmlMixin-class.html#label +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.html.HtmlMixin.resolve_base_href lxml.html.HtmlMixin-class.html#resolve_base_href +lxml.html.HtmlMixin.body lxml.html.HtmlMixin-class.html#body +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.html.HtmlMixin.find_class lxml.html.HtmlMixin-class.html#find_class +lxml.html.HtmlMixin._label__del lxml.html.HtmlMixin-class.html#_label__del +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.html.HtmlMixin.cssselect lxml.html.HtmlMixin-class.html#cssselect +lxml.html.InputMixin.__repr__ lxml.html.InputMixin-class.html#__repr__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.html.HtmlMixin.drop_tree lxml.html.HtmlMixin-class.html#drop_tree +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.html.HtmlMixin.text_content lxml.html.HtmlMixin-class.html#text_content +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.html.HtmlMixin.rewrite_links lxml.html.HtmlMixin-class.html#rewrite_links +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.html.HtmlMixin.head lxml.html.HtmlMixin-class.html#head +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.html.TextareaElement.value lxml.html.TextareaElement-class.html#value +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.html.TextareaElement._value__del lxml.html.TextareaElement-class.html#_value__del +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.html.HtmlMixin.make_links_absolute lxml.html.HtmlMixin-class.html#make_links_absolute +lxml.html.HtmlMixin._label__set lxml.html.HtmlMixin-class.html#_label__set +lxml.html.HtmlMixin.get_element_by_id lxml.html.HtmlMixin-class.html#get_element_by_id +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.html.TextareaElement._value__set lxml.html.TextareaElement-class.html#_value__set +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.html.TextareaElement._value__get lxml.html.TextareaElement-class.html#_value__get +lxml.html.XHTMLParser lxml.html.XHTMLParser-class.html +lxml.etree._FeedParser.feed lxml.etree._FeedParser-class.html#feed +lxml.etree._BaseParser.resolvers lxml.etree._BaseParser-class.html#resolvers +lxml.etree.XMLParser.__new__ lxml.etree.XMLParser-class.html#__new__ +lxml.etree._BaseParser.setElementClassLookup lxml.etree._BaseParser-class.html#setElementClassLookup +lxml.etree._BaseParser.makeelement lxml.etree._BaseParser-class.html#makeelement +lxml.etree._BaseParser.error_log lxml.etree._BaseParser-class.html#error_log +lxml.etree._BaseParser.set_element_class_lookup lxml.etree._BaseParser-class.html#set_element_class_lookup +lxml.etree._BaseParser.version lxml.etree._BaseParser-class.html#version +lxml.etree._FeedParser.close lxml.etree._FeedParser-class.html#close +lxml.etree._FeedParser.feed_error_log lxml.etree._FeedParser-class.html#feed_error_log +lxml.etree._BaseParser.copy lxml.etree._BaseParser-class.html#copy +lxml.html.XHTMLParser.__init__ lxml.html.XHTMLParser-class.html#__init__ +lxml.html._MethodFunc lxml.html._MethodFunc-class.html +lxml.html._MethodFunc.__call__ lxml.html._MethodFunc-class.html#__call__ +lxml.html._MethodFunc.__init__ lxml.html._MethodFunc-class.html#__init__ +lxml.html.clean.Cleaner lxml.html.clean.Cleaner-class.html +lxml.html.clean.Cleaner.annoying_tags lxml.html.clean.Cleaner-class.html#annoying_tags +lxml.html.clean.Cleaner.links lxml.html.clean.Cleaner-class.html#links +lxml.html.clean.Cleaner.allow_embedded_url lxml.html.clean.Cleaner-class.html#allow_embedded_url +lxml.html.clean.Cleaner.remove_unknown_tags lxml.html.clean.Cleaner-class.html#remove_unknown_tags +lxml.html.clean.Cleaner.clean_html lxml.html.clean.Cleaner-class.html#clean_html +lxml.html.clean.Cleaner.meta lxml.html.clean.Cleaner-class.html#meta +lxml.html.clean.Cleaner.page_structure lxml.html.clean.Cleaner-class.html#page_structure +lxml.html.clean.Cleaner.frames lxml.html.clean.Cleaner-class.html#frames +lxml.html.clean.Cleaner.allow_follow lxml.html.clean.Cleaner-class.html#allow_follow +lxml.html.clean.Cleaner.__init__ lxml.html.clean.Cleaner-class.html#__init__ +lxml.html.clean.Cleaner.style lxml.html.clean.Cleaner-class.html#style +lxml.html.clean.Cleaner.allow_tags lxml.html.clean.Cleaner-class.html#allow_tags +lxml.html.clean.Cleaner._remove_javascript_link lxml.html.clean.Cleaner-class.html#_remove_javascript_link +lxml.html.clean.Cleaner.comments lxml.html.clean.Cleaner-class.html#comments +lxml.html.clean.Cleaner.forms lxml.html.clean.Cleaner-class.html#forms +lxml.html.clean.Cleaner._substitute_comments lxml.html.clean.Cleaner-class.html#_substitute_comments +lxml.html.clean.Cleaner.kill_conditional_comments lxml.html.clean.Cleaner-class.html#kill_conditional_comments +lxml.html.clean.Cleaner.host_whitelist lxml.html.clean.Cleaner-class.html#host_whitelist +lxml.html.clean.Cleaner.whitelist_tags lxml.html.clean.Cleaner-class.html#whitelist_tags +lxml.html.clean.Cleaner.__call__ lxml.html.clean.Cleaner-class.html#__call__ +lxml.html.clean.Cleaner.remove_tags lxml.html.clean.Cleaner-class.html#remove_tags +lxml.html.clean.Cleaner._kill_elements lxml.html.clean.Cleaner-class.html#_kill_elements +lxml.html.clean.Cleaner._has_sneaky_javascript lxml.html.clean.Cleaner-class.html#_has_sneaky_javascript +lxml.html.clean.Cleaner.processing_instructions lxml.html.clean.Cleaner-class.html#processing_instructions +lxml.html.clean.Cleaner.javascript lxml.html.clean.Cleaner-class.html#javascript +lxml.html.clean.Cleaner.add_nofollow lxml.html.clean.Cleaner-class.html#add_nofollow +lxml.html.clean.Cleaner.allow_element lxml.html.clean.Cleaner-class.html#allow_element +lxml.html.clean.Cleaner.scripts lxml.html.clean.Cleaner-class.html#scripts +lxml.html.clean.Cleaner._tag_link_attrs lxml.html.clean.Cleaner-class.html#_tag_link_attrs +lxml.html.clean.Cleaner.safe_attrs_only lxml.html.clean.Cleaner-class.html#safe_attrs_only +lxml.html.clean.Cleaner.embedded lxml.html.clean.Cleaner-class.html#embedded +lxml.html.diff.DEL_END lxml.html.diff.DEL_END-class.html +lxml.html.diff.DEL_START lxml.html.diff.DEL_START-class.html +lxml.html.diff.InsensitiveSequenceMatcher lxml.html.diff.InsensitiveSequenceMatcher-class.html +lxml.html.diff.InsensitiveSequenceMatcher.get_matching_blocks lxml.html.diff.InsensitiveSequenceMatcher-class.html#get_matching_blocks +lxml.html.diff.InsensitiveSequenceMatcher.threshold lxml.html.diff.InsensitiveSequenceMatcher-class.html#threshold +lxml.html.diff.NoDeletes lxml.html.diff.NoDeletes-class.html +lxml.html.diff.href_token lxml.html.diff.href_token-class.html +lxml.html.diff.href_token.hide_when_equal lxml.html.diff.href_token-class.html#hide_when_equal +lxml.html.diff.token.__new__ lxml.html.diff.token-class.html#__new__ +lxml.html.diff.href_token.html lxml.html.diff.href_token-class.html#html +lxml.html.diff.token.__repr__ lxml.html.diff.token-class.html#__repr__ +lxml.html.diff.tag_token lxml.html.diff.tag_token-class.html +lxml.html.diff.token.hide_when_equal lxml.html.diff.token-class.html#hide_when_equal +lxml.html.diff.tag_token.__new__ lxml.html.diff.tag_token-class.html#__new__ +lxml.html.diff.tag_token.html lxml.html.diff.tag_token-class.html#html +lxml.html.diff.tag_token.__repr__ lxml.html.diff.tag_token-class.html#__repr__ +lxml.html.diff.token lxml.html.diff.token-class.html +lxml.html.diff.token.hide_when_equal lxml.html.diff.token-class.html#hide_when_equal +lxml.html.diff.token.__new__ lxml.html.diff.token-class.html#__new__ +lxml.html.diff.token.html lxml.html.diff.token-class.html#html +lxml.html.diff.token.__repr__ lxml.html.diff.token-class.html#__repr__ +lxml.html.formfill.DefaultErrorCreator lxml.html.formfill.DefaultErrorCreator-class.html +lxml.html.formfill.DefaultErrorCreator.error_container_tag lxml.html.formfill.DefaultErrorCreator-class.html#error_container_tag +lxml.html.formfill.DefaultErrorCreator.default_message lxml.html.formfill.DefaultErrorCreator-class.html#default_message +lxml.html.formfill.DefaultErrorCreator.insert_before lxml.html.formfill.DefaultErrorCreator-class.html#insert_before +lxml.html.formfill.DefaultErrorCreator.error_message_class lxml.html.formfill.DefaultErrorCreator-class.html#error_message_class +lxml.html.formfill.DefaultErrorCreator.__call__ lxml.html.formfill.DefaultErrorCreator-class.html#__call__ +lxml.html.formfill.DefaultErrorCreator.block_inside lxml.html.formfill.DefaultErrorCreator-class.html#block_inside +lxml.html.formfill.DefaultErrorCreator.error_block_class lxml.html.formfill.DefaultErrorCreator-class.html#error_block_class +lxml.html.formfill.DefaultErrorCreator.__init__ lxml.html.formfill.DefaultErrorCreator-class.html#__init__ +lxml.html.formfill.FormNotFound lxml.html.formfill.FormNotFound-class.html +lxml.html.html5parser.HTMLParser lxml.html.html5parser.HTMLParser-class.html +lxml.html.html5parser.HTMLParser.__init__ lxml.html.html5parser.HTMLParser-class.html#__init__ +lxml.html.html5parser.XHTMLParser lxml.html.html5parser.XHTMLParser-class.html +lxml.html.html5parser.XHTMLParser.__init__ lxml.html.html5parser.XHTMLParser-class.html#__init__ +lxml.objectify.BoolElement lxml.objectify.BoolElement-class.html +lxml.objectify.NumberElement.__int__ lxml.objectify.NumberElement-class.html#__int__ +lxml.objectify.NumberElement.__ror__ lxml.objectify.NumberElement-class.html#__ror__ +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.BoolElement.__str__ lxml.objectify.BoolElement-class.html#__str__ +lxml.objectify.BoolElement._init lxml.objectify.BoolElement-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.objectify.NumberElement.__rdiv__ lxml.objectify.NumberElement-class.html#__rdiv__ +lxml.objectify.NumberElement.__rmul__ lxml.objectify.NumberElement-class.html#__rmul__ +lxml.objectify.BoolElement.__lt__ lxml.objectify.BoolElement-class.html#__lt__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.objectify.NumberElement.__rshift__ lxml.objectify.NumberElement-class.html#__rshift__ +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.objectify.NumberElement.__pow__ lxml.objectify.NumberElement-class.html#__pow__ +lxml.objectify.BoolElement.__gt__ lxml.objectify.BoolElement-class.html#__gt__ +lxml.objectify.NumberElement.__oct__ lxml.objectify.NumberElement-class.html#__oct__ +lxml.objectify.NumberElement.__rxor__ lxml.objectify.NumberElement-class.html#__rxor__ +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.objectify.BoolElement.__nonzero__ lxml.objectify.BoolElement-class.html#__nonzero__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.NumberElement.__long__ lxml.objectify.NumberElement-class.html#__long__ +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.objectify.NumberElement.__truediv__ lxml.objectify.NumberElement-class.html#__truediv__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.NumberElement.__rmod__ lxml.objectify.NumberElement-class.html#__rmod__ +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.objectify.NumberElement.__rand__ lxml.objectify.NumberElement-class.html#__rand__ +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.BoolElement.__le__ lxml.objectify.BoolElement-class.html#__le__ +lxml.objectify.NumberElement.__float__ lxml.objectify.NumberElement-class.html#__float__ +lxml.objectify.BoolElement.__ne__ lxml.objectify.BoolElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.NumberElement.__hex__ lxml.objectify.NumberElement-class.html#__hex__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.objectify.NumberElement.__xor__ lxml.objectify.NumberElement-class.html#__xor__ +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.NumberElement.__mul__ lxml.objectify.NumberElement-class.html#__mul__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.objectify.NumberElement.__rlshift__ lxml.objectify.NumberElement-class.html#__rlshift__ +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.NumberElement.__rsub__ lxml.objectify.NumberElement-class.html#__rsub__ +lxml.objectify.NumberElement.__and__ lxml.objectify.NumberElement-class.html#__and__ +lxml.objectify.NumberElement.__complex__ lxml.objectify.NumberElement-class.html#__complex__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.objectify.NumberElement.__abs__ lxml.objectify.NumberElement-class.html#__abs__ +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.NumberElement.__invert__ lxml.objectify.NumberElement-class.html#__invert__ +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.NumberElement.__lshift__ lxml.objectify.NumberElement-class.html#__lshift__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.BoolElement.__eq__ lxml.objectify.BoolElement-class.html#__eq__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.NumberElement.__mod__ lxml.objectify.NumberElement-class.html#__mod__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.NumberElement.__sub__ lxml.objectify.NumberElement-class.html#__sub__ +lxml.objectify.BoolElement.__ge__ lxml.objectify.BoolElement-class.html#__ge__ +lxml.objectify.NumberElement.__rtruediv__ lxml.objectify.NumberElement-class.html#__rtruediv__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.NumberElement.__radd__ lxml.objectify.NumberElement-class.html#__radd__ +lxml.objectify.NumberElement.__rrshift__ lxml.objectify.NumberElement-class.html#__rrshift__ +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.BoolElement.__new__ lxml.objectify.BoolElement-class.html#__new__ +lxml.objectify.NumberElement._setValueParser lxml.objectify.NumberElement-class.html#_setValueParser +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.NumberElement.__pos__ lxml.objectify.NumberElement-class.html#__pos__ +lxml.objectify.NumberElement.__rpow__ lxml.objectify.NumberElement-class.html#__rpow__ +lxml.objectify.BoolElement.pyval lxml.objectify.BoolElement-class.html#pyval +lxml.objectify.BoolElement.__repr__ lxml.objectify.BoolElement-class.html#__repr__ +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.NumberElement.__or__ lxml.objectify.NumberElement-class.html#__or__ +lxml.objectify.NumberElement.__add__ lxml.objectify.NumberElement-class.html#__add__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.NumberElement.__div__ lxml.objectify.NumberElement-class.html#__div__ +lxml.objectify.NumberElement.__neg__ lxml.objectify.NumberElement-class.html#__neg__ +lxml.objectify.ElementMaker lxml.objectify.ElementMaker-class.html +lxml.objectify.ElementMaker.__new__ lxml.objectify.ElementMaker-class.html#__new__ +lxml.objectify.ElementMaker.__getattribute__ lxml.objectify.ElementMaker-class.html#__getattribute__ +lxml.objectify.ElementMaker.__getattr__ lxml.objectify.ElementMaker-class.html#__getattr__ +lxml.objectify.ElementMaker.__init__ lxml.objectify.ElementMaker-class.html#__init__ +lxml.objectify.FloatElement lxml.objectify.FloatElement-class.html +lxml.objectify.NumberElement.__int__ lxml.objectify.NumberElement-class.html#__int__ +lxml.objectify.NumberElement.__ror__ lxml.objectify.NumberElement-class.html#__ror__ +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.NumberElement.__str__ lxml.objectify.NumberElement-class.html#__str__ +lxml.objectify.FloatElement._init lxml.objectify.FloatElement-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.objectify.NumberElement.__rdiv__ lxml.objectify.NumberElement-class.html#__rdiv__ +lxml.objectify.NumberElement.__rmul__ lxml.objectify.NumberElement-class.html#__rmul__ +lxml.objectify.NumberElement.__lt__ lxml.objectify.NumberElement-class.html#__lt__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.objectify.NumberElement.__rshift__ lxml.objectify.NumberElement-class.html#__rshift__ +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.objectify.NumberElement.__pow__ lxml.objectify.NumberElement-class.html#__pow__ +lxml.objectify.NumberElement.__gt__ lxml.objectify.NumberElement-class.html#__gt__ +lxml.objectify.NumberElement.__oct__ lxml.objectify.NumberElement-class.html#__oct__ +lxml.objectify.NumberElement.__rxor__ lxml.objectify.NumberElement-class.html#__rxor__ +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.objectify.NumberElement.__nonzero__ lxml.objectify.NumberElement-class.html#__nonzero__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.NumberElement.__long__ lxml.objectify.NumberElement-class.html#__long__ +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.objectify.NumberElement.__truediv__ lxml.objectify.NumberElement-class.html#__truediv__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.NumberElement.__rmod__ lxml.objectify.NumberElement-class.html#__rmod__ +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.objectify.NumberElement.__rand__ lxml.objectify.NumberElement-class.html#__rand__ +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.NumberElement.__le__ lxml.objectify.NumberElement-class.html#__le__ +lxml.objectify.NumberElement.__complex__ lxml.objectify.NumberElement-class.html#__complex__ +lxml.objectify.NumberElement.__ne__ lxml.objectify.NumberElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.NumberElement.__hex__ lxml.objectify.NumberElement-class.html#__hex__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.objectify.NumberElement.__xor__ lxml.objectify.NumberElement-class.html#__xor__ +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.NumberElement.__mul__ lxml.objectify.NumberElement-class.html#__mul__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.objectify.NumberElement.__rlshift__ lxml.objectify.NumberElement-class.html#__rlshift__ +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.NumberElement.__rsub__ lxml.objectify.NumberElement-class.html#__rsub__ +lxml.objectify.NumberElement.__and__ lxml.objectify.NumberElement-class.html#__and__ +lxml.objectify.NumberElement.__float__ lxml.objectify.NumberElement-class.html#__float__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.objectify.NumberElement.__abs__ lxml.objectify.NumberElement-class.html#__abs__ +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.NumberElement.__invert__ lxml.objectify.NumberElement-class.html#__invert__ +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.NumberElement.__lshift__ lxml.objectify.NumberElement-class.html#__lshift__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.NumberElement.__eq__ lxml.objectify.NumberElement-class.html#__eq__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.NumberElement.__mod__ lxml.objectify.NumberElement-class.html#__mod__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.NumberElement.__sub__ lxml.objectify.NumberElement-class.html#__sub__ +lxml.objectify.NumberElement.__ge__ lxml.objectify.NumberElement-class.html#__ge__ +lxml.objectify.NumberElement.__rtruediv__ lxml.objectify.NumberElement-class.html#__rtruediv__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.NumberElement.__radd__ lxml.objectify.NumberElement-class.html#__radd__ +lxml.objectify.NumberElement.__rrshift__ lxml.objectify.NumberElement-class.html#__rrshift__ +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.FloatElement.__new__ lxml.objectify.FloatElement-class.html#__new__ +lxml.objectify.NumberElement._setValueParser lxml.objectify.NumberElement-class.html#_setValueParser +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.NumberElement.__pos__ lxml.objectify.NumberElement-class.html#__pos__ +lxml.objectify.NumberElement.__rpow__ lxml.objectify.NumberElement-class.html#__rpow__ +lxml.objectify.NumberElement.pyval lxml.objectify.NumberElement-class.html#pyval +lxml.objectify.NumberElement.__repr__ lxml.objectify.NumberElement-class.html#__repr__ +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.NumberElement.__or__ lxml.objectify.NumberElement-class.html#__or__ +lxml.objectify.NumberElement.__add__ lxml.objectify.NumberElement-class.html#__add__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.NumberElement.__div__ lxml.objectify.NumberElement-class.html#__div__ +lxml.objectify.NumberElement.__neg__ lxml.objectify.NumberElement-class.html#__neg__ +lxml.objectify.IntElement lxml.objectify.IntElement-class.html +lxml.objectify.NumberElement.__int__ lxml.objectify.NumberElement-class.html#__int__ +lxml.objectify.NumberElement.__ror__ lxml.objectify.NumberElement-class.html#__ror__ +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.NumberElement.__str__ lxml.objectify.NumberElement-class.html#__str__ +lxml.objectify.IntElement._init lxml.objectify.IntElement-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.objectify.NumberElement.__rdiv__ lxml.objectify.NumberElement-class.html#__rdiv__ +lxml.objectify.NumberElement.__rmul__ lxml.objectify.NumberElement-class.html#__rmul__ +lxml.objectify.NumberElement.__lt__ lxml.objectify.NumberElement-class.html#__lt__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.objectify.NumberElement.__rshift__ lxml.objectify.NumberElement-class.html#__rshift__ +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.objectify.NumberElement.__pow__ lxml.objectify.NumberElement-class.html#__pow__ +lxml.objectify.NumberElement.__gt__ lxml.objectify.NumberElement-class.html#__gt__ +lxml.objectify.NumberElement.__oct__ lxml.objectify.NumberElement-class.html#__oct__ +lxml.objectify.NumberElement.__rxor__ lxml.objectify.NumberElement-class.html#__rxor__ +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.objectify.NumberElement.__nonzero__ lxml.objectify.NumberElement-class.html#__nonzero__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.NumberElement.__long__ lxml.objectify.NumberElement-class.html#__long__ +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.objectify.NumberElement.__truediv__ lxml.objectify.NumberElement-class.html#__truediv__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.NumberElement.__rmod__ lxml.objectify.NumberElement-class.html#__rmod__ +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.objectify.NumberElement.__rand__ lxml.objectify.NumberElement-class.html#__rand__ +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.NumberElement.__le__ lxml.objectify.NumberElement-class.html#__le__ +lxml.objectify.NumberElement.__complex__ lxml.objectify.NumberElement-class.html#__complex__ +lxml.objectify.NumberElement.__ne__ lxml.objectify.NumberElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.NumberElement.__hex__ lxml.objectify.NumberElement-class.html#__hex__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.objectify.NumberElement.__xor__ lxml.objectify.NumberElement-class.html#__xor__ +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.NumberElement.__mul__ lxml.objectify.NumberElement-class.html#__mul__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.objectify.NumberElement.__rlshift__ lxml.objectify.NumberElement-class.html#__rlshift__ +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.NumberElement.__rsub__ lxml.objectify.NumberElement-class.html#__rsub__ +lxml.objectify.NumberElement.__and__ lxml.objectify.NumberElement-class.html#__and__ +lxml.objectify.NumberElement.__float__ lxml.objectify.NumberElement-class.html#__float__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.objectify.NumberElement.__abs__ lxml.objectify.NumberElement-class.html#__abs__ +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.NumberElement.__invert__ lxml.objectify.NumberElement-class.html#__invert__ +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.NumberElement.__lshift__ lxml.objectify.NumberElement-class.html#__lshift__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.NumberElement.__eq__ lxml.objectify.NumberElement-class.html#__eq__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.NumberElement.__mod__ lxml.objectify.NumberElement-class.html#__mod__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.NumberElement.__sub__ lxml.objectify.NumberElement-class.html#__sub__ +lxml.objectify.NumberElement.__ge__ lxml.objectify.NumberElement-class.html#__ge__ +lxml.objectify.NumberElement.__rtruediv__ lxml.objectify.NumberElement-class.html#__rtruediv__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.NumberElement.__radd__ lxml.objectify.NumberElement-class.html#__radd__ +lxml.objectify.NumberElement.__rrshift__ lxml.objectify.NumberElement-class.html#__rrshift__ +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.IntElement.__new__ lxml.objectify.IntElement-class.html#__new__ +lxml.objectify.NumberElement._setValueParser lxml.objectify.NumberElement-class.html#_setValueParser +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.NumberElement.__pos__ lxml.objectify.NumberElement-class.html#__pos__ +lxml.objectify.NumberElement.__rpow__ lxml.objectify.NumberElement-class.html#__rpow__ +lxml.objectify.NumberElement.pyval lxml.objectify.NumberElement-class.html#pyval +lxml.objectify.NumberElement.__repr__ lxml.objectify.NumberElement-class.html#__repr__ +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.NumberElement.__or__ lxml.objectify.NumberElement-class.html#__or__ +lxml.objectify.NumberElement.__add__ lxml.objectify.NumberElement-class.html#__add__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.NumberElement.__div__ lxml.objectify.NumberElement-class.html#__div__ +lxml.objectify.NumberElement.__neg__ lxml.objectify.NumberElement-class.html#__neg__ +lxml.objectify.LongElement lxml.objectify.LongElement-class.html +lxml.objectify.NumberElement.__int__ lxml.objectify.NumberElement-class.html#__int__ +lxml.objectify.NumberElement.__ror__ lxml.objectify.NumberElement-class.html#__ror__ +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.NumberElement.__str__ lxml.objectify.NumberElement-class.html#__str__ +lxml.objectify.LongElement._init lxml.objectify.LongElement-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.objectify.NumberElement.__rdiv__ lxml.objectify.NumberElement-class.html#__rdiv__ +lxml.objectify.NumberElement.__rmul__ lxml.objectify.NumberElement-class.html#__rmul__ +lxml.objectify.NumberElement.__lt__ lxml.objectify.NumberElement-class.html#__lt__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.objectify.NumberElement.__rshift__ lxml.objectify.NumberElement-class.html#__rshift__ +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.objectify.NumberElement.__pow__ lxml.objectify.NumberElement-class.html#__pow__ +lxml.objectify.NumberElement.__gt__ lxml.objectify.NumberElement-class.html#__gt__ +lxml.objectify.NumberElement.__oct__ lxml.objectify.NumberElement-class.html#__oct__ +lxml.objectify.NumberElement.__rxor__ lxml.objectify.NumberElement-class.html#__rxor__ +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.objectify.NumberElement.__nonzero__ lxml.objectify.NumberElement-class.html#__nonzero__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.NumberElement.__long__ lxml.objectify.NumberElement-class.html#__long__ +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.objectify.NumberElement.__truediv__ lxml.objectify.NumberElement-class.html#__truediv__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.NumberElement.__rmod__ lxml.objectify.NumberElement-class.html#__rmod__ +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.objectify.NumberElement.__rand__ lxml.objectify.NumberElement-class.html#__rand__ +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.NumberElement.__le__ lxml.objectify.NumberElement-class.html#__le__ +lxml.objectify.NumberElement.__complex__ lxml.objectify.NumberElement-class.html#__complex__ +lxml.objectify.NumberElement.__ne__ lxml.objectify.NumberElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.NumberElement.__hex__ lxml.objectify.NumberElement-class.html#__hex__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.objectify.NumberElement.__xor__ lxml.objectify.NumberElement-class.html#__xor__ +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.NumberElement.__mul__ lxml.objectify.NumberElement-class.html#__mul__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.objectify.NumberElement.__rlshift__ lxml.objectify.NumberElement-class.html#__rlshift__ +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.NumberElement.__rsub__ lxml.objectify.NumberElement-class.html#__rsub__ +lxml.objectify.NumberElement.__and__ lxml.objectify.NumberElement-class.html#__and__ +lxml.objectify.NumberElement.__float__ lxml.objectify.NumberElement-class.html#__float__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.objectify.NumberElement.__abs__ lxml.objectify.NumberElement-class.html#__abs__ +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.NumberElement.__invert__ lxml.objectify.NumberElement-class.html#__invert__ +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.NumberElement.__lshift__ lxml.objectify.NumberElement-class.html#__lshift__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.NumberElement.__eq__ lxml.objectify.NumberElement-class.html#__eq__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.NumberElement.__mod__ lxml.objectify.NumberElement-class.html#__mod__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.NumberElement.__sub__ lxml.objectify.NumberElement-class.html#__sub__ +lxml.objectify.NumberElement.__ge__ lxml.objectify.NumberElement-class.html#__ge__ +lxml.objectify.NumberElement.__rtruediv__ lxml.objectify.NumberElement-class.html#__rtruediv__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.NumberElement.__radd__ lxml.objectify.NumberElement-class.html#__radd__ +lxml.objectify.NumberElement.__rrshift__ lxml.objectify.NumberElement-class.html#__rrshift__ +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.LongElement.__new__ lxml.objectify.LongElement-class.html#__new__ +lxml.objectify.NumberElement._setValueParser lxml.objectify.NumberElement-class.html#_setValueParser +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.NumberElement.__pos__ lxml.objectify.NumberElement-class.html#__pos__ +lxml.objectify.NumberElement.__rpow__ lxml.objectify.NumberElement-class.html#__rpow__ +lxml.objectify.NumberElement.pyval lxml.objectify.NumberElement-class.html#pyval +lxml.objectify.NumberElement.__repr__ lxml.objectify.NumberElement-class.html#__repr__ +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.NumberElement.__or__ lxml.objectify.NumberElement-class.html#__or__ +lxml.objectify.NumberElement.__add__ lxml.objectify.NumberElement-class.html#__add__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.NumberElement.__div__ lxml.objectify.NumberElement-class.html#__div__ +lxml.objectify.NumberElement.__neg__ lxml.objectify.NumberElement-class.html#__neg__ +lxml.objectify.NoneElement lxml.objectify.NoneElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.NoneElement.__str__ lxml.objectify.NoneElement-class.html#__str__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.NoneElement.__lt__ lxml.objectify.NoneElement-class.html#__lt__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.objectify.NoneElement.__new__ lxml.objectify.NoneElement-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.NoneElement.pyval lxml.objectify.NoneElement-class.html#pyval +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.NoneElement.__ne__ lxml.objectify.NoneElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.NoneElement.__gt__ lxml.objectify.NoneElement-class.html#__gt__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.NoneElement.__eq__ lxml.objectify.NoneElement-class.html#__eq__ +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.NoneElement.__nonzero__ lxml.objectify.NoneElement-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.NoneElement.__le__ lxml.objectify.NoneElement-class.html#__le__ +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.NoneElement.__repr__ lxml.objectify.NoneElement-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.objectify.NoneElement.__ge__ lxml.objectify.NoneElement-class.html#__ge__ +lxml.objectify.NumberElement lxml.objectify.NumberElement-class.html +lxml.objectify.NumberElement.__int__ lxml.objectify.NumberElement-class.html#__int__ +lxml.objectify.NumberElement.__ror__ lxml.objectify.NumberElement-class.html#__ror__ +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.NumberElement.__str__ lxml.objectify.NumberElement-class.html#__str__ +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.objectify.NumberElement.__rdiv__ lxml.objectify.NumberElement-class.html#__rdiv__ +lxml.objectify.NumberElement.__rmul__ lxml.objectify.NumberElement-class.html#__rmul__ +lxml.objectify.NumberElement.__lt__ lxml.objectify.NumberElement-class.html#__lt__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.objectify.NumberElement.__rshift__ lxml.objectify.NumberElement-class.html#__rshift__ +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.objectify.NumberElement.__pow__ lxml.objectify.NumberElement-class.html#__pow__ +lxml.objectify.NumberElement.__gt__ lxml.objectify.NumberElement-class.html#__gt__ +lxml.objectify.NumberElement.__oct__ lxml.objectify.NumberElement-class.html#__oct__ +lxml.objectify.NumberElement.__rxor__ lxml.objectify.NumberElement-class.html#__rxor__ +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.objectify.NumberElement.__nonzero__ lxml.objectify.NumberElement-class.html#__nonzero__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.NumberElement.__long__ lxml.objectify.NumberElement-class.html#__long__ +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.objectify.NumberElement.__truediv__ lxml.objectify.NumberElement-class.html#__truediv__ +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.NumberElement.__rmod__ lxml.objectify.NumberElement-class.html#__rmod__ +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.objectify.NumberElement.__rand__ lxml.objectify.NumberElement-class.html#__rand__ +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.NumberElement.__le__ lxml.objectify.NumberElement-class.html#__le__ +lxml.objectify.NumberElement.__complex__ lxml.objectify.NumberElement-class.html#__complex__ +lxml.objectify.NumberElement.__ne__ lxml.objectify.NumberElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.NumberElement.__hex__ lxml.objectify.NumberElement-class.html#__hex__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.objectify.NumberElement.__xor__ lxml.objectify.NumberElement-class.html#__xor__ +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.NumberElement.__repr__ lxml.objectify.NumberElement-class.html#__repr__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.objectify.NumberElement.__rpow__ lxml.objectify.NumberElement-class.html#__rpow__ +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.NumberElement.__rsub__ lxml.objectify.NumberElement-class.html#__rsub__ +lxml.objectify.NumberElement.__and__ lxml.objectify.NumberElement-class.html#__and__ +lxml.objectify.NumberElement.__float__ lxml.objectify.NumberElement-class.html#__float__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.objectify.NumberElement.__abs__ lxml.objectify.NumberElement-class.html#__abs__ +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.NumberElement.__invert__ lxml.objectify.NumberElement-class.html#__invert__ +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.NumberElement.__lshift__ lxml.objectify.NumberElement-class.html#__lshift__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.NumberElement.__eq__ lxml.objectify.NumberElement-class.html#__eq__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.objectify.NumberElement.__mod__ lxml.objectify.NumberElement-class.html#__mod__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.NumberElement.__sub__ lxml.objectify.NumberElement-class.html#__sub__ +lxml.objectify.NumberElement.__ge__ lxml.objectify.NumberElement-class.html#__ge__ +lxml.objectify.NumberElement.__rtruediv__ lxml.objectify.NumberElement-class.html#__rtruediv__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.NumberElement.__radd__ lxml.objectify.NumberElement-class.html#__radd__ +lxml.objectify.NumberElement.__rrshift__ lxml.objectify.NumberElement-class.html#__rrshift__ +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.NumberElement.__new__ lxml.objectify.NumberElement-class.html#__new__ +lxml.objectify.NumberElement._setValueParser lxml.objectify.NumberElement-class.html#_setValueParser +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.NumberElement.__pos__ lxml.objectify.NumberElement-class.html#__pos__ +lxml.objectify.NumberElement.__or__ lxml.objectify.NumberElement-class.html#__or__ +lxml.objectify.NumberElement.pyval lxml.objectify.NumberElement-class.html#pyval +lxml.objectify.NumberElement.__mul__ lxml.objectify.NumberElement-class.html#__mul__ +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.NumberElement.__rlshift__ lxml.objectify.NumberElement-class.html#__rlshift__ +lxml.objectify.NumberElement.__add__ lxml.objectify.NumberElement-class.html#__add__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.NumberElement.__div__ lxml.objectify.NumberElement-class.html#__div__ +lxml.objectify.NumberElement.__neg__ lxml.objectify.NumberElement-class.html#__neg__ +lxml.objectify.ObjectPath lxml.objectify.ObjectPath-class.html +lxml.objectify.ObjectPath.addattr lxml.objectify.ObjectPath-class.html#addattr +lxml.objectify.ObjectPath.__new__ lxml.objectify.ObjectPath-class.html#__new__ +lxml.objectify.ObjectPath.setattr lxml.objectify.ObjectPath-class.html#setattr +lxml.objectify.ObjectPath.__str__ lxml.objectify.ObjectPath-class.html#__str__ +lxml.objectify.ObjectPath.hasattr lxml.objectify.ObjectPath-class.html#hasattr +lxml.objectify.ObjectPath.__call__ lxml.objectify.ObjectPath-class.html#__call__ +lxml.objectify.ObjectPath.find lxml.objectify.ObjectPath-class.html#find +lxml.objectify.ObjectPath.__init__ lxml.objectify.ObjectPath-class.html#__init__ +lxml.objectify.ObjectifiedDataElement lxml.objectify.ObjectifiedDataElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.ObjectifiedDataElement.__str__ lxml.objectify.ObjectifiedDataElement-class.html#__str__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.objectify.ObjectifiedDataElement.__new__ lxml.objectify.ObjectifiedDataElement-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.ObjectifiedDataElement.pyval lxml.objectify.ObjectifiedDataElement-class.html#pyval +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.ObjectifiedDataElement.__repr__ lxml.objectify.ObjectifiedDataElement-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.objectify.ObjectifiedElement lxml.objectify.ObjectifiedElement-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.ObjectifiedElement.__str__ lxml.objectify.ObjectifiedElement-class.html#__str__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.objectify.ObjectifiedElement.__new__ lxml.objectify.ObjectifiedElement-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.objectify.ObjectifyElementClassLookup lxml.objectify.ObjectifyElementClassLookup-class.html +lxml.objectify.ObjectifyElementClassLookup.__new__ lxml.objectify.ObjectifyElementClassLookup-class.html#__new__ +lxml.objectify.ObjectifyElementClassLookup.__init__ lxml.objectify.ObjectifyElementClassLookup-class.html#__init__ +lxml.objectify.PyType lxml.objectify.PyType-class.html +lxml.objectify.PyType.stringify lxml.objectify.PyType-class.html#stringify +lxml.objectify.PyType.name lxml.objectify.PyType-class.html#name +lxml.objectify.PyType.type_check lxml.objectify.PyType-class.html#type_check +lxml.objectify.PyType.unregister lxml.objectify.PyType-class.html#unregister +lxml.objectify.PyType.register lxml.objectify.PyType-class.html#register +lxml.objectify.PyType.__repr__ lxml.objectify.PyType-class.html#__repr__ +lxml.objectify.PyType.xmlSchemaTypes lxml.objectify.PyType-class.html#xmlSchemaTypes +lxml.objectify.PyType.__init__ lxml.objectify.PyType-class.html#__init__ +lxml.objectify.PyType.__new__ lxml.objectify.PyType-class.html#__new__ +lxml.objectify.StringElement lxml.objectify.StringElement-class.html +lxml.objectify.StringElement.__int__ lxml.objectify.StringElement-class.html#__int__ +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.objectify.ObjectifiedElement.addattr lxml.objectify.ObjectifiedElement-class.html#addattr +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.objectify.ObjectifiedElement.text lxml.objectify.ObjectifiedElement-class.html#text +lxml.objectify.ObjectifiedDataElement.__str__ lxml.objectify.ObjectifiedDataElement-class.html#__str__ +lxml.objectify.ObjectifiedElement.iterfind lxml.objectify.ObjectifiedElement-class.html#iterfind +lxml.objectify.ObjectifiedElement.__getattribute__ lxml.objectify.ObjectifiedElement-class.html#__getattribute__ +lxml.objectify.StringElement.__radd__ lxml.objectify.StringElement-class.html#__radd__ +lxml.objectify.StringElement.__complex__ lxml.objectify.StringElement-class.html#__complex__ +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.objectify.StringElement.__rmul__ lxml.objectify.StringElement-class.html#__rmul__ +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.objectify.StringElement.__lt__ lxml.objectify.StringElement-class.html#__lt__ +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.objectify.StringElement.strlen lxml.objectify.StringElement-class.html#strlen +lxml.objectify.StringElement.__rmod__ lxml.objectify.StringElement-class.html#__rmod__ +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.objectify.StringElement.__float__ lxml.objectify.StringElement-class.html#__float__ +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.objectify.ObjectifiedElement.__setattr__ lxml.objectify.ObjectifiedElement-class.html#__setattr__ +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.objectify.StringElement.__new__ lxml.objectify.StringElement-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.objectify.ObjectifiedDataElement._setText lxml.objectify.ObjectifiedDataElement-class.html#_setText +lxml.objectify.ObjectifiedElement.getchildren lxml.objectify.ObjectifiedElement-class.html#getchildren +lxml.objectify.ObjectifiedElement.__getattr__ lxml.objectify.ObjectifiedElement-class.html#__getattr__ +lxml.objectify.ObjectifiedElement.findall lxml.objectify.ObjectifiedElement-class.html#findall +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.objectify.ObjectifiedElement.find lxml.objectify.ObjectifiedElement-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.objectify.StringElement.pyval lxml.objectify.StringElement-class.html#pyval +lxml.objectify.ObjectifiedElement.__len__ lxml.objectify.ObjectifiedElement-class.html#__len__ +lxml.objectify.StringElement.__mul__ lxml.objectify.StringElement-class.html#__mul__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.objectify.StringElement.__ne__ lxml.objectify.StringElement-class.html#__ne__ +lxml.objectify.ObjectifiedElement.findtext lxml.objectify.ObjectifiedElement-class.html#findtext +lxml.objectify.ObjectifiedElement.__getitem__ lxml.objectify.ObjectifiedElement-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.objectify.ObjectifiedElement.__setitem__ lxml.objectify.ObjectifiedElement-class.html#__setitem__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.objectify.ObjectifiedElement.countchildren lxml.objectify.ObjectifiedElement-class.html#countchildren +lxml.objectify.StringElement.__add__ lxml.objectify.StringElement-class.html#__add__ +lxml.objectify.StringElement.__gt__ lxml.objectify.StringElement-class.html#__gt__ +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.objectify.StringElement.__eq__ lxml.objectify.StringElement-class.html#__eq__ +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.objectify.ObjectifiedElement.__delitem__ lxml.objectify.ObjectifiedElement-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.objectify.StringElement.__nonzero__ lxml.objectify.StringElement-class.html#__nonzero__ +lxml.objectify.StringElement.__mod__ lxml.objectify.StringElement-class.html#__mod__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.objectify.ObjectifiedElement.__iter__ lxml.objectify.ObjectifiedElement-class.html#__iter__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.objectify.ObjectifiedElement.__delattr__ lxml.objectify.ObjectifiedElement-class.html#__delattr__ +lxml.objectify.StringElement.__le__ lxml.objectify.StringElement-class.html#__le__ +lxml.objectify.ObjectifiedElement.descendantpaths lxml.objectify.ObjectifiedElement-class.html#descendantpaths +lxml.objectify.StringElement.__repr__ lxml.objectify.StringElement-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.objectify.StringElement.__long__ lxml.objectify.StringElement-class.html#__long__ +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.objectify.StringElement.__ge__ lxml.objectify.StringElement-class.html#__ge__ +lxml.objectify._ObjectifyElementMakerCaller lxml.objectify._ObjectifyElementMakerCaller-class.html +lxml.objectify._ObjectifyElementMakerCaller.__new__ lxml.objectify._ObjectifyElementMakerCaller-class.html#__new__ +lxml.objectify._ObjectifyElementMakerCaller.__call__ lxml.objectify._ObjectifyElementMakerCaller-class.html#__call__ +lxml.sax.ElementTreeContentHandler lxml.sax.ElementTreeContentHandler-class.html +lxml.sax.ElementTreeContentHandler.startPrefixMapping lxml.sax.ElementTreeContentHandler-class.html#startPrefixMapping +lxml.sax.ElementTreeContentHandler.endPrefixMapping lxml.sax.ElementTreeContentHandler-class.html#endPrefixMapping +lxml.sax.ElementTreeContentHandler.etree lxml.sax.ElementTreeContentHandler-class.html#etree +lxml.sax.ElementTreeContentHandler.processingInstruction lxml.sax.ElementTreeContentHandler-class.html#processingInstruction +lxml.sax.ElementTreeContentHandler.endElement lxml.sax.ElementTreeContentHandler-class.html#endElement +lxml.sax.ElementTreeContentHandler._get_etree lxml.sax.ElementTreeContentHandler-class.html#_get_etree +lxml.sax.ElementTreeContentHandler.startElement lxml.sax.ElementTreeContentHandler-class.html#startElement +lxml.sax.ElementTreeContentHandler.setDocumentLocator lxml.sax.ElementTreeContentHandler-class.html#setDocumentLocator +lxml.sax.ElementTreeContentHandler.startDocument lxml.sax.ElementTreeContentHandler-class.html#startDocument +lxml.sax.ElementTreeContentHandler.startElementNS lxml.sax.ElementTreeContentHandler-class.html#startElementNS +lxml.sax.ElementTreeContentHandler.characters lxml.sax.ElementTreeContentHandler-class.html#characters +lxml.sax.ElementTreeContentHandler.endDocument lxml.sax.ElementTreeContentHandler-class.html#endDocument +lxml.sax.ElementTreeContentHandler.ignorableWhitespace lxml.sax.ElementTreeContentHandler-class.html#ignorableWhitespace +lxml.sax.ElementTreeContentHandler.__init__ lxml.sax.ElementTreeContentHandler-class.html#__init__ +lxml.sax.ElementTreeContentHandler.endElementNS lxml.sax.ElementTreeContentHandler-class.html#endElementNS +lxml.sax.ElementTreeProducer lxml.sax.ElementTreeProducer-class.html +lxml.sax.ElementTreeProducer._build_qname lxml.sax.ElementTreeProducer-class.html#_build_qname +lxml.sax.ElementTreeProducer.saxify lxml.sax.ElementTreeProducer-class.html#saxify +lxml.sax.ElementTreeProducer.__init__ lxml.sax.ElementTreeProducer-class.html#__init__ +lxml.sax.ElementTreeProducer._recursive_saxify lxml.sax.ElementTreeProducer-class.html#_recursive_saxify +lxml.sax.SaxError lxml.sax.SaxError-class.html +lxml.etree.LxmlError.__init__ lxml.etree.LxmlError-class.html#__init__ +lxml.tests.common_imports.HelperTestCase lxml.tests.common_imports.HelperTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.common_imports.LargeFileLike lxml.tests.common_imports.LargeFileLike-class.html +lxml.tests.common_imports.LargeFileLike.read lxml.tests.common_imports.LargeFileLike-class.html#read +lxml.tests.common_imports.LargeFileLike.iterelements lxml.tests.common_imports.LargeFileLike-class.html#iterelements +lxml.tests.common_imports.LargeFileLike.__init__ lxml.tests.common_imports.LargeFileLike-class.html#__init__ +lxml.tests.common_imports.LargeFileLikeUnicode lxml.tests.common_imports.LargeFileLikeUnicode-class.html +lxml.tests.common_imports.LargeFileLike.read lxml.tests.common_imports.LargeFileLike-class.html#read +lxml.tests.common_imports.LargeFileLikeUnicode.iterelements lxml.tests.common_imports.LargeFileLikeUnicode-class.html#iterelements +lxml.tests.common_imports.LargeFileLikeUnicode.__init__ lxml.tests.common_imports.LargeFileLikeUnicode-class.html#__init__ +lxml.tests.common_imports.SillyFileLike lxml.tests.common_imports.SillyFileLike-class.html +lxml.tests.common_imports.SillyFileLike.read lxml.tests.common_imports.SillyFileLike-class.html#read +lxml.tests.common_imports.SillyFileLike.__init__ lxml.tests.common_imports.SillyFileLike-class.html#__init__ +lxml.tests.test_classlookup.ClassLookupTestCase lxml.tests.test_classlookup.ClassLookupTestCase-class.html +lxml.tests.test_classlookup.ClassLookupTestCase.tearDown lxml.tests.test_classlookup.ClassLookupTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_classlookup.ClassLookupTestCase.test_attribute_based_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_attribute_based_lookup +lxml.tests.test_classlookup.ClassLookupTestCase.test_default_class_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_default_class_lookup +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_classlookup.ClassLookupTestCase.test_class_lookup_reentry lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_class_lookup_reentry +lxml.tests.test_classlookup.ClassLookupTestCase.test_namespace_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_namespace_lookup +lxml.tests.test_classlookup.ClassLookupTestCase.test_parser_based_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_parser_based_lookup +lxml.tests.test_classlookup.ClassLookupTestCase.test_lookup_without_fallback lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_lookup_without_fallback +lxml.tests.test_classlookup.ClassLookupTestCase.test_custom_lookup lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_custom_lookup +lxml.tests.test_classlookup.ClassLookupTestCase.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_classlookup.ClassLookupTestCase.test_custom_lookup_ns_fallback lxml.tests.test_classlookup.ClassLookupTestCase-class.html#test_custom_lookup_ns_fallback +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_css.CSSTestCase lxml.tests.test_css.CSSTestCase-class.html +lxml.tests.test_css.CSSTestCase.all lxml.tests.test_css.CSSTestCase-class.html#all +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_css.CSSTestCase.shortDescription lxml.tests.test_css.CSSTestCase-class.html#shortDescription +lxml.tests.test_css.CSSTestCase.__init__ lxml.tests.test_css.CSSTestCase-class.html#__init__ +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_css.CSSTestCase.selectors lxml.tests.test_css.CSSTestCase-class.html#selectors +lxml.tests.test_css.CSSTestCase.runTest lxml.tests.test_css.CSSTestCase-class.html#runTest +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_dtd.ETreeDtdTestCase lxml.tests.test_dtd.ETreeDtdTestCase-class.html +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_parse_valid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_valid +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_broken lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_broken +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_dtd.ETreeDtdTestCase.test_parse_file_dtd lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_parse_file_dtd +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_stringio lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_stringio +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_parse_invalid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_invalid +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_internal_invalid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_internal_invalid +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_assertValid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_assertValid +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_parse_file_not_found lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_file_not_found +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_parse_valid_relative lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_parse_valid_relative +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_file lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_file +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_internal lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_internal +lxml.tests.test_dtd.ETreeDtdTestCase.test_iterparse_file_dtd lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_iterparse_file_dtd +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd_invalid lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd_invalid +lxml.tests.test_dtd.ETreeDtdTestCase.test_dtd lxml.tests.test_dtd.ETreeDtdTestCase-class.html#test_dtd +lxml.tests.test_elementtree.CElementTreeTestCase lxml.tests.test_elementtree.CElementTreeTestCase-class.html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_pi +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes3 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes3 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElementFile lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElementFile +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_nonexistent lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_nonexistent +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_double lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_double +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_getitem_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_getitem_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_latin1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_latin1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree.ETreeTestCaseBase._test_del_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_tag lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_tag +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_has_key lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_has_key +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_sequence lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_sequence +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_child_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_child_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_with_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_with_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._test_element_boolean lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_element_boolean +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_getset lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall +lxml.tests.test_elementtree.ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_beyond_index lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_beyond_index +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_feed_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_feed_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_attrib_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_attrib_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_set_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_set_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_broken lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_broken +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_empty_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_empty_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_indexerror lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_indexerror +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_merge_namespaced_subtree_as_slice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_merge_namespaced_subtree_as_slice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_utf8_bom lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_utf8_bom +lxml.tests.test_elementtree.ETreeTestCaseBase.test_namespaces_after_serialize lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_namespaces_after_serialize +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_invalid_args lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_invalid_args +lxml.tests.test_elementtree.ETreeTestCaseBase._test_wrong_unicode_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_setting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_ElementTreeDoctest lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_explicit lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_simple lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_simple +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_fail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_fail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_root_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_root_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_override lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_override +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_only_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_only_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_makeelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_makeelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_fromstring_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_fromstring_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve_new lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve_new +lxml.tests.test_elementtree.ETreeTestCaseBase._test_getchildren lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_getchildren +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_nonexisting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_nonexisting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_set lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_set +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_elementtree_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_elementtree_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_whitespace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_whitespace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_extend lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_extend +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_replace_slice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_replace_slice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_text_only lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_text_only +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.assertEncodingDeclaration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertEncodingDeclaration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_ns_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_ns_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_write_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_out lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_twice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_twice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_version lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_version +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_dict lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_dict +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_move_elements lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_move_elements +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_multiple_elementrees lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_multiple_elementrees +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_str +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_del_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_xml lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_xml +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_comment +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_parser_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_parser_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setitem +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.CElementTreeTestCase.etree lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_from_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_from_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_incomplete lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_other lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_other +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns_parsed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns_parsed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_namespaces lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_namespaces +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_xmlns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_xmlns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_keywords lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_keywords +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree.ETreeTestCaseBase._rootstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_rootstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_manipulation +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element_tree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_in lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_in +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_tag_parse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_tag_parse +lxml.tests.test_elementtree.ETreeTestCaseBase._check_string lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_string +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_large lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_position lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_position +lxml.tests.test_elementtree.ETreeTestCaseBase.assertXML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_characters lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_characters +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_data lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_data +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree.ETreeTestCaseBase.test_weird_dict_interaction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree.ETreeTestCase lxml.tests.test_elementtree.ETreeTestCase-class.html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_pi +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes3 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes3 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElementFile lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElementFile +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_nonexistent lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_nonexistent +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_double lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_double +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_getitem_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_getitem_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_latin1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_latin1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree.ETreeTestCaseBase._test_del_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_tag lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_tag +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_has_key lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_has_key +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_sequence lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_sequence +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_child_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_child_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_with_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_with_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._test_element_boolean lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_element_boolean +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_getset lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall +lxml.tests.test_elementtree.ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_beyond_index lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_beyond_index +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_feed_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_feed_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_attrib_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_attrib_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_set_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_set_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_broken lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_broken +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_empty_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_empty_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_indexerror lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_indexerror +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_merge_namespaced_subtree_as_slice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_merge_namespaced_subtree_as_slice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_utf8_bom lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_utf8_bom +lxml.tests.test_elementtree.ETreeTestCaseBase.test_namespaces_after_serialize lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_namespaces_after_serialize +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_invalid_args lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_invalid_args +lxml.tests.test_elementtree.ETreeTestCaseBase._test_wrong_unicode_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_setting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_ElementTreeDoctest lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_explicit lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_simple lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_simple +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_fail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_fail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_root_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_root_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_override lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_override +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_only_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_only_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_makeelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_makeelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_fromstring_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_fromstring_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve_new lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve_new +lxml.tests.test_elementtree.ETreeTestCaseBase._test_getchildren lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_getchildren +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_nonexisting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_nonexisting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_set lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_set +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_elementtree_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_elementtree_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_whitespace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_whitespace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_extend lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_extend +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_replace_slice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_replace_slice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_text_only lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_text_only +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.assertEncodingDeclaration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertEncodingDeclaration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_ns_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_ns_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_write_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_out lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_twice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_twice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_version lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_version +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_dict lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_dict +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_move_elements lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_move_elements +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_multiple_elementrees lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_multiple_elementrees +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_str +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_del_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_xml lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_xml +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_comment +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_parser_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_parser_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setitem +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.ETreeTestCase.etree lxml.etree-module.html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_from_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_from_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_incomplete lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_other lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_other +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns_parsed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns_parsed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_namespaces lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_namespaces +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_xmlns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_xmlns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_keywords lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_keywords +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree.ETreeTestCaseBase._rootstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_rootstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_manipulation +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element_tree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_in lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_in +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_tag_parse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_tag_parse +lxml.tests.test_elementtree.ETreeTestCaseBase._check_string lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_string +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_large lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_position lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_position +lxml.tests.test_elementtree.ETreeTestCaseBase.assertXML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_characters lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_characters +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_data lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_data +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree.ETreeTestCaseBase.test_weird_dict_interaction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase lxml.tests.test_elementtree.ETreeTestCaseBase-class.html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_pi +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes3 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes3 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElementFile lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElementFile +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_nonexistent lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_nonexistent +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_double lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_double +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_getitem_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_getitem_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_latin1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_latin1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_tag lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_tag +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_has_key lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_has_key +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_sequence lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_sequence +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_child_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_child_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_with_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_with_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._test_element_boolean lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_element_boolean +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_getset lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall +lxml.tests.test_elementtree.ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_feed_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_feed_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_set_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_set_clear +lxml.tests.test_elementtree.ETreeTestCaseBase._check_string lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_string +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_broken lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_broken +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_empty_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_empty_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_indexerror lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_indexerror +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_whitespace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_whitespace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_merge_namespaced_subtree_as_slice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_merge_namespaced_subtree_as_slice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys +lxml.tests.test_elementtree.ETreeTestCaseBase.test_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_utf8_bom lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_utf8_bom +lxml.tests.test_elementtree.ETreeTestCaseBase.test_namespaces_after_serialize lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_namespaces_after_serialize +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_invalid_args lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_invalid_args +lxml.tests.test_elementtree.ETreeTestCaseBase._test_wrong_unicode_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_override lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_override +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_setting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_explicit lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_simple lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_simple +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_fail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_fail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_only_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_only_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_makeelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_makeelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_fromstring_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_fromstring_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve_new lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve_new +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_nonexisting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_nonexisting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_set lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_set +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_elementtree_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_elementtree_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_extend lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_extend +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_replace_slice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_replace_slice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_text_only lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_text_only +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.assertEncodingDeclaration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertEncodingDeclaration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_del_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_xml lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_xml +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_write_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_out lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_twice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_twice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_beyond_index lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_beyond_index +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_position lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_position +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_version lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_version +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_parser_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_parser_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_dict lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_dict +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_move_elements lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_move_elements +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_multiple_elementrees lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_multiple_elementrees +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_str +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_ns_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_ns_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_attrib_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_attrib_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setitem +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.ETreeTestCaseBase.etree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#etree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_from_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_from_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_incomplete lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_append +lxml.tests.test_elementtree.ETreeTestCaseBase._rootstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_rootstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_other lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_other +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns_parsed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns_parsed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns2 +lxml.tests.test_elementtree.ETreeTestCaseBase._test_del_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_namespaces lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_namespaces +lxml.tests.test_elementtree.ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_xmlns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_xmlns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_keywords lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_keywords +lxml.tests.test_elementtree.ETreeTestCaseBase._test_getchildren lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_getchildren +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_ElementTreeDoctest lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_manipulation +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_large lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element_tree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_in lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_in +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_tag_parse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_tag_parse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_weird_dict_interaction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_root_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_root_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.assertXML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_characters lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_characters +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_data lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_data +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_elementtree.ElementTreeTestCase lxml.tests.test_elementtree.ElementTreeTestCase-class.html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_pi +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes3 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes3 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase._writeElementFile lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_writeElementFile +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_nonexistent lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_nonexistent +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_cdata lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_cdata +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_empty +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_double lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_double +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_getitem_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_getitem_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_latin1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_latin1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iselement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iselement +lxml.tests.test_elementtree.ETreeTestCaseBase._test_del_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_del_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_tag lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_tag +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_has_key lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_has_key +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_sequence lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_sequence +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_entity lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_entity +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_child_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_child_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_with_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_with_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._test_element_boolean lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_element_boolean +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_getset lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_getset +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_findall lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_findall +lxml.tests.test_elementtree.ETreeTestCaseBase._check_mapping lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_mapping +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_beyond_index lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_beyond_index +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_feed_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_feed_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_attrib_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_attrib_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_set_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_set_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_write lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_write +lxml.tests.test_elementtree.ETreeTestCaseBase.test_set_text_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_set_text_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_broken lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_broken +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_empty_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_empty_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_indexerror lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_indexerror +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_merge_namespaced_subtree_as_slice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_merge_namespaced_subtree_as_slice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_crash lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_crash +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_utf8_bom lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_utf8_bom +lxml.tests.test_elementtree.ETreeTestCaseBase.test_namespaces_after_serialize lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_namespaces_after_serialize +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_invalid_args lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_invalid_args +lxml.tests.test_elementtree.ETreeTestCaseBase._test_wrong_unicode_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_wrong_unicode_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_treebuilder lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_treebuilder +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_setting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_setting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_keys_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_keys_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_elementtree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_elementtree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_ElementTreeDoctest lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_ElementTreeDoctest +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_contains lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_contains +lxml.tests.test_elementtree.ETreeTestCaseBase.test_itertext lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_itertext +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_explicit lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_explicit +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_simple lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_simple +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_fail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_fail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_none lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_none +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_object_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_object_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_root_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_root_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_encoding_8bit_override lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_encoding_8bit_override +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_only_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_only_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_makeelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_makeelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_iterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_iterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_fromstring_exception lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_fromstring_exception +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve_new lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve_new +lxml.tests.test_elementtree.ETreeTestCaseBase._test_getchildren lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_test_getchildren +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_nonexisting lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_nonexisting +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_single lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_single +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_set lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_set +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_elementtree_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_elementtree_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attributes2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attributes2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_whitespace lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_whitespace +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_extend lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_extend +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_memory lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_memory +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_reset_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_reset_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_unknown lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_unknown +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_replace_slice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_replace_slice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_text_only lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_text_only +lxml.tests.test_elementtree.ETreeTestCaseBase.test_insert_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_insert_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.assertEncodingDeclaration lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertEncodingDeclaration +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_ns_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_ns_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_getiterator lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_getiterator +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attribute_resolve lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attribute_resolve +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_write_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_write_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_element_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_element_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_tostring_sub_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_tostring_sub_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_out lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_out +lxml.tests.test_elementtree.ETreeTestCaseBase.test_shallowcopy lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_shallowcopy +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_reference lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_reference +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_set_twice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_set_twice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_stringio lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_stringio +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ElementTree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ElementTree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_cmp lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_cmp +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_indexing_with_text2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_indexing_with_text2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_version lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_version +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_update_dict lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_update_dict +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_move_elements lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_move_elements +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_sub_tostring_default_encoding lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_sub_tostring_default_encoding +lxml.tests.test_elementtree.ETreeTestCaseBase.test_multiple_elementrees lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_multiple_elementrees +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_nonsense lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_nonsense +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_str lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_str +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iteration_del_child lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iteration_del_child +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_8bit_xml lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_8bit_xml +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_comment lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_comment +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_encoding_exact lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_encoding_exact +lxml.tests.test_elementtree.ETreeTestCaseBase.test_elementtree_parser_target lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_elementtree_parser_target +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setitem +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_elementtree.ElementTreeTestCase.etree elementtree.ElementTree-module.html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_start_end lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_start_end +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_remove_ns lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_remove_ns +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_items lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_items +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_step_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_step_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_error_from_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_error_from_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_close_incomplete lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_close_incomplete +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tail_append lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tail_append +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_other lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_other +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_attribute_ns_parsed lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_attribute_ns_parsed +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_negative2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_negative2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns1 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns1 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_root lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_root +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_all_replace_reversed_ns2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_all_replace_reversed_ns2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iter lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iter +lxml.tests.test_elementtree.ETreeTestCaseBase.test_deepcopy_namespaces lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_deepcopy_namespaces +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setslice_empty lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setslice_empty +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_xmlns_move lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_xmlns_move +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element_with_attributes_keywords lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element_with_attributes_keywords +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_pop_default lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_pop_default +lxml.tests.test_elementtree.ETreeTestCaseBase.test_processinginstruction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_processinginstruction +lxml.tests.test_elementtree.ETreeTestCaseBase._rootstring lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_rootstring +lxml.tests.test_elementtree.ETreeTestCaseBase.test_del_setslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_del_setslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_filter_all lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_filter_all +lxml.tests.test_elementtree.ETreeTestCaseBase.test_qname_attrib lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_qname_attrib +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_manipulation lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_manipulation +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parse_file lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parse_file +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attrib_clear lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attrib_clear +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_access2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_access2 +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_attr lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_attr +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem_tail +lxml.tests.test_elementtree.ETreeTestCaseBase.test_clear_tail lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_clear_tail +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element +lxml.tests.test_elementtree.ETreeTestCaseBase._check_element_tree lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_element_tree +lxml.tests.test_elementtree.ETreeTestCaseBase.test_text_escape_in lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_text_escape_in +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_tag_parse lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_tag_parse +lxml.tests.test_elementtree.ETreeTestCaseBase._check_string lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#_check_string +lxml.tests.test_elementtree.ETreeTestCaseBase.test_write_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_write_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_delslice lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_delslice +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tag_str_subclass lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tag_str_subclass +lxml.tests.test_elementtree.ETreeTestCaseBase.test_getiterator_with_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_getiterator_with_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_iterparse_large lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_iterparse_large +lxml.tests.test_elementtree.ETreeTestCaseBase.test_feed_parser_error_position lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_feed_parser_error_position +lxml.tests.test_elementtree.ETreeTestCaseBase.assertXML lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#assertXML +lxml.tests.test_elementtree.ETreeTestCaseBase.test_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_tostring_method_html lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_tostring_method_html +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem2 lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem2 +lxml.tests.test_elementtree.ETreeTestCaseBase.test_comment_text lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_comment_text +lxml.tests.test_elementtree.ETreeTestCaseBase.test_fromstringlist_characters lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_fromstringlist_characters +lxml.tests.test_elementtree.ETreeTestCaseBase.test_parser_target_data lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_parser_target_data +lxml.tests.test_elementtree.ETreeTestCaseBase.test_XMLID lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_XMLID +lxml.tests.test_elementtree.ETreeTestCaseBase.test_ns_decl_tostring_element lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_ns_decl_tostring_element +lxml.tests.test_elementtree.ETreeTestCaseBase.test_attribute_values lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_attribute_values +lxml.tests.test_elementtree.ETreeTestCaseBase.test_weird_dict_interaction lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_weird_dict_interaction +lxml.tests.test_elementtree.ETreeTestCaseBase.test_setitem lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_setitem +lxml.tests.test_elementtree.ETreeTestCaseBase.test_pi lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_pi +lxml.tests.test_elementtree.ETreeTestCaseBase.test_subelement_with_attributes lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#test_subelement_with_attributes +lxml.tests.test_errors.ErrorTestCase lxml.tests.test_errors.ErrorTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_errors.ErrorTestCase.test_bad_element lxml.tests.test_errors.ErrorTestCase-class.html#test_bad_element +lxml.tests.test_errors.ErrorTestCase.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_errors.ErrorTestCase.test_element_cyclic_gc_none lxml.tests.test_errors.ErrorTestCase-class.html#test_element_cyclic_gc_none +lxml.tests.test_errors.ErrorTestCase.test_empty_parse lxml.tests.test_errors.ErrorTestCase-class.html#test_empty_parse +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.ETreeC14NTestCase lxml.tests.test_etree.ETreeC14NTestCase-class.html +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_exclusive lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_exclusive +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_gzip lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_gzip +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_file lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_file +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_with_comments lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_with_comments +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeC14NTestCase.test_c14n_file_gzip lxml.tests.test_etree.ETreeC14NTestCase-class.html#test_c14n_file_gzip +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.ETreeErrorLogTest lxml.tests.test_etree.ETreeErrorLogTest-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeErrorLogTest._test_python_error_logging lxml.tests.test_etree.ETreeErrorLogTest-class.html#_test_python_error_logging +lxml.tests.test_etree.ETreeErrorLogTest.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeErrorLogTest.test_parse_error_logging lxml.tests.test_etree.ETreeErrorLogTest-class.html#test_parse_error_logging +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.ETreeOnlyTestCase lxml.tests.test_etree.ETreeOnlyTestCase-class.html +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext_root lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_root +lxml.tests.test_etree.ETreeOnlyTestCase.test_dump_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_dump_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_nsmap_prefix_invalid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_nsmap_prefix_invalid +lxml.tests.test_etree.ETreeOnlyTestCase._writeElement lxml.tests.test_etree.ETreeOnlyTestCase-class.html#_writeElement +lxml.tests.test_etree.ETreeOnlyTestCase.test_xml_base lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_xml_base +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_elementtree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_elementtree +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_start lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_start +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext_root_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_root_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_target_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_space lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_space +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_deepcopy_elementtree_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_deepcopy_elementtree_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_subelement_name_quote lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_subelement_name_quote +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_start_end lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_start_end +lxml.tests.test_etree.ETreeOnlyTestCase.test_parseid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parseid +lxml.tests.test_etree.ETreeOnlyTestCase.test_parse_fileobject_unicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_fileobject_unicode +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_strip lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_strip +lxml.tests.test_etree.ETreeOnlyTestCase.test_html_base_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_html_base_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_xml_base_attribute lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_xml_base_attribute +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_standalone lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_standalone +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext_root_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_root_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_all_comment_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_all_comment_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_remove_comments lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_remove_comments +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_unicode_element_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_unicode_element_tail +lxml.tests.test_etree.ETreeOnlyTestCase.etree lxml.etree-module.html +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_name_space lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_name_space +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_replace lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_replace +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_subelement_name_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_subelement_name_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_elements_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_elements_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_iterparse_start lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_iterparse_start +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_getiterator lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_getiterator +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_unicode_pretty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_unicode_pretty +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_target_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_c_api lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_c_api +lxml.tests.test_etree.ETreeOnlyTestCase.test_standalone lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_standalone +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_encoding_8bit_override lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_encoding_8bit_override +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_reuse_after_move lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_reuse_after_move +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_text_resolve lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_text_resolve +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_broken lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_broken +lxml.tests.test_etree.ETreeOnlyTestCase.test_elementtree_parser_target_type_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_parser_target_type_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_elements lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_elements +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_namespace_localname lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_namespace_localname +lxml.tests.test_etree.ETreeOnlyTestCase.test_findall_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_findall_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_comment_immutable lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_immutable +lxml.tests.test_etree.ETreeOnlyTestCase.test_attribute_set_invalid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_set_invalid +lxml.tests.test_etree.ETreeOnlyTestCase.test_subelement_nsmap lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_subelement_nsmap +lxml.tests.test_etree.ETreeOnlyTestCase.test_comment_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_pi_parse lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pi_parse +lxml.tests.test_etree.ETreeOnlyTestCase.test_XML_set_base_url_docinfo lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XML_set_base_url_docinfo +lxml.tests.test_etree.ETreeOnlyTestCase.test_setitem_assert lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setitem_assert +lxml.tests.test_etree.ETreeOnlyTestCase.test_setslice_step_overrun lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_step_overrun +lxml.tests.test_etree.ETreeOnlyTestCase.test_itersiblings lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_itersiblings +lxml.tests.test_etree.ETreeOnlyTestCase.test_parse_base_url_docinfo lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_base_url_docinfo +lxml.tests.test_etree.ETreeOnlyTestCase.test_replace_new lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_replace_new +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_attrib_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_attrib_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_parse lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_parse +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_pis lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_pis +lxml.tests.test_etree.ETreeOnlyTestCase.test_getparent lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getparent +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_doctype_name_only_roundtrip lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_doctype_name_only_roundtrip +lxml.tests.test_etree.ETreeOnlyTestCase.test_unicode_byte_zero lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_unicode_byte_zero +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespace_cleanup lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespace_cleanup +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_name_quote lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_name_quote +lxml.tests.test_etree.ETreeOnlyTestCase.test_comment_no_proxy_yet lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_no_proxy_yet +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_pretty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_pretty +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_filename_dtd_relative lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_filename_dtd_relative +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_string_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_string_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_root_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_root_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_filelike_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_filelike_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_keep_cdata lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_keep_cdata +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_names lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_names +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_nsmap lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_nsmap +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_filename_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_filename_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_unicode_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_unicode_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_byte_invalid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_byte_invalid +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterancestors_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterancestors_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_addnext_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addnext_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_attributes lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_attributes +lxml.tests.test_etree.ETreeOnlyTestCase.test_setslice_step_negative2 lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_step_negative2 +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_clear lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_clear +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_values lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_values +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_iterparse_end lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_iterparse_end +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_tag_reversed lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_tag_reversed +lxml.tests.test_etree.ETreeOnlyTestCase.test_subelement_attribute_invalid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_subelement_attribute_invalid +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_default_and_attr lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_default_and_attr +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_name_colon lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_name_colon +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_copy_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_copy_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_encoding_unknown lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_encoding_unknown +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_default_copy_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_default_copy_element +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_tags_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_tags_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_element_name_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_element_name_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_attribute_set lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_set +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren +lxml.tests.test_etree.ETreeOnlyTestCase.test_getroottree lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getroottree +lxml.tests.test_etree.ETreeOnlyTestCase.test_attribute_values lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_attribute_values +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_root_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_root_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_method_text_unicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_method_text_unicode +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_target_recover lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_recover +lxml.tests.test_etree.ETreeOnlyTestCase.test_deepcopy_elementtree_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_deepcopy_elementtree_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_unicode_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_unicode_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_element lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_element +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_tree_comments lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tree_comments +lxml.tests.test_etree.ETreeOnlyTestCase.test_byte_zero lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_byte_zero +lxml.tests.test_etree.ETreeOnlyTestCase.test_parse_stringio_base_url lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_stringio_base_url +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_xpath lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_xpath +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_elementtree_findall_qname lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_findall_qname +lxml.tests.test_etree.ETreeOnlyTestCase.test_XMLDTDID lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XMLDTDID +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_method_text_encoding lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_method_text_encoding +lxml.tests.test_etree.ETreeOnlyTestCase.test_parse_parser_type_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_parser_type_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_elementtree_find_qname lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_find_qname +lxml.tests.test_etree.ETreeOnlyTestCase.test_encoding_tostring_utf16 lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_encoding_tostring_utf16 +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode_pretty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode_pretty +lxml.tests.test_etree.ETreeOnlyTestCase.test_XMLDTDID_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XMLDTDID_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_system lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_system +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_attributes_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_attributes_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_parse_remove_pis lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_remove_pis +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_encoding_error lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_encoding_error +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_public lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_public +lxml.tests.test_etree.ETreeOnlyTestCase.test_qname_colon lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_qname_colon +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_target_cdata lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_target_cdata +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_strip_tags lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_strip_tags +lxml.tests.test_etree.ETreeOnlyTestCase.test_getnext lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getnext +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_errors lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_errors +lxml.tests.test_etree.ETreeOnlyTestCase.test_parser_encoding lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parser_encoding +lxml.tests.test_etree.ETreeOnlyTestCase.test_namespaces_default lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_namespaces_default +lxml.tests.test_etree.ETreeOnlyTestCase.test_itersiblings_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_itersiblings_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_type lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_type +lxml.tests.test_etree.ETreeOnlyTestCase.test_subelement_name_colon lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_subelement_name_colon +lxml.tests.test_etree.ETreeOnlyTestCase.test_setslice_all_empty_reversed lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_all_empty_reversed +lxml.tests.test_etree.ETreeOnlyTestCase.test_getprevious lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getprevious +lxml.tests.test_etree.ETreeOnlyTestCase.test_sourceline_XML lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_sourceline_XML +lxml.tests.test_etree.ETreeOnlyTestCase.test_unicode_byte_invalid lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_unicode_byte_invalid +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterdescendants_tag lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterdescendants_tag +lxml.tests.test_etree.ETreeOnlyTestCase.test_append_None lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_append_None +lxml.tests.test_etree.ETreeOnlyTestCase.test_comment_parse_empty lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_comment_parse_empty +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_etree.ETreeOnlyTestCase.test_docinfo_name_only lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_docinfo_name_only +lxml.tests.test_etree.ETreeOnlyTestCase.test_XML_base_url_docinfo lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_XML_base_url_docinfo +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_comments lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_comments +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_with_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_with_tail +lxml.tests.test_etree.ETreeOnlyTestCase.test_prefix_default_ns lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_prefix_default_ns +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_namespace lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_namespace +lxml.tests.test_etree.ETreeOnlyTestCase.test_parse_remove_comments lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_parse_remove_comments +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_append lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_append +lxml.tests.test_etree.ETreeOnlyTestCase.test_subelement_name_space lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_subelement_name_space +lxml.tests.test_etree.ETreeOnlyTestCase.test_prefix lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_prefix +lxml.tests.test_etree.ETreeOnlyTestCase._checkIDDict lxml.tests.test_etree.ETreeOnlyTestCase-class.html#_checkIDDict +lxml.tests.test_etree.ETreeOnlyTestCase.test_addprevious_comment lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_addprevious_comment +lxml.tests.test_etree.ETreeOnlyTestCase.test_index lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_index +lxml.tests.test_etree.ETreeOnlyTestCase.test_HTML_base_url_docinfo lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_HTML_base_url_docinfo +lxml.tests.test_etree.ETreeOnlyTestCase.test_feed_parser_recover lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_feed_parser_recover +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterchildren_reversed lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterchildren_reversed +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_bytes_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_bytes_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_resolve_file_dtd lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_resolve_file_dtd +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_parse lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_parse +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.ETreeOnlyTestCase.test_setslice_step_negative lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_step_negative +lxml.tests.test_etree.ETreeOnlyTestCase.test_deepcopy_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_deepcopy_pi +lxml.tests.test_etree.ETreeOnlyTestCase.test_version lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_version +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_unicode lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_unicode +lxml.tests.test_etree.ETreeOnlyTestCase.test_dtd_io lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_dtd_io +lxml.tests.test_etree.ETreeOnlyTestCase.test_getiterator_filter_entities lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_getiterator_filter_entities +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterparse_tag_all lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterparse_tag_all +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode_none lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode_none +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterancestors lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterancestors +lxml.tests.test_etree.ETreeOnlyTestCase.test_setslice_step lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_setslice_step +lxml.tests.test_etree.ETreeOnlyTestCase.test_cdata_parser lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_cdata_parser +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterwalk_tag_all lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterwalk_tag_all +lxml.tests.test_etree.ETreeOnlyTestCase.test_tostring_standalone_in_out lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tostring_standalone_in_out +lxml.tests.test_etree.ETreeOnlyTestCase.test_tounicode_element_tail lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_tounicode_element_tail +lxml.tests.test_etree.ETreeOnlyTestCase.test_entity_restructure lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_entity_restructure +lxml.tests.test_etree.ETreeOnlyTestCase.test_elementtree_findall_ns_qname lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_elementtree_findall_ns_qname +lxml.tests.test_etree.ETreeOnlyTestCase.test_html_base lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_html_base +lxml.tests.test_etree.ETreeOnlyTestCase.test_iterdescendants lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_iterdescendants +lxml.tests.test_etree.ETreeOnlyTestCase.test_pi lxml.tests.test_etree.ETreeOnlyTestCase-class.html#test_pi +lxml.tests.test_etree.ETreeWriteTestCase lxml.tests.test_etree.ETreeWriteTestCase-class.html +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_gzip lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_gzip +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_etree.ETreeWriteTestCase.test_write lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file +lxml.tests.test_etree.ETreeWriteTestCase.test_write_gzip_level lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_gzip_level +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_gzipfile_parse lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_gzipfile_parse +lxml.tests.test_etree.ETreeWriteTestCase.test_write_gzip lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_gzip +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.ETreeWriteTestCase.test_write_file_gzip_parse lxml.tests.test_etree.ETreeWriteTestCase-class.html#test_write_file_gzip_parse +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.ETreeXIncludeTestCase lxml.tests.test_etree.ETreeXIncludeTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.XIncludeTestCase.test_xinclude lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ETreeXIncludeTestCase.include lxml.tests.test_etree.ETreeXIncludeTestCase-class.html#include +lxml.tests.test_etree.XIncludeTestCase.test_xinclude_resolver lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude_resolver +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.XIncludeTestCase.test_xinclude_text lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude_text +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.ElementIncludeTestCase lxml.tests.test_etree.ElementIncludeTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.ElementIncludeTestCase.ElementInclude lxml.ElementInclude-module.html +lxml.tests.test_etree.XIncludeTestCase.test_xinclude lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.ElementIncludeTestCase.include lxml.tests.test_etree.ElementIncludeTestCase-class.html#include +lxml.tests.test_etree.XIncludeTestCase.test_xinclude_resolver lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude_resolver +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.XIncludeTestCase.test_xinclude_text lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude_text +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_etree.XIncludeTestCase lxml.tests.test_etree.XIncludeTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_etree.XIncludeTestCase.test_xinclude lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_etree.XIncludeTestCase.test_xinclude_resolver lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude_resolver +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_etree.XIncludeTestCase.test_xinclude_text lxml.tests.test_etree.XIncludeTestCase-class.html#test_xinclude_text +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_htmlparser.HtmlParserTestCase lxml.tests.test_htmlparser.HtmlParserTestCase-class.html +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_HTML_broken lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML_broken +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_HTML_cdata lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML_cdata +lxml.tests.test_htmlparser.HtmlParserTestCase.tearDown lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#tearDown +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_subelement_name_colon lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_colon +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_element_name_quote lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_element_name_quote +lxml.tests.test_htmlparser.HtmlParserTestCase.uhtml_str lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#uhtml_str +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_parse_html_filelike lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_parse_html_filelike +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_HTML_pretty_print lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML_pretty_print +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_subelement_name_empty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_empty +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_parse_html_norecover lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_parse_html_norecover +lxml.tests.test_htmlparser.HtmlParserTestCase.test_default_parser_HTML_broken lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_default_parser_HTML_broken +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_subelement_name_space lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_space +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_htmlparser.HtmlParserTestCase.etree lxml.etree-module.html +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_HTML_unicode lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML_unicode +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_parse_html lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_parse_html +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_element_name_colon lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_element_name_colon +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_file_error lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_file_error +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_subelement_name_quote lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_subelement_name_quote +lxml.tests.test_htmlparser.HtmlParserTestCase.test_parse_encoding_8bit_override lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_parse_encoding_8bit_override +lxml.tests.test_htmlparser.HtmlParserTestCase.broken_html_str lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#broken_html_str +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_parse_html_error lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_parse_html_error +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_iterparse_file lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_iterparse_file +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_HTML_access lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML_access +lxml.tests.test_htmlparser.HtmlParserTestCase.test_parse_encoding_8bit_explicit lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_parse_encoding_8bit_explicit +lxml.tests.test_htmlparser.HtmlParserTestCase.test_module_HTML lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_module_HTML +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_element_name_empty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_element_name_empty +lxml.tests.test_htmlparser.HtmlParserTestCase.html_str lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#html_str +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_htmlparser.HtmlParserTestCase.test_html_element_name_space lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#test_html_element_name_space +lxml.tests.test_htmlparser.HtmlParserTestCase.html_str_pretty lxml.tests.test_htmlparser.HtmlParserTestCase-class.html#html_str_pretty +lxml.tests.test_io.ETreeIOTestCase lxml.tests.test_io.ETreeIOTestCase-class.html +lxml.tests.test_io.IOTestCaseBase.buildNodes lxml.tests.test_io.IOTestCaseBase-class.html#buildNodes +lxml.tests.test_io.IOTestCaseBase.tearDown lxml.tests.test_io.IOTestCaseBase-class.html#tearDown +lxml.tests.test_io.IOTestCaseBase.test_write_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_write_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_fileobject +lxml.tests.test_io.IOTestCaseBase.test_module_parse_gzipobject lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_gzipobject +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_io.IOTestCaseBase.getTestFilePath lxml.tests.test_io.IOTestCaseBase-class.html#getTestFilePath +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_error +lxml.tests.test_io.IOTestCaseBase.test_module_parse_large_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_large_fileobject +lxml.tests.test_io.ETreeIOTestCase.etree lxml.etree-module.html +lxml.tests.test_io.IOTestCaseBase.test_tree_io_latin1 lxml.tests.test_io.IOTestCaseBase-class.html#test_tree_io_latin1 +lxml.tests.test_io.IOTestCaseBase.setUp lxml.tests.test_io.IOTestCaseBase-class.html#setUp +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_io.IOTestCaseBase.test_class_parse_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_filename_remove_previous lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_filename_remove_previous +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_io.IOTestCaseBase.test_tree_io lxml.tests.test_io.IOTestCaseBase-class.html#test_tree_io +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_late_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_late_error +lxml.tests.test_io.IOTestCaseBase.test_write_invalid_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_write_invalid_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_unamed_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_unamed_fileobject +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_type_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_type_error +lxml.tests.test_io.ElementTreeIOTestCase lxml.tests.test_io.ElementTreeIOTestCase-class.html +lxml.tests.test_io.IOTestCaseBase.buildNodes lxml.tests.test_io.IOTestCaseBase-class.html#buildNodes +lxml.tests.test_io.IOTestCaseBase.tearDown lxml.tests.test_io.IOTestCaseBase-class.html#tearDown +lxml.tests.test_io.IOTestCaseBase.test_write_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_write_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_fileobject +lxml.tests.test_io.IOTestCaseBase.test_module_parse_gzipobject lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_gzipobject +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_io.IOTestCaseBase.getTestFilePath lxml.tests.test_io.IOTestCaseBase-class.html#getTestFilePath +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_error +lxml.tests.test_io.IOTestCaseBase.test_module_parse_large_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_large_fileobject +lxml.tests.test_io.ElementTreeIOTestCase.etree elementtree.ElementTree-module.html +lxml.tests.test_io.IOTestCaseBase.test_tree_io_latin1 lxml.tests.test_io.IOTestCaseBase-class.html#test_tree_io_latin1 +lxml.tests.test_io.IOTestCaseBase.setUp lxml.tests.test_io.IOTestCaseBase-class.html#setUp +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_io.IOTestCaseBase.test_class_parse_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_filename_remove_previous lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_filename_remove_previous +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_io.IOTestCaseBase.test_tree_io lxml.tests.test_io.IOTestCaseBase-class.html#test_tree_io +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_late_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_late_error +lxml.tests.test_io.IOTestCaseBase.test_write_invalid_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_write_invalid_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_unamed_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_unamed_fileobject +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_type_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_type_error +lxml.tests.test_io.IOTestCaseBase lxml.tests.test_io.IOTestCaseBase-class.html +lxml.tests.test_io.IOTestCaseBase.buildNodes lxml.tests.test_io.IOTestCaseBase-class.html#buildNodes +lxml.tests.test_io.IOTestCaseBase.tearDown lxml.tests.test_io.IOTestCaseBase-class.html#tearDown +lxml.tests.test_io.IOTestCaseBase.test_write_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_write_filename +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_io.IOTestCaseBase.test_module_parse_gzipobject lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_gzipobject +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_io.IOTestCaseBase.getTestFilePath lxml.tests.test_io.IOTestCaseBase-class.html#getTestFilePath +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_error +lxml.tests.test_io.IOTestCaseBase.test_module_parse_large_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_large_fileobject +lxml.tests.test_io.IOTestCaseBase.etree lxml.tests.test_io.IOTestCaseBase-class.html#etree +lxml.tests.test_io.IOTestCaseBase.test_tree_io_latin1 lxml.tests.test_io.IOTestCaseBase-class.html#test_tree_io_latin1 +lxml.tests.test_io.IOTestCaseBase.setUp lxml.tests.test_io.IOTestCaseBase-class.html#setUp +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_io.IOTestCaseBase.test_class_parse_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_filename_remove_previous lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_filename_remove_previous +lxml.tests.test_io.IOTestCaseBase.test_class_parse_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_fileobject +lxml.tests.test_io.IOTestCaseBase.test_tree_io lxml.tests.test_io.IOTestCaseBase-class.html#test_tree_io +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_late_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_late_error +lxml.tests.test_io.IOTestCaseBase.test_write_invalid_filename lxml.tests.test_io.IOTestCaseBase-class.html#test_write_invalid_filename +lxml.tests.test_io.IOTestCaseBase.test_class_parse_unamed_fileobject lxml.tests.test_io.IOTestCaseBase-class.html#test_class_parse_unamed_fileobject +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_io.IOTestCaseBase.test_module_parse_fileobject_type_error lxml.tests.test_io.IOTestCaseBase-class.html#test_module_parse_fileobject_type_error +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.test_ns_classes lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#test_ns_classes +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.tearDown lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#tearDown +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.test_create_element_default lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#test_create_element_default +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.test_default_tagname lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#test_default_tagname +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.setUp lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#setUp +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.test_create_element lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#test_create_element +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.test_element_creation lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#test_element_creation +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.test_registry lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html#test_registry +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class.bluff lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html#bluff +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html +lxml.etree._Element.getprevious lxml.etree._Element-class.html#getprevious +lxml.etree._Element.set lxml.etree._Element-class.html#set +lxml.etree._Element.getparent lxml.etree._Element-class.html#getparent +lxml.etree._Element.sourceline lxml.etree._Element-class.html#sourceline +lxml.etree._Element.text lxml.etree._Element-class.html#text +lxml.etree._Element.iterfind lxml.etree._Element-class.html#iterfind +lxml.etree._Element._init lxml.etree._Element-class.html#_init +lxml.etree._Element.nsmap lxml.etree._Element-class.html#nsmap +lxml.etree._Element.replace lxml.etree._Element-class.html#replace +lxml.etree._Element.prefix lxml.etree._Element-class.html#prefix +lxml.etree._Element.tag lxml.etree._Element-class.html#tag +lxml.etree._Element.iter lxml.etree._Element-class.html#iter +lxml.etree._Element.addnext lxml.etree._Element-class.html#addnext +lxml.etree._Element.addprevious lxml.etree._Element-class.html#addprevious +lxml.etree._Element.find lxml.etree._Element-class.html#find +lxml.etree._Element.append lxml.etree._Element-class.html#append +lxml.etree._Element.getnext lxml.etree._Element-class.html#getnext +lxml.etree._Element.index lxml.etree._Element-class.html#index +lxml.etree.ElementBase.__new__ lxml.etree.ElementBase-class.html#__new__ +lxml.etree._Element.__contains__ lxml.etree._Element-class.html#__contains__ +lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class.maeh lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html#maeh +lxml.etree._Element.findtext lxml.etree._Element-class.html#findtext +lxml.etree._Element.tail lxml.etree._Element-class.html#tail +lxml.etree._Element.getroottree lxml.etree._Element-class.html#getroottree +lxml.etree._Element.iterdescendants lxml.etree._Element-class.html#iterdescendants +lxml.etree._Element.getchildren lxml.etree._Element-class.html#getchildren +lxml.etree.ElementBase.__init__ lxml.etree.ElementBase-class.html#__init__ +lxml.etree._Element.__len__ lxml.etree._Element-class.html#__len__ +lxml.etree._Element.xpath lxml.etree._Element-class.html#xpath +lxml.etree._Element.__getitem__ lxml.etree._Element-class.html#__getitem__ +lxml.etree._Element.get lxml.etree._Element-class.html#get +lxml.etree._Element.keys lxml.etree._Element-class.html#keys +lxml.etree._Element.__deepcopy__ lxml.etree._Element-class.html#__deepcopy__ +lxml.etree._Element.makeelement lxml.etree._Element-class.html#makeelement +lxml.etree._Element.__iter__ lxml.etree._Element-class.html#__iter__ +lxml.etree._Element.base lxml.etree._Element-class.html#base +lxml.etree._Element.insert lxml.etree._Element-class.html#insert +lxml.etree._Element.iterchildren lxml.etree._Element-class.html#iterchildren +lxml.etree._Element.iterancestors lxml.etree._Element-class.html#iterancestors +lxml.etree._Element.extend lxml.etree._Element-class.html#extend +lxml.etree._Element.__delitem__ lxml.etree._Element-class.html#__delitem__ +lxml.etree._Element.__reversed__ lxml.etree._Element-class.html#__reversed__ +lxml.etree._Element.itersiblings lxml.etree._Element-class.html#itersiblings +lxml.etree._Element.__nonzero__ lxml.etree._Element-class.html#__nonzero__ +lxml.etree._Element.items lxml.etree._Element-class.html#items +lxml.etree._Element.clear lxml.etree._Element-class.html#clear +lxml.etree._Element.itertext lxml.etree._Element-class.html#itertext +lxml.etree._Element.findall lxml.etree._Element-class.html#findall +lxml.etree._Element.__setitem__ lxml.etree._Element-class.html#__setitem__ +lxml.etree._Element.remove lxml.etree._Element-class.html#remove +lxml.etree._Element.values lxml.etree._Element-class.html#values +lxml.etree._Element.__repr__ lxml.etree._Element-class.html#__repr__ +lxml.etree._Element.getiterator lxml.etree._Element-class.html#getiterator +lxml.etree._Element.attrib lxml.etree._Element-class.html#attrib +lxml.etree._Element.__copy__ lxml.etree._Element-class.html#__copy__ +lxml.tests.test_objectify.ObjectifyTestCase lxml.tests.test_objectify.ObjectifyTestCase-class.html +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_nested lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_nested +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_partial_allneg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_partial_allneg +lxml.tests.test_objectify.ObjectifyTestCase.test_type_bool_cmp lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_bool_cmp +lxml.tests.test_objectify.ObjectifyTestCase.test_type_unregistered lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_unregistered +lxml.tests.test_objectify.ObjectifyTestCase.test_xml_base lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xml_base +lxml.tests.test_objectify.ObjectifyTestCase.test_pytype_annotation_use_old lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pytype_annotation_use_old +lxml.tests.test_objectify.ObjectifyTestCase.test_registered_types lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_registered_types +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_data_element_nsmap_custom lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_data_element_nsmap_custom +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_element_nsmap_default lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_element_nsmap_default +lxml.tests.test_objectify.ObjectifyTestCase.test_child_nonexistant lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_nonexistant +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_list +lxml.tests.test_objectify.ObjectifyTestCase.test_schema_types lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_schema_types +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_attrib_attributes_precedence lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_attrib_attributes_precedence +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_dot lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_dot +lxml.tests.test_objectify.ObjectifyTestCase.test_pyannotate_use_old lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pyannotate_use_old +lxml.tests.test_objectify.ObjectifyTestCase.test_build_tree lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_build_tree +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str +lxml.tests.test_objectify.ObjectifyTestCase.test_element_nsmap_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_element_nsmap_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_dot_root_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_dot_root_list +lxml.tests.test_objectify.ObjectifyTestCase.test_setitem_string lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setitem_string +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_dot_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_dot_list +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_pytypes lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_pytypes +lxml.tests.test_objectify.ObjectifyTestCase.test_xml_base_attribute lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xml_base_attribute +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_addattr_create_element lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_addattr_create_element +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg_invalid_pytype lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg_invalid_pytype +lxml.tests.test_objectify.ObjectifyTestCase.etree lxml.etree-module.html +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_nsmap_custom_prefixes lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_nsmap_custom_prefixes +lxml.tests.test_objectify.ObjectifyTestCase.test_xsitype_deannotate lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xsitype_deannotate +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_nsmap_custom lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_nsmap_custom +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_as_complex lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_as_complex +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_fail_parse_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_fail_parse_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_pyannotate_ignore_old lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pyannotate_ignore_old +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_fail lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_fail +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_ns lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_ns +lxml.tests.test_objectify.ObjectifyTestCase.test_pyannotate_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pyannotate_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_attrib lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_attrib +lxml.tests.test_objectify.ObjectifyTestCase.test_class_lookup lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_class_lookup +lxml.tests.test_objectify.ObjectifyTestCase.test_change_pytype_attribute lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_change_pytype_attribute +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_index_fail_lookup lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_index_fail_lookup +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_partial lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_partial +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg_pytype_xsitype lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg_pytype_xsitype +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_partial_wrong_length lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_partial_wrong_length +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_default_absolute lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_default_absolute +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_index_fail_parse lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_index_fail_parse +lxml.tests.test_objectify.ObjectifyTestCase.test_findall_ns lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_findall_ns +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_ns_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_ns_list +lxml.tests.test_objectify.ObjectifyTestCase.test_descendant_paths_prefix lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_descendant_paths_prefix +lxml.tests.test_objectify.ObjectifyTestCase.tearDown lxml.tests.test_objectify.ObjectifyTestCase-class.html#tearDown +lxml.tests.test_objectify.ObjectifyTestCase.test_pytype_xsitype_annotation lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pytype_xsitype_annotation +lxml.tests.test_objectify.ObjectifyTestCase.test_pickle_elementtree lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle_elementtree +lxml.tests.test_objectify.ObjectifyTestCase.test_XML_set_base_url_docinfo lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_XML_set_base_url_docinfo +lxml.tests.test_objectify.ObjectifyTestCase.test_parse_stringio_base_url lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_parse_stringio_base_url +lxml.tests.test_objectify.ObjectifyTestCase.test_setitem_string_special lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setitem_string_special +lxml.tests.test_objectify.ObjectifyTestCase.test_type_ustr_intliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_ustr_intliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_set_create_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_set_create_list +lxml.tests.test_objectify.ObjectifyTestCase.test_root lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_root +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_as_int lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_as_int +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_ustr_floatliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_ustr_floatliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_bool lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_bool +lxml.tests.test_objectify.ObjectifyTestCase.test_xsiannotate_ignore_old lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xsiannotate_ignore_old +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_xsitypes lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_xsitypes +lxml.tests.test_objectify.ObjectifyTestCase.test_pickle lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pickle +lxml.tests.test_objectify.ObjectifyTestCase.test_addattr_element lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_addattr_element +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_index lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_index +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_set_create lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_set_create +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_element_nsmap_custom lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_element_nsmap_custom +lxml.tests.test_objectify.ObjectifyTestCase.test_type_ustr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_ustr +lxml.tests.test_objectify.ObjectifyTestCase.test_xsinil_deannotate lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xsinil_deannotate +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_float lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_float +lxml.tests.test_objectify.ObjectifyTestCase.test_dataelement_xsi_prefix_error lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_dataelement_xsi_prefix_error +lxml.tests.test_objectify.ObjectifyTestCase.setUp lxml.tests.test_objectify.ObjectifyTestCase-class.html#setUp +lxml.tests.test_objectify.ObjectifyTestCase.test_setattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setattr +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_cmp lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_cmp +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg_pytype_none lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg_pytype_none +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_element_nsmap_custom_prefixes lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_element_nsmap_custom_prefixes +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_index_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_index_list +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_addattr_element lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_addattr_element +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_nsmap_default lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_nsmap_default +lxml.tests.test_objectify.ObjectifyTestCase.test_addattr_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_addattr_list +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_elements lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_elements +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_mod lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_mod +lxml.tests.test_objectify.ObjectifyTestCase.test_child_index lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_index +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_data_element_nsmap_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_data_element_nsmap_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_getslice_partial lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_getslice_partial +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_str lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_str +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_addattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_addattr +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg_xsitype lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg_xsitype +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_sequence lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_sequence +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_addattr_create lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_addattr_create +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_set_element lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_set_element +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_str_intliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_str_intliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_str lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_str +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_ustr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_ustr +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_none lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_none +lxml.tests.test_objectify.ObjectifyTestCase.test_str lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_str +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_syntax lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_syntax +lxml.tests.test_objectify.ObjectifyTestCase.test_type_bool lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_bool +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_NoneType lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_NoneType +lxml.tests.test_objectify.ObjectifyTestCase.test_type_NoneType lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_NoneType +lxml.tests.test_objectify.ObjectifyTestCase.test_dataelement_xsi_nsmap lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_dataelement_xsi_nsmap +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_xsitypes_xsdprefixed lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_xsitypes_xsdprefixed +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_float lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_float +lxml.tests.test_objectify.ObjectifyTestCase.test_element_nsmap_default lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_element_nsmap_default +lxml.tests.test_objectify.ObjectifyTestCase.test_pytype_annotation_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pytype_annotation_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_child_addattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_addattr +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_complete lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_complete +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_xsitypes_prefixed lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_xsitypes_prefixed +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_addattr_create_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_addattr_create_list +lxml.tests.test_objectify.ObjectifyTestCase.XML lxml.tests.test_objectify.ObjectifyTestCase-class.html#XML +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_data_element_nsmap_custom_prefixes lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_data_element_nsmap_custom_prefixes +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_invalid_xsi lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_invalid_xsi +lxml.tests.test_objectify.ObjectifyTestCase.test_getslice_complete lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_getslice_complete +lxml.tests.test_objectify.ObjectifyTestCase.test_dataelement_xsi lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_dataelement_xsi +lxml.tests.test_objectify.ObjectifyTestCase.test_getslice_partial_neg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_getslice_partial_neg +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_objectify.ObjectifyTestCase.test_type_none_cmp lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_none_cmp +lxml.tests.test_objectify.ObjectifyTestCase.test_child_len lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_len +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_pytype_none lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_pytype_none +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_insert lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_insert +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_nsmap_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_nsmap_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_schema_types_prefixed lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_schema_types_prefixed +lxml.tests.test_objectify.ObjectifyTestCase.test_type_ustr_floatliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_ustr_floatliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_addattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_addattr +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_set lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_set +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_int lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_int +lxml.tests.test_objectify.ObjectifyTestCase.test_registered_type_stringify lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_registered_type_stringify +lxml.tests.test_objectify.ObjectifyTestCase.test_dir lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_dir +lxml.tests.test_objectify.ObjectifyTestCase.test_findall lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_findall +lxml.tests.test_objectify.ObjectifyTestCase.test_type_ustr_add lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_ustr_add +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_dot_root lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_dot_root +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_hasattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_hasattr +lxml.tests.test_objectify.ObjectifyTestCase.test_XML_base_url_docinfo lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_XML_base_url_docinfo +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_default_relative lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_default_relative +lxml.tests.test_objectify.ObjectifyTestCase.test_xsiannotate_use_old lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_xsiannotate_use_old +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_pytype_none_compat lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_pytype_none_compat +lxml.tests.test_objectify.ObjectifyTestCase.test_type_int lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_int +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_unregistered lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_unregistered +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_str_floatliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_str_floatliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_mul lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_mul +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_ustr_intliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_ustr_intliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_set_create_element lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_set_create_element +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_add lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_add +lxml.tests.test_objectify.ObjectifyTestCase.test_type_float lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_float +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg_pytype lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg_pytype +lxml.tests.test_objectify.ObjectifyTestCase.test_type_ustr_mul lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_ustr_mul +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg_invalid_xsi lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg_invalid_xsi +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_partial_neg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_partial_neg +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_data_element_nsmap_default lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_data_element_nsmap_default +lxml.tests.test_objectify.ObjectifyTestCase.test_descendant_paths_child lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_descendant_paths_child +lxml.tests.test_objectify.ObjectifyTestCase.test_pytype_annotation lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pytype_annotation +lxml.tests.test_objectify.ObjectifyTestCase.test_type_int_cmp lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_int_cmp +lxml.tests.test_objectify.ObjectifyTestCase.test_child_set_ro lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_set_ro +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_intliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_intliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_element_nsmap_custom_prefixes lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_element_nsmap_custom_prefixes +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_data_element_arg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_data_element_arg +lxml.tests.test_objectify.ObjectifyTestCase.test_vars lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_vars +lxml.tests.test_objectify.ObjectifyTestCase.test_child lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_floatliteral lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_floatliteral +lxml.tests.test_objectify.ObjectifyTestCase.test_parse_base_url_docinfo lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_parse_base_url_docinfo +lxml.tests.test_objectify.ObjectifyTestCase.test_element_nsmap_custom lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_element_nsmap_custom +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_bool lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_bool +lxml.tests.test_objectify.ObjectifyTestCase.test_setslice_insert_neg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setslice_insert_neg +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_value_concatenation lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_value_concatenation +lxml.tests.test_objectify.ObjectifyTestCase.test_pytype_deannotate lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_pytype_deannotate +lxml.tests.test_objectify.ObjectifyTestCase.test_child_getattr lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_getattr +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_int lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_int +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_mod_data_elements lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_mod_data_elements +lxml.tests.test_objectify.ObjectifyTestCase.test_data_element_invalid_pytype lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_data_element_invalid_pytype +lxml.tests.test_objectify.ObjectifyTestCase.test_setattr_nonunicode lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_setattr_nonunicode +lxml.tests.test_objectify.ObjectifyTestCase.test_sub_element_nsmap_empty lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_sub_element_nsmap_empty +lxml.tests.test_objectify.ObjectifyTestCase.test_descendant_paths lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_descendant_paths +lxml.tests.test_objectify.ObjectifyTestCase.test_type_str_as_float lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_type_str_as_float +lxml.tests.test_objectify.ObjectifyTestCase.test_deannotate lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_deannotate +lxml.tests.test_objectify.ObjectifyTestCase.test_object_path_fail_parse_empty_list lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_object_path_fail_parse_empty_list +lxml.tests.test_objectify.ObjectifyTestCase.test_efactory_unicode lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_efactory_unicode +lxml.tests.test_objectify.ObjectifyTestCase.test_set_string lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_set_string +lxml.tests.test_objectify.ObjectifyTestCase.test_child_index_neg lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_index_neg +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_objectify.ObjectifyTestCase.test_standard_lookup lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_standard_lookup +lxml.tests.test_objectify.ObjectifyTestCase.test_child_iter lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_child_iter +lxml.tests.test_objectify.ObjectifyTestCase.test_countchildren lxml.tests.test_objectify.ObjectifyTestCase-class.html#test_countchildren +lxml.tests.test_pyclasslookup.PyClassLookupTestCase lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_get_default lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_get_default +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_attrib lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_attrib +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.tearDown lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#tearDown +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getitem_neg lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getitem_neg +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.parser lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#parser +lxml.tests.test_pyclasslookup.PyClassLookupTestCase._setClassLookup lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#_setClassLookup +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getparent lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getparent +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_iterchildren lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_iterchildren +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_len lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_len +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getnext lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getnext +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_iterchildren_tag lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_iterchildren_tag +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_prefix lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_prefix +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getprevious lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getprevious +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_text lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_text +lxml.tests.test_pyclasslookup.PyClassLookupTestCase._buildElementClass lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#_buildElementClass +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_bool lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_bool +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_tag lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_tag +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.XML lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#XML +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.etree lxml.etree-module.html +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getitem lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getitem +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#Element +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_keep_ref_assertion lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_keep_ref_assertion +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getchildren lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getchildren +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_tail lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_tail +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_get lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_get +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_getslice lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_getslice +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_sourceline lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_sourceline +lxml.tests.test_pyclasslookup.PyClassLookupTestCase.test_lookup_iter_children lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#test_lookup_iter_children +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_relaxng.ETreeRelaxNGTestCase lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_multiple_elementrees lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_multiple_elementrees +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_stringio lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_stringio +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_invalid_schema lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_invalid_schema +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_shortcut lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_shortcut +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_invalid_schema4 lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_invalid_schema4 +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_invalid_schema2 lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_invalid_schema2 +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_invalid_schema3 lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_invalid_schema3 +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_include lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_include +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_elementtree_error lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_elementtree_error +lxml.tests.test_relaxng.ETreeRelaxNGTestCase.test_relaxng_error lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html#test_relaxng_error +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_sax.ETreeSaxTestCase lxml.tests.test_sax.ETreeSaxTestCase-class.html +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_comment lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_comment +lxml.tests.test_sax.ETreeSaxTestCase.test_element_sax_ns lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_element_sax_ns +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_sax.ETreeSaxTestCase._saxify_unsaxify lxml.tests.test_sax.ETreeSaxTestCase-class.html#_saxify_unsaxify +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_comment_root lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_comment_root +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_error lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_error +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_error2 lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_error2 +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_pi_root lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_pi_root +lxml.tests.test_sax.ETreeSaxTestCase.test_element_sax lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_element_sax +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_redefine_ns lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_redefine_ns +lxml.tests.test_sax.ETreeSaxTestCase._saxify_serialize lxml.tests.test_sax.ETreeSaxTestCase-class.html#_saxify_serialize +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_pi lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_pi +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_simple lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_simple +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_double lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_double +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_ns1 lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_ns1 +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_attributes lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_attributes +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_ns2 lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_ns2 +lxml.tests.test_sax.ETreeSaxTestCase.test_sax_to_pulldom lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_sax_to_pulldom +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_handler_default_ns lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_handler_default_ns +lxml.tests.test_sax.ETreeSaxTestCase.test_etree_sax_no_ns lxml.tests.test_sax.ETreeSaxTestCase-class.html#test_etree_sax_no_ns +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_schematron.ETreeSchematronTestCase lxml.tests.test_schematron.ETreeSchematronTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_schematron.ETreeSchematronTestCase.test_schematron lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron +lxml.tests.test_schematron.ETreeSchematronTestCase.test_schematron_invalid_schema_empty lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron_invalid_schema_empty +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_schematron.ETreeSchematronTestCase.test_schematron_invalid_schema lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron_invalid_schema +lxml.tests.test_schematron.ETreeSchematronTestCase.test_schematron_elementtree_error lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron_elementtree_error +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_schematron.ETreeSchematronTestCase.test_schematron_invalid_schema_namespace lxml.tests.test_schematron.ETreeSchematronTestCase-class.html#test_schematron_invalid_schema_namespace +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_threading.ThreadPipelineTestCase lxml.tests.test_threading.ThreadPipelineTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.xml lxml.tests.test_threading.ThreadPipelineTestCase-class.html#xml +lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.item_count lxml.tests.test_threading.ThreadPipelineTestCase-class.html#item_count +lxml.tests.test_threading.ThreadPipelineTestCase._build_pipeline lxml.tests.test_threading.ThreadPipelineTestCase-class.html#_build_pipeline +lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.test_thread_pipeline_global_parse lxml.tests.test_threading.ThreadPipelineTestCase-class.html#test_thread_pipeline_global_parse +lxml.tests.test_threading.ThreadPipelineTestCase.etree lxml.etree-module.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_threading.ThreadPipelineTestCase.test_thread_pipeline_thread_parse lxml.tests.test_threading.ThreadPipelineTestCase-class.html#test_thread_pipeline_thread_parse +lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__ lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__ +lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker.XML lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html#XML +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.run lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#run +lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker.handle lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html#handle +lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__ lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__ +lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker.XML lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html#XML +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.run lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#run +lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker.handle lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html#handle +lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__ lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__ +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.run lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#run +lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker.handle lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html#handle +lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__ lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__ +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.run lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#run +lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker.handle lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html#handle +lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__ lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__ +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.run lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#run +lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker.handle lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html#handle +lxml.tests.test_threading.ThreadPipelineTestCase.Worker lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.run lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#run +lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__ lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__ +lxml.tests.test_threading.ThreadingTestCase lxml.tests.test_threading.ThreadingTestCase-class.html +lxml.tests.test_threading.ThreadingTestCase.test_concurrent_class_lookup lxml.tests.test_threading.ThreadingTestCase-class.html#test_concurrent_class_lookup +lxml.tests.test_threading.ThreadingTestCase.test_thread_mix lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_mix +lxml.tests.test_threading.ThreadingTestCase.test_subtree_copy_thread lxml.tests.test_threading.ThreadingTestCase-class.html#test_subtree_copy_thread +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_threading.ThreadingTestCase.test_main_xslt_in_thread lxml.tests.test_threading.ThreadingTestCase-class.html#test_main_xslt_in_thread +lxml.tests.test_threading.ThreadingTestCase._run_thread lxml.tests.test_threading.ThreadingTestCase-class.html#_run_thread +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_threading.ThreadingTestCase.test_concurrent_proxies lxml.tests.test_threading.ThreadingTestCase-class.html#test_concurrent_proxies +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_threading.ThreadingTestCase.test_thread_create_xslt lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_create_xslt +lxml.tests.test_threading.ThreadingTestCase.etree lxml.etree-module.html +lxml.tests.test_threading.ThreadingTestCase.test_thread_xslt_attr_replace lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_xslt_attr_replace +lxml.tests.test_threading.ThreadingTestCase.test_thread_xslt lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_xslt +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_threading.ThreadingTestCase.test_thread_error_log lxml.tests.test_threading.ThreadingTestCase-class.html#test_thread_error_log +lxml.tests.test_unicode.UnicodeTestCase lxml.tests.test_unicode.UnicodeTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_qname lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_qname +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_xml_broken lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_xml_broken +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_nstag lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_nstag +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_qname_invalid lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_qname_invalid +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_attr lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_attr +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_comment lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_comment +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_tag lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_tag +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_nstag_invalid lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_nstag_invalid +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_parse_stringio lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_parse_stringio +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_tag_invalid lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_tag_invalid +lxml.tests.test_unicode.UnicodeTestCase.test_unicode_xml lxml.tests.test_unicode.UnicodeTestCase-class.html#test_unicode_xml +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.resolver_schema_int2 lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#resolver_schema_int2 +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.test_xmlschema_resolvers_noroot lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#test_xmlschema_resolvers_noroot +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.test_xmlschema_resolvers lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#test_xmlschema_resolvers +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.test_xmlschema_resolvers_root lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#test_xmlschema_resolvers_root +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.test_xmlschema_nested_resolvers lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#test_xmlschema_nested_resolvers +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.resolver_schema_ext lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#resolver_schema_ext +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.resolver_schema_int lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html#resolver_schema_int +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver.resolve lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html#resolve +lxml.etree.Resolver.resolve_filename lxml.etree.Resolver-class.html#resolve_filename +lxml.etree.Resolver.__new__ lxml.etree.Resolver-class.html#__new__ +lxml.etree.Resolver.resolve_string lxml.etree.Resolver-class.html#resolve_string +lxml.etree.Resolver.resolve_file lxml.etree.Resolver-class.html#resolve_file +lxml.etree.Resolver.resolve_empty lxml.etree.Resolver-class.html#resolve_empty +lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver.__init__ lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html#__init__ +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_stringio lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_stringio +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_import_file lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_import_file +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_invalid_schema2 lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_invalid_schema2 +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_invalid_schema1 lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_invalid_schema1 +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_parse lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_parse +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_shortcut lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_shortcut +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_iterparse_fail lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_iterparse_fail +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_elementtree_error lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_elementtree_error +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_default_attributes lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_default_attributes +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_file lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_file +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_parse_default_attributes_schema_config lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_parse_default_attributes_schema_config +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_parse_fixed_attributes lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_parse_fixed_attributes +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_iterparse lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_iterparse +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase.test_xmlschema_parse_default_attributes lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html#test_xmlschema_parse_default_attributes +lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase.test_xpath_compile_ns lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html#test_xpath_compile_ns +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase._test_xpath_compile_unicode lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html#_test_xpath_compile_unicode +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_compile_vars lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_compile_vars +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_elementtree_error lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_elementtree_error +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_compile_doc lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_compile_doc +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_compile_error lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_compile_error +lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase.test_xpath_compile_element lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html#test_xpath_compile_element +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xpathevaluator.ETreeXPathTestCase lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_comment lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_comment +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_boolean lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_boolean +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_prefix_error lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_prefix_error +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_elementtree_getpath_partial lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_elementtree_getpath_partial +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_evaluator_element lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_evaluator_element +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_attribute_parent lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_attribute_parent +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_elementtree_getpath lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_elementtree_getpath +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_text_parent lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_text_parent +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_error lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_error +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_variables lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_variables +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_eval_context_propagation lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_eval_context_propagation +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_elements lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_elements +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_namespace lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_namespace +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_evaluator_tree lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_evaluator_tree +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_unicode_text_parent lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_unicode_text_parent +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions_mix lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_mix +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_attribute lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_attribute +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_namespace_empty lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_namespace_empty +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_eval_context_clear lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_eval_context_clear +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_nothing lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_nothing +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_class_error lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_class_error +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions_nodes lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_nodes +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_variables_nodeset lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_variables_nodeset +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions_nodes_append2 lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_nodes_append2 +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_string lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_string +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_ns_none lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_ns_none +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_text lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_text +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_attribute_parent_no_smart_strings lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_attribute_parent_no_smart_strings +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_document_root lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_document_root +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions_wrong_args lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_wrong_args +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_evaluator lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_evaluator +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_number lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_number +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_ns_empty lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_ns_empty +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_rel_xpath_list_elements lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_rel_xpath_list_elements +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions_nodes_append lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_nodes_append +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_list_text_parent_no_smart_strings lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_list_text_parent_no_smart_strings +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_rel_xpath_boolean lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_rel_xpath_boolean +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_evaluator_tree_absolute lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_evaluator_tree_absolute +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_class_prefix_error lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_class_prefix_error +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_context_node lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_context_node +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_extensions_error lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_extensions_error +lxml.tests.test_xpathevaluator.ETreeXPathTestCase.test_xpath_ns lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html#test_xpath_ns +lxml.tests.test_xslt.ETreeXSLTTestCase lxml.tests.test_xslt.ETreeXSLTTestCase-class.html +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_parameter_xpath lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_parameter_xpath +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_default_parameters lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_default_parameters +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_repeat_transform lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_repeat_transform +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_set_replace lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_set_replace +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_get_all lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_get_all +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_html_output lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_html_output +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_regexp_match lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_regexp_match +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_parameter_invalid lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_parameter_invalid +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_multiple_parameters lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_multiple_parameters +lxml.tests.test_xslt.ETreeXSLTTestCase.test_extension_element_apply_templates lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_extension_element_apply_templates +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_regexp_match1 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_regexp_match1 +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_message lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_message +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_regexp_match2 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_regexp_match2 +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_str lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_str +lxml.tests.test_xslt.ETreeXSLTTestCase.test_variable_result_tree_fragment lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_variable_result_tree_fragment +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_unicode lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_unicode +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_message_terminate lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_message_terminate +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_input lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_input +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_resolver_url_building lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_resolver_url_building +lxml.tests.test_xslt.ETreeXSLTTestCase._test_exslt_regexp_match4 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#_test_exslt_regexp_match4 +lxml.tests.test_xslt.ETreeXSLTTestCase._test_exslt_regexp_match3 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#_test_exslt_regexp_match3 +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_regexp_replace lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_regexp_replace +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_broken lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_broken +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_copy lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_copy +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_input_none lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_input_none +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_get lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_get +lxml.tests.test_xslt.ETreeXSLTTestCase.test_extension_element_content lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_extension_element_content +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_get_unknown lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_get_unknown +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_multiple_transforms lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_multiple_transforms +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_regexp_test lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_regexp_test +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_error lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_error +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_empty lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_empty +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_parameter_missing lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_parameter_missing +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_math lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_math +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_invalid_stylesheet lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_invalid_stylesheet +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_encoding_override lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_encoding_override +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_include_from_filelike lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_include_from_filelike +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_elementtree_error lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_elementtree_error +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_string_parameters lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_string_parameters +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_input_partial_doc lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_input_partial_doc +lxml.tests.test_xslt.ETreeXSLTTestCase.test_extensions2 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_extensions2 +lxml.tests.test_xslt.ETreeXSLTTestCase.test_extensions1 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_extensions1 +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_include lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_include +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_parse_allow lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_parse_allow +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_str_attribute_replace lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_str_attribute_replace +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_embedded_id lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_embedded_id +lxml.tests.test_xslt.ETreeXSLTTestCase.test_exslt_regexp_match_groups lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_exslt_regexp_match_groups +lxml.tests.test_xslt.ETreeXSLTTestCase.test_extension_element_raise lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_extension_element_raise +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_parse_deny lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_parse_deny +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_XML_resolver lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_XML_resolver +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_move_result lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_move_result +lxml.tests.test_xslt.ETreeXSLTTestCase.test_multiple_elementrees lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_multiple_elementrees +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_parse_deny_all lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_parse_deny_all +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_elementtree lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_elementtree +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_shortcut lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_shortcut +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_parameters lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_parameters +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_XML lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_XML +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_embedded_xmlid lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_embedded_xmlid +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_set_new lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_set_new +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_document_parse lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_document_parse +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_utf8 lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_utf8 +lxml.tests.test_xslt.ETreeXSLTTestCase.test_extension_element lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_extension_element +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_encoding lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_encoding +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +lxml.tests.test_xslt.ETreeXSLTTestCase.test_xslt_pi_get_all_reversed lxml.tests.test_xslt.ETreeXSLTTestCase-class.html#test_xslt_pi_get_all_reversed +lxml.tests.test_xslt.Py3XSLTTestCase lxml.tests.test_xslt.Py3XSLTTestCase-class.html +lxml.tests.common_imports.HelperTestCase.tearDown lxml.tests.common_imports.HelperTestCase-class.html#tearDown +lxml.tests.common_imports.HelperTestCase.parse lxml.tests.common_imports.HelperTestCase-class.html#parse +unittest.TestCase.failureException exceptions.AssertionError-class.html +lxml.tests.test_xslt.Py3XSLTTestCase.test_xslt_result_bytearray lxml.tests.test_xslt.Py3XSLTTestCase-class.html#test_xslt_result_bytearray +lxml.tests.test_xslt.Py3XSLTTestCase.test_xslt_result_memoryview lxml.tests.test_xslt.Py3XSLTTestCase-class.html#test_xslt_result_memoryview +lxml.tests.common_imports.HelperTestCase._rootstring lxml.tests.common_imports.HelperTestCase-class.html#_rootstring +lxml.tests.test_xslt.Py3XSLTTestCase.test_xslt_result_bytes lxml.tests.test_xslt.Py3XSLTTestCase-class.html#test_xslt_result_bytes +lxml.tests.common_imports.HelperTestCase.assertFalse lxml.tests.common_imports.HelperTestCase-class.html#assertFalse +str str-class.html +str.upper str-class.html#upper +str.__getslice__ str-class.html#__getslice__ +str.__ne__ str-class.html#__ne__ +str.lstrip str-class.html#lstrip +str.__str__ str-class.html#__str__ +str.__getattribute__ str-class.html#__getattribute__ +str.rpartition str-class.html#rpartition +str.replace str-class.html#replace +str.isdigit str-class.html#isdigit +str.endswith str-class.html#endswith +str.splitlines str-class.html#splitlines +str.rfind str-class.html#rfind +str.strip str-class.html#strip +str.__rmul__ str-class.html#__rmul__ +str.__lt__ str-class.html#__lt__ +str.__getnewargs__ str-class.html#__getnewargs__ +str.__rmod__ str-class.html#__rmod__ +str.index str-class.html#index +str.ljust str-class.html#ljust +str.__new__ str-class.html#__new__ +str.isalnum str-class.html#isalnum +str.__contains__ str-class.html#__contains__ +str.rindex str-class.html#rindex +str.rsplit str-class.html#rsplit +str.find str-class.html#find +str.decode str-class.html#decode +str.isalpha str-class.html#isalpha +str.__eq__ str-class.html#__eq__ +str.split str-class.html#split +str.rstrip str-class.html#rstrip +str.encode str-class.html#encode +str.translate str-class.html#translate +str.isspace str-class.html#isspace +str.__len__ str-class.html#__len__ +str.__repr__ str-class.html#__repr__ +str.startswith str-class.html#startswith +str.__getitem__ str-class.html#__getitem__ +str.rjust str-class.html#rjust +str.swapcase str-class.html#swapcase +str.__hash__ str-class.html#__hash__ +str.zfill str-class.html#zfill +str.__add__ str-class.html#__add__ +str.__gt__ str-class.html#__gt__ +str.capitalize str-class.html#capitalize +str.count str-class.html#count +str.lower str-class.html#lower +str.join str-class.html#join +str.center str-class.html#center +str.__mod__ str-class.html#__mod__ +str.partition str-class.html#partition +str.expandtabs str-class.html#expandtabs +str.istitle str-class.html#istitle +str.__le__ str-class.html#__le__ +str.__mul__ str-class.html#__mul__ +str.islower str-class.html#islower +str.title str-class.html#title +str.isupper str-class.html#isupper +str.__ge__ str-class.html#__ge__ diff --git a/doc/html/api/class-tree.html b/doc/html/api/class-tree.html new file mode 100644 index 0000000..3f9b7af --- /dev/null +++ b/doc/html/api/class-tree.html @@ -0,0 +1,1129 @@ + + + + + Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
+ [ Module Hierarchy + | Class Hierarchy ] +

+

Class Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/deprecated-index.html b/doc/html/api/deprecated-index.html new file mode 100644 index 0000000..a4ae296 --- /dev/null +++ b/doc/html/api/deprecated-index.html @@ -0,0 +1,167 @@ + + + + + Deprecation List + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+

Deprecation List

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree-module.html b/doc/html/api/elementtree.ElementTree-module.html new file mode 100644 index 0000000..f5aae39 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree-module.html @@ -0,0 +1,765 @@ + + + + + elementtree.ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package elementtree :: + Module ElementTree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ElementTree

source code

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Element +
+   + + ElementTree +
+   + + ParseError +
+   + + QName +
+   + + TreeBuilder +
+   + + XMLParser +
+   + + XMLTreeBuilder +
+   + + _Element +
+   + + _ElementInterface +
+   + + _IterParseIterator +
+   + + _SimpleElementPath +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
Comment(text=None) + source code + +
+ +
+   + + + + + + +
PI(target, + text=None) + source code + +
+ +
+   + + + + + + +
ProcessingInstruction(target, + text=None) + source code + +
+ +
+   + + + + + + +
SubElement(parent, + tag, + attrib={}, + **extra) + source code + +
+ +
+   + + + + + + +
XML(text, + parser=None) + source code + +
+ +
+   + + + + + + +
XMLID(text, + parser=None) + source code + +
+ +
+   + + + + + + +
_encode(text, + encoding) + source code + +
+ +
+   + + + + + + +
_escape_attrib(text, + encoding) + source code + +
+ +
+   + + + + + + +
_escape_attrib_html(text, + encoding) + source code + +
+ +
+   + + + + + + +
_escape_cdata(text, + encoding) + source code + +
+ +
+   + + + + + + +
_namespaces(elem, + encoding, + default_namespace=None) + source code + +
+ +
+   + + + + + + +
_raise_serialization_error(text) + source code + +
+ +
+   + + + + + + +
_serialize_html(write, + elem, + encoding, + qnames, + namespaces) + source code + +
+ +
+   + + + + + + +
_serialize_text(write, + elem, + encoding) + source code + +
+ +
+   + + + + + + +
_serialize_xml(write, + elem, + encoding, + qnames, + namespaces) + source code + +
+ +
+   + + + + + + +
dump(elem) + source code + +
+ +
+   + + + + + + +
fromstring(text, + parser=None) + source code + +
+ +
+   + + + + + + +
fromstringlist(sequence, + parser=None) + source code + +
+ +
+   + + + + + + +
iselement(element) + source code + +
+ +
+   + + + + + + +
iterparse(source, + events=None, + parser=None) + source code + +
+ +
+   + + + + + + +
parse(source, + parser=None) + source code + +
+ +
+   + + + + + + +
register_namespace(prefix, + uri) + source code + +
+ +
+   + + + + + + +
tostring(element, + encoding=None, + method=None) + source code + +
+ +
+   + + + + + + +
tostringlist(element, + encoding=None) + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + HTML_EMPTY = set(['area', 'base', 'basefont', 'br', 'col', 'fr... +
+   + + VERSION = '1.3a2' +
+   + + _namespace_map = {'http://purl.org/dc/elements/1.1/': 'dc', 'h... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

HTML_EMPTY

+ +
+
+
+
Value:
+
+set(['area',
+     'base',
+     'basefont',
+     'br',
+     'col',
+     'frame',
+     'hr',
+     'img',
+...
+
+
+
+
+
+ +
+ +
+

_namespace_map

+ +
+
+
+
Value:
+
+{'http://purl.org/dc/elements/1.1/': 'dc',
+ 'http://schemas.xmlsoap.org/wsdl/': 'wsdl',
+ 'http://www.w3.org/1999/02/22-rdf-syntax-ns#': 'rdf',
+ 'http://www.w3.org/1999/xhtml': 'html',
+ 'http://www.w3.org/2001/XMLSchema': 'xs',
+ 'http://www.w3.org/2001/XMLSchema-instance': 'xsi',
+ 'http://www.w3.org/XML/1998/namespace': 'xml'}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree-pysrc.html b/doc/html/api/elementtree.ElementTree-pysrc.html new file mode 100644 index 0000000..89bec3a --- /dev/null +++ b/doc/html/api/elementtree.ElementTree-pysrc.html @@ -0,0 +1,3514 @@ + + + + + elementtree.ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package elementtree :: + Module ElementTree + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module elementtree.ElementTree

+
+   1  # 
+   2  # ElementTree 
+   3  # $Id: ElementTree.py 3276 2007-09-12 06:52:30Z fredrik $ 
+   4  # 
+   5  # light-weight XML support for Python 2.2 and later. 
+   6  # 
+   7  # history: 
+   8  # 2001-10-20 fl   created (from various sources) 
+   9  # 2001-11-01 fl   return root from parse method 
+  10  # 2002-02-16 fl   sort attributes in lexical order 
+  11  # 2002-04-06 fl   TreeBuilder refactoring, added PythonDoc markup 
+  12  # 2002-05-01 fl   finished TreeBuilder refactoring 
+  13  # 2002-07-14 fl   added basic namespace support to ElementTree.write 
+  14  # 2002-07-25 fl   added QName attribute support 
+  15  # 2002-10-20 fl   fixed encoding in write 
+  16  # 2002-11-24 fl   changed default encoding to ascii; fixed attribute encoding 
+  17  # 2002-11-27 fl   accept file objects or file names for parse/write 
+  18  # 2002-12-04 fl   moved XMLTreeBuilder back to this module 
+  19  # 2003-01-11 fl   fixed entity encoding glitch for us-ascii 
+  20  # 2003-02-13 fl   added XML literal factory 
+  21  # 2003-02-21 fl   added ProcessingInstruction/PI factory 
+  22  # 2003-05-11 fl   added tostring/fromstring helpers 
+  23  # 2003-05-26 fl   added ElementPath support 
+  24  # 2003-07-05 fl   added makeelement factory method 
+  25  # 2003-07-28 fl   added more well-known namespace prefixes 
+  26  # 2003-08-15 fl   fixed typo in ElementTree.findtext (Thomas Dartsch) 
+  27  # 2003-09-04 fl   fall back on emulator if ElementPath is not installed 
+  28  # 2003-10-31 fl   markup updates 
+  29  # 2003-11-15 fl   fixed nested namespace bug 
+  30  # 2004-03-28 fl   added XMLID helper 
+  31  # 2004-06-02 fl   added default support to findtext 
+  32  # 2004-06-08 fl   fixed encoding of non-ascii element/attribute names 
+  33  # 2004-08-23 fl   take advantage of post-2.1 expat features 
+  34  # 2004-09-03 fl   made Element class visible; removed factory 
+  35  # 2005-02-01 fl   added iterparse implementation 
+  36  # 2005-03-02 fl   fixed iterparse support for pre-2.2 versions 
+  37  # 2005-11-12 fl   added tostringlist/fromstringlist helpers 
+  38  # 2006-07-05 fl   merged in selected changes from the 1.3 sandbox 
+  39  # 2006-07-05 fl   removed support for 2.1 and earlier 
+  40  # 2007-06-21 fl   added deprecation/future warnings 
+  41  # 2007-08-25 fl   added doctype hook, added parser version attribute etc 
+  42  # 2007-08-26 fl   added new serializer code (better namespace handling, etc) 
+  43  # 2007-08-27 fl   warn for broken /tag searches on tree level 
+  44  # 2007-09-02 fl   added html/text methods to serializer (experimental) 
+  45  # 2007-09-05 fl   added method argument to tostring/tostringlist 
+  46  # 2007-09-06 fl   improved error handling 
+  47  # 
+  48  # Copyright (c) 1999-2007 by Fredrik Lundh.  All rights reserved. 
+  49  # 
+  50  # fredrik@pythonware.com 
+  51  # http://www.pythonware.com 
+  52  # 
+  53  # -------------------------------------------------------------------- 
+  54  # The ElementTree toolkit is 
+  55  # 
+  56  # Copyright (c) 1999-2007 by Fredrik Lundh 
+  57  # 
+  58  # By obtaining, using, and/or copying this software and/or its 
+  59  # associated documentation, you agree that you have read, understood, 
+  60  # and will comply with the following terms and conditions: 
+  61  # 
+  62  # Permission to use, copy, modify, and distribute this software and 
+  63  # its associated documentation for any purpose and without fee is 
+  64  # hereby granted, provided that the above copyright notice appears in 
+  65  # all copies, and that both that copyright notice and this permission 
+  66  # notice appear in supporting documentation, and that the name of 
+  67  # Secret Labs AB or the author not be used in advertising or publicity 
+  68  # pertaining to distribution of the software without specific, written 
+  69  # prior permission. 
+  70  # 
+  71  # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 
+  72  # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- 
+  73  # ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR 
+  74  # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
+  75  # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
+  76  # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
+  77  # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+  78  # OF THIS SOFTWARE. 
+  79  # -------------------------------------------------------------------- 
+  80   
+  81  from __future__ import generators 
+  82   
+  83  __all__ = [ 
+  84      # public symbols 
+  85      "Comment", 
+  86      "dump", 
+  87      "Element", "ElementTree", 
+  88      "fromstring", "fromstringlist", 
+  89      "iselement", "iterparse", 
+  90      "parse", "ParseError", 
+  91      "PI", "ProcessingInstruction", 
+  92      "QName", 
+  93      "SubElement", 
+  94      "tostring", "tostringlist", 
+  95      "TreeBuilder", 
+  96      "VERSION", 
+  97      "XML", 
+  98      "XMLParser", "XMLTreeBuilder", 
+  99      ] 
+ 100   
+ 101  ## 
+ 102  # The <b>Element</b> type is a flexible container object, designed to 
+ 103  # store hierarchical data structures in memory. The type can be 
+ 104  # described as a cross between a list and a dictionary. 
+ 105  # <p> 
+ 106  # Each element has a number of properties associated with it: 
+ 107  # <ul> 
+ 108  # <li>a <i>tag</i>. This is a string identifying what kind of data 
+ 109  # this element represents (the element type, in other words).</li> 
+ 110  # <li>a number of <i>attributes</i>, stored in a Python dictionary.</li> 
+ 111  # <li>a <i>text</i> string.</li> 
+ 112  # <li>an optional <i>tail</i> string.</li> 
+ 113  # <li>a number of <i>child elements</i>, stored in a Python sequence</li> 
+ 114  # </ul> 
+ 115  # 
+ 116  # To create an element instance, use the {@link #Element} constructor 
+ 117  # or the {@link #SubElement} factory function. 
+ 118  # <p> 
+ 119  # The {@link #ElementTree} class can be used to wrap an element 
+ 120  # structure, and convert it from and to XML. 
+ 121  ## 
+ 122   
+ 123  import sys, re 
+ 124   
+
125 -class _SimpleElementPath(object): +
126 # emulate pre-1.2 find/findtext/findall behaviour +
127 - def find(self, element, tag): +
128 for elem in element: + 129 if elem.tag == tag: + 130 return elem + 131 return None +
132 - def findtext(self, element, tag, default=None): +
133 for elem in element: + 134 if elem.tag == tag: + 135 return elem.text or "" + 136 return default +
137 - def findall(self, element, tag): +
138 if tag[:3] == ".//": + 139 return element.getiterator(tag[3:]) + 140 result = [] + 141 for elem in element: + 142 if elem.tag == tag: + 143 result.append(elem) + 144 return result +
145 + 146 try: + 147 import ElementPath + 148 except ImportError: + 149 # FIXME: issue warning in this case? + 150 ElementPath = _SimpleElementPath() + 151 + 152 VERSION = "1.3a2" + 153 +
154 -class ParseError(SyntaxError): +
155 pass +
156 + 157 # -------------------------------------------------------------------- + 158 + 159 ## + 160 # Checks if an object appears to be a valid element object. + 161 # + 162 # @param An element instance. + 163 # @return A true value if this is an element object. + 164 # @defreturn flag + 165 +
166 -def iselement(element): +
167 # FIXME: not sure about this; might be a better idea to look + 168 # for tag/attrib/text attributes + 169 return isinstance(element, Element) or hasattr(element, "tag") +
170 + 171 ## + 172 # Element class. This class defines the Element interface, and + 173 # provides a reference implementation of this interface. + 174 # <p> + 175 # The element name, attribute names, and attribute values can be + 176 # either 8-bit ASCII strings or Unicode strings. + 177 # + 178 # @param tag The element name. + 179 # @param attrib An optional dictionary, containing element attributes. + 180 # @param **extra Additional attributes, given as keyword arguments. + 181 # @see Element + 182 # @see SubElement + 183 # @see Comment + 184 # @see ProcessingInstruction + 185 +
186 -class Element(object): +
187 # <tag attrib>text<child/>...</tag>tail + 188 + 189 ## + 190 # (Attribute) Element tag. + 191 + 192 tag = None + 193 + 194 ## + 195 # (Attribute) Element attribute dictionary. Where possible, use + 196 # {@link #Element.get}, + 197 # {@link #Element.set}, + 198 # {@link #Element.keys}, and + 199 # {@link #Element.items} to access + 200 # element attributes. + 201 + 202 attrib = None + 203 + 204 ## + 205 # (Attribute) Text before first subelement. This is either a + 206 # string or the value None, if there was no text. + 207 + 208 text = None + 209 + 210 ## + 211 # (Attribute) Text after this element's end tag, but before the + 212 # next sibling element's start tag. This is either a string or + 213 # the value None, if there was no text. + 214 + 215 tail = None # text after end tag, if any + 216 +
217 - def __init__(self, tag, attrib={}, **extra): +
218 attrib = attrib.copy() + 219 attrib.update(extra) + 220 self.tag = tag + 221 self.attrib = attrib + 222 self._children = [] +
223 +
224 - def __repr__(self): +
225 return "<Element %s at %x>" % (repr(self.tag), id(self)) +
226 + 227 ## + 228 # Creates a new element object of the same type as this element. + 229 # + 230 # @param tag Element tag. + 231 # @param attrib Element attributes, given as a dictionary. + 232 # @return A new element instance. + 233 +
234 - def makeelement(self, tag, attrib): +
235 return Element(tag, attrib) +
236 + 237 ## + 238 # Returns the number of subelements. + 239 # + 240 # @return The number of subelements. + 241 +
242 - def __len__(self): +
243 return len(self._children) +
244 +
245 - def __nonzero__(self): +
246 import warnings + 247 warnings.warn( + 248 "The behavior of this method will change in future versions. " + 249 "Use specific 'len(elem)' or 'elem is not None' test instead.", + 250 FutureWarning + 251 ) + 252 return len(self._children) != 0 # emulate old behaviour +
253 + 254 ## + 255 # Returns the given subelement. + 256 # + 257 # @param index What subelement to return. + 258 # @return The given subelement. + 259 # @exception IndexError If the given element does not exist. + 260 +
261 - def __getitem__(self, index): +
262 return self._children[index] +
263 + 264 ## + 265 # Replaces the given subelement. + 266 # + 267 # @param index What subelement to replace. + 268 # @param element The new element value. + 269 # @exception IndexError If the given element does not exist. + 270 # @exception AssertionError If element is not a valid object. + 271 +
272 - def __setitem__(self, index, element): +
273 assert iselement(element) + 274 self._children[index] = element +
275 + 276 ## + 277 # Deletes the given subelement. + 278 # + 279 # @param index What subelement to delete. + 280 # @exception IndexError If the given element does not exist. + 281 +
282 - def __delitem__(self, index): +
283 del self._children[index] +
284 + 285 ## + 286 # Returns a list containing subelements in the given range. + 287 # + 288 # @param start The first subelement to return. + 289 # @param stop The first subelement that shouldn't be returned. + 290 # @return A sequence object containing subelements. + 291 +
292 - def __getslice__(self, start, stop): +
293 return self._children[start:stop] +
294 + 295 ## + 296 # Replaces a number of subelements with elements from a sequence. + 297 # + 298 # @param start The first subelement to replace. + 299 # @param stop The first subelement that shouldn't be replaced. + 300 # @param elements A sequence object with zero or more elements. + 301 # @exception AssertionError If a sequence member is not a valid object. + 302 +
303 - def __setslice__(self, start, stop, elements): +
304 for element in elements: + 305 assert iselement(element) + 306 self._children[start:stop] = list(elements) +
307 + 308 ## + 309 # Deletes a number of subelements. + 310 # + 311 # @param start The first subelement to delete. + 312 # @param stop The first subelement to leave in there. + 313 +
314 - def __delslice__(self, start, stop): +
315 del self._children[start:stop] +
316 + 317 ## + 318 # Adds a subelement to the end of this element. + 319 # + 320 # @param element The element to add. + 321 # @exception AssertionError If a sequence member is not a valid object. + 322 +
323 - def append(self, element): +
324 assert iselement(element) + 325 self._children.append(element) +
326 + 327 ## + 328 # Appends subelements from a sequence. + 329 # + 330 # @param elements A sequence object with zero or more elements. + 331 # @exception AssertionError If a subelement is not a valid object. + 332 # @since 1.3 + 333 +
334 - def extend(self, elements): +
335 for element in elements: + 336 assert iselement(element) + 337 self._children.extend(elements) +
338 + 339 ## + 340 # Inserts a subelement at the given position in this element. + 341 # + 342 # @param index Where to insert the new subelement. + 343 # @exception AssertionError If the element is not a valid object. + 344 +
345 - def insert(self, index, element): +
346 assert iselement(element) + 347 self._children.insert(index, element) +
348 + 349 ## + 350 # Removes a matching subelement. Unlike the <b>find</b> methods, + 351 # this method compares elements based on identity, not on tag + 352 # value or contents. + 353 # + 354 # @param element What element to remove. + 355 # @exception ValueError If a matching element could not be found. + 356 # @exception AssertionError If the element is not a valid object. + 357 +
358 - def remove(self, element): +
359 assert iselement(element) + 360 self._children.remove(element) +
361 + 362 ## + 363 # (Deprecated) Returns all subelements. The elements are returned + 364 # in document order. + 365 # + 366 # @return A list of subelements. + 367 # @defreturn list of Element instances + 368 +
369 - def getchildren(self): +
370 import warnings + 371 warnings.warn( + 372 "This method will be removed in future versions. " + 373 "Use 'list(elem)' or iteration over elem instead.", + 374 DeprecationWarning + 375 ) + 376 return self._children +
377 + 378 ## + 379 # Finds the first matching subelement, by tag name or path. + 380 # + 381 # @param path What element to look for. + 382 # @return The first matching element, or None if no element was found. + 383 # @defreturn Element or None + 384 +
385 - def find(self, path): +
386 return ElementPath.find(self, path) +
387 + 388 ## + 389 # Finds text for the first matching subelement, by tag name or path. + 390 # + 391 # @param path What element to look for. + 392 # @param default What to return if the element was not found. + 393 # @return The text content of the first matching element, or the + 394 # default value no element was found. Note that if the element + 395 # has is found, but has no text content, this method returns an + 396 # empty string. + 397 # @defreturn string + 398 +
399 - def findtext(self, path, default=None): +
400 return ElementPath.findtext(self, path, default) +
401 + 402 ## + 403 # Finds all matching subelements, by tag name or path. + 404 # + 405 # @param path What element to look for. + 406 # @return A list or iterator containing all matching elements, + 407 # in document order. + 408 # @defreturn list of Element instances + 409 +
410 - def findall(self, path): +
411 return ElementPath.findall(self, path) +
412 + 413 ## + 414 # Resets an element. This function removes all subelements, clears + 415 # all attributes, and sets the text and tail attributes to None. + 416 +
417 - def clear(self): +
418 self.attrib.clear() + 419 self._children = [] + 420 self.text = self.tail = None +
421 + 422 ## + 423 # Gets an element attribute. + 424 # + 425 # @param key What attribute to look for. + 426 # @param default What to return if the attribute was not found. + 427 # @return The attribute value, or the default value, if the + 428 # attribute was not found. + 429 # @defreturn string or None + 430 +
431 - def get(self, key, default=None): +
432 return self.attrib.get(key, default) +
433 + 434 ## + 435 # Sets an element attribute. + 436 # + 437 # @param key What attribute to set. + 438 # @param value The attribute value. + 439 +
440 - def set(self, key, value): +
441 self.attrib[key] = value +
442 + 443 ## + 444 # Gets a list of attribute names. The names are returned in an + 445 # arbitrary order (just like for an ordinary Python dictionary). + 446 # + 447 # @return A list of element attribute names. + 448 # @defreturn list of strings + 449 +
450 - def keys(self): +
451 return self.attrib.keys() +
452 + 453 ## + 454 # Gets element attributes, as a sequence. The attributes are + 455 # returned in an arbitrary order. + 456 # + 457 # @return A list of (name, value) tuples for all attributes. + 458 # @defreturn list of (string, string) tuples + 459 +
460 - def items(self): +
461 return self.attrib.items() +
462 + 463 ## + 464 # Creates a tree iterator. The iterator loops over this element + 465 # and all subelements, in document order, and returns all elements + 466 # with a matching tag. + 467 # <p> + 468 # If the tree structure is modified during iteration, new or removed + 469 # elements may or may not be included. To get a stable set, use the + 470 # list() function on the iterator, and loop over the resulting list. + 471 # + 472 # @param tag What tags to look for (default is to return all elements). + 473 # @return An iterator containing all the matching elements. + 474 # @defreturn iterator + 475 +
476 - def iter(self, tag=None): +
477 if tag == "*": + 478 tag = None + 479 if tag is None or self.tag == tag: + 480 yield self + 481 for e in self._children: + 482 for e in e.iter(tag): + 483 yield e +
484 + 485 # compatibility (FIXME: preserve list behaviour too? see below) + 486 getiterator = iter + 487 + 488 # def getiterator(self, tag=None): + 489 # return list(tag) + 490 + 491 ## + 492 # Creates a text iterator. The iterator loops over this element + 493 # and all subelements, in document order, and returns all inner + 494 # text. + 495 # + 496 # @return An iterator containing all inner text. + 497 # @defreturn iterator + 498 +
499 - def itertext(self): +
500 if self.text: + 501 yield self.text + 502 for e in self: + 503 for s in e.itertext(): + 504 yield s + 505 if e.tail: + 506 yield e.tail +
507 + 508 # compatibility + 509 _Element = _ElementInterface = Element + 510 + 511 ## + 512 # Subelement factory. This function creates an element instance, and + 513 # appends it to an existing element. + 514 # <p> + 515 # The element name, attribute names, and attribute values can be + 516 # either 8-bit ASCII strings or Unicode strings. + 517 # + 518 # @param parent The parent element. + 519 # @param tag The subelement name. + 520 # @param attrib An optional dictionary, containing element attributes. + 521 # @param **extra Additional attributes, given as keyword arguments. + 522 # @return An element instance. + 523 # @defreturn Element + 524 +
525 -def SubElement(parent, tag, attrib={}, **extra): +
526 attrib = attrib.copy() + 527 attrib.update(extra) + 528 element = parent.makeelement(tag, attrib) + 529 parent.append(element) + 530 return element +
531 + 532 ## + 533 # Comment element factory. This factory function creates a special + 534 # element that will be serialized as an XML comment by the standard + 535 # serializer. + 536 # <p> + 537 # The comment string can be either an 8-bit ASCII string or a Unicode + 538 # string. + 539 # + 540 # @param text A string containing the comment string. + 541 # @return An element instance, representing a comment. + 542 # @defreturn Element + 543 +
544 -def Comment(text=None): +
545 element = Element(Comment) + 546 element.text = text + 547 return element +
548 + 549 ## + 550 # PI element factory. This factory function creates a special element + 551 # that will be serialized as an XML processing instruction by the standard + 552 # serializer. + 553 # + 554 # @param target A string containing the PI target. + 555 # @param text A string containing the PI contents, if any. + 556 # @return An element instance, representing a PI. + 557 # @defreturn Element + 558 +
559 -def ProcessingInstruction(target, text=None): +
560 element = Element(ProcessingInstruction) + 561 element.text = target + 562 if text: + 563 element.text = element.text + " " + text + 564 return element +
565 + 566 PI = ProcessingInstruction + 567 + 568 ## + 569 # QName wrapper. This can be used to wrap a QName attribute value, in + 570 # order to get proper namespace handling on output. + 571 # + 572 # @param text A string containing the QName value, in the form {uri}local, + 573 # or, if the tag argument is given, the URI part of a QName. + 574 # @param tag Optional tag. If given, the first argument is interpreted as + 575 # an URI, and this argument is interpreted as a local name. + 576 # @return An opaque object, representing the QName. + 577 +
578 -class QName(object): +
579 - def __init__(self, text_or_uri, tag=None): +
580 if tag: + 581 text_or_uri = "{%s}%s" % (text_or_uri, tag) + 582 self.text = text_or_uri +
583 - def __str__(self): +
584 return self.text +
585 - def __hash__(self): +
586 return hash(self.text) +
587 - def __cmp__(self, other): +
588 if isinstance(other, QName): + 589 return cmp(self.text, other.text) + 590 return cmp(self.text, other) +
591 + 592 # -------------------------------------------------------------------- + 593 + 594 ## + 595 # ElementTree wrapper class. This class represents an entire element + 596 # hierarchy, and adds some extra support for serialization to and from + 597 # standard XML. + 598 # + 599 # @param element Optional root element. + 600 # @keyparam file Optional file handle or file name. If given, the + 601 # tree is initialized with the contents of this XML file. + 602 +
603 -class ElementTree(object): +
604 +
605 - def __init__(self, element=None, file=None): +
606 assert element is None or iselement(element) + 607 self._root = element # first node + 608 if file: + 609 self.parse(file) +
610 + 611 ## + 612 # Gets the root element for this tree. + 613 # + 614 # @return An element instance. + 615 # @defreturn Element + 616 +
617 - def getroot(self): +
618 return self._root +
619 + 620 ## + 621 # Replaces the root element for this tree. This discards the + 622 # current contents of the tree, and replaces it with the given + 623 # element. Use with care. + 624 # + 625 # @param element An element instance. + 626 +
627 - def _setroot(self, element): +
628 assert iselement(element) + 629 self._root = element +
630 + 631 ## + 632 # Loads an external XML document into this element tree. + 633 # + 634 # @param source A file name or file object. + 635 # @keyparam parser An optional parser instance. If not given, the + 636 # standard {@link XMLParser} parser is used. + 637 # @return The document root element. + 638 # @defreturn Element + 639 +
640 - def parse(self, source, parser=None): +
641 if not hasattr(source, "read"): + 642 source = open(source, "rb") + 643 if not parser: + 644 parser = XMLParser(target=TreeBuilder()) + 645 while 1: + 646 data = source.read(32768) + 647 if not data: + 648 break + 649 parser.feed(data) + 650 self._root = parser.close() + 651 return self._root +
652 + 653 ## + 654 # Creates a tree iterator for the root element. The iterator loops + 655 # over all elements in this tree, in document order. + 656 # + 657 # @param tag What tags to look for (default is to return all elements) + 658 # @return An iterator. + 659 # @defreturn iterator + 660 +
661 - def iter(self, tag=None): +
662 assert self._root is not None + 663 return self._root.iter(tag) +
664 + 665 getiterator = iter + 666 + 667 ## + 668 # Finds the first toplevel element with given tag. + 669 # Same as getroot().find(path). + 670 # + 671 # @param path What element to look for. + 672 # @return The first matching element, or None if no element was found. + 673 # @defreturn Element or None + 674 +
675 - def find(self, path): +
676 assert self._root is not None + 677 if path[:1] == "/": + 678 path = "." + path + 679 import warnings + 680 warnings.warn( + 681 "This search is broken in 1.3 and earlier; if you rely " + 682 "on the current behaviour, change it to %r" % path, + 683 FutureWarning + 684 ) + 685 return self._root.find(path) +
686 + 687 ## + 688 # Finds the element text for the first toplevel element with given + 689 # tag. Same as getroot().findtext(path). + 690 # + 691 # @param path What toplevel element to look for. + 692 # @param default What to return if the element was not found. + 693 # @return The text content of the first matching element, or the + 694 # default value no element was found. Note that if the element + 695 # has is found, but has no text content, this method returns an + 696 # empty string. + 697 # @defreturn string + 698 +
699 - def findtext(self, path, default=None): +
700 assert self._root is not None + 701 if path[:1] == "/": + 702 path = "." + path + 703 import warnings + 704 warnings.warn( + 705 "This search is broken in 1.3 and earlier; if you rely " + 706 "on the current behaviour, change it to %r" % path, + 707 FutureWarning + 708 ) + 709 return self._root.findtext(path, default) +
710 + 711 ## + 712 # Finds all toplevel elements with the given tag. + 713 # Same as getroot().findall(path). + 714 # + 715 # @param path What element to look for. + 716 # @return A list or iterator containing all matching elements, + 717 # in document order. + 718 # @defreturn list of Element instances + 719 +
720 - def findall(self, path): +
721 assert self._root is not None + 722 if path[:1] == "/": + 723 path = "." + path + 724 import warnings + 725 warnings.warn( + 726 "This search is broken in 1.3 and earlier; if you rely " + 727 "on the current behaviour, change it to %r" % path, + 728 FutureWarning + 729 ) + 730 return self._root.findall(path) +
731 + 732 ## + 733 # Writes the element tree to a file, as XML. + 734 # + 735 # @param file A file name, or a file object opened for writing. + 736 # @keyparam encoding Optional output encoding (default is US-ASCII). + 737 # @keyparam method Optional output method ("xml" or "html"; default + 738 # is "xml". + 739 # @keyparam xml_declaration Controls if an XML declaration should + 740 # be added to the file. Use False for never, True for always, + 741 # None for only if not US-ASCII or UTF-8. None is default. + 742 +
743 - def write(self, file, + 744 # keyword arguments + 745 encoding="us-ascii", + 746 xml_declaration=None, + 747 default_namespace=None, + 748 method=None): +
749 assert self._root is not None + 750 if not hasattr(file, "write"): + 751 file = open(file, "wb") + 752 write = file.write + 753 if not method: + 754 method = "xml" + 755 if not encoding: + 756 encoding = "us-ascii" + 757 elif xml_declaration or (xml_declaration is None and + 758 encoding not in ("utf-8", "us-ascii")): + 759 write("<?xml version='1.0' encoding='%s'?>\n" % encoding) + 760 if method == "text": + 761 _serialize_text(write, self._root, encoding) + 762 else: + 763 qnames, namespaces = _namespaces( + 764 self._root, encoding, default_namespace + 765 ) + 766 if method == "xml": + 767 _serialize_xml( + 768 write, self._root, encoding, qnames, namespaces + 769 ) + 770 elif method == "html": + 771 _serialize_html( + 772 write, self._root, encoding, qnames, namespaces + 773 ) + 774 else: + 775 raise ValueError("unknown method %r" % method) +
776 + 777 # -------------------------------------------------------------------- + 778 # serialization support + 779 +
780 -def _namespaces(elem, encoding, default_namespace=None): +
781 # identify namespaces used in this tree + 782 + 783 # maps qnames to *encoded* prefix:local names + 784 qnames = {None: None} + 785 + 786 # maps uri:s to prefixes + 787 namespaces = {} + 788 if default_namespace: + 789 namespaces[default_namespace] = "" + 790 + 791 def encode(text): + 792 return text.encode(encoding) +
793 + 794 def add_qname(qname): + 795 # calculate serialized qname representation + 796 try: + 797 if qname[:1] == "{": + 798 uri, tag = qname[1:].split("}", 1) + 799 prefix = namespaces.get(uri) + 800 if prefix is None: + 801 prefix = _namespace_map.get(uri) + 802 if prefix is None: + 803 prefix = "ns%d" % len(namespaces) + 804 if prefix != "xml": + 805 namespaces[uri] = prefix + 806 if prefix: + 807 qnames[qname] = encode("%s:%s" % (prefix, tag)) + 808 else: + 809 qnames[qname] = encode(tag) # default element + 810 else: + 811 if default_namespace: + 812 # FIXME: can this be handled in XML 1.0? + 813 raise ValueError( + 814 "cannot use non-qualified names with " + 815 "default_namespace option" + 816 ) + 817 qnames[qname] = encode(qname) + 818 except TypeError: + 819 _raise_serialization_error(qname) + 820 + 821 # populate qname and namespaces table + 822 try: + 823 iterate = elem.iter + 824 except AttributeError: + 825 iterate = elem.getiterator # cET compatibility + 826 for elem in iterate(): + 827 tag = elem.tag + 828 if isinstance(tag, QName) and tag.text not in qnames: + 829 add_qname(tag.text) + 830 elif isinstance(tag, basestring): + 831 if tag not in qnames: + 832 add_qname(tag) + 833 elif tag is not None and tag is not Comment and tag is not PI: + 834 _raise_serialization_error(tag) + 835 for key, value in elem.items(): + 836 if isinstance(key, QName): + 837 key = key.text + 838 if key not in qnames: + 839 add_qname(key) + 840 if isinstance(value, QName) and value.text not in qnames: + 841 add_qname(value.text) + 842 text = elem.text + 843 if isinstance(text, QName) and text.text not in qnames: + 844 add_qname(text.text) + 845 return qnames, namespaces + 846 +
847 -def _serialize_xml(write, elem, encoding, qnames, namespaces): +
848 tag = elem.tag + 849 text = elem.text + 850 if tag is Comment: + 851 write("<!--%s-->" % _escape_cdata(text, encoding)) + 852 elif tag is ProcessingInstruction: + 853 write("<?%s?>" % _escape_cdata(text, encoding)) + 854 else: + 855 tag = qnames[tag] + 856 if tag is None: + 857 if text: + 858 write(_escape_cdata(text, encoding)) + 859 for e in elem: + 860 _serialize_xml(write, e, encoding, qnames, None) + 861 else: + 862 write("<" + tag) + 863 items = elem.items() + 864 if items or namespaces: + 865 items.sort() # lexical order + 866 for k, v in items: + 867 if isinstance(k, QName): + 868 k = k.text + 869 if isinstance(v, QName): + 870 v = qnames[v.text] + 871 else: + 872 v = _escape_attrib(v, encoding) + 873 write(" %s=\"%s\"" % (qnames[k], v)) + 874 if namespaces: + 875 items = namespaces.items() + 876 items.sort(key=lambda x: x[1]) # sort on prefix + 877 for v, k in items: + 878 if k: + 879 k = ":" + k + 880 write(" xmlns%s=\"%s\"" % ( + 881 k.encode(encoding), + 882 _escape_attrib(v, encoding) + 883 )) + 884 if text or len(elem): + 885 write(">") + 886 if text: + 887 write(_escape_cdata(text, encoding)) + 888 for e in elem: + 889 _serialize_xml(write, e, encoding, qnames, None) + 890 write("</" + tag + ">") + 891 else: + 892 write(" />") + 893 if elem.tail: + 894 write(_escape_cdata(elem.tail, encoding)) +
895 + 896 HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr", + 897 "img", "input", "isindex", "link", "meta" "param") + 898 + 899 try: + 900 HTML_EMPTY = set(HTML_EMPTY) + 901 except NameError: + 902 pass + 903 +
904 -def _serialize_html(write, elem, encoding, qnames, namespaces): +
905 tag = elem.tag + 906 text = elem.text + 907 if tag is Comment: + 908 write("<!--%s-->" % _escape_cdata(text, encoding)) + 909 elif tag is ProcessingInstruction: + 910 write("<?%s?>" % _escape_cdata(text, encoding)) + 911 else: + 912 tag = qnames[tag] + 913 if tag is None: + 914 if text: + 915 write(_escape_cdata(text, encoding)) + 916 for e in elem: + 917 _serialize_html(write, e, encoding, qnames, None) + 918 else: + 919 write("<" + tag) + 920 items = elem.items() + 921 if items or namespaces: + 922 items.sort() # lexical order + 923 for k, v in items: + 924 if isinstance(k, QName): + 925 k = k.text + 926 if isinstance(v, QName): + 927 v = qnames[v.text] + 928 else: + 929 v = _escape_attrib_html(v, encoding) + 930 # FIXME: handle boolean attributes + 931 write(" %s=\"%s\"" % (qnames[k], v)) + 932 if namespaces: + 933 items = namespaces.items() + 934 items.sort(key=lambda x: x[1]) # sort on prefix + 935 for v, k in items: + 936 if k: + 937 k = ":" + k + 938 write(" xmlns%s=\"%s\"" % ( + 939 k.encode(encoding), + 940 _escape_attrib(v, encoding) + 941 )) + 942 write(">") + 943 tag = tag.lower() + 944 if text: + 945 if tag == "script" or tag == "style": + 946 write(_encode(text, encoding)) + 947 else: + 948 write(_escape_cdata(text, encoding)) + 949 for e in elem: + 950 _serialize_html(write, e, encoding, qnames, None) + 951 if tag not in HTML_EMPTY: + 952 write("</" + tag + ">") + 953 if elem.tail: + 954 write(_escape_cdata(elem.tail, encoding)) +
955 +
956 -def _serialize_text(write, elem, encoding): +
957 for part in elem.itertext(): + 958 write(part.encode(encoding)) + 959 if elem.tail: + 960 write(elem.tail.encode(encoding)) +
961 + 962 ## + 963 # Registers a namespace prefix. The registry is global, and any + 964 # existing mapping for either the given prefix or the namespace URI + 965 # will be removed. + 966 # + 967 # @param prefix Namespace prefix. + 968 # @param uri Namespace uri. Tags and attributes in this namespace + 969 # will be serialized with the given prefix, if at all possible. + 970 # @raise ValueError If the prefix is reserved, or is otherwise + 971 # invalid. + 972 +
973 -def register_namespace(prefix, uri): +
974 if re.match("ns\d+$", prefix): + 975 raise ValueError("Prefix format reserved for internal use") + 976 for k, v in _namespace_map.items(): + 977 if k == uri or v == prefix: + 978 del _namespace_map[k] + 979 _namespace_map[uri] = prefix +
980 + 981 _namespace_map = { + 982 # "well-known" namespace prefixes + 983 "http://www.w3.org/XML/1998/namespace": "xml", + 984 "http://www.w3.org/1999/xhtml": "html", + 985 "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + 986 "http://schemas.xmlsoap.org/wsdl/": "wsdl", + 987 # xml schema + 988 "http://www.w3.org/2001/XMLSchema": "xs", + 989 "http://www.w3.org/2001/XMLSchema-instance": "xsi", + 990 # dublic core + 991 "http://purl.org/dc/elements/1.1/": "dc", + 992 } + 993 +
994 -def _raise_serialization_error(text): +
995 raise TypeError( + 996 "cannot serialize %r (type %s)" % (text, type(text).__name__) + 997 ) +
998 +
999 -def _encode(text, encoding): +
1000 try: +1001 return text.encode(encoding, "xmlcharrefreplace") +1002 except (TypeError, AttributeError): +1003 _raise_serialization_error(text) +
1004 +
1005 -def _escape_cdata(text, encoding): +
1006 # escape character data +1007 try: +1008 # it's worth avoiding do-nothing calls for strings that are +1009 # shorter than 500 character, or so. assume that's, by far, +1010 # the most common case in most applications. +1011 if "&" in text: +1012 text = text.replace("&", "&amp;") +1013 if "<" in text: +1014 text = text.replace("<", "&lt;") +1015 if ">" in text: +1016 text = text.replace(">", "&gt;") +1017 return text.encode(encoding, "xmlcharrefreplace") +1018 except (TypeError, AttributeError): +1019 _raise_serialization_error(text) +
1020 +
1021 -def _escape_attrib(text, encoding): +
1022 # escape attribute value +1023 try: +1024 if "&" in text: +1025 text = text.replace("&", "&amp;") +1026 if "<" in text: +1027 text = text.replace("<", "&lt;") +1028 if ">" in text: +1029 text = text.replace(">", "&gt;") +1030 if "\"" in text: +1031 text = text.replace("\"", "&quot;") +1032 if "\n" in text: +1033 text = text.replace("\n", "&#10;") +1034 return text.encode(encoding, "xmlcharrefreplace") +1035 except (TypeError, AttributeError): +1036 _raise_serialization_error(text) +
1037 +
1038 -def _escape_attrib_html(text, encoding): +
1039 # escape attribute value +1040 try: +1041 if "&" in text: +1042 text = text.replace("&", "&amp;") +1043 if ">" in text: +1044 text = text.replace(">", "&gt;") +1045 if "\"" in text: +1046 text = text.replace("\"", "&quot;") +1047 return text.encode(encoding, "xmlcharrefreplace") +1048 except (TypeError, AttributeError): +1049 _raise_serialization_error(text) +
1050 +1051 # -------------------------------------------------------------------- +1052 +1053 ## +1054 # Generates a string representation of an XML element, including all +1055 # subelements. +1056 # +1057 # @param element An Element instance. +1058 # @return An encoded string containing the XML data. +1059 # @defreturn string +1060 +
1061 -def tostring(element, encoding=None, method=None): +
1062 class dummy: +1063 pass +
1064 data = [] +1065 file = dummy() +1066 file.write = data.append +1067 ElementTree(element).write(file, encoding, method=method) +1068 return "".join(data) +1069 +1070 ## +1071 # Generates a string representation of an XML element, including all +1072 # subelements. The string is returned as a sequence of string fragments. +1073 # +1074 # @param element An Element instance. +1075 # @return A sequence object containing the XML data. +1076 # @defreturn sequence +1077 # @since 1.3 +1078 +
1079 -def tostringlist(element, encoding=None): +
1080 class dummy: +1081 pass +
1082 data = [] +1083 file = dummy() +1084 file.write = data.append +1085 ElementTree(element).write(file, encoding) +1086 # FIXME: merge small fragments into larger parts +1087 return data +1088 +1089 ## +1090 # Writes an element tree or element structure to sys.stdout. This +1091 # function should be used for debugging only. +1092 # <p> +1093 # The exact output format is implementation dependent. In this +1094 # version, it's written as an ordinary XML file. +1095 # +1096 # @param elem An element tree or an individual element. +1097 +
1098 -def dump(elem): +
1099 # debugging +1100 if not isinstance(elem, ElementTree): +1101 elem = ElementTree(elem) +1102 elem.write(sys.stdout) +1103 tail = elem.getroot().tail +1104 if not tail or tail[-1] != "\n": +1105 sys.stdout.write("\n") +
1106 +1107 # -------------------------------------------------------------------- +1108 # parsing +1109 +1110 ## +1111 # Parses an XML document into an element tree. +1112 # +1113 # @param source A filename or file object containing XML data. +1114 # @param parser An optional parser instance. If not given, the +1115 # standard {@link XMLParser} parser is used. +1116 # @return An ElementTree instance +1117 +
1118 -def parse(source, parser=None): +
1119 tree = ElementTree() +1120 tree.parse(source, parser) +1121 return tree +
1122 +1123 ## +1124 # Parses an XML document into an element tree incrementally, and reports +1125 # what's going on to the user. +1126 # +1127 # @param source A filename or file object containing XML data. +1128 # @param events A list of events to report back. If omitted, only "end" +1129 # events are reported. +1130 # @param parser An optional parser instance. If not given, the +1131 # standard {@link XMLParser} parser is used. +1132 # @return A (event, elem) iterator. +1133 +
1134 -def iterparse(source, events=None, parser=None): +
1135 if not hasattr(source, "read"): +1136 source = open(source, "rb") +1137 if not parser: +1138 parser = XMLParser(target=TreeBuilder()) +1139 return _IterParseIterator(source, events, parser) +
1140 +
1141 -class _IterParseIterator(object): +
1142 +
1143 - def __init__(self, source, events, parser): +
1144 self._file = source +1145 self._events = [] +1146 self._index = 0 +1147 self.root = self._root = None +1148 self._parser = parser +1149 # wire up the parser for event reporting +1150 parser = self._parser._parser +1151 append = self._events.append +1152 if events is None: +1153 events = ["end"] +1154 for event in events: +1155 if event == "start": +1156 try: +1157 parser.ordered_attributes = 1 +1158 parser.specified_attributes = 1 +1159 def handler(tag, attrib_in, event=event, append=append, +1160 start=self._parser._start_list): +1161 append((event, start(tag, attrib_in))) +
1162 parser.StartElementHandler = handler +1163 except AttributeError: +1164 def handler(tag, attrib_in, event=event, append=append, +1165 start=self._parser._start): +1166 append((event, start(tag, attrib_in))) +
1167 parser.StartElementHandler = handler +1168 elif event == "end": +1169 def handler(tag, event=event, append=append, +1170 end=self._parser._end): +1171 append((event, end(tag))) +1172 parser.EndElementHandler = handler +1173 elif event == "start-ns": +1174 def handler(prefix, uri, event=event, append=append): +1175 try: +1176 uri = uri.encode("ascii") +1177 except UnicodeError: +1178 pass +1179 append((event, (prefix or "", uri))) +1180 parser.StartNamespaceDeclHandler = handler +1181 elif event == "end-ns": +1182 def handler(prefix, event=event, append=append): +1183 append((event, None)) +1184 parser.EndNamespaceDeclHandler = handler +1185 +
1186 - def next(self): +
1187 while 1: +1188 try: +1189 item = self._events[self._index] +1190 except IndexError: +1191 if self._parser is None: +1192 self.root = self._root +1193 raise StopIteration +1194 # load event buffer +1195 del self._events[:] +1196 self._index = 0 +1197 data = self._file.read(16384) +1198 if data: +1199 self._parser.feed(data) +1200 else: +1201 self._root = self._parser.close() +1202 self._parser = None +1203 else: +1204 self._index = self._index + 1 +1205 return item +
1206 +
1207 - def __iter__(self): +
1208 return self +
1209 +1210 ## +1211 # Parses an XML document from a string constant. This function can +1212 # be used to embed "XML literals" in Python code. +1213 # +1214 # @param source A string containing XML data. +1215 # @param parser An optional parser instance. If not given, the +1216 # standard {@link XMLParser} parser is used. +1217 # @return An Element instance. +1218 # @defreturn Element +1219 +
1220 -def XML(text, parser=None): +
1221 if not parser: +1222 parser = XMLParser(target=TreeBuilder()) +1223 parser.feed(text) +1224 return parser.close() +
1225 +1226 ## +1227 # Parses an XML document from a string constant, and also returns +1228 # a dictionary which maps from element id:s to elements. +1229 # +1230 # @param source A string containing XML data. +1231 # @param parser An optional parser instance. If not given, the +1232 # standard {@link XMLParser} parser is used. +1233 # @return A tuple containing an Element instance and a dictionary. +1234 # @defreturn (Element, dictionary) +1235 +
1236 -def XMLID(text, parser=None): +
1237 if not parser: +1238 parser = XMLParser(target=TreeBuilder()) +1239 parser.feed(text) +1240 tree = parser.close() +1241 ids = {} +1242 for elem in tree.getiterator(): +1243 id = elem.get("id") +1244 if id: +1245 ids[id] = elem +1246 return tree, ids +
1247 +1248 ## +1249 # Parses an XML document from a string constant. Same as {@link #XML}. +1250 # +1251 # @def fromstring(text) +1252 # @param source A string containing XML data. +1253 # @return An Element instance. +1254 # @defreturn Element +1255 +1256 fromstring = XML +1257 +1258 ## +1259 # Parses an XML document from a sequence of string fragments. +1260 # +1261 # @param sequence A list or other sequence containing XML data fragments. +1262 # @param parser An optional parser instance. If not given, the +1263 # standard {@link XMLParser} parser is used. +1264 # @return An Element instance. +1265 # @defreturn Element +1266 # @since 1.3 +1267 +
1268 -def fromstringlist(sequence, parser=None): +
1269 if not parser: +1270 parser = XMLParser(target=TreeBuilder()) +1271 for text in sequence: +1272 parser.feed(text) +1273 return parser.close() +
1274 +1275 # -------------------------------------------------------------------- +1276 +1277 ## +1278 # Generic element structure builder. This builder converts a sequence +1279 # of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link +1280 # #TreeBuilder.end} method calls to a well-formed element structure. +1281 # <p> +1282 # You can use this class to build an element structure using a custom XML +1283 # parser, or a parser for some other XML-like format. +1284 # +1285 # @param element_factory Optional element factory. This factory +1286 # is called to create new Element instances, as necessary. +1287 +
1288 -class TreeBuilder(object): +
1289 +
1290 - def __init__(self, element_factory=None): +
1291 self._data = [] # data collector +1292 self._elem = [] # element stack +1293 self._last = None # last element +1294 self._tail = None # true if we're after an end tag +1295 if element_factory is None: +1296 element_factory = Element +1297 self._factory = element_factory +
1298 +1299 ## +1300 # Flushes the builder buffers, and returns the toplevel document +1301 # element. +1302 # +1303 # @return An Element instance. +1304 # @defreturn Element +1305 +
1306 - def close(self): +
1307 assert len(self._elem) == 0, "missing end tags" +1308 assert self._last != None, "missing toplevel element" +1309 return self._last +
1310 +
1311 - def _flush(self): +
1312 if self._data: +1313 if self._last is not None: +1314 text = "".join(self._data) +1315 if self._tail: +1316 assert self._last.tail is None, "internal error (tail)" +1317 self._last.tail = text +1318 else: +1319 assert self._last.text is None, "internal error (text)" +1320 self._last.text = text +1321 self._data = [] +
1322 +1323 ## +1324 # Adds text to the current element. +1325 # +1326 # @param data A string. This should be either an 8-bit string +1327 # containing ASCII text, or a Unicode string. +1328 +
1329 - def data(self, data): +
1330 self._data.append(data) +
1331 +1332 ## +1333 # Opens a new element. +1334 # +1335 # @param tag The element name. +1336 # @param attrib A dictionary containing element attributes. +1337 # @return The opened element. +1338 # @defreturn Element +1339 +
1340 - def start(self, tag, attrs): +
1341 self._flush() +1342 self._last = elem = self._factory(tag, attrs) +1343 if self._elem: +1344 self._elem[-1].append(elem) +1345 self._elem.append(elem) +1346 self._tail = 0 +1347 return elem +
1348 +1349 ## +1350 # Closes the current element. +1351 # +1352 # @param tag The element name. +1353 # @return The closed element. +1354 # @defreturn Element +1355 +
1356 - def end(self, tag): +
1357 self._flush() +1358 self._last = self._elem.pop() +1359 assert self._last.tag == tag,\ +1360 "end tag mismatch (expected %s, got %s)" % ( +1361 self._last.tag, tag) +1362 self._tail = 1 +1363 return self._last +
1364 +1365 ## +1366 # Element structure builder for XML source data, based on the +1367 # <b>expat</b> parser. +1368 # +1369 # @keyparam target Target object. If omitted, the builder uses an +1370 # instance of the standard {@link #TreeBuilder} class. +1371 # @keyparam html Predefine HTML entities. This flag is not supported +1372 # by the current implementation. +1373 # @keyparam encoding Optional encoding. If given, the value overrides +1374 # the encoding specified in the XML file. +1375 # @see #ElementTree +1376 # @see #TreeBuilder +1377 +
1378 -class XMLParser(object): +
1379 +
1380 - def __init__(self, html=0, target=None, encoding=None): +
1381 try: +1382 from xml.parsers import expat +1383 except ImportError: +1384 try: +1385 import pyexpat; expat = pyexpat +1386 except ImportError: +1387 raise ImportError( +1388 "No module named expat; use SimpleXMLTreeBuilder instead" +1389 ) +1390 parser = expat.ParserCreate(encoding, "}") +1391 if target is None: +1392 target = TreeBuilder() +1393 # underscored names are provided for compatibility only +1394 self.parser = self._parser = parser +1395 self.target = self._target = target +1396 self._error = expat.error +1397 self._names = {} # name memo cache +1398 # callbacks +1399 parser.DefaultHandlerExpand = self._default +1400 parser.StartElementHandler = self._start +1401 parser.EndElementHandler = self._end +1402 parser.CharacterDataHandler = self._data +1403 # let expat do the buffering, if supported +1404 try: +1405 self._parser.buffer_text = 1 +1406 except AttributeError: +1407 pass +1408 # use new-style attribute handling, if supported +1409 try: +1410 self._parser.ordered_attributes = 1 +1411 self._parser.specified_attributes = 1 +1412 parser.StartElementHandler = self._start_list +1413 except AttributeError: +1414 pass +1415 self._doctype = None +1416 self.entity = {} +1417 try: +1418 self.version = "Expat %d.%d.%d" % expat.version_info +1419 except AttributeError: +1420 pass # unknown +
1421 +
1422 - def _raiseerror(self, value): +
1423 err = ParseError(value) +1424 err.code = value.code +1425 err.position = value.lineno, value.offset +1426 raise err +
1427 +
1428 - def _fixtext(self, text): +
1429 # convert text string to ascii, if possible +1430 try: +1431 return text.encode("ascii") +1432 except UnicodeError: +1433 return text +
1434 +
1435 - def _fixname(self, key): +
1436 # expand qname, and convert name string to ascii, if possible +1437 try: +1438 name = self._names[key] +1439 except KeyError: +1440 name = key +1441 if "}" in name: +1442 name = "{" + name +1443 self._names[key] = name = self._fixtext(name) +1444 return name +
1445 +
1446 - def _start(self, tag, attrib_in): +
1447 fixname = self._fixname +1448 fixtext = self._fixtext +1449 tag = fixname(tag) +1450 attrib = {} +1451 for key, value in attrib_in.items(): +1452 attrib[fixname(key)] = fixtext(value) +1453 return self.target.start(tag, attrib) +
1454 +
1455 - def _start_list(self, tag, attrib_in): +
1456 fixname = self._fixname +1457 fixtext = self._fixtext +1458 tag = fixname(tag) +1459 attrib = {} +1460 if attrib_in: +1461 for i in range(0, len(attrib_in), 2): +1462 attrib[fixname(attrib_in[i])] = fixtext(attrib_in[i+1]) +1463 return self.target.start(tag, attrib) +
1464 +
1465 - def _data(self, text): +
1466 return self.target.data(self._fixtext(text)) +
1467 +
1468 - def _end(self, tag): +
1469 return self.target.end(self._fixname(tag)) +
1470 +
1471 - def _default(self, text): +
1472 prefix = text[:1] +1473 if prefix == "&": +1474 # deal with undefined entities +1475 try: +1476 self.target.data(self.entity[text[1:-1]]) +1477 except KeyError: +1478 from xml.parsers import expat +1479 err = expat.error( +1480 "undefined entity %s: line %d, column %d" % +1481 (text, self._parser.ErrorLineNumber, +1482 self._parser.ErrorColumnNumber) +1483 ) +1484 err.code = 11 # XML_ERROR_UNDEFINED_ENTITY +1485 err.lineno = self._parser.ErrorLineNumber +1486 err.offset = self._parser.ErrorColumnNumber +1487 raise err +1488 elif prefix == "<" and text[:9] == "<!DOCTYPE": +1489 self._doctype = [] # inside a doctype declaration +1490 elif self._doctype is not None: +1491 # parse doctype contents +1492 if prefix == ">": +1493 self._doctype = None +1494 return +1495 text = text.strip() +1496 if not text: +1497 return +1498 self._doctype.append(text) +1499 n = len(self._doctype) +1500 if n > 2: +1501 type = self._doctype[1] +1502 if type == "PUBLIC" and n == 4: +1503 name, type, pubid, system = self._doctype +1504 elif type == "SYSTEM" and n == 3: +1505 name, type, system = self._doctype +1506 pubid = None +1507 else: +1508 return +1509 if pubid: +1510 pubid = pubid[1:-1] +1511 if hasattr(self.target, "doctype"): +1512 self.target.doctype(name, pubid, system[1:-1]) +1513 self._doctype = None +
1514 +1515 ## +1516 # Feeds data to the parser. +1517 # +1518 # @param data Encoded data. +1519 +
1520 - def feed(self, data): +
1521 try: +1522 self._parser.Parse(data, 0) +1523 except self._error, v: +1524 self._raiseerror(v) +
1525 +1526 ## +1527 # Finishes feeding data to the parser. +1528 # +1529 # @return An element structure. +1530 # @defreturn Element +1531 +
1532 - def close(self): +
1533 try: +1534 self._parser.Parse("", 1) # end of data +1535 except self._error, v: +1536 self._raiseerror(v) +1537 tree = self.target.close() +1538 del self.target, self._parser # get rid of circular references +1539 return tree +
1540 +1541 # compatibility +1542 XMLTreeBuilder = XMLParser +1543 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree.Element-class.html b/doc/html/api/elementtree.ElementTree.Element-class.html new file mode 100644 index 0000000..97f3887 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree.Element-class.html @@ -0,0 +1,761 @@ + + + + + elementtree.ElementTree.Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + Element :: + Class Element + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Element

source code

+
+object --+
+         |
+        Element
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delitem__(self, + index) + source code + +
+ +
+   + + + + + + +
__delslice__(self, + start, + stop) + source code + +
+ +
+   + + + + + + +
__getitem__(self, + index) + source code + +
+ +
+   + + + + + + +
__getslice__(self, + start, + stop) + source code + +
+ +
+   + + + + + + +
__init__(self, + tag, + attrib={}, + **extra)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__len__(self) + source code + +
+ +
+   + + + + + + +
__nonzero__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
__setitem__(self, + index, + element) + source code + +
+ +
+   + + + + + + +
__setslice__(self, + start, + stop, + elements) + source code + +
+ +
+   + + + + + + +
append(self, + element) + source code + +
+ +
+   + + + + + + +
clear(self) + source code + +
+ +
+   + + + + + + +
extend(self, + elements) + source code + +
+ +
+   + + + + + + +
find(self, + path) + source code + +
+ +
+   + + + + + + +
findall(self, + path) + source code + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None) + source code + +
+ +
+   + + + + + + +
get(self, + key, + default=None) + source code + +
+ +
+   + + + + + + +
getchildren(self) + source code + +
+ +
+   + + + + + + +
getiterator(self, + tag=None) + source code + +
+ +
+   + + + + + + +
insert(self, + index, + element) + source code + +
+ +
+   + + + + + + +
items(self) + source code + +
+ +
+   + + + + + + +
iter(self, + tag=None) + source code + +
+ +
+   + + + + + + +
itertext(self) + source code + +
+ +
+   + + + + + + +
keys(self) + source code + +
+ +
+   + + + + + + +
makeelement(self, + tag, + attrib) + source code + +
+ +
+   + + + + + + +
remove(self, + element) + source code + +
+ +
+   + + + + + + +
set(self, + key, + value) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + attrib = None +
+   + + tag = None +
+   + + tail = None +
+   + + text = None +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + tag, + attrib={}, + **extra) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree.ElementTree-class.html b/doc/html/api/elementtree.ElementTree.ElementTree-class.html new file mode 100644 index 0000000..f47973e --- /dev/null +++ b/doc/html/api/elementtree.ElementTree.ElementTree-class.html @@ -0,0 +1,403 @@ + + + + + elementtree.ElementTree.ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + ElementTree :: + Class ElementTree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTree

source code

+
+object --+
+         |
+        ElementTree
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element=None, + file=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
_setroot(self, + element) + source code + +
+ +
+   + + + + + + +
find(self, + path) + source code + +
+ +
+   + + + + + + +
findall(self, + path) + source code + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None) + source code + +
+ +
+   + + + + + + +
getiterator(self, + tag=None) + source code + +
+ +
+   + + + + + + +
getroot(self) + source code + +
+ +
+   + + + + + + +
iter(self, + tag=None) + source code + +
+ +
+   + + + + + + +
parse(self, + source, + parser=None) + source code + +
+ +
+   + + + + + + +
write(self, + file, + encoding='us-ascii', + xml_declaration=None, + default_namespace=None, + method=None) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element=None, + file=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree.ParseError-class.html b/doc/html/api/elementtree.ElementTree.ParseError-class.html new file mode 100644 index 0000000..b7e6da3 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree.ParseError-class.html @@ -0,0 +1,209 @@ + + + + + elementtree.ElementTree.ParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + ParseError :: + Class ParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParseError

source code

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+        exceptions.StandardError --+    
+                                   |    
+              exceptions.SyntaxError --+
+                                       |
+                                      ParseError
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from exceptions.SyntaxError: + __init__, + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree.QName-class.html b/doc/html/api/elementtree.ElementTree.QName-class.html new file mode 100644 index 0000000..ceee70f --- /dev/null +++ b/doc/html/api/elementtree.ElementTree.QName-class.html @@ -0,0 +1,342 @@ + + + + + elementtree.ElementTree.QName + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + QName :: + Class QName + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class QName

source code

+
+object --+
+         |
+        QName
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__cmp__(self, + other) + source code + +
+ +
+   + + + + + + +
__hash__(self)
+ hash(x)
+ source code + +
+ +
+   + + + + + + +
__init__(self, + text_or_uri, + tag=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__str__(self)
+ str(x)
+ source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__hash__(self) +
(Hashing function) +

+
source code  +
+ + hash(x) +
+
Overrides: + object.__hash__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__init__(self, + text_or_uri, + tag=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(self) +
(Informal representation operator) +

+
source code  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree.TreeBuilder-class.html b/doc/html/api/elementtree.ElementTree.TreeBuilder-class.html new file mode 100644 index 0000000..033b066 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree.TreeBuilder-class.html @@ -0,0 +1,327 @@ + + + + + elementtree.ElementTree.TreeBuilder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + TreeBuilder :: + Class TreeBuilder + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class TreeBuilder

source code

+
+object --+
+         |
+        TreeBuilder
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element_factory=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
_flush(self) + source code + +
+ +
+   + + + + + + +
close(self) + source code + +
+ +
+   + + + + + + +
data(self, + data) + source code + +
+ +
+   + + + + + + +
end(self, + tag) + source code + +
+ +
+   + + + + + + +
start(self, + tag, + attrs) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element_factory=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree.XMLParser-class.html b/doc/html/api/elementtree.ElementTree.XMLParser-class.html new file mode 100644 index 0000000..e8c13e7 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree.XMLParser-class.html @@ -0,0 +1,418 @@ + + + + + elementtree.ElementTree.XMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + XMLParser :: + Class XMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLParser

source code

+
+object --+
+         |
+        XMLParser
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + html=0, + target=None, + encoding=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
_data(self, + text) + source code + +
+ +
+   + + + + + + +
_default(self, + text) + source code + +
+ +
+   + + + + + + +
_end(self, + tag) + source code + +
+ +
+   + + + + + + +
_fixname(self, + key) + source code + +
+ +
+   + + + + + + +
_fixtext(self, + text) + source code + +
+ +
+   + + + + + + +
_raiseerror(self, + value) + source code + +
+ +
+   + + + + + + +
_start(self, + tag, + attrib_in) + source code + +
+ +
+   + + + + + + +
_start_list(self, + tag, + attrib_in) + source code + +
+ +
+   + + + + + + +
close(self) + source code + +
+ +
+   + + + + + + +
feed(self, + data) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + html=0, + target=None, + encoding=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree._IterParseIterator-class.html b/doc/html/api/elementtree.ElementTree._IterParseIterator-class.html new file mode 100644 index 0000000..ea22651 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree._IterParseIterator-class.html @@ -0,0 +1,279 @@ + + + + + elementtree.ElementTree._IterParseIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + _IterParseIterator :: + Class _IterParseIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _IterParseIterator

source code

+
+object --+
+         |
+        _IterParseIterator
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + source, + events, + parser)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
next(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + source, + events, + parser) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/elementtree.ElementTree._SimpleElementPath-class.html b/doc/html/api/elementtree.ElementTree._SimpleElementPath-class.html new file mode 100644 index 0000000..e5e4db1 --- /dev/null +++ b/doc/html/api/elementtree.ElementTree._SimpleElementPath-class.html @@ -0,0 +1,237 @@ + + + + + elementtree.ElementTree._SimpleElementPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + elementtree :: + ElementTree :: + _SimpleElementPath :: + Class _SimpleElementPath + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _SimpleElementPath

source code

+
+object --+
+         |
+        _SimpleElementPath
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
find(self, + element, + tag) + source code + +
+ +
+   + + + + + + +
findall(self, + element, + tag) + source code + +
+ +
+   + + + + + + +
findtext(self, + element, + tag, + default=None) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/epydoc.css b/doc/html/api/epydoc.css new file mode 100644 index 0000000..86d4170 --- /dev/null +++ b/doc/html/api/epydoc.css @@ -0,0 +1,322 @@ + + +/* Epydoc CSS Stylesheet + * + * This stylesheet can be used to customize the appearance of epydoc's + * HTML output. + * + */ + +/* Default Colors & Styles + * - Set the default foreground & background color with 'body'; and + * link colors with 'a:link' and 'a:visited'. + * - Use bold for decision list terms. + * - The heading styles defined here are used for headings *within* + * docstring descriptions. All headings used by epydoc itself use + * either class='epydoc' or class='toc' (CSS styles for both + * defined below). + */ +body { background: #ffffff; color: #000000; } +p { margin-top: 0.5em; margin-bottom: 0.5em; } +a:link { color: #0000ff; } +a:visited { color: #204080; } +dt { font-weight: bold; } +h1 { font-size: +140%; font-style: italic; + font-weight: bold; } +h2 { font-size: +125%; font-style: italic; + font-weight: bold; } +h3 { font-size: +110%; font-style: italic; + font-weight: normal; } +code { font-size: 100%; } +/* N.B.: class, not pseudoclass */ +a.link { font-family: monospace; } + +/* Page Header & Footer + * - The standard page header consists of a navigation bar (with + * pointers to standard pages such as 'home' and 'trees'); a + * breadcrumbs list, which can be used to navigate to containing + * classes or modules; options links, to show/hide private + * variables and to show/hide frames; and a page title (using + *

). The page title may be followed by a link to the + * corresponding source code (using 'span.codelink'). + * - The footer consists of a navigation bar, a timestamp, and a + * pointer to epydoc's homepage. + */ +h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } +h2.epydoc { font-size: +130%; font-weight: bold; } +h3.epydoc { font-size: +115%; font-weight: bold; + margin-top: 0.2em; } +td h3.epydoc { font-size: +115%; font-weight: bold; + margin-bottom: 0; } +table.navbar { background: #a0c0ff; color: #000000; + border: 2px groove #c0d0d0; } +table.navbar table { color: #000000; } +th.navbar-select { background: #70b0ff; + color: #000000; } +table.navbar a { text-decoration: none; } +table.navbar a:link { color: #0000ff; } +table.navbar a:visited { color: #204080; } +span.breadcrumbs { font-size: 85%; font-weight: bold; } +span.options { font-size: 70%; } +span.codelink { font-size: 85%; } +td.footer { font-size: 85%; } + +/* Table Headers + * - Each summary table and details section begins with a 'header' + * row. This row contains a section title (marked by + * 'span.table-header') as well as a show/hide private link + * (marked by 'span.options', defined above). + * - Summary tables that contain user-defined groups mark those + * groups using 'group header' rows. + */ +td.table-header { background: #70b0ff; color: #000000; + border: 1px solid #608090; } +td.table-header table { color: #000000; } +td.table-header table a:link { color: #0000ff; } +td.table-header table a:visited { color: #204080; } +span.table-header { font-size: 120%; font-weight: bold; } +th.group-header { background: #c0e0f8; color: #000000; + text-align: left; font-style: italic; + font-size: 115%; + border: 1px solid #608090; } + +/* Summary Tables (functions, variables, etc) + * - Each object is described by a single row of the table with + * two cells. The left cell gives the object's type, and is + * marked with 'code.summary-type'. The right cell gives the + * object's name and a summary description. + * - CSS styles for the table's header and group headers are + * defined above, under 'Table Headers' + */ +table.summary { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; + margin-bottom: 0.5em; } +td.summary { border: 1px solid #608090; } +code.summary-type { font-size: 85%; } +table.summary a:link { color: #0000ff; } +table.summary a:visited { color: #204080; } + + +/* Details Tables (functions, variables, etc) + * - Each object is described in its own div. + * - A single-row summary table w/ table-header is used as + * a header for each details section (CSS style for table-header + * is defined above, under 'Table Headers'). + */ +table.details { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; + margin: .2em 0 0 0; } +table.details table { color: #000000; } +table.details a:link { color: #0000ff; } +table.details a:visited { color: #204080; } + +/* Fields */ +dl.fields { margin-left: 2em; margin-top: 1em; + margin-bottom: 1em; } +dl.fields dd ul { margin-left: 0em; padding-left: 0em; } +dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } +div.fields { margin-left: 2em; } +div.fields p { margin-bottom: 0.5em; } + +/* Index tables (identifier index, term index, etc) + * - link-index is used for indices containing lists of links + * (namely, the identifier index & term index). + * - index-where is used in link indices for the text indicating + * the container/source for each link. + * - metadata-index is used for indices containing metadata + * extracted from fields (namely, the bug index & todo index). + */ +table.link-index { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; } +td.link-index { border-width: 0px; } +table.link-index a:link { color: #0000ff; } +table.link-index a:visited { color: #204080; } +span.index-where { font-size: 70%; } +table.metadata-index { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; + margin: .2em 0 0 0; } +td.metadata-index { border-width: 1px; border-style: solid; } +table.metadata-index a:link { color: #0000ff; } +table.metadata-index a:visited { color: #204080; } + +/* Function signatures + * - sig* is used for the signature in the details section. + * - .summary-sig* is used for the signature in the summary + * table, and when listing property accessor functions. + * */ +.sig-name { color: #006080; } +.sig-arg { color: #008060; } +.sig-default { color: #602000; } +.summary-sig { font-family: monospace; } +.summary-sig-name { color: #006080; font-weight: bold; } +table.summary a.summary-sig-name:link + { color: #006080; font-weight: bold; } +table.summary a.summary-sig-name:visited + { color: #006080; font-weight: bold; } +.summary-sig-arg { color: #006040; } +.summary-sig-default { color: #501800; } + +/* Subclass list + */ +ul.subclass-list { display: inline; } +ul.subclass-list li { display: inline; } + +/* To render variables, classes etc. like functions */ +table.summary .summary-name { color: #006080; font-weight: bold; + font-family: monospace; } +table.summary + a.summary-name:link { color: #006080; font-weight: bold; + font-family: monospace; } +table.summary + a.summary-name:visited { color: #006080; font-weight: bold; + font-family: monospace; } + +/* Variable values + * - In the 'variable details' sections, each varaible's value is + * listed in a 'pre.variable' box. The width of this box is + * restricted to 80 chars; if the value's repr is longer than + * this it will be wrapped, using a backslash marked with + * class 'variable-linewrap'. If the value's repr is longer + * than 3 lines, the rest will be ellided; and an ellipsis + * marker ('...' marked with 'variable-ellipsis') will be used. + * - If the value is a string, its quote marks will be marked + * with 'variable-quote'. + * - If the variable is a regexp, it is syntax-highlighted using + * the re* CSS classes. + */ +pre.variable { padding: .5em; margin: 0; + background: #dce4ec; color: #000000; + border: 1px solid #708890; } +.variable-linewrap { color: #604000; font-weight: bold; } +.variable-ellipsis { color: #604000; font-weight: bold; } +.variable-quote { color: #604000; font-weight: bold; } +.variable-group { color: #008000; font-weight: bold; } +.variable-op { color: #604000; font-weight: bold; } +.variable-string { color: #006030; } +.variable-unknown { color: #a00000; font-weight: bold; } +.re { color: #000000; } +.re-char { color: #006030; } +.re-op { color: #600000; } +.re-group { color: #003060; } +.re-ref { color: #404040; } + +/* Base tree + * - Used by class pages to display the base class hierarchy. + */ +pre.base-tree { font-size: 80%; margin: 0; } + +/* Frames-based table of contents headers + * - Consists of two frames: one for selecting modules; and + * the other listing the contents of the selected module. + * - h1.toc is used for each frame's heading + * - h2.toc is used for subheadings within each frame. + */ +h1.toc { text-align: center; font-size: 105%; + margin: 0; font-weight: bold; + padding: 0; } +h2.toc { font-size: 100%; font-weight: bold; + margin: 0.5em 0 0 -0.3em; } + +/* Syntax Highlighting for Source Code + * - doctest examples are displayed in a 'pre.py-doctest' block. + * If the example is in a details table entry, then it will use + * the colors specified by the 'table pre.py-doctest' line. + * - Source code listings are displayed in a 'pre.py-src' block. + * Each line is marked with 'span.py-line' (used to draw a line + * down the left margin, separating the code from the line + * numbers). Line numbers are displayed with 'span.py-lineno'. + * The expand/collapse block toggle button is displayed with + * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not + * modify the font size of the text.) + * - If a source code page is opened with an anchor, then the + * corresponding code block will be highlighted. The code + * block's header is highlighted with 'py-highlight-hdr'; and + * the code block's body is highlighted with 'py-highlight'. + * - The remaining py-* classes are used to perform syntax + * highlighting (py-string for string literals, py-name for names, + * etc.) + */ +pre.py-doctest { padding: .5em; margin: 1em; + background: #e8f0f8; color: #000000; + border: 1px solid #708890; } +table pre.py-doctest { background: #dce4ec; + color: #000000; } +pre.py-src { border: 2px solid #000000; + background: #f0f0f0; color: #000000; } +.py-line { border-left: 2px solid #000000; + margin-left: .2em; padding-left: .4em; } +.py-lineno { font-style: italic; font-size: 90%; + padding-left: .5em; } +a.py-toggle { text-decoration: none; } +div.py-highlight-hdr { border-top: 2px solid #000000; + border-bottom: 2px solid #000000; + background: #d8e8e8; } +div.py-highlight { border-bottom: 2px solid #000000; + background: #d0e0e0; } +.py-prompt { color: #005050; font-weight: bold;} +.py-more { color: #005050; font-weight: bold;} +.py-string { color: #006030; } +.py-comment { color: #003060; } +.py-keyword { color: #600000; } +.py-output { color: #404040; } +.py-name { color: #000050; } +.py-name:link { color: #000050 !important; } +.py-name:visited { color: #000050 !important; } +.py-number { color: #005000; } +.py-defname { color: #000060; font-weight: bold; } +.py-def-name { color: #000060; font-weight: bold; } +.py-base-class { color: #000060; } +.py-param { color: #000060; } +.py-docstring { color: #006030; } +.py-decorator { color: #804020; } +/* Use this if you don't want links to names underlined: */ +/*a.py-name { text-decoration: none; }*/ + +/* Graphs & Diagrams + * - These CSS styles are used for graphs & diagrams generated using + * Graphviz dot. 'img.graph-without-title' is used for bare + * diagrams (to remove the border created by making the image + * clickable). + */ +img.graph-without-title { border: none; } +img.graph-with-title { border: 1px solid #000000; } +span.graph-title { font-weight: bold; } +span.graph-caption { } + +/* General-purpose classes + * - 'p.indent-wrapped-lines' defines a paragraph whose first line + * is not indented, but whose subsequent lines are. + * - The 'nomargin-top' class is used to remove the top margin (e.g. + * from lists). The 'nomargin' class is used to remove both the + * top and bottom margin (but not the left or right margin -- + * for lists, that would cause the bullets to disappear.) + */ +p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; + margin: 0; } +.nomargin-top { margin-top: 0; } +.nomargin { margin-top: 0; margin-bottom: 0; } + +/* HTML Log */ +div.log-block { padding: 0; margin: .5em 0 .5em 0; + background: #e8f0f8; color: #000000; + border: 1px solid #000000; } +div.log-error { padding: .1em .3em .1em .3em; margin: 4px; + background: #ffb0b0; color: #000000; + border: 1px solid #000000; } +div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; + background: #ffffb0; color: #000000; + border: 1px solid #000000; } +div.log-info { padding: .1em .3em .1em .3em; margin: 4px; + background: #b0ffb0; color: #000000; + border: 1px solid #000000; } +h2.log-hdr { background: #70b0ff; color: #000000; + margin: 0; padding: 0em 0.5em 0em 0.5em; + border-bottom: 1px solid #000000; font-size: 110%; } +p.log { font-weight: bold; margin: .5em 0 .5em 0; } +tr.opt-changed { color: #000000; font-weight: bold; } +tr.opt-default { color: #606060; } +pre.log { margin: 0; padding: 0; padding-left: 1em; } diff --git a/doc/html/api/exceptions.AssertionError-class.html b/doc/html/api/exceptions.AssertionError-class.html new file mode 100644 index 0000000..47377a2 --- /dev/null +++ b/doc/html/api/exceptions.AssertionError-class.html @@ -0,0 +1,298 @@ + + + + + exceptions.AssertionError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + exceptions :: + AssertionError :: + Class AssertionError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class AssertionError

+
+   object --+            
+            |            
+BaseException --+        
+                |        
+        Exception --+    
+                    |    
+        StandardError --+
+                        |
+                       AssertionError
+
+ +
+Assertion failed. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/frames.html b/doc/html/api/frames.html new file mode 100644 index 0000000..7c41668 --- /dev/null +++ b/doc/html/api/frames.html @@ -0,0 +1,17 @@ + + + + + lxml API + + + + + + + + + diff --git a/doc/html/api/help.html b/doc/html/api/help.html new file mode 100644 index 0000000..3261c5a --- /dev/null +++ b/doc/html/api/help.html @@ -0,0 +1,278 @@ + + + + + Help + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+ +

API Documentation

+ +

This document contains the API (Application Programming Interface) +documentation for lxml API. Documentation for the Python +objects defined by the project is divided into separate pages for each +package, module, and class. The API documentation also includes two +pages containing information about the project as a whole: a trees +page, and an index page.

+ +

Object Documentation

+ +

Each Package Documentation page contains:

+
    +
  • A description of the package.
  • +
  • A list of the modules and sub-packages contained by the + package.
  • +
  • A summary of the classes defined by the package.
  • +
  • A summary of the functions defined by the package.
  • +
  • A summary of the variables defined by the package.
  • +
  • A detailed description of each function defined by the + package.
  • +
  • A detailed description of each variable defined by the + package.
  • +
+ +

Each Module Documentation page contains:

+
    +
  • A description of the module.
  • +
  • A summary of the classes defined by the module.
  • +
  • A summary of the functions defined by the module.
  • +
  • A summary of the variables defined by the module.
  • +
  • A detailed description of each function defined by the + module.
  • +
  • A detailed description of each variable defined by the + module.
  • +
+ +

Each Class Documentation page contains:

+
    +
  • A class inheritance diagram.
  • +
  • A list of known subclasses.
  • +
  • A description of the class.
  • +
  • A summary of the methods defined by the class.
  • +
  • A summary of the instance variables defined by the class.
  • +
  • A summary of the class (static) variables defined by the + class.
  • +
  • A detailed description of each method defined by the + class.
  • +
  • A detailed description of each instance variable defined by the + class.
  • +
  • A detailed description of each class (static) variable defined + by the class.
  • +
+ +

Project Documentation

+ +

The Trees page contains the module and class hierarchies:

+
    +
  • The module hierarchy lists every package and module, with + modules grouped into packages. At the top level, and within each + package, modules and sub-packages are listed alphabetically.
  • +
  • The class hierarchy lists every class, grouped by base + class. If a class has more than one base class, then it will be + listed under each base class. At the top level, and under each base + class, classes are listed alphabetically.
  • +
+ +

The Index page contains indices of terms and + identifiers:

+
    +
  • The term index lists every term indexed by any object's + documentation. For each term, the index provides links to each + place where the term is indexed.
  • +
  • The identifier index lists the (short) name of every package, + module, class, method, function, variable, and parameter. For each + identifier, the index provides a short description, and a link to + its documentation.
  • +
+ +

The Table of Contents

+ +

The table of contents occupies the two frames on the left side of +the window. The upper-left frame displays the project +contents, and the lower-left frame displays the module +contents:

+ + + + + + + + + +
+ Project
Contents
...
+ API
Documentation
Frame


+
+ Module
Contents
 
...
  +

+ +

The project contents frame contains a list of all packages +and modules that are defined by the project. Clicking on an entry +will display its contents in the module contents frame. Clicking on a +special entry, labeled "Everything," will display the contents of +the entire project.

+ +

The module contents frame contains a list of every +submodule, class, type, exception, function, and variable defined by a +module or package. Clicking on an entry will display its +documentation in the API documentation frame. Clicking on the name of +the module, at the top of the frame, will display the documentation +for the module itself.

+ +

The "frames" and "no frames" buttons below the top +navigation bar can be used to control whether the table of contents is +displayed or not.

+ +

The Navigation Bar

+ +

A navigation bar is located at the top and bottom of every page. +It indicates what type of page you are currently viewing, and allows +you to go to related pages. The following table describes the labels +on the navigation bar. Note that not some labels (such as +[Parent]) are not displayed on all pages.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LabelHighlighted when...Links to...
[Parent](never highlighted) the parent of the current package
[Package]viewing a packagethe package containing the current object +
[Module]viewing a modulethe module containing the current object +
[Class]viewing a class the class containing the current object
[Trees]viewing the trees page the trees page
[Index]viewing the index page the index page
[Help]viewing the help page the help page
+ +

The "show private" and "hide private" buttons below +the top navigation bar can be used to control whether documentation +for private objects is displayed. Private objects are usually defined +as objects whose (short) names begin with a single underscore, but do +not end with an underscore. For example, "_x", +"__pprint", and "epydoc.epytext._tokenize" +are private objects; but "re.sub", +"__init__", and "type_" are not. However, +if a module defines the "__all__" variable, then its +contents are used to decide which objects are private.

+ +

A timestamp below the bottom navigation bar indicates when each +page was last updated.

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-A.html b/doc/html/api/identifier-index-A.html new file mode 100644 index 0000000..c9e88a8 --- /dev/null +++ b/doc/html/api/identifier-index-A.html @@ -0,0 +1,286 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

A

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-B.html b/doc/html/api/identifier-index-B.html new file mode 100644 index 0000000..7c41466 --- /dev/null +++ b/doc/html/api/identifier-index-B.html @@ -0,0 +1,216 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

B

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-C.html b/doc/html/api/identifier-index-C.html new file mode 100644 index 0000000..2cc42d3 --- /dev/null +++ b/doc/html/api/identifier-index-C.html @@ -0,0 +1,487 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

C

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-D.html b/doc/html/api/identifier-index-D.html new file mode 100644 index 0000000..b2de767 --- /dev/null +++ b/doc/html/api/identifier-index-D.html @@ -0,0 +1,391 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

D

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-E.html b/doc/html/api/identifier-index-E.html new file mode 100644 index 0000000..255d856 --- /dev/null +++ b/doc/html/api/identifier-index-E.html @@ -0,0 +1,684 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

E

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-F.html b/doc/html/api/identifier-index-F.html new file mode 100644 index 0000000..72c589d --- /dev/null +++ b/doc/html/api/identifier-index-F.html @@ -0,0 +1,358 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

F

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-G.html b/doc/html/api/identifier-index-G.html new file mode 100644 index 0000000..944603e --- /dev/null +++ b/doc/html/api/identifier-index-G.html @@ -0,0 +1,239 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

G

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-H.html b/doc/html/api/identifier-index-H.html new file mode 100644 index 0000000..d6b6429 --- /dev/null +++ b/doc/html/api/identifier-index-H.html @@ -0,0 +1,318 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

H

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-I.html b/doc/html/api/identifier-index-I.html new file mode 100644 index 0000000..7cbae52 --- /dev/null +++ b/doc/html/api/identifier-index-I.html @@ -0,0 +1,503 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

I

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-J.html b/doc/html/api/identifier-index-J.html new file mode 100644 index 0000000..a1fc3bb --- /dev/null +++ b/doc/html/api/identifier-index-J.html @@ -0,0 +1,160 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

J

+ + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-K.html b/doc/html/api/identifier-index-K.html new file mode 100644 index 0000000..0cc0c20 --- /dev/null +++ b/doc/html/api/identifier-index-K.html @@ -0,0 +1,182 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

K

+ + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-L.html b/doc/html/api/identifier-index-L.html new file mode 100644 index 0000000..12abc11 --- /dev/null +++ b/doc/html/api/identifier-index-L.html @@ -0,0 +1,246 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

L

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-M.html b/doc/html/api/identifier-index-M.html new file mode 100644 index 0000000..d0a834b --- /dev/null +++ b/doc/html/api/identifier-index-M.html @@ -0,0 +1,222 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

M

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-N.html b/doc/html/api/identifier-index-N.html new file mode 100644 index 0000000..c2b5b3e --- /dev/null +++ b/doc/html/api/identifier-index-N.html @@ -0,0 +1,238 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

N

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-O.html b/doc/html/api/identifier-index-O.html new file mode 100644 index 0000000..a874777 --- /dev/null +++ b/doc/html/api/identifier-index-O.html @@ -0,0 +1,206 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

O

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-P.html b/doc/html/api/identifier-index-P.html new file mode 100644 index 0000000..88c8591 --- /dev/null +++ b/doc/html/api/identifier-index-P.html @@ -0,0 +1,319 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

P

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-Q.html b/doc/html/api/identifier-index-Q.html new file mode 100644 index 0000000..8d054a8 --- /dev/null +++ b/doc/html/api/identifier-index-Q.html @@ -0,0 +1,160 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

Q

+ + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-R.html b/doc/html/api/identifier-index-R.html new file mode 100644 index 0000000..92743a4 --- /dev/null +++ b/doc/html/api/identifier-index-R.html @@ -0,0 +1,728 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

R

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-S.html b/doc/html/api/identifier-index-S.html new file mode 100644 index 0000000..4eec818 --- /dev/null +++ b/doc/html/api/identifier-index-S.html @@ -0,0 +1,1125 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

S

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-T.html b/doc/html/api/identifier-index-T.html new file mode 100644 index 0000000..9f252d2 --- /dev/null +++ b/doc/html/api/identifier-index-T.html @@ -0,0 +1,2934 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

T

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-U.html b/doc/html/api/identifier-index-U.html new file mode 100644 index 0000000..8e2662e --- /dev/null +++ b/doc/html/api/identifier-index-U.html @@ -0,0 +1,215 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

U

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-V.html b/doc/html/api/identifier-index-V.html new file mode 100644 index 0000000..59d8b41 --- /dev/null +++ b/doc/html/api/identifier-index-V.html @@ -0,0 +1,200 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

V

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-W.html b/doc/html/api/identifier-index-W.html new file mode 100644 index 0000000..1feeac8 --- /dev/null +++ b/doc/html/api/identifier-index-W.html @@ -0,0 +1,199 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

W

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-X.html b/doc/html/api/identifier-index-X.html new file mode 100644 index 0000000..561f5fa --- /dev/null +++ b/doc/html/api/identifier-index-X.html @@ -0,0 +1,477 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

X

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-Y.html b/doc/html/api/identifier-index-Y.html new file mode 100644 index 0000000..2974a96 --- /dev/null +++ b/doc/html/api/identifier-index-Y.html @@ -0,0 +1,145 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-Z.html b/doc/html/api/identifier-index-Z.html new file mode 100644 index 0000000..18c588f --- /dev/null +++ b/doc/html/api/identifier-index-Z.html @@ -0,0 +1,145 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index-_.html b/doc/html/api/identifier-index-_.html new file mode 100644 index 0000000..7cbb99d --- /dev/null +++ b/doc/html/api/identifier-index-_.html @@ -0,0 +1,2044 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

_

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/identifier-index.html b/doc/html/api/identifier-index.html new file mode 100644 index 0000000..1be8177 --- /dev/null +++ b/doc/html/api/identifier-index.html @@ -0,0 +1,286 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| Deprecations +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + +

A

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/index.html b/doc/html/api/index.html new file mode 100644 index 0000000..7c41668 --- /dev/null +++ b/doc/html/api/index.html @@ -0,0 +1,17 @@ + + + + + lxml API + + + + + + + + + diff --git a/doc/html/api/lxml-module.html b/doc/html/api/lxml-module.html new file mode 100644 index 0000000..7f625b2 --- /dev/null +++ b/doc/html/api/lxml-module.html @@ -0,0 +1,187 @@ + + + + + lxml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package lxml

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml-pysrc.html b/doc/html/api/lxml-pysrc.html new file mode 100644 index 0000000..2bedb38 --- /dev/null +++ b/doc/html/api/lxml-pysrc.html @@ -0,0 +1,121 @@ + + + + + lxml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml

+
+1  # this is a package 
+2   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.ElementInclude-module.html b/doc/html/api/lxml.ElementInclude-module.html new file mode 100644 index 0000000..74619f2 --- /dev/null +++ b/doc/html/api/lxml.ElementInclude-module.html @@ -0,0 +1,292 @@ + + + + + lxml.ElementInclude + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module ElementInclude + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ElementInclude

source code

+

Limited XInclude support for the ElementTree package.

+

While lxml.etree has full support for XInclude (see +etree.ElementTree.xinclude()), this module provides a simpler, pure +Python, ElementTree compatible implementation that supports a simple +form of custom URL resolvers.

+ + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + FatalIncludeError +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
default_loader(href, + parse, + encoding=None) + source code + +
+ +
+   + + + + + + +
_lxml_default_loader(href, + parse, + encoding=None, + parser=None) + source code + +
+ +
+   + + + + + + +
_wrap_et_loader(loader) + source code + +
+ +
+   + + + + + + +
include(elem, + loader=None, + base_url=None) + source code + +
+ +
+   + + + + + + +
_include(elem, + loader=None, + _parent_hrefs=None, + base_url=None) + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + XINCLUDE = '{http://www.w3.org/2001/XInclude}' +
+   + + XINCLUDE_INCLUDE = '{http://www.w3.org/2001/XInclude}include' +
+   + + XINCLUDE_FALLBACK = '{http://www.w3.org/2001/XInclude}fallback' +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.ElementInclude-pysrc.html b/doc/html/api/lxml.ElementInclude-pysrc.html new file mode 100644 index 0000000..40912f3 --- /dev/null +++ b/doc/html/api/lxml.ElementInclude-pysrc.html @@ -0,0 +1,615 @@ + + + + + lxml.ElementInclude + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module ElementInclude + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.ElementInclude

+
+  1  # 
+  2  # ElementTree 
+  3  # $Id: ElementInclude.py 1862 2004-06-18 07:31:02Z Fredrik $ 
+  4  # 
+  5  # limited xinclude support for element trees 
+  6  # 
+  7  # history: 
+  8  # 2003-08-15 fl   created 
+  9  # 2003-11-14 fl   fixed default loader 
+ 10  # 
+ 11  # Copyright (c) 2003-2004 by Fredrik Lundh.  All rights reserved. 
+ 12  # 
+ 13  # fredrik@pythonware.com 
+ 14  # http://www.pythonware.com 
+ 15  # 
+ 16  # -------------------------------------------------------------------- 
+ 17  # The ElementTree toolkit is 
+ 18  # 
+ 19  # Copyright (c) 1999-2004 by Fredrik Lundh 
+ 20  # 
+ 21  # By obtaining, using, and/or copying this software and/or its 
+ 22  # associated documentation, you agree that you have read, understood, 
+ 23  # and will comply with the following terms and conditions: 
+ 24  # 
+ 25  # Permission to use, copy, modify, and distribute this software and 
+ 26  # its associated documentation for any purpose and without fee is 
+ 27  # hereby granted, provided that the above copyright notice appears in 
+ 28  # all copies, and that both that copyright notice and this permission 
+ 29  # notice appear in supporting documentation, and that the name of 
+ 30  # Secret Labs AB or the author not be used in advertising or publicity 
+ 31  # pertaining to distribution of the software without specific, written 
+ 32  # prior permission. 
+ 33  # 
+ 34  # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 
+ 35  # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- 
+ 36  # ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR 
+ 37  # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
+ 38  # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
+ 39  # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
+ 40  # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ 41  # OF THIS SOFTWARE. 
+ 42  # -------------------------------------------------------------------- 
+ 43   
+ 44  """ 
+ 45  Limited XInclude support for the ElementTree package. 
+ 46   
+ 47  While lxml.etree has full support for XInclude (see 
+ 48  `etree.ElementTree.xinclude()`), this module provides a simpler, pure 
+ 49  Python, ElementTree compatible implementation that supports a simple 
+ 50  form of custom URL resolvers. 
+ 51  """ 
+ 52   
+ 53  from lxml import etree 
+ 54  import copy 
+ 55  try: 
+ 56      from urlparse import urljoin 
+ 57      from urllib2 import urlopen 
+ 58  except ImportError: 
+ 59      # Python 3 
+ 60      from urllib.parse import urljoin 
+ 61      from urllib.request import urlopen 
+ 62   
+ 63  try: 
+ 64      set 
+ 65  except NameError: 
+ 66      # Python 2.3 
+ 67      from sets import Set as set 
+ 68   
+ 69  XINCLUDE = "{http://www.w3.org/2001/XInclude}" 
+ 70   
+ 71  XINCLUDE_INCLUDE = XINCLUDE + "include" 
+ 72  XINCLUDE_FALLBACK = XINCLUDE + "fallback" 
+ 73   
+ 74  ## 
+ 75  # Fatal include error. 
+ 76   
+
77 -class FatalIncludeError(etree.LxmlSyntaxError): +
78 pass +
79 + 80 ## + 81 # ET compatible default loader. + 82 # This loader reads an included resource from disk. + 83 # + 84 # @param href Resource reference. + 85 # @param parse Parse mode. Either "xml" or "text". + 86 # @param encoding Optional text encoding. + 87 # @return The expanded resource. If the parse mode is "xml", this + 88 # is an ElementTree instance. If the parse mode is "text", this + 89 # is a Unicode string. If the loader fails, it can return None + 90 # or raise an IOError exception. + 91 # @throws IOError If the loader fails to load the resource. + 92 +
93 -def default_loader(href, parse, encoding=None): +
94 file = open(href, 'rb') + 95 if parse == "xml": + 96 data = etree.parse(file).getroot() + 97 else: + 98 data = file.read() + 99 if not encoding: +100 encoding = 'utf-8' +101 data = data.decode(encoding) +102 file.close() +103 return data +
104 +105 ## +106 # Default loader used by lxml.etree - handles custom resolvers properly +107 # +108 +
109 -def _lxml_default_loader(href, parse, encoding=None, parser=None): +
110 if parse == "xml": +111 data = etree.parse(href, parser).getroot() +112 else: +113 if "://" in href: +114 f = urlopen(href) +115 else: +116 f = open(href, 'rb') +117 data = f.read() +118 f.close() +119 if not encoding: +120 encoding = 'utf-8' +121 data = data.decode(encoding) +122 return data +
123 +124 ## +125 # Wrapper for ET compatibility - drops the parser +126 +
127 -def _wrap_et_loader(loader): +
128 def load(href, parse, encoding=None, parser=None): +129 return loader(href, parse, encoding) +
130 return load +131 +132 +133 ## +134 # Expand XInclude directives. +135 # +136 # @param elem Root element. +137 # @param loader Optional resource loader. If omitted, it defaults +138 # to {@link default_loader}. If given, it should be a callable +139 # that implements the same interface as <b>default_loader</b>. +140 # @throws FatalIncludeError If the function fails to include a given +141 # resource, or if the tree contains malformed XInclude elements. +142 # @throws IOError If the function fails to load a given resource. +143 # @returns the node or its replacement if it was an XInclude node +144 +
145 -def include(elem, loader=None, base_url=None): +
146 if base_url is None: +147 if hasattr(elem, 'getroot'): +148 tree = elem +149 elem = elem.getroot() +150 else: +151 tree = elem.getroottree() +152 if hasattr(tree, 'docinfo'): +153 base_url = tree.docinfo.URL +154 elif hasattr(elem, 'getroot'): +155 elem = elem.getroot() +156 _include(elem, loader, base_url=base_url) +
157 +
158 -def _include(elem, loader=None, _parent_hrefs=None, base_url=None): +
159 if loader is not None: +160 load_include = _wrap_et_loader(loader) +161 else: +162 load_include = _lxml_default_loader +163 +164 if _parent_hrefs is None: +165 _parent_hrefs = set() +166 +167 parser = elem.getroottree().parser +168 +169 include_elements = list( +170 elem.iter('{http://www.w3.org/2001/XInclude}*')) +171 +172 for e in include_elements: +173 if e.tag == XINCLUDE_INCLUDE: +174 # process xinclude directive +175 href = urljoin(base_url, e.get("href")) +176 parse = e.get("parse", "xml") +177 parent = e.getparent() +178 if parse == "xml": +179 if href in _parent_hrefs: +180 raise FatalIncludeError( +181 "recursive include of %r detected" % href +182 ) +183 _parent_hrefs.add(href) +184 node = load_include(href, parse, parser=parser) +185 if node is None: +186 raise FatalIncludeError( +187 "cannot load %r as %r" % (href, parse) +188 ) +189 node = _include(node, loader, _parent_hrefs) +190 if e.tail: +191 node.tail = (node.tail or "") + e.tail +192 if parent is None: +193 return node # replaced the root node! +194 parent.replace(e, node) +195 elif parse == "text": +196 text = load_include(href, parse, encoding=e.get("encoding")) +197 if text is None: +198 raise FatalIncludeError( +199 "cannot load %r as %r" % (href, parse) +200 ) +201 predecessor = e.getprevious() +202 if predecessor is not None: +203 predecessor.tail = (predecessor.tail or "") + text +204 elif parent is None: +205 return text # replaced the root node! +206 else: +207 parent.text = (parent.text or "") + text + (e.tail or "") +208 parent.remove(e) +209 else: +210 raise FatalIncludeError( +211 "unknown parse type in xi:include tag (%r)" % parse +212 ) +213 elif e.tag == XINCLUDE_FALLBACK: +214 parent = e.getparent() +215 if parent is not None and parent.tag != XINCLUDE_INCLUDE: +216 raise FatalIncludeError( +217 "xi:fallback tag must be child of xi:include (%r)" % e.tag +218 ) +219 else: +220 raise FatalIncludeError( +221 "Invalid element found in XInclude namespace (%r)" % e.tag +222 ) +223 return elem +
224 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.ElementInclude.FatalIncludeError-class.html b/doc/html/api/lxml.ElementInclude.FatalIncludeError-class.html new file mode 100644 index 0000000..3a5461d --- /dev/null +++ b/doc/html/api/lxml.ElementInclude.FatalIncludeError-class.html @@ -0,0 +1,222 @@ + + + + + lxml.ElementInclude.FatalIncludeError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module ElementInclude :: + Class FatalIncludeError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FatalIncludeError

source code

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                     etree.Error --+        
+                                   |        
+                     etree.LxmlError --+    
+                                       |    
+              object --+               |    
+                       |               |    
+exceptions.BaseException --+           |    
+                           |           |    
+        exceptions.Exception --+       |    
+                               |       |    
+        exceptions.StandardError --+   |    
+                                   |   |    
+              exceptions.SyntaxError --+    
+                                       |    
+                   etree.LxmlSyntaxError --+
+                                           |
+                                          FatalIncludeError
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.LxmlError: + __init__ +

+

Inherited from exceptions.SyntaxError: + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.builder-module.html b/doc/html/api/lxml.builder-module.html new file mode 100644 index 0000000..1528c8c --- /dev/null +++ b/doc/html/api/lxml.builder-module.html @@ -0,0 +1,201 @@ + + + + + lxml.builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module builder + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module builder

source code

+The E Element factory for generating XML documents. + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ElementMaker
+ Element generator factory. +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
callable(f) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + E = ElementMaker() +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.builder-pysrc.html b/doc/html/api/lxml.builder-pysrc.html new file mode 100644 index 0000000..03bf6da --- /dev/null +++ b/doc/html/api/lxml.builder-pysrc.html @@ -0,0 +1,482 @@ + + + + + lxml.builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module builder + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.builder

+
+  1  # 
+  2  # Element generator factory by Fredrik Lundh. 
+  3  # 
+  4  # Source: 
+  5  #    http://online.effbot.org/2006_11_01_archive.htm#et-builder 
+  6  #    http://effbot.python-hosting.com/file/stuff/sandbox/elementlib/builder.py 
+  7  # 
+  8  # -------------------------------------------------------------------- 
+  9  # The ElementTree toolkit is 
+ 10  # 
+ 11  # Copyright (c) 1999-2004 by Fredrik Lundh 
+ 12  # 
+ 13  # By obtaining, using, and/or copying this software and/or its 
+ 14  # associated documentation, you agree that you have read, understood, 
+ 15  # and will comply with the following terms and conditions: 
+ 16  # 
+ 17  # Permission to use, copy, modify, and distribute this software and 
+ 18  # its associated documentation for any purpose and without fee is 
+ 19  # hereby granted, provided that the above copyright notice appears in 
+ 20  # all copies, and that both that copyright notice and this permission 
+ 21  # notice appear in supporting documentation, and that the name of 
+ 22  # Secret Labs AB or the author not be used in advertising or publicity 
+ 23  # pertaining to distribution of the software without specific, written 
+ 24  # prior permission. 
+ 25  # 
+ 26  # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 
+ 27  # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- 
+ 28  # ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR 
+ 29  # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
+ 30  # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
+ 31  # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
+ 32  # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ 33  # OF THIS SOFTWARE. 
+ 34  # -------------------------------------------------------------------- 
+ 35   
+ 36  """ 
+ 37  The ``E`` Element factory for generating XML documents. 
+ 38  """ 
+ 39   
+ 40  import lxml.etree as ET 
+ 41   
+ 42  try: 
+ 43      from functools import partial 
+ 44  except ImportError: 
+ 45      # fake it for pre-2.5 releases 
+
46 - def partial(func, tag): +
47 return lambda *args, **kwargs: func(tag, *args, **kwargs) +
48 + 49 try: + 50 callable + 51 except NameError: + 52 # Python 3 +
53 - def callable(f): +
54 return hasattr(f, '__call__') +
55 + 56 try: + 57 basestring = __builtins__["basestring"] + 58 except (NameError, KeyError): + 59 basestring = str + 60 + 61 try: + 62 unicode = __builtins__["unicode"] + 63 except (NameError, KeyError): + 64 unicode = str + 65 + 66 +
67 -class ElementMaker(object): +
68 """Element generator factory. + 69 + 70 Unlike the ordinary Element factory, the E factory allows you to pass in + 71 more than just a tag and some optional attributes; you can also pass in + 72 text and other elements. The text is added as either text or tail + 73 attributes, and elements are inserted at the right spot. Some small + 74 examples:: + 75 + 76 >>> from lxml import etree as ET + 77 >>> from lxml.builder import E + 78 + 79 >>> ET.tostring(E("tag")) + 80 '<tag/>' + 81 >>> ET.tostring(E("tag", "text")) + 82 '<tag>text</tag>' + 83 >>> ET.tostring(E("tag", "text", key="value")) + 84 '<tag key="value">text</tag>' + 85 >>> ET.tostring(E("tag", E("subtag", "text"), "tail")) + 86 '<tag><subtag>text</subtag>tail</tag>' + 87 + 88 For simple tags, the factory also allows you to write ``E.tag(...)`` instead + 89 of ``E('tag', ...)``:: + 90 + 91 >>> ET.tostring(E.tag()) + 92 '<tag/>' + 93 >>> ET.tostring(E.tag("text")) + 94 '<tag>text</tag>' + 95 >>> ET.tostring(E.tag(E.subtag("text"), "tail")) + 96 '<tag><subtag>text</subtag>tail</tag>' + 97 + 98 Here's a somewhat larger example; this shows how to generate HTML + 99 documents, using a mix of prepared factory functions for inline elements, +100 nested ``E.tag`` calls, and embedded XHTML fragments:: +101 +102 # some common inline elements +103 A = E.a +104 I = E.i +105 B = E.b +106 +107 def CLASS(v): +108 # helper function, 'class' is a reserved word +109 return {'class': v} +110 +111 page = ( +112 E.html( +113 E.head( +114 E.title("This is a sample document") +115 ), +116 E.body( +117 E.h1("Hello!", CLASS("title")), +118 E.p("This is a paragraph with ", B("bold"), " text in it!"), +119 E.p("This is another paragraph, with a ", +120 A("link", href="http://www.python.org"), "."), +121 E.p("Here are some reservered characters: <spam&egg>."), +122 ET.XML("<p>And finally, here is an embedded XHTML fragment.</p>"), +123 ) +124 ) +125 ) +126 +127 print ET.tostring(page) +128 +129 Here's a prettyprinted version of the output from the above script:: +130 +131 <html> +132 <head> +133 <title>This is a sample document</title> +134 </head> +135 <body> +136 <h1 class="title">Hello!</h1> +137 <p>This is a paragraph with <b>bold</b> text in it!</p> +138 <p>This is another paragraph, with <a href="http://www.python.org">link</a>.</p> +139 <p>Here are some reservered characters: &lt;spam&amp;egg&gt;.</p> +140 <p>And finally, here is an embedded XHTML fragment.</p> +141 </body> +142 </html> +143 +144 For namespace support, you can pass a namespace map (``nsmap``) +145 and/or a specific target ``namespace`` to the ElementMaker class:: +146 +147 >>> E = ElementMaker(namespace="http://my.ns/") +148 >>> print(ET.tostring( E.test )) +149 <test xmlns="http://my.ns/"/> +150 +151 >>> E = ElementMaker(namespace="http://my.ns/", nsmap={'p':'http://my.ns/'}) +152 >>> print(ET.tostring( E.test )) +153 <p:test xmlns:p="http://my.ns/"/> +154 """ +155 +
156 - def __init__(self, typemap=None, +157 namespace=None, nsmap=None, makeelement=None): +
158 if namespace is not None: +159 self._namespace = '{' + namespace + '}' +160 else: +161 self._namespace = None +162 +163 if nsmap: +164 self._nsmap = dict(nsmap) +165 else: +166 self._nsmap = None +167 +168 if makeelement is not None: +169 assert callable(makeelement) +170 self._makeelement = makeelement +171 else: +172 self._makeelement = ET.Element +173 +174 # initialize type map for this element factory +175 +176 if typemap: +177 typemap = typemap.copy() +178 else: +179 typemap = {} +180 +181 def add_text(elem, item): +182 if len(elem): +183 elem[-1].tail = (elem[-1].tail or "") + item +184 else: +185 elem.text = (elem.text or "") + item +
186 if str not in typemap: +187 typemap[str] = add_text +188 if unicode not in typemap: +189 typemap[unicode] = add_text +190 +191 def add_dict(elem, item): +192 attrib = elem.attrib +193 for k, v in item.items(): +194 if isinstance(v, basestring): +195 attrib[k] = v +196 else: +197 attrib[k] = typemap[type(v)](None, v) +
198 if dict not in typemap: +199 typemap[dict] = add_dict +200 +201 self._typemap = typemap +202 +
203 - def __call__(self, tag, *children, **attrib): +
204 get = self._typemap.get +205 +206 if self._namespace is not None and tag[0] != '{': +207 tag = self._namespace + tag +208 elem = self._makeelement(tag, nsmap=self._nsmap) +209 if attrib: +210 get(dict)(elem, attrib) +211 +212 for item in children: +213 if callable(item): +214 item = item() +215 t = get(type(item)) +216 if t is None: +217 if ET.iselement(item): +218 elem.append(item) +219 continue +220 raise TypeError("bad argument type: %r" % item) +221 else: +222 v = t(elem, item) +223 if v: +224 get(type(v))(elem, v) +225 +226 return elem +
227 +
228 - def __getattr__(self, tag): +
229 return partial(self, tag) +
230 +231 # create factory object +232 E = ElementMaker() +233 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.builder.ElementMaker-class.html b/doc/html/api/lxml.builder.ElementMaker-class.html new file mode 100644 index 0000000..6e1adb1 --- /dev/null +++ b/doc/html/api/lxml.builder.ElementMaker-class.html @@ -0,0 +1,374 @@ + + + + + lxml.builder.ElementMaker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module builder :: + Class ElementMaker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementMaker

source code

+
+object --+
+         |
+        ElementMaker
+
+ +
+
+Element generator factory.
+
+Unlike the ordinary Element factory, the E factory allows you to pass in
+more than just a tag and some optional attributes; you can also pass in
+text and other elements.  The text is added as either text or tail
+attributes, and elements are inserted at the right spot.  Some small
+examples::
+
+    >>> from lxml import etree as ET
+    >>> from lxml.builder import E
+
+    >>> ET.tostring(E("tag"))
+    '<tag/>'
+    >>> ET.tostring(E("tag", "text"))
+    '<tag>text</tag>'
+    >>> ET.tostring(E("tag", "text", key="value"))
+    '<tag key="value">text</tag>'
+    >>> ET.tostring(E("tag", E("subtag", "text"), "tail"))
+    '<tag><subtag>text</subtag>tail</tag>'
+
+For simple tags, the factory also allows you to write ``E.tag(...)`` instead
+of ``E('tag', ...)``::
+
+    >>> ET.tostring(E.tag())
+    '<tag/>'
+    >>> ET.tostring(E.tag("text"))
+    '<tag>text</tag>'
+    >>> ET.tostring(E.tag(E.subtag("text"), "tail"))
+    '<tag><subtag>text</subtag>tail</tag>'
+
+Here's a somewhat larger example; this shows how to generate HTML
+documents, using a mix of prepared factory functions for inline elements,
+nested ``E.tag`` calls, and embedded XHTML fragments::
+
+    # some common inline elements
+    A = E.a
+    I = E.i
+    B = E.b
+
+    def CLASS(v):
+        # helper function, 'class' is a reserved word
+        return {'class': v}
+
+    page = (
+        E.html(
+            E.head(
+                E.title("This is a sample document")
+            ),
+            E.body(
+                E.h1("Hello!", CLASS("title")),
+                E.p("This is a paragraph with ", B("bold"), " text in it!"),
+                E.p("This is another paragraph, with a ",
+                    A("link", href="http://www.python.org"), "."),
+                E.p("Here are some reservered characters: <spam&egg>."),
+                ET.XML("<p>And finally, here is an embedded XHTML fragment.</p>"),
+            )
+        )
+    )
+
+    print ET.tostring(page)
+
+Here's a prettyprinted version of the output from the above script::
+
+    <html>
+      <head>
+        <title>This is a sample document</title>
+      </head>
+      <body>
+        <h1 class="title">Hello!</h1>
+        <p>This is a paragraph with <b>bold</b> text in it!</p>
+        <p>This is another paragraph, with <a href="http://www.python.org">link</a>.</p>
+        <p>Here are some reservered characters: &lt;spam&amp;egg&gt;.</p>
+        <p>And finally, here is an embedded XHTML fragment.</p>
+      </body>
+    </html>
+
+For namespace support, you can pass a namespace map (``nsmap``)
+and/or a specific target ``namespace`` to the ElementMaker class::
+
+>>> E = ElementMaker(namespace="http://my.ns/")
+>>> print(ET.tostring( E.test ))
+<test xmlns="http://my.ns/"/>
+
+>>> E = ElementMaker(namespace="http://my.ns/", nsmap={'p':'http://my.ns/'})
+>>> print(ET.tostring( E.test ))
+<p:test xmlns:p="http://my.ns/"/>
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + typemap=None, + namespace=None, + nsmap=None, + makeelement=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + tag, + *children, + **attrib) + source code + +
+ +
+   + + + + + + +
__getattr__(self, + tag) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + typemap=None, + namespace=None, + nsmap=None, + makeelement=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect-module.html b/doc/html/api/lxml.cssselect-module.html new file mode 100644 index 0000000..93c9985 --- /dev/null +++ b/doc/html/api/lxml.cssselect-module.html @@ -0,0 +1,685 @@ + + + + + lxml.cssselect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module cssselect

source code

+

CSS Selectors based on XPath.

+

This module supports selecting XML/HTML tags based on CSS selectors. +See the CSSSelector class for details.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + SelectorSyntaxError +
+   + + ExpressionError +
+   + + CSSSelector
+ A CSS selector. +
+   + + _UniToken +
+   + + Symbol +
+   + + String +
+   + + Token +
+   + + Class
+ Represents selector.class_name +
+   + + Function
+ Represents selector:name(expr) +
+   + + Pseudo
+ Represents selector:ident +
+   + + Attrib
+ Represents selector[namespace|attrib operator value] +
+   + + Element
+ Represents namespace|element +
+   + + Hash
+ Represents selector#id +
+   + + Or +
+   + + CombinedSelector +
+   + + XPathExpr +
+   + + XPathExprOr
+ Represents |'d expressions. +
+   + + TokenStream +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
_make_lower_case(context, + s) + source code + +
+ +
+   + + + + + + +
css_to_xpath(css_expr, + prefix='descendant-or-self::') + source code + +
+ +
+   + + + + + + +
split_at_single_quotes(...)
+ split(string[, maxsplit = 0]) --> list.
+ source code + +
+ +
+   + + + + + + +
xpath_literal(s) + source code + +
+ +
+   + + + + + + +
parse(string) + source code + +
+ +
+   + + + + + + +
parse_selector_group(stream) + source code + +
+ +
+   + + + + + + +
parse_selector(stream) + source code + +
+ +
+   + + + + + + +
parse_simple_selector(stream) + source code + +
+ +
+   + + + + + + +
is_int(v) + source code + +
+ +
+   + + + + + + +
parse_attrib(selector, + stream) + source code + +
+ +
+   + + + + + + +
parse_series(s)
+ Parses things like '1n+2', or 'an+b' generally, returning (a, b)
+ source code + +
+ +
+   + + + + + + +
tokenize(s) + source code + +
+ +
+   + + + + + + +
split_at_string_escapes(...)
+ split(string[, maxsplit = 0]) --> list.
+ source code + +
+ +
+   + + + + + + +
unescape_string_literal(literal) + source code + +
+ +
+   + + + + + + +
tokenize_escaped_string(s, + pos) + source code + +
+ +
+   + + + + + + +
tokenize_symbol(s, + pos) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + ns = FunctionNamespace('http://codespeak.net/lxml/css/') +
+   + + _el_re = re.compile(r'(?u)^\w+\s*$') +
+   + + _id_re = re.compile(r'(?u)^(\w*)#(\w+)\s*$') +
+   + + _class_re = re.compile(r'(?u)^(\w*)\.(\w+)\s*$') +
+   + + _whitespace_re = re.compile(r'(?u)\s+') +
+   + + _comment_re = re.compile(r'(?s)/\*.*?\*/') +
+   + + _count_re = re.compile(r'[\+-]?\d*n(?:[\+-]\d+)?') +
+   + + _illegal_symbol = re.compile(r'(?u)[^\w\\-]') +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

split_at_single_quotes(...) +

+
source code  +
+ + split(string[, maxsplit = 0]) --> list. +Split string by the occurrences of pattern. +
+
+
+
+ +
+ +
+ + +
+

split_at_string_escapes(...) +

+
source code  +
+ + split(string[, maxsplit = 0]) --> list. +Split string by the occurrences of pattern. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect-pysrc.html b/doc/html/api/lxml.cssselect-pysrc.html new file mode 100644 index 0000000..3687fa4 --- /dev/null +++ b/doc/html/api/lxml.cssselect-pysrc.html @@ -0,0 +1,2635 @@ + + + + + lxml.cssselect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.cssselect

+
+  1  """CSS Selectors based on XPath. 
+  2   
+  3  This module supports selecting XML/HTML tags based on CSS selectors. 
+  4  See the `CSSSelector` class for details. 
+  5  """ 
+  6   
+  7  import re 
+  8  from lxml import etree 
+  9   
+ 10  __all__ = ['SelectorSyntaxError', 'ExpressionError', 
+ 11             'CSSSelector'] 
+ 12   
+ 13  try: 
+ 14      _basestring = basestring 
+ 15  except NameError: 
+ 16      _basestring = str 
+ 17   
+
18 -class SelectorSyntaxError(SyntaxError): +
19 pass +
20 +
21 -class ExpressionError(RuntimeError): +
22 pass +
23 +
24 -class CSSSelector(etree.XPath): +
25 """A CSS selector. + 26 + 27 Usage:: + 28 + 29 >>> from lxml import etree, cssselect + 30 >>> select = cssselect.CSSSelector("a tag > child") + 31 + 32 >>> root = etree.XML("<a><b><c/><tag><child>TEXT</child></tag></b></a>") + 33 >>> [ el.tag for el in select(root) ] + 34 ['child'] + 35 """ +
36 - def __init__(self, css): +
37 path = css_to_xpath(css) + 38 etree.XPath.__init__(self, path) + 39 self.css = css +
40 +
41 - def __repr__(self): +
42 return '<%s %s for %r>' % ( + 43 self.__class__.__name__, + 44 hex(abs(id(self)))[2:], + 45 self.css) +
46 + 47 ############################## + 48 ## Token objects: + 49 + 50 try: + 51 _unicode = unicode + 52 _unichr = unichr + 53 except NameError: + 54 # Python 3 + 55 _unicode = str + 56 _unichr = chr + 57 +
58 -class _UniToken(_unicode): +
59 - def __new__(cls, contents, pos): +
60 obj = _unicode.__new__(cls, contents) + 61 obj.pos = pos + 62 return obj +
63 +
64 - def __repr__(self): +
65 return '%s(%s, %r)' % ( + 66 self.__class__.__name__, + 67 _unicode.__repr__(self), + 68 self.pos) +
69 +
70 -class Symbol(_UniToken): +
71 pass +
72 +
73 -class String(_UniToken): +
74 pass +
75 +
76 -class Token(_UniToken): +
77 pass +
78 + 79 ############################################################ + 80 ## Parsing + 81 ############################################################ + 82 + 83 ############################## + 84 ## Syntax objects: + 85 +
86 -class Class(object): +
87 """ + 88 Represents selector.class_name + 89 """ + 90 +
91 - def __init__(self, selector, class_name): +
92 self.selector = selector + 93 self.class_name = class_name +
94 +
95 - def __repr__(self): +
96 return '%s[%r.%s]' % ( + 97 self.__class__.__name__, + 98 self.selector, + 99 self.class_name) +
100 +
101 - def xpath(self): +
102 sel_xpath = self.selector.xpath() +103 sel_xpath.add_condition( +104 "contains(concat(' ', normalize-space(@class), ' '), %s)" % xpath_literal(' '+self.class_name+' ')) +105 return sel_xpath +
106 +
107 -class Function(object): +
108 """ +109 Represents selector:name(expr) +110 """ +111 +112 unsupported = [ +113 'target', 'lang', 'enabled', 'disabled',] +114 +
115 - def __init__(self, selector, type, name, expr): +
116 self.selector = selector +117 self.type = type +118 self.name = name +119 self.expr = expr +
120 +
121 - def __repr__(self): +
122 return '%s[%r%s%s(%r)]' % ( +123 self.__class__.__name__, +124 self.selector, +125 self.type, self.name, self.expr) +
126 +
127 - def xpath(self): +
128 sel_path = self.selector.xpath() +129 if self.name in self.unsupported: +130 raise ExpressionError( +131 "The psuedo-class %r is not supported" % self.name) +132 method = '_xpath_' + self.name.replace('-', '_') +133 if not hasattr(self, method): +134 raise ExpressionError( +135 "The psuedo-class %r is unknown" % self.name) +136 method = getattr(self, method) +137 return method(sel_path, self.expr) +
138 +
139 - def _xpath_nth_child(self, xpath, expr, last=False, +140 add_name_test=True): +
141 a, b = parse_series(expr) +142 if not a and not b and not last: +143 # a=0 means nothing is returned... +144 xpath.add_condition('false() and position() = 0') +145 return xpath +146 if add_name_test: +147 xpath.add_name_test() +148 xpath.add_star_prefix() +149 if a == 0: +150 if last: +151 b = 'last() - %s' % b +152 xpath.add_condition('position() = %s' % b) +153 return xpath +154 if last: +155 # FIXME: I'm not sure if this is right +156 a = -a +157 b = -b +158 if b > 0: +159 b_neg = str(-b) +160 else: +161 b_neg = '+%s' % (-b) +162 if a != 1: +163 expr = ['(position() %s) mod %s = 0' % (b_neg, a)] +164 else: +165 expr = [] +166 if b >= 0: +167 expr.append('position() >= %s' % b) +168 elif b < 0 and last: +169 expr.append('position() < (last() %s)' % b) +170 expr = ' and '.join(expr) +171 if expr: +172 xpath.add_condition(expr) +173 return xpath +
174 # FIXME: handle an+b, odd, even +175 # an+b means every-a, plus b, e.g., 2n+1 means odd +176 # 0n+b means b +177 # n+0 means a=1, i.e., all elements +178 # an means every a elements, i.e., 2n means even +179 # -n means -1n +180 # -1n+6 means elements 6 and previous +181 +
182 - def _xpath_nth_last_child(self, xpath, expr): +
183 return self._xpath_nth_child(xpath, expr, last=True) +
184 +
185 - def _xpath_nth_of_type(self, xpath, expr): +
186 if xpath.element == '*': +187 raise NotImplementedError( +188 "*:nth-of-type() is not implemented") +189 return self._xpath_nth_child(xpath, expr, add_name_test=False) +
190 +
191 - def _xpath_nth_last_of_type(self, xpath, expr): +
192 return self._xpath_nth_child(xpath, expr, last=True, add_name_test=False) +
193 +
194 - def _xpath_contains(self, xpath, expr): +
195 # text content, minus tags, must contain expr +196 if isinstance(expr, Element): +197 expr = expr._format_element() +198 xpath.add_condition('contains(css:lower-case(string(.)), %s)' +199 % xpath_literal(expr.lower())) +200 # FIXME: Currently case insensitive matching doesn't seem to be happening +201 return xpath +
202 +
203 - def _xpath_not(self, xpath, expr): +
204 # everything for which not expr applies +205 expr = expr.xpath() +206 cond = expr.condition +207 # FIXME: should I do something about element_path? +208 xpath.add_condition('not(%s)' % cond) +209 return xpath +
210 +
211 -def _make_lower_case(context, s): +
212 return s.lower() +
213 +214 ns = etree.FunctionNamespace('http://codespeak.net/lxml/css/') +215 ns.prefix = 'css' +216 ns['lower-case'] = _make_lower_case +217 +
218 -class Pseudo(object): +
219 """ +220 Represents selector:ident +221 """ +222 +223 unsupported = ['indeterminate', 'first-line', 'first-letter', +224 'selection', 'before', 'after', 'link', 'visited', +225 'active', 'focus', 'hover'] +226 +
227 - def __init__(self, element, type, ident): +
228 self.element = element +229 assert type in (':', '::') +230 self.type = type +231 self.ident = ident +
232 +
233 - def __repr__(self): +
234 return '%s[%r%s%s]' % ( +235 self.__class__.__name__, +236 self.element, +237 self.type, self.ident) +
238 +
239 - def xpath(self): +
240 el_xpath = self.element.xpath() +241 if self.ident in self.unsupported: +242 raise ExpressionError( +243 "The psuedo-class %r is unsupported" % self.ident) +244 method = '_xpath_' + self.ident.replace('-', '_') +245 if not hasattr(self, method): +246 raise ExpressionError( +247 "The psuedo-class %r is unknown" % self.ident) +248 method = getattr(self, method) +249 el_xpath = method(el_xpath) +250 return el_xpath +
251 +
252 - def _xpath_checked(self, xpath): +
253 # FIXME: is this really all the elements? +254 xpath.add_condition("(@selected or @checked) and (name(.) = 'input' or name(.) = 'option')") +255 return xpath +
256 +
257 - def _xpath_root(self, xpath): +
258 # if this element is the root element +259 raise NotImplementedError +
260 +
261 - def _xpath_first_child(self, xpath): +
262 xpath.add_star_prefix() +263 xpath.add_name_test() +264 xpath.add_condition('position() = 1') +265 return xpath +
266 +
267 - def _xpath_last_child(self, xpath): +
268 xpath.add_star_prefix() +269 xpath.add_name_test() +270 xpath.add_condition('position() = last()') +271 return xpath +
272 +
273 - def _xpath_first_of_type(self, xpath): +
274 if xpath.element == '*': +275 raise NotImplementedError( +276 "*:first-of-type is not implemented") +277 xpath.add_star_prefix() +278 xpath.add_condition('position() = 1') +279 return xpath +
280 +
281 - def _xpath_last_of_type(self, xpath): +
282 if xpath.element == '*': +283 raise NotImplementedError( +284 "*:last-of-type is not implemented") +285 xpath.add_star_prefix() +286 xpath.add_condition('position() = last()') +287 return xpath +
288 +
289 - def _xpath_only_child(self, xpath): +
290 xpath.add_name_test() +291 xpath.add_star_prefix() +292 xpath.add_condition('last() = 1') +293 return xpath +
294 +
295 - def _xpath_only_of_type(self, xpath): +
296 if xpath.element == '*': +297 raise NotImplementedError( +298 "*:only-of-type is not implemented") +299 xpath.add_condition('last() = 1') +300 return xpath +
301 +
302 - def _xpath_empty(self, xpath): +
303 xpath.add_condition("not(*) and not(normalize-space())") +304 return xpath +
305 +
306 -class Attrib(object): +
307 """ +308 Represents selector[namespace|attrib operator value] +309 """ +310 +
311 - def __init__(self, selector, namespace, attrib, operator, value): +
312 self.selector = selector +313 self.namespace = namespace +314 self.attrib = attrib +315 self.operator = operator +316 self.value = value +
317 +
318 - def __repr__(self): +
319 if self.operator == 'exists': +320 return '%s[%r[%s]]' % ( +321 self.__class__.__name__, +322 self.selector, +323 self._format_attrib()) +324 else: +325 return '%s[%r[%s %s %r]]' % ( +326 self.__class__.__name__, +327 self.selector, +328 self._format_attrib(), +329 self.operator, +330 self.value) +
331 +
332 - def _format_attrib(self): +
333 if self.namespace == '*': +334 return self.attrib +335 else: +336 return '%s|%s' % (self.namespace, self.attrib) +
337 +
338 - def _xpath_attrib(self): +
339 # FIXME: if attrib is *? +340 if self.namespace == '*': +341 return '@' + self.attrib +342 else: +343 return '@%s:%s' % (self.namespace, self.attrib) +
344 +
345 - def xpath(self): +
346 path = self.selector.xpath() +347 attrib = self._xpath_attrib() +348 value = self.value +349 if self.operator == 'exists': +350 assert not value +351 path.add_condition(attrib) +352 elif self.operator == '=': +353 path.add_condition('%s = %s' % (attrib, +354 xpath_literal(value))) +355 elif self.operator == '!=': +356 # FIXME: this seems like a weird hack... +357 if value: +358 path.add_condition('not(%s) or %s != %s' +359 % (attrib, attrib, xpath_literal(value))) +360 else: +361 path.add_condition('%s != %s' +362 % (attrib, xpath_literal(value))) +363 #path.add_condition('%s != %s' % (attrib, xpath_literal(value))) +364 elif self.operator == '~=': +365 path.add_condition("contains(concat(' ', normalize-space(%s), ' '), %s)" % (attrib, xpath_literal(' '+value+' '))) +366 elif self.operator == '|=': +367 # Weird, but true... +368 path.add_condition('%s = %s or starts-with(%s, %s)' % ( +369 attrib, xpath_literal(value), +370 attrib, xpath_literal(value + '-'))) +371 elif self.operator == '^=': +372 path.add_condition('starts-with(%s, %s)' % ( +373 attrib, xpath_literal(value))) +374 elif self.operator == '$=': +375 # Oddly there is a starts-with in XPath 1.0, but not ends-with +376 path.add_condition('substring(%s, string-length(%s)-%s) = %s' +377 % (attrib, attrib, len(value)-1, xpath_literal(value))) +378 elif self.operator == '*=': +379 # FIXME: case sensitive? +380 path.add_condition('contains(%s, %s)' % ( +381 attrib, xpath_literal(value))) +382 else: +383 assert 0, ("Unknown operator: %r" % self.operator) +384 return path +
385 +
386 -class Element(object): +
387 """ +388 Represents namespace|element +389 """ +390 +
391 - def __init__(self, namespace, element): +
392 self.namespace = namespace +393 self.element = element +
394 +
395 - def __repr__(self): +
396 return '%s[%s]' % ( +397 self.__class__.__name__, +398 self._format_element()) +
399 +
400 - def _format_element(self): +
401 if self.namespace == '*': +402 return self.element +403 else: +404 return '%s|%s' % (self.namespace, self.element) +
405 +
406 - def xpath(self): +
407 if self.namespace == '*': +408 el = self.element.lower() +409 else: +410 # FIXME: Should we lowercase here? +411 el = '%s:%s' % (self.namespace, self.element) +412 return XPathExpr(element=el) +
413 +
414 -class Hash(object): +
415 """ +416 Represents selector#id +417 """ +418 +
419 - def __init__(self, selector, id): +
420 self.selector = selector +421 self.id = id +
422 +
423 - def __repr__(self): +
424 return '%s[%r#%s]' % ( +425 self.__class__.__name__, +426 self.selector, self.id) +
427 +
428 - def xpath(self): +
429 path = self.selector.xpath() +430 path.add_condition('@id = %s' % xpath_literal(self.id)) +431 return path +
432 +
433 -class Or(object): +
434 +
435 - def __init__(self, items): +
436 self.items = items +
437 - def __repr__(self): +
438 return '%s(%r)' % ( +439 self.__class__.__name__, +440 self.items) +
441 +
442 - def xpath(self): +
443 paths = [item.xpath() for item in self.items] +444 return XPathExprOr(paths) +
445 +
446 -class CombinedSelector(object): +
447 +448 _method_mapping = { +449 ' ': 'descendant', +450 '>': 'child', +451 '+': 'direct_adjacent', +452 '~': 'indirect_adjacent', +453 } +454 +
455 - def __init__(self, selector, combinator, subselector): +
456 assert selector is not None +457 self.selector = selector +458 self.combinator = combinator +459 self.subselector = subselector +
460 +
461 - def __repr__(self): +
462 if self.combinator == ' ': +463 comb = '<followed>' +464 else: +465 comb = self.combinator +466 return '%s[%r %s %r]' % ( +467 self.__class__.__name__, +468 self.selector, +469 comb, +470 self.subselector) +
471 +
472 - def xpath(self): +
473 if self.combinator not in self._method_mapping: +474 raise ExpressionError( +475 "Unknown combinator: %r" % self.combinator) +476 method = '_xpath_' + self._method_mapping[self.combinator] +477 method = getattr(self, method) +478 path = self.selector.xpath() +479 return method(path, self.subselector) +
480 +
481 - def _xpath_descendant(self, xpath, sub): +
482 # when sub is a descendant in any way of xpath +483 xpath.join('/descendant::', sub.xpath()) +484 return xpath +
485 +
486 - def _xpath_child(self, xpath, sub): +
487 # when sub is an immediate child of xpath +488 xpath.join('/', sub.xpath()) +489 return xpath +
490 +
491 - def _xpath_direct_adjacent(self, xpath, sub): +
492 # when sub immediately follows xpath +493 xpath.join('/following-sibling::', sub.xpath()) +494 xpath.add_name_test() +495 xpath.add_condition('position() = 1') +496 return xpath +
497 +
498 - def _xpath_indirect_adjacent(self, xpath, sub): +
499 # when sub comes somewhere after xpath as a sibling +500 xpath.join('/following-sibling::', sub.xpath()) +501 return xpath +
502 +503 ############################## +504 ## XPathExpr objects: +505 +506 _el_re = re.compile(r'^\w+\s*$', re.UNICODE) +507 _id_re = re.compile(r'^(\w*)#(\w+)\s*$', re.UNICODE) +508 _class_re = re.compile(r'^(\w*)\.(\w+)\s*$', re.UNICODE) +509 +
510 -def css_to_xpath(css_expr, prefix='descendant-or-self::'): +
511 if isinstance(css_expr, _basestring): +512 match = _el_re.search(css_expr) +513 if match is not None: +514 return '%s%s' % (prefix, match.group(0).strip()) +515 match = _id_re.search(css_expr) +516 if match is not None: +517 return "%s%s[@id = '%s']" % ( +518 prefix, match.group(1) or '*', match.group(2)) +519 match = _class_re.search(css_expr) +520 if match is not None: +521 return "%s%s[contains(concat(' ', normalize-space(@class), ' '), ' %s ')]" % ( +522 prefix, match.group(1) or '*', match.group(2)) +523 css_expr = parse(css_expr) +524 expr = css_expr.xpath() +525 assert expr is not None, ( +526 "Got None for xpath expression from %s" % repr(css_expr)) +527 if prefix: +528 expr.add_prefix(prefix) +529 return _unicode(expr) +
530 +
531 -class XPathExpr(object): +
532 +
533 - def __init__(self, prefix=None, path=None, element='*', condition=None, +534 star_prefix=False): +
535 self.prefix = prefix +536 self.path = path +537 self.element = element +538 self.condition = condition +539 self.star_prefix = star_prefix +
540 +
541 - def __str__(self): +
542 path = '' +543 if self.prefix is not None: +544 path += _unicode(self.prefix) +545 if self.path is not None: +546 path += _unicode(self.path) +547 path += _unicode(self.element) +548 if self.condition: +549 path += '[%s]' % self.condition +550 return path +
551 +
552 - def __repr__(self): +
553 return '%s[%s]' % ( +554 self.__class__.__name__, self) +
555 +
556 - def add_condition(self, condition): +
557 if self.condition: +558 self.condition = '%s and (%s)' % (self.condition, condition) +559 else: +560 self.condition = condition +
561 +
562 - def add_path(self, part): +
563 if self.path is None: +564 self.path = self.element +565 else: +566 self.path += self.element +567 self.element = part +
568 +
569 - def add_prefix(self, prefix): +
570 if self.prefix: +571 self.prefix = prefix + self.prefix +572 else: +573 self.prefix = prefix +
574 +
575 - def add_name_test(self): +
576 if self.element == '*': +577 # We weren't doing a test anyway +578 return +579 self.add_condition("name() = %s" % xpath_literal(self.element)) +580 self.element = '*' +
581 +
582 - def add_star_prefix(self): +
583 """ +584 Adds a /* prefix if there is no prefix. This is when you need +585 to keep context's constrained to a single parent. +586 """ +587 if self.path: +588 self.path += '*/' +589 else: +590 self.path = '*/' +591 self.star_prefix = True +
592 +
593 - def join(self, combiner, other): +
594 prefix = _unicode(self) +595 prefix += combiner +596 path = (other.prefix or '') + (other.path or '') +597 # We don't need a star prefix if we are joining to this other +598 # prefix; so we'll get rid of it +599 if other.star_prefix and path == '*/': +600 path = '' +601 self.prefix = prefix +602 self.path = path +603 self.element = other.element +604 self.condition = other.condition +
605 +
606 -class XPathExprOr(XPathExpr): +
607 """ +608 Represents |'d expressions. Note that unfortunately it isn't +609 the union, it's the sum, so duplicate elements will appear. +610 """ +611 +
612 - def __init__(self, items, prefix=None): +
613 for item in items: +614 assert item is not None +615 self.items = items +616 self.prefix = prefix +
617 +
618 - def __str__(self): +
619 prefix = self.prefix or '' +620 return ' | '.join(["%s%s" % (prefix,i) for i in self.items]) +
621 +622 split_at_single_quotes = re.compile("('+)").split +623 +
624 -def xpath_literal(s): +
625 if isinstance(s, Element): +626 # This is probably a symbol that looks like an expression... +627 s = s._format_element() +628 else: +629 s = _unicode(s) +630 if "'" not in s: +631 s = "'%s'" % s +632 elif '"' not in s: +633 s = '"%s"' % s +634 else: +635 s = "concat(%s)" % ','.join([ +636 (("'" in part) and '"%s"' or "'%s'") % part +637 for part in split_at_single_quotes(s) if part +638 ]) +639 return s +
640 +641 ############################## +642 ## Parsing functions +643 +
644 -def parse(string): +
645 stream = TokenStream(tokenize(string)) +646 stream.source = string +647 try: +648 return parse_selector_group(stream) +649 except SelectorSyntaxError: +650 import sys +651 e = sys.exc_info()[1] +652 message = "%s at %s -> %r" % ( +653 e, stream.used, stream.peek()) +654 e.msg = message +655 if sys.version_info < (2,6): +656 e.message = message +657 e.args = tuple([message]) +658 raise +
659 +
660 -def parse_selector_group(stream): +
661 result = [] +662 while 1: +663 result.append(parse_selector(stream)) +664 if stream.peek() == ',': +665 stream.next() +666 else: +667 break +668 if len(result) == 1: +669 return result[0] +670 else: +671 return Or(result) +
672 +
673 -def parse_selector(stream): +
674 result = parse_simple_selector(stream) +675 while 1: +676 peek = stream.peek() +677 if peek == ',' or peek is None: +678 return result +679 elif peek in ('+', '>', '~'): +680 # A combinator +681 combinator = stream.next() +682 else: +683 combinator = ' ' +684 consumed = len(stream.used) +685 next_selector = parse_simple_selector(stream) +686 if consumed == len(stream.used): +687 raise SelectorSyntaxError( +688 "Expected selector, got '%s'" % stream.peek()) +689 result = CombinedSelector(result, combinator, next_selector) +690 return result +
691 +
692 -def parse_simple_selector(stream): +
693 peek = stream.peek() +694 if peek != '*' and not isinstance(peek, Symbol): +695 element = namespace = '*' +696 else: +697 next = stream.next() +698 if next != '*' and not isinstance(next, Symbol): +699 raise SelectorSyntaxError( +700 "Expected symbol, got '%s'" % next) +701 if stream.peek() == '|': +702 namespace = next +703 stream.next() +704 element = stream.next() +705 if element != '*' and not isinstance(next, Symbol): +706 raise SelectorSyntaxError( +707 "Expected symbol, got '%s'" % next) +708 else: +709 namespace = '*' +710 element = next +711 result = Element(namespace, element) +712 has_hash = False +713 while 1: +714 peek = stream.peek() +715 if peek == '#': +716 if has_hash: +717 # You can't have two hashes +718 # (FIXME: is there some more general rule I'm missing?) +719 break +720 stream.next() +721 result = Hash(result, stream.next()) +722 has_hash = True +723 continue +724 elif peek == '.': +725 stream.next() +726 result = Class(result, stream.next()) +727 continue +728 elif peek == '[': +729 stream.next() +730 result = parse_attrib(result, stream) +731 next = stream.next() +732 if not next == ']': +733 raise SelectorSyntaxError( +734 "] expected, got '%s'" % next) +735 continue +736 elif peek == ':' or peek == '::': +737 type = stream.next() +738 ident = stream.next() +739 if not isinstance(ident, Symbol): +740 raise SelectorSyntaxError( +741 "Expected symbol, got '%s'" % ident) +742 if stream.peek() == '(': +743 stream.next() +744 peek = stream.peek() +745 if isinstance(peek, String): +746 selector = stream.next() +747 elif isinstance(peek, Symbol) and is_int(peek): +748 selector = int(stream.next()) +749 else: +750 # FIXME: parse_simple_selector, or selector, or...? +751 selector = parse_simple_selector(stream) +752 next = stream.next() +753 if not next == ')': +754 raise SelectorSyntaxError( +755 "Expected ')', got '%s' and '%s'" +756 % (next, selector)) +757 result = Function(result, type, ident, selector) +758 else: +759 result = Pseudo(result, type, ident) +760 continue +761 else: +762 if peek == ' ': +763 stream.next() +764 break +765 # FIXME: not sure what "negation" is +766 return result +
767 +
768 -def is_int(v): +
769 try: +770 int(v) +771 except ValueError: +772 return False +773 else: +774 return True +
775 +
776 -def parse_attrib(selector, stream): +
777 attrib = stream.next() +778 if stream.peek() == '|': +779 namespace = attrib +780 stream.next() +781 attrib = stream.next() +782 else: +783 namespace = '*' +784 if stream.peek() == ']': +785 return Attrib(selector, namespace, attrib, 'exists', None) +786 op = stream.next() +787 if not op in ('^=', '$=', '*=', '=', '~=', '|=', '!='): +788 raise SelectorSyntaxError( +789 "Operator expected, got '%s'" % op) +790 value = stream.next() +791 if not isinstance(value, (Symbol, String)): +792 raise SelectorSyntaxError( +793 "Expected string or symbol, got '%s'" % value) +794 return Attrib(selector, namespace, attrib, op, value) +
795 +
796 -def parse_series(s): +
797 """ +798 Parses things like '1n+2', or 'an+b' generally, returning (a, b) +799 """ +800 if isinstance(s, Element): +801 s = s._format_element() +802 if not s or s == '*': +803 # Happens when there's nothing, which the CSS parser thinks of as * +804 return (0, 0) +805 if isinstance(s, int): +806 # Happens when you just get a number +807 return (0, s) +808 if s == 'odd': +809 return (2, 1) +810 elif s == 'even': +811 return (2, 0) +812 elif s == 'n': +813 return (1, 0) +814 if 'n' not in s: +815 # Just a b +816 return (0, int(s)) +817 a, b = s.split('n', 1) +818 if not a: +819 a = 1 +820 elif a == '-' or a == '+': +821 a = int(a+'1') +822 else: +823 a = int(a) +824 if not b: +825 b = 0 +826 elif b == '-' or b == '+': +827 b = int(b+'1') +828 else: +829 b = int(b) +830 return (a, b) +
831 +832 +833 ############################################################ +834 ## Tokenizing +835 ############################################################ +836 +837 _whitespace_re = re.compile(r'\s+', re.UNICODE) +838 +839 _comment_re = re.compile(r'/\*.*?\*/', re.DOTALL) +840 +841 _count_re = re.compile(r'[+-]?\d*n(?:[+-]\d+)?') +842 +
843 -def tokenize(s): +
844 pos = 0 +845 s = _comment_re.sub('', s) +846 while 1: +847 match = _whitespace_re.match(s, pos=pos) +848 if match: +849 preceding_whitespace_pos = pos +850 pos = match.end() +851 else: +852 preceding_whitespace_pos = 0 +853 if pos >= len(s): +854 return +855 match = _count_re.match(s, pos=pos) +856 if match and match.group() != 'n': +857 sym = s[pos:match.end()] +858 yield Symbol(sym, pos) +859 pos = match.end() +860 continue +861 c = s[pos] +862 c2 = s[pos:pos+2] +863 if c2 in ('~=', '|=', '^=', '$=', '*=', '::', '!='): +864 yield Token(c2, pos) +865 pos += 2 +866 continue +867 if c in '>+~,.*=[]()|:#': +868 if c in '.#' and preceding_whitespace_pos > 0: +869 yield Token(' ', preceding_whitespace_pos) +870 yield Token(c, pos) +871 pos += 1 +872 continue +873 if c == '"' or c == "'": +874 # Quoted string +875 old_pos = pos +876 sym, pos = tokenize_escaped_string(s, pos) +877 yield String(sym, old_pos) +878 continue +879 old_pos = pos +880 sym, pos = tokenize_symbol(s, pos) +881 yield Symbol(sym, old_pos) +882 continue +
883 +884 split_at_string_escapes = re.compile(r'(\\(?:%s))' +885 % '|'.join(['[A-Fa-f0-9]{1,6}(?:\r\n|\s)?', +886 '[^A-Fa-f0-9]'])).split +887 +
888 -def unescape_string_literal(literal): +
889 substrings = [] +890 for substring in split_at_string_escapes(literal): +891 if not substring: +892 continue +893 elif '\\' in substring: +894 if substring[0] == '\\' and len(substring) > 1: +895 substring = substring[1:] +896 if substring[0] in '0123456789ABCDEFabcdef': +897 # int() correctly ignores the potentially trailing whitespace +898 substring = _unichr(int(substring, 16)) +899 else: +900 raise SelectorSyntaxError( +901 "Invalid escape sequence %r in string %r" +902 % (substring.split('\\')[1], literal)) +903 substrings.append(substring) +904 return ''.join(substrings) +
905 +
906 -def tokenize_escaped_string(s, pos): +
907 quote = s[pos] +908 assert quote in ('"', "'") +909 pos = pos+1 +910 start = pos +911 while 1: +912 next = s.find(quote, pos) +913 if next == -1: +914 raise SelectorSyntaxError( +915 "Expected closing %s for string in: %r" +916 % (quote, s[start:])) +917 result = s[start:next] +918 if result.endswith('\\'): +919 # next quote character is escaped +920 pos = next+1 +921 continue +922 if '\\' in result: +923 result = unescape_string_literal(result) +924 return result, next+1 +
925 +926 _illegal_symbol = re.compile(r'[^\w\\-]', re.UNICODE) +927 +
928 -def tokenize_symbol(s, pos): +
929 start = pos +930 match = _illegal_symbol.search(s, pos=pos) +931 if not match: +932 # Goes to end of s +933 return s[start:], len(s) +934 if match.start() == pos: +935 assert 0, ( +936 "Unexpected symbol: %r at %s" % (s[pos], pos)) +937 if not match: +938 result = s[start:] +939 pos = len(s) +940 else: +941 result = s[start:match.start()] +942 pos = match.start() +943 try: +944 result = result.encode('ASCII', 'backslashreplace').decode('unicode_escape') +945 except UnicodeDecodeError: +946 import sys +947 e = sys.exc_info()[1] +948 raise SelectorSyntaxError( +949 "Bad symbol %r: %s" % (result, e)) +950 return result, pos +
951 +
952 -class TokenStream(object): +
953 +
954 - def __init__(self, tokens, source=None): +
955 self.used = [] +956 self.tokens = iter(tokens) +957 self.source = source +958 self.peeked = None +959 self._peeking = False +960 try: +961 self.next_token = self.tokens.next +962 except AttributeError: +963 # Python 3 +964 self.next_token = self.tokens.__next__ +
965 +
966 - def next(self): +
967 if self._peeking: +968 self._peeking = False +969 self.used.append(self.peeked) +970 return self.peeked +971 else: +972 try: +973 next = self.next_token() +974 self.used.append(next) +975 return next +976 except StopIteration: +977 return None +
978 +
979 - def __iter__(self): +
980 return iter(self.next, None) +
981 +
982 - def peek(self): +
983 if not self._peeking: +984 try: +985 self.peeked = self.next_token() +986 except StopIteration: +987 return None +988 self._peeking = True +989 return self.peeked +
990 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Attrib-class.html b/doc/html/api/lxml.cssselect.Attrib-class.html new file mode 100644 index 0000000..bef5179 --- /dev/null +++ b/doc/html/api/lxml.cssselect.Attrib-class.html @@ -0,0 +1,340 @@ + + + + + lxml.cssselect.Attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Attrib + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Attrib

source code

+
+object --+
+         |
+        Attrib
+
+ +
+Represents selector[namespace|attrib operator value] + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + selector, + namespace, + attrib, + operator, + value)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
_format_attrib(self) + source code + +
+ +
+   + + + + + + +
_xpath_attrib(self) + source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + selector, + namespace, + attrib, + operator, + value) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.CSSSelector-class.html b/doc/html/api/lxml.cssselect.CSSSelector-class.html new file mode 100644 index 0000000..d63a8af --- /dev/null +++ b/doc/html/api/lxml.cssselect.CSSSelector-class.html @@ -0,0 +1,309 @@ + + + + + lxml.cssselect.CSSSelector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class CSSSelector + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CSSSelector

source code

+
+               object --+        
+                        |        
+etree._XPathEvaluatorBase --+    
+                            |    
+                  etree.XPath --+
+                                |
+                               CSSSelector
+
+ +
+

A CSS selector.

+

Usage:

+
+>>> from lxml import etree, cssselect
+>>> select = cssselect.CSSSelector("a tag > child")
+
+>>> root = etree.XML("<a><b><c/><tag><child>TEXT</child></tag></b></a>")
+>>> [ el.tag for el in select(root) ]
+['child']
+
+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + css)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from etree.XPath: + __call__, + __new__ +

+

Inherited from etree._XPathEvaluatorBase: + evaluate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree.XPath: + path +

+

Inherited from etree._XPathEvaluatorBase: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + css) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Class-class.html b/doc/html/api/lxml.cssselect.Class-class.html new file mode 100644 index 0000000..951d64a --- /dev/null +++ b/doc/html/api/lxml.cssselect.Class-class.html @@ -0,0 +1,302 @@ + + + + + lxml.cssselect.Class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Class + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Class

source code

+
+object --+
+         |
+        Class
+
+ +
+Represents selector.class_name + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + selector, + class_name)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + selector, + class_name) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.CombinedSelector-class.html b/doc/html/api/lxml.cssselect.CombinedSelector-class.html new file mode 100644 index 0000000..364e541 --- /dev/null +++ b/doc/html/api/lxml.cssselect.CombinedSelector-class.html @@ -0,0 +1,442 @@ + + + + + lxml.cssselect.CombinedSelector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class CombinedSelector + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CombinedSelector

source code

+
+object --+
+         |
+        CombinedSelector
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + selector, + combinator, + subselector)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+   + + + + + + +
_xpath_descendant(self, + xpath, + sub) + source code + +
+ +
+   + + + + + + +
_xpath_child(self, + xpath, + sub) + source code + +
+ +
+   + + + + + + +
_xpath_direct_adjacent(self, + xpath, + sub) + source code + +
+ +
+   + + + + + + +
_xpath_indirect_adjacent(self, + xpath, + sub) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _method_mapping = {' ': 'descendant', '+': 'direct_adjacent', ... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + selector, + combinator, + subselector) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_method_mapping

+ +
+
+
+
Value:
+
+{' ': 'descendant',
+ '+': 'direct_adjacent',
+ '>': 'child',
+ '~': 'indirect_adjacent'}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Element-class.html b/doc/html/api/lxml.cssselect.Element-class.html new file mode 100644 index 0000000..e682fbe --- /dev/null +++ b/doc/html/api/lxml.cssselect.Element-class.html @@ -0,0 +1,318 @@ + + + + + lxml.cssselect.Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Element + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Element

source code

+
+object --+
+         |
+        Element
+
+ +
+Represents namespace|element + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + namespace, + element)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
_format_element(self) + source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + namespace, + element) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.ExpressionError-class.html b/doc/html/api/lxml.cssselect.ExpressionError-class.html new file mode 100644 index 0000000..f682607 --- /dev/null +++ b/doc/html/api/lxml.cssselect.ExpressionError-class.html @@ -0,0 +1,200 @@ + + + + + lxml.cssselect.ExpressionError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class ExpressionError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ExpressionError

source code

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+        exceptions.StandardError --+    
+                                   |    
+             exceptions.RuntimeError --+
+                                       |
+                                      ExpressionError
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from exceptions.RuntimeError: + __init__, + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Function-class.html b/doc/html/api/lxml.cssselect.Function-class.html new file mode 100644 index 0000000..684b84c --- /dev/null +++ b/doc/html/api/lxml.cssselect.Function-class.html @@ -0,0 +1,441 @@ + + + + + lxml.cssselect.Function + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Function + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Function

source code

+
+object --+
+         |
+        Function
+
+ +
+Represents selector:name(expr) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + selector, + type, + name, + expr)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+   + + + + + + +
_xpath_nth_child(self, + xpath, + expr, + last=False, + add_name_test=True) + source code + +
+ +
+   + + + + + + +
_xpath_nth_last_child(self, + xpath, + expr) + source code + +
+ +
+   + + + + + + +
_xpath_nth_of_type(self, + xpath, + expr) + source code + +
+ +
+   + + + + + + +
_xpath_nth_last_of_type(self, + xpath, + expr) + source code + +
+ +
+   + + + + + + +
_xpath_contains(self, + xpath, + expr) + source code + +
+ +
+   + + + + + + +
_xpath_not(self, + xpath, + expr) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + unsupported = ['target', 'lang', 'enabled', 'disabled'] +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + selector, + type, + name, + expr) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Hash-class.html b/doc/html/api/lxml.cssselect.Hash-class.html new file mode 100644 index 0000000..eb52292 --- /dev/null +++ b/doc/html/api/lxml.cssselect.Hash-class.html @@ -0,0 +1,302 @@ + + + + + lxml.cssselect.Hash + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Hash + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Hash

source code

+
+object --+
+         |
+        Hash
+
+ +
+Represents selector#id + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + selector, + id)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + selector, + id) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Or-class.html b/doc/html/api/lxml.cssselect.Or-class.html new file mode 100644 index 0000000..a4496b3 --- /dev/null +++ b/doc/html/api/lxml.cssselect.Or-class.html @@ -0,0 +1,298 @@ + + + + + lxml.cssselect.Or + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Or + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Or

source code

+
+object --+
+         |
+        Or
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + items)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + items) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Pseudo-class.html b/doc/html/api/lxml.cssselect.Pseudo-class.html new file mode 100644 index 0000000..1b93325 --- /dev/null +++ b/doc/html/api/lxml.cssselect.Pseudo-class.html @@ -0,0 +1,535 @@ + + + + + lxml.cssselect.Pseudo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Pseudo + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Pseudo

source code

+
+object --+
+         |
+        Pseudo
+
+ +
+Represents selector:ident + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element, + type, + ident)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
xpath(self) + source code + +
+ +
+   + + + + + + +
_xpath_checked(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_root(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_first_child(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_last_child(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_first_of_type(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_last_of_type(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_only_child(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_only_of_type(self, + xpath) + source code + +
+ +
+   + + + + + + +
_xpath_empty(self, + xpath) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + unsupported = ['indeterminate', 'first-line', 'first-letter', ... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element, + type, + ident) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

unsupported

+ +
+
+
+
Value:
+
+['indeterminate',
+ 'first-line',
+ 'first-letter',
+ 'selection',
+ 'before',
+ 'after',
+ 'link',
+ 'visited',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.SelectorSyntaxError-class.html b/doc/html/api/lxml.cssselect.SelectorSyntaxError-class.html new file mode 100644 index 0000000..a2c457e --- /dev/null +++ b/doc/html/api/lxml.cssselect.SelectorSyntaxError-class.html @@ -0,0 +1,208 @@ + + + + + lxml.cssselect.SelectorSyntaxError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class SelectorSyntaxError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SelectorSyntaxError

source code

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+        exceptions.StandardError --+    
+                                   |    
+              exceptions.SyntaxError --+
+                                       |
+                                      SelectorSyntaxError
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from exceptions.SyntaxError: + __init__, + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.String-class.html b/doc/html/api/lxml.cssselect.String-class.html new file mode 100644 index 0000000..61a467c --- /dev/null +++ b/doc/html/api/lxml.cssselect.String-class.html @@ -0,0 +1,270 @@ + + + + + lxml.cssselect.String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class String + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class String

source code

+
+object --+            
+         |            
+basestring --+        
+             |        
+       unicode --+    
+                 |    
+         _UniToken --+
+                     |
+                    String
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from _UniToken: + __repr__ +

+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+

Inherited from _UniToken: + __new__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Symbol-class.html b/doc/html/api/lxml.cssselect.Symbol-class.html new file mode 100644 index 0000000..2b5fa25 --- /dev/null +++ b/doc/html/api/lxml.cssselect.Symbol-class.html @@ -0,0 +1,270 @@ + + + + + lxml.cssselect.Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Symbol + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Symbol

source code

+
+object --+            
+         |            
+basestring --+        
+             |        
+       unicode --+    
+                 |    
+         _UniToken --+
+                     |
+                    Symbol
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from _UniToken: + __repr__ +

+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+

Inherited from _UniToken: + __new__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.Token-class.html b/doc/html/api/lxml.cssselect.Token-class.html new file mode 100644 index 0000000..076cf6f --- /dev/null +++ b/doc/html/api/lxml.cssselect.Token-class.html @@ -0,0 +1,270 @@ + + + + + lxml.cssselect.Token + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class Token + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Token

source code

+
+object --+            
+         |            
+basestring --+        
+             |        
+       unicode --+    
+                 |    
+         _UniToken --+
+                     |
+                    Token
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from _UniToken: + __repr__ +

+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+

Inherited from _UniToken: + __new__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.TokenStream-class.html b/doc/html/api/lxml.cssselect.TokenStream-class.html new file mode 100644 index 0000000..5e1cd21 --- /dev/null +++ b/doc/html/api/lxml.cssselect.TokenStream-class.html @@ -0,0 +1,292 @@ + + + + + lxml.cssselect.TokenStream + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class TokenStream + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class TokenStream

source code

+
+object --+
+         |
+        TokenStream
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + tokens, + source=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
next(self) + source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
peek(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + tokens, + source=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.XPathExpr-class.html b/doc/html/api/lxml.cssselect.XPathExpr-class.html new file mode 100644 index 0000000..87ae2c0 --- /dev/null +++ b/doc/html/api/lxml.cssselect.XPathExpr-class.html @@ -0,0 +1,458 @@ + + + + + lxml.cssselect.XPathExpr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class XPathExpr + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathExpr

source code

+
+object --+
+         |
+        XPathExpr
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + prefix=None, + path=None, + element='*', + condition=None, + star_prefix=False)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__str__(self)
+ str(x)
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
add_condition(self, + condition) + source code + +
+ +
+   + + + + + + +
add_path(self, + part) + source code + +
+ +
+   + + + + + + +
add_prefix(self, + prefix) + source code + +
+ +
+   + + + + + + +
add_name_test(self) + source code + +
+ +
+   + + + + + + +
add_star_prefix(self)
+ Adds a /* prefix if there is no prefix.
+ source code + +
+ +
+   + + + + + + +
join(self, + combiner, + other) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + prefix=None, + path=None, + element='*', + condition=None, + star_prefix=False) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(self) +
(Informal representation operator) +

+
source code  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

add_star_prefix(self) +

+
source code  +
+ + Adds a /* prefix if there is no prefix. This is when you need +to keep context's constrained to a single parent. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect.XPathExprOr-class.html b/doc/html/api/lxml.cssselect.XPathExprOr-class.html new file mode 100644 index 0000000..16ce4ea --- /dev/null +++ b/doc/html/api/lxml.cssselect.XPathExprOr-class.html @@ -0,0 +1,297 @@ + + + + + lxml.cssselect.XPathExprOr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class XPathExprOr + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathExprOr

source code

+
+object --+    
+         |    
+ XPathExpr --+
+             |
+            XPathExprOr
+
+ +
+Represents |'d expressions. Note that unfortunately it isn't +the union, it's the sum, so duplicate elements will appear. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + items, + prefix=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__str__(self)
+ str(x)
+ source code + +
+ +
+

Inherited from XPathExpr: + __repr__, + add_condition, + add_name_test, + add_path, + add_prefix, + add_star_prefix, + join +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + items, + prefix=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(self) +
(Informal representation operator) +

+
source code  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.cssselect._UniToken-class.html b/doc/html/api/lxml.cssselect._UniToken-class.html new file mode 100644 index 0000000..cd0cb11 --- /dev/null +++ b/doc/html/api/lxml.cssselect._UniToken-class.html @@ -0,0 +1,369 @@ + + + + + lxml.cssselect._UniToken + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module cssselect :: + Class _UniToken + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _UniToken

source code

+
+object --+        
+         |        
+basestring --+    
+             |    
+       unicode --+
+                 |
+                _UniToken
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(cls, + contents, + pos) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(cls, + contents, + pos) +
Static Method +

+
source code  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.doctestcompare-module.html b/doc/html/api/lxml.doctestcompare-module.html new file mode 100644 index 0000000..910cf18 --- /dev/null +++ b/doc/html/api/lxml.doctestcompare-module.html @@ -0,0 +1,508 @@ + + + + + lxml.doctestcompare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module doctestcompare + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module doctestcompare

source code

+

lxml-based doctest output comparison.

+

Note: normally, you should just import the lxml.usedoctest and +lxml.html.usedoctest modules from within a doctest, instead of this +one:

+
+>>> import lxml.usedoctest # for XML output
+
+>>> import lxml.html.usedoctest # for HTML output
+
+

To use this module directly, you must call lxmldoctest.install(), +which will cause doctest to use this in all subsequent calls.

+

This changes the way output is checked and comparisons are made for +XML or HTML-like content.

+

XML or HTML content is noticed because the example starts with < +(it's HTML if it starts with <html). You can also use the +PARSE_HTML and PARSE_XML flags to force parsing.

+

Some rough wildcard-like things are allowed. Whitespace is generally +ignored (except in attributes). In text (attributes and text in the +body) you can use ... as a wildcard. In an example it also +matches any trailing tags in the element, though it does not match +leading tags. You may create a tag <any> or include an any +attribute in the tag. An any tag matches any tag, while the +attribute matches any and all attributes.

+

When a match fails, the reformatted example and gotten text is +displayed (indented), and a rough diff-like output is given. Anything +marked with - is in the output but wasn't supposed to be, and +similarly + means its in the example but wasn't in the output.

+

You can disable parsing on one line with # doctest:+NOPARSE_MARKUP

+ + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + LXMLOutputChecker +
+   + + LHTMLOutputChecker +
+   + + _RestoreChecker +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
strip(v) + source code + +
+ +
+   + + + + + + +
norm_whitespace(v) + source code + +
+ +
+   + + + + + + +
html_fromstring(html) + source code + +
+ +
+   + + + + + + +
install(html=False)
+ Install doctestcompare for all future doctests.
+ source code + +
+ +
+   + + + + + + +
temp_install(html=False, + del_module=None)
+ Use this inside a doctest to enable this checker for this +doctest only.
+ source code + +
+ +
+   + + + + + + +
_find_doctest_frame() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + _IS_PYTHON_3 = False +
+   + + PARSE_HTML = 1024 +
+   + + PARSE_XML = 2048 +
+   + + NOPARSE_MARKUP = 4096 +
+   + + _html_parser = etree.HTMLParser(recover= False, remove_blank_t... +
+   + + _repr_re = re.compile(r'^<[^>]+ (at|object) ') +
+   + + _norm_whitespace_re = re.compile(r'[ \t\n][ \t\n]+') +
+   + + __test__ = {'basic': '\n >>> temp_install()\n >>> print ... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

install(html=False) +

+
source code  +
+ +

Install doctestcompare for all future doctests.

+

If html is true, then by default the HTML parser will be used; +otherwise the XML parser is used.

+
+
+
+
+ +
+ +
+ + +
+

temp_install(html=False, + del_module=None) +

+
source code  +
+ +

Use this inside a doctest to enable this checker for this +doctest only.

+

If html is true, then by default the HTML parser will be used; +otherwise the XML parser is used.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

_html_parser

+ +
+
+
+
Value:
+
+etree.HTMLParser(recover= False, remove_blank_text= True)
+
+
+
+
+
+ +
+ +
+

__test__

+ +
+
+
+
Value:
+
+{'basic': '''
+    >>> temp_install()
+    >>> print """<xml a="1" b="2">stuff</xml>"""
+    <xml b="2" a="1">...</xml>
+    >>> print """<xml xmlns="http://example.com"><tag   attr="bar"   /\
+></xml>"""
+    <xml xmlns="...">
+      <tag attr="..." />
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.doctestcompare-pysrc.html b/doc/html/api/lxml.doctestcompare-pysrc.html new file mode 100644 index 0000000..c6eb326 --- /dev/null +++ b/doc/html/api/lxml.doctestcompare-pysrc.html @@ -0,0 +1,1351 @@ + + + + + lxml.doctestcompare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module doctestcompare + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.doctestcompare

+
+  1  """ 
+  2  lxml-based doctest output comparison. 
+  3   
+  4  Note: normally, you should just import the `lxml.usedoctest` and 
+  5  `lxml.html.usedoctest` modules from within a doctest, instead of this 
+  6  one:: 
+  7   
+  8      >>> import lxml.usedoctest # for XML output 
+  9   
+ 10      >>> import lxml.html.usedoctest # for HTML output 
+ 11   
+ 12  To use this module directly, you must call ``lxmldoctest.install()``, 
+ 13  which will cause doctest to use this in all subsequent calls. 
+ 14   
+ 15  This changes the way output is checked and comparisons are made for 
+ 16  XML or HTML-like content. 
+ 17   
+ 18  XML or HTML content is noticed because the example starts with ``<`` 
+ 19  (it's HTML if it starts with ``<html``).  You can also use the 
+ 20  ``PARSE_HTML`` and ``PARSE_XML`` flags to force parsing. 
+ 21   
+ 22  Some rough wildcard-like things are allowed.  Whitespace is generally 
+ 23  ignored (except in attributes).  In text (attributes and text in the 
+ 24  body) you can use ``...`` as a wildcard.  In an example it also 
+ 25  matches any trailing tags in the element, though it does not match 
+ 26  leading tags.  You may create a tag ``<any>`` or include an ``any`` 
+ 27  attribute in the tag.  An ``any`` tag matches any tag, while the 
+ 28  attribute matches any and all attributes. 
+ 29   
+ 30  When a match fails, the reformatted example and gotten text is 
+ 31  displayed (indented), and a rough diff-like output is given.  Anything 
+ 32  marked with ``-`` is in the output but wasn't supposed to be, and 
+ 33  similarly ``+`` means its in the example but wasn't in the output. 
+ 34   
+ 35  You can disable parsing on one line with ``# doctest:+NOPARSE_MARKUP`` 
+ 36  """ 
+ 37   
+ 38  from lxml import etree 
+ 39  import sys 
+ 40  import re 
+ 41  import doctest 
+ 42  import cgi 
+ 43   
+ 44  __all__ = ['PARSE_HTML', 'PARSE_XML', 'NOPARSE_MARKUP', 'LXMLOutputChecker', 
+ 45             'LHTMLOutputChecker', 'install', 'temp_install'] 
+ 46   
+ 47  try: 
+ 48      _basestring = basestring 
+ 49  except NameError: 
+ 50      _basestring = (str, bytes) 
+ 51   
+ 52  _IS_PYTHON_3 = sys.version_info[0] >= 3 
+ 53   
+ 54  PARSE_HTML = doctest.register_optionflag('PARSE_HTML') 
+ 55  PARSE_XML = doctest.register_optionflag('PARSE_XML') 
+ 56  NOPARSE_MARKUP = doctest.register_optionflag('NOPARSE_MARKUP') 
+ 57   
+ 58  OutputChecker = doctest.OutputChecker 
+ 59   
+
60 -def strip(v): +
61 if v is None: + 62 return None + 63 else: + 64 return v.strip() +
65 +
66 -def norm_whitespace(v): +
67 return _norm_whitespace_re.sub(' ', v) +
68 + 69 _html_parser = etree.HTMLParser(recover=False, remove_blank_text=True) + 70 +
71 -def html_fromstring(html): +
73 + 74 # We use this to distinguish repr()s from elements: + 75 _repr_re = re.compile(r'^<[^>]+ (at|object) ') + 76 _norm_whitespace_re = re.compile(r'[ \t\n][ \t\n]+') + 77 +
78 -class LXMLOutputChecker(OutputChecker): +
79 + 80 empty_tags = ( + 81 'param', 'img', 'area', 'br', 'basefont', 'input', + 82 'base', 'meta', 'link', 'col') + 83 +
84 - def get_default_parser(self): +
85 return etree.XML +
86 +
87 - def check_output(self, want, got, optionflags): +
88 alt_self = getattr(self, '_temp_override_self', None) + 89 if alt_self is not None: + 90 super_method = self._temp_call_super_check_output + 91 self = alt_self + 92 else: + 93 super_method = OutputChecker.check_output + 94 parser = self.get_parser(want, got, optionflags) + 95 if not parser: + 96 return super_method( + 97 self, want, got, optionflags) + 98 try: + 99 want_doc = parser(want) +100 except etree.XMLSyntaxError: +101 return False +102 try: +103 got_doc = parser(got) +104 except etree.XMLSyntaxError: +105 return False +106 return self.compare_docs(want_doc, got_doc) +
107 +
108 - def get_parser(self, want, got, optionflags): +
109 parser = None +110 if NOPARSE_MARKUP & optionflags: +111 return None +112 if PARSE_HTML & optionflags: +113 parser = html_fromstring +114 elif PARSE_XML & optionflags: +115 parser = etree.XML +116 elif (want.strip().lower().startswith('<html') +117 and got.strip().startswith('<html')): +118 parser = html_fromstring +119 elif (self._looks_like_markup(want) +120 and self._looks_like_markup(got)): +121 parser = self.get_default_parser() +122 return parser +
123 +
124 - def _looks_like_markup(self, s): +
125 s = s.strip() +126 return (s.startswith('<') +127 and not _repr_re.search(s)) +
128 +
129 - def compare_docs(self, want, got): +
130 if not self.tag_compare(want.tag, got.tag): +131 return False +132 if not self.text_compare(want.text, got.text, True): +133 return False +134 if not self.text_compare(want.tail, got.tail, True): +135 return False +136 if 'any' not in want.attrib: +137 want_keys = sorted(want.attrib.keys()) +138 got_keys = sorted(got.attrib.keys()) +139 if want_keys != got_keys: +140 return False +141 for key in want_keys: +142 if not self.text_compare(want.attrib[key], got.attrib[key], False): +143 return False +144 if want.text != '...' or len(want): +145 want_children = list(want) +146 got_children = list(got) +147 while want_children or got_children: +148 if not want_children or not got_children: +149 return False +150 want_first = want_children.pop(0) +151 got_first = got_children.pop(0) +152 if not self.compare_docs(want_first, got_first): +153 return False +154 if not got_children and want_first.tail == '...': +155 break +156 return True +
157 +
158 - def text_compare(self, want, got, strip): +
159 want = want or '' +160 got = got or '' +161 if strip: +162 want = norm_whitespace(want).strip() +163 got = norm_whitespace(got).strip() +164 want = '^%s$' % re.escape(want) +165 want = want.replace(r'\.\.\.', '.*') +166 if re.search(want, got): +167 return True +168 else: +169 return False +
170 +
171 - def tag_compare(self, want, got): +
172 if want == 'any': +173 return True +174 if (not isinstance(want, _basestring) +175 or not isinstance(got, _basestring)): +176 return want == got +177 want = want or '' +178 got = got or '' +179 if want.startswith('{...}'): +180 # Ellipsis on the namespace +181 return want.split('}')[-1] == got.split('}')[-1] +182 else: +183 return want == got +
184 +
185 - def output_difference(self, example, got, optionflags): +
186 want = example.want +187 parser = self.get_parser(want, got, optionflags) +188 errors = [] +189 if parser is not None: +190 try: +191 want_doc = parser(want) +192 except etree.XMLSyntaxError: +193 e = sys.exc_info()[1] +194 errors.append('In example: %s' % e) +195 try: +196 got_doc = parser(got) +197 except etree.XMLSyntaxError: +198 e = sys.exc_info()[1] +199 errors.append('In actual output: %s' % e) +200 if parser is None or errors: +201 value = OutputChecker.output_difference( +202 self, example, got, optionflags) +203 if errors: +204 errors.append(value) +205 return '\n'.join(errors) +206 else: +207 return value +208 html = parser is html_fromstring +209 diff_parts = [] +210 diff_parts.append('Expected:') +211 diff_parts.append(self.format_doc(want_doc, html, 2)) +212 diff_parts.append('Got:') +213 diff_parts.append(self.format_doc(got_doc, html, 2)) +214 diff_parts.append('Diff:') +215 diff_parts.append(self.collect_diff(want_doc, got_doc, html, 2)) +216 return '\n'.join(diff_parts) +
217 +
218 - def html_empty_tag(self, el, html=True): +
219 if not html: +220 return False +221 if el.tag not in self.empty_tags: +222 return False +223 if el.text or len(el): +224 # This shouldn't happen (contents in an empty tag) +225 return False +226 return True +
227 +
228 - def format_doc(self, doc, html, indent, prefix=''): +
229 parts = [] +230 if not len(doc): +231 # No children... +232 parts.append(' '*indent) +233 parts.append(prefix) +234 parts.append(self.format_tag(doc)) +235 if not self.html_empty_tag(doc, html): +236 if strip(doc.text): +237 parts.append(self.format_text(doc.text)) +238 parts.append(self.format_end_tag(doc)) +239 if strip(doc.tail): +240 parts.append(self.format_text(doc.tail)) +241 parts.append('\n') +242 return ''.join(parts) +243 parts.append(' '*indent) +244 parts.append(prefix) +245 parts.append(self.format_tag(doc)) +246 if not self.html_empty_tag(doc, html): +247 parts.append('\n') +248 if strip(doc.text): +249 parts.append(' '*indent) +250 parts.append(self.format_text(doc.text)) +251 parts.append('\n') +252 for el in doc: +253 parts.append(self.format_doc(el, html, indent+2)) +254 parts.append(' '*indent) +255 parts.append(self.format_end_tag(doc)) +256 parts.append('\n') +257 if strip(doc.tail): +258 parts.append(' '*indent) +259 parts.append(self.format_text(doc.tail)) +260 parts.append('\n') +261 return ''.join(parts) +
262 +
263 - def format_text(self, text, strip=True): +
264 if text is None: +265 return '' +266 if strip: +267 text = text.strip() +268 return cgi.escape(text, 1) +
269 +
270 - def format_tag(self, el): +
271 attrs = [] +272 if isinstance(el, etree.CommentBase): +273 # FIXME: probably PIs should be handled specially too? +274 return '<!--' +275 for name, value in sorted(el.attrib.items()): +276 attrs.append('%s="%s"' % (name, self.format_text(value, False))) +277 if not attrs: +278 return '<%s>' % el.tag +279 return '<%s %s>' % (el.tag, ' '.join(attrs)) +
280 +
281 - def format_end_tag(self, el): +
282 if isinstance(el, etree.CommentBase): +283 # FIXME: probably PIs should be handled specially too? +284 return '-->' +285 return '</%s>' % el.tag +
286 +
287 - def collect_diff(self, want, got, html, indent): +
288 parts = [] +289 if not len(want) and not len(got): +290 parts.append(' '*indent) +291 parts.append(self.collect_diff_tag(want, got)) +292 if not self.html_empty_tag(got, html): +293 parts.append(self.collect_diff_text(want.text, got.text)) +294 parts.append(self.collect_diff_end_tag(want, got)) +295 parts.append(self.collect_diff_text(want.tail, got.tail)) +296 parts.append('\n') +297 return ''.join(parts) +298 parts.append(' '*indent) +299 parts.append(self.collect_diff_tag(want, got)) +300 parts.append('\n') +301 if strip(want.text) or strip(got.text): +302 parts.append(' '*indent) +303 parts.append(self.collect_diff_text(want.text, got.text)) +304 parts.append('\n') +305 want_children = list(want) +306 got_children = list(got) +307 while want_children or got_children: +308 if not want_children: +309 parts.append(self.format_doc(got_children.pop(0), html, indent+2, '-')) +310 continue +311 if not got_children: +312 parts.append(self.format_doc(want_children.pop(0), html, indent+2, '+')) +313 continue +314 parts.append(self.collect_diff( +315 want_children.pop(0), got_children.pop(0), html, indent+2)) +316 parts.append(' '*indent) +317 parts.append(self.collect_diff_end_tag(want, got)) +318 parts.append('\n') +319 if strip(want.tail) or strip(got.tail): +320 parts.append(' '*indent) +321 parts.append(self.collect_diff_text(want.tail, got.tail)) +322 parts.append('\n') +323 return ''.join(parts) +
324 +
325 - def collect_diff_tag(self, want, got): +
326 if not self.tag_compare(want.tag, got.tag): +327 tag = '%s (got: %s)' % (want.tag, got.tag) +328 else: +329 tag = got.tag +330 attrs = [] +331 any = want.tag == 'any' or 'any' in want.attrib +332 for name, value in sorted(got.attrib.items()): +333 if name not in want.attrib and not any: +334 attrs.append('-%s="%s"' % (name, self.format_text(value, False))) +335 else: +336 if name in want.attrib: +337 text = self.collect_diff_text(value, want.attrib[name], False) +338 else: +339 text = self.format_text(value, False) +340 attrs.append('%s="%s"' % (name, text)) +341 if not any: +342 for name, value in sorted(want.attrib.items()): +343 if name in got.attrib: +344 continue +345 attrs.append('+%s="%s"' % (name, self.format_text(value, False))) +346 if attrs: +347 tag = '<%s %s>' % (tag, ' '.join(attrs)) +348 else: +349 tag = '<%s>' % tag +350 return tag +
351 +
352 - def collect_diff_end_tag(self, want, got): +
353 if want.tag != got.tag: +354 tag = '%s (got: %s)' % (want.tag, got.tag) +355 else: +356 tag = got.tag +357 return '</%s>' % tag +
358 +
359 - def collect_diff_text(self, want, got, strip=True): +
360 if self.text_compare(want, got, strip): +361 if not got: +362 return '' +363 return self.format_text(got, strip) +364 text = '%s (got: %s)' % (want, got) +365 return self.format_text(text, strip) +
366 +
367 -class LHTMLOutputChecker(LXMLOutputChecker): +
368 - def get_default_parser(self): +
369 return html_fromstring +
370 +
371 -def install(html=False): +
372 """ +373 Install doctestcompare for all future doctests. +374 +375 If html is true, then by default the HTML parser will be used; +376 otherwise the XML parser is used. +377 """ +378 if html: +379 doctest.OutputChecker = LHTMLOutputChecker +380 else: +381 doctest.OutputChecker = LXMLOutputChecker +
382 +
383 -def temp_install(html=False, del_module=None): +
384 """ +385 Use this *inside* a doctest to enable this checker for this +386 doctest only. +387 +388 If html is true, then by default the HTML parser will be used; +389 otherwise the XML parser is used. +390 """ +391 if html: +392 Checker = LHTMLOutputChecker +393 else: +394 Checker = LXMLOutputChecker +395 frame = _find_doctest_frame() +396 dt_self = frame.f_locals['self'] +397 checker = Checker() +398 old_checker = dt_self._checker +399 dt_self._checker = checker +400 # The unfortunate thing is that there is a local variable 'check' +401 # in the function that runs the doctests, that is a bound method +402 # into the output checker. We have to update that. We can't +403 # modify the frame, so we have to modify the object in place. The +404 # only way to do this is to actually change the func_code +405 # attribute of the method. We change it, and then wait for +406 # __record_outcome to be run, which signals the end of the __run +407 # method, at which point we restore the previous check_output +408 # implementation. +409 if _IS_PYTHON_3: +410 check_func = frame.f_locals['check'].__func__ +411 checker_check_func = checker.check_output.__func__ +412 else: +413 check_func = frame.f_locals['check'].im_func +414 checker_check_func = checker.check_output.im_func +415 # Because we can't patch up func_globals, this is the only global +416 # in check_output that we care about: +417 doctest.etree = etree +418 _RestoreChecker(dt_self, old_checker, checker, +419 check_func, checker_check_func, +420 del_module) +
421 +
422 -class _RestoreChecker(object): +
423 - def __init__(self, dt_self, old_checker, new_checker, check_func, clone_func, +424 del_module): +
425 self.dt_self = dt_self +426 self.checker = old_checker +427 self.checker._temp_call_super_check_output = self.call_super +428 self.checker._temp_override_self = new_checker +429 self.check_func = check_func +430 self.clone_func = clone_func +431 self.del_module = del_module +432 self.install_clone() +433 self.install_dt_self() +
434 - def install_clone(self): +
435 if _IS_PYTHON_3: +436 self.func_code = self.check_func.__code__ +437 self.func_globals = self.check_func.__globals__ +438 self.check_func.__code__ = self.clone_func.__code__ +439 else: +440 self.func_code = self.check_func.func_code +441 self.func_globals = self.check_func.func_globals +442 self.check_func.func_code = self.clone_func.func_code +
443 - def uninstall_clone(self): +
444 if _IS_PYTHON_3: +445 self.check_func.__code__ = self.func_code +446 else: +447 self.check_func.func_code = self.func_code +
448 - def install_dt_self(self): +
449 self.prev_func = self.dt_self._DocTestRunner__record_outcome +450 self.dt_self._DocTestRunner__record_outcome = self +
451 - def uninstall_dt_self(self): +
452 self.dt_self._DocTestRunner__record_outcome = self.prev_func +
453 - def uninstall_module(self): +
454 if self.del_module: +455 import sys +456 del sys.modules[self.del_module] +457 if '.' in self.del_module: +458 package, module = self.del_module.rsplit('.', 1) +459 package_mod = sys.modules[package] +460 delattr(package_mod, module) +
461 - def __call__(self, *args, **kw): +
462 self.uninstall_clone() +463 self.uninstall_dt_self() +464 del self.checker._temp_override_self +465 del self.checker._temp_call_super_check_output +466 result = self.prev_func(*args, **kw) +467 self.uninstall_module() +468 return result +
469 - def call_super(self, *args, **kw): +
470 self.uninstall_clone() +471 try: +472 return self.check_func(*args, **kw) +473 finally: +474 self.install_clone() +
475 +
477 import sys +478 frame = sys._getframe(1) +479 while frame: +480 l = frame.f_locals +481 if 'BOOM' in l: +482 # Sign of doctest +483 return frame +484 frame = frame.f_back +485 raise LookupError( +486 "Could not find doctest (only use this function *inside* a doctest)") +
487 +488 __test__ = { +489 'basic': ''' +490 >>> temp_install() +491 >>> print """<xml a="1" b="2">stuff</xml>""" +492 <xml b="2" a="1">...</xml> +493 >>> print """<xml xmlns="http://example.com"><tag attr="bar" /></xml>""" +494 <xml xmlns="..."> +495 <tag attr="..." /> +496 </xml> +497 >>> print """<xml>blahblahblah<foo /></xml>""" # doctest: +NOPARSE_MARKUP, +ELLIPSIS +498 <xml>...foo /></xml> +499 '''} +500 +501 if __name__ == '__main__': +502 import doctest +503 doctest.testmod() +504 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.doctestcompare.LHTMLOutputChecker-class.html b/doc/html/api/lxml.doctestcompare.LHTMLOutputChecker-class.html new file mode 100644 index 0000000..6708b8c --- /dev/null +++ b/doc/html/api/lxml.doctestcompare.LHTMLOutputChecker-class.html @@ -0,0 +1,251 @@ + + + + + lxml.doctestcompare.LHTMLOutputChecker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module doctestcompare :: + Class LHTMLOutputChecker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LHTMLOutputChecker

source code

+
+doctest.OutputChecker --+    
+                        |    
+        LXMLOutputChecker --+
+                            |
+                           LHTMLOutputChecker
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
get_default_parser(self) + source code + +
+ +
+

Inherited from LXMLOutputChecker: + check_output, + collect_diff, + collect_diff_end_tag, + collect_diff_tag, + collect_diff_text, + compare_docs, + format_doc, + format_end_tag, + format_tag, + format_text, + get_parser, + html_empty_tag, + output_difference, + tag_compare, + text_compare +

+

Inherited from LXMLOutputChecker (private): + _looks_like_markup +

+

Inherited from doctest.OutputChecker (private): + _do_a_fancy_diff +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from LXMLOutputChecker: + empty_tags +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

get_default_parser(self) +

+
source code  +
+ + +
+
Overrides: + LXMLOutputChecker.get_default_parser +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.doctestcompare.LXMLOutputChecker-class.html b/doc/html/api/lxml.doctestcompare.LXMLOutputChecker-class.html new file mode 100644 index 0000000..eed8892 --- /dev/null +++ b/doc/html/api/lxml.doctestcompare.LXMLOutputChecker-class.html @@ -0,0 +1,626 @@ + + + + + lxml.doctestcompare.LXMLOutputChecker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module doctestcompare :: + Class LXMLOutputChecker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LXMLOutputChecker

source code

+
+doctest.OutputChecker --+
+                        |
+                       LXMLOutputChecker
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
get_default_parser(self) + source code + +
+ +
+   + + + + + + +
check_output(self, + want, + got, + optionflags)
+ Return True iff the actual output from an example (got) +matches the expected output (want).
+ source code + +
+ +
+   + + + + + + +
get_parser(self, + want, + got, + optionflags) + source code + +
+ +
+   + + + + + + +
_looks_like_markup(self, + s) + source code + +
+ +
+   + + + + + + +
compare_docs(self, + want, + got) + source code + +
+ +
+   + + + + + + +
text_compare(self, + want, + got, + strip) + source code + +
+ +
+   + + + + + + +
tag_compare(self, + want, + got) + source code + +
+ +
+   + + + + + + +
output_difference(self, + example, + got, + optionflags)
+ Return a string describing the differences between the +expected output for a given example (example) and the actual +output (got).
+ source code + +
+ +
+   + + + + + + +
html_empty_tag(self, + el, + html=True) + source code + +
+ +
+   + + + + + + +
format_doc(self, + doc, + html, + indent, + prefix='') + source code + +
+ +
+   + + + + + + +
format_text(self, + text, + strip=True) + source code + +
+ +
+   + + + + + + +
format_tag(self, + el) + source code + +
+ +
+   + + + + + + +
format_end_tag(self, + el) + source code + +
+ +
+   + + + + + + +
collect_diff(self, + want, + got, + html, + indent) + source code + +
+ +
+   + + + + + + +
collect_diff_tag(self, + want, + got) + source code + +
+ +
+   + + + + + + +
collect_diff_end_tag(self, + want, + got) + source code + +
+ +
+   + + + + + + +
collect_diff_text(self, + want, + got, + strip=True) + source code + +
+ +
+

Inherited from doctest.OutputChecker (private): + _do_a_fancy_diff +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + empty_tags = ('param', 'img', 'area', 'br', 'basefont', 'input... +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

check_output(self, + want, + got, + optionflags) +

+
source code  +
+ + Return True iff the actual output from an example (got) +matches the expected output (want). These strings are +always considered to match if they are identical; but +depending on what option flags the test runner is using, +several non-exact match types are also possible. See the +documentation for TestRunner for more information about +option flags. +
+
Overrides: + doctest.OutputChecker.check_output +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

output_difference(self, + example, + got, + optionflags) +

+
source code  +
+ + Return a string describing the differences between the +expected output for a given example (example) and the actual +output (got). optionflags is the set of option flags used +to compare want and got. +
+
Overrides: + doctest.OutputChecker.output_difference +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

empty_tags

+ +
+
+
+
Value:
+
+('param',
+ 'img',
+ 'area',
+ 'br',
+ 'basefont',
+ 'input',
+ 'base',
+ 'meta',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.doctestcompare._RestoreChecker-class.html b/doc/html/api/lxml.doctestcompare._RestoreChecker-class.html new file mode 100644 index 0000000..413da46 --- /dev/null +++ b/doc/html/api/lxml.doctestcompare._RestoreChecker-class.html @@ -0,0 +1,368 @@ + + + + + lxml.doctestcompare._RestoreChecker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module doctestcompare :: + Class _RestoreChecker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _RestoreChecker

source code

+
+object --+
+         |
+        _RestoreChecker
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + dt_self, + old_checker, + new_checker, + check_func, + clone_func, + del_module)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
install_clone(self) + source code + +
+ +
+   + + + + + + +
uninstall_clone(self) + source code + +
+ +
+   + + + + + + +
install_dt_self(self) + source code + +
+ +
+   + + + + + + +
uninstall_dt_self(self) + source code + +
+ +
+   + + + + + + +
uninstall_module(self) + source code + +
+ +
+   + + + + + + +
__call__(self, + *args, + **kw) + source code + +
+ +
+   + + + + + + +
call_super(self, + *args, + **kw) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + dt_self, + old_checker, + new_checker, + check_func, + clone_func, + del_module) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree-module.html b/doc/html/api/lxml.etree-module.html new file mode 100644 index 0000000..7fdfdfb --- /dev/null +++ b/doc/html/api/lxml.etree-module.html @@ -0,0 +1,2653 @@ + + + + + lxml.etree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module etree

+The lxml.etree module implements the extended ElementTree API +for XML. + +
+

Version: + 2.2.3-68552 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + AncestorsIterator
+ AncestorsIterator(self, node, tag=None) +Iterates over the ancestors of an element (from parent to parent). +
+   + + AttributeBasedElementClassLookup
+ AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None) +Checks an attribute of an Element and looks up the value in a +class dictionary. +
+   + + C14NError
+ Error during C14N serialisation. +
+   + + CDATA
+ CDATA(data) +
+   + + CommentBase
+ All custom Comment classes must inherit from this one. +
+   + + CustomElementClassLookup
+ CustomElementClassLookup(self, fallback=None) +Element class lookup based on a subclass method. +
+   + + DTD
+ DTD(self, file=None, external_id=None) +A DTD validator. +
+   + + DTDError
+ Base class for DTD errors. +
+   + + DTDParseError
+ Error while parsing a DTD. +
+   + + DTDValidateError
+ Error while validating an XML document with a DTD. +
+   + + DocInfo
+ Document information provided by parser and DTD. +
+   + + DocumentInvalid
+ Validation error. +
+   + + ETCompatXMLParser
+ ETCompatXMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=True, remove_pis=True, strip_cdata=True, target=None, compact=True) +
+   + + ETXPath
+ ETXPath(self, path, extensions=None, regexp=True) +Special XPath class that supports the ElementTree {uri} notation for namespaces. +
+   + + ElementBase
+ ElementBase(*children, attrib=None, nsmap=None, **_extra) +
+   + + ElementChildIterator
+ ElementChildIterator(self, node, tag=None, reversed=False) +Iterates over the children of an element. +
+   + + ElementClassLookup
+ ElementClassLookup(self) +Superclass of Element class lookups. +
+   + + ElementDefaultClassLookup
+ ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None) +Element class lookup scheme that always returns the default Element +class. +
+   + + ElementDepthFirstIterator
+ ElementDepthFirstIterator(self, node, tag=None, inclusive=True) +Iterates over an element and its sub-elements in document order (depth +first pre-order). +
+   + + ElementNamespaceClassLookup
+ ElementNamespaceClassLookup(self, fallback=None) +
+   + + ElementTextIterator
+ ElementTextIterator(self, element, tag=None, with_tail=True) +Iterates over the text content of a subtree. +
+   + + EntityBase
+ All custom Entity classes must inherit from this one. +
+   + + Error +
+   + + ErrorDomains
+ Libxml2 error domains +
+   + + ErrorLevels
+ Libxml2 error levels +
+   + + ErrorTypes
+ Libxml2 error types +
+   + + FallbackElementClassLookup
+ FallbackElementClassLookup(self, fallback=None) +
+   + + HTMLParser
+ 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) +
+   + + LxmlError
+ Main exception base class for lxml. +
+   + + LxmlRegistryError
+ Base class of lxml registry errors. +
+   + + LxmlSyntaxError
+ Base class for all syntax errors. +
+   + + NamespaceRegistryError
+ Error registering a namespace extension. +
+   + + PIBase
+ All custom Processing Instruction classes must inherit from this one. +
+   + + ParseError
+ Syntax error while parsing an XML document. +
+   + + ParserBasedElementClassLookup
+ ParserBasedElementClassLookup(self, fallback=None) +Element class lookup based on the XML parser. +
+   + + ParserError
+ Internal lxml parser error. +
+   + + PyErrorLog
+ PyErrorLog(self, logger_name=None) +A global error log that connects to the Python stdlib logging package. +
+   + + PythonElementClassLookup
+ PythonElementClassLookup(self, fallback=None) +Element class lookup based on a subclass method. +
+   + + QName
+ QName(text_or_uri, tag=None) +
+   + + RelaxNG
+ RelaxNG(self, etree=None, file=None) +Turn a document into a Relax NG validator. +
+   + + RelaxNGError
+ Base class for RelaxNG errors. +
+   + + RelaxNGErrorTypes
+ Libxml2 RelaxNG error types +
+   + + RelaxNGParseError
+ Error while parsing an XML document as RelaxNG. +
+   + + RelaxNGValidateError
+ Error while validating an XML document with a RelaxNG schema. +
+   + + Resolver
+ This is the base class of all resolvers. +
+   + + Schematron
+ Schematron(self, etree=None, file=None) +A Schematron validator. +
+   + + SchematronError
+ Base class of all Schematron errors. +
+   + + SchematronParseError
+ Error while parsing an XML document as Schematron schema. +
+   + + SchematronValidateError
+ Error while validating an XML document with a Schematron schema. +
+   + + SerialisationError
+ A libxml2 error that occurred during serialisation. +
+   + + SiblingsIterator
+ SiblingsIterator(self, node, tag=None, preceding=False) +Iterates over the siblings of an element. +
+   + + TreeBuilder
+ TreeBuilder(self, element_factory=None, parser=None) +Parser target that builds a tree. +
+   + + XInclude
+ XInclude(self) +XInclude processor. +
+   + + XIncludeError
+ Error during XInclude processing. +
+   + + XMLParser
+ 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) +
+   + + XMLSchema
+ XMLSchema(self, etree=None, file=None) +Turn a document into an XML Schema validator. +
+   + + XMLSchemaError
+ Base class of all XML Schema errors +
+   + + XMLSchemaParseError
+ Error while parsing an XML document as XML Schema. +
+   + + XMLSchemaValidateError
+ Error while validating an XML document with an XML Schema. +
+   + + XMLSyntaxError
+ Syntax error while parsing an XML document. +
+   + + XPath
+ XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True) +A compiled XPath expression that can be called on Elements and ElementTrees. +
+   + + XPathDocumentEvaluator
+ XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True) +Create an XPath evaluator for an ElementTree. +
+   + + XPathElementEvaluator
+ XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True) +Create an XPath evaluator for an element. +
+   + + XPathError
+ Base class of all XPath errors. +
+   + + XPathEvalError
+ Error during XPath evaluation. +
+   + + XPathFunctionError
+ Internal error looking up an XPath extension function. +
+   + + XPathResultError
+ Error handling an XPath result. +
+   + + XPathSyntaxError +
+   + + XSLT
+ XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None) +
+   + + XSLTAccessControl
+ XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True) +
+   + + XSLTApplyError
+ Error running an XSL transformation. +
+   + + XSLTError
+ Base class of all XSLT errors. +
+   + + XSLTExtension
+ Base class of an XSLT extension element. +
+   + + XSLTExtensionError
+ Error registering an XSLT extension. +
+   + + XSLTParseError
+ Error parsing a stylesheet document. +
+   + + XSLTSaveError
+ Error serialising an XSLT result. +
+   + + _AppendOnlyElementProxy
+ A read-only element that allows adding children and changing the +text content (i.e. +
+   + + _Attrib
+ A dict-like proxy for the Element.attrib property. +
+   + + _AttribIterator
+ Attribute iterator - for internal use only! +
+   + + _BaseContext +
+   + + _BaseErrorLog +
+   + + _BaseParser +
+   + + _ClassNamespaceRegistry
+ Dictionary-like registry for namespace implementation classes +
+   + + _Comment +
+   + + _Document
+ Internal base class to reference a libxml document. +
+   + + _DomainErrorLog +
+   + + _Element
+ Element class. +
+   + + _ElementIterator +
+   + + _ElementStringResult +
+   + + _ElementTagMatcher +
+   + + _ElementTree +
+   + + _ElementUnicodeResult +
+   + + _Entity +
+   + + _ErrorLog +
+   + + _ExceptionContext +
+   + + _ExsltRegExp +
+   + + _FeedParser +
+   + + _FileReaderContext +
+   + + _FilelikeWriter +
+   + + _FunctionNamespaceRegistry +
+   + + _IDDict
+ IDDict(self, etree) +A dictionary-like proxy class that mapps ID attributes to elements. +
+   + + _InputDocument +
+   + + _IterparseContext +
+   + + _ListErrorLog
+ Immutable base version of a list based error log. +
+   + + _LogEntry +
+   + + _NamespaceRegistry
+ Dictionary-like namespace registry +
+   + + _ParserContext +
+   + + _ParserDictionaryContext +
+   + + _ParserSchemaValidationContext +
+   + + _ProcessingInstruction +
+   + + _PythonSaxParserTarget +
+   + + _ReadOnlyElementProxy
+ The main read-only Element proxy class (for internal use only!). +
+   + + _ResolverContext +
+   + + _ResolverRegistry +
+   + + _RotatingErrorLog +
+   + + _SaxParserContext
+ This class maps SAX2 events to method calls. +
+   + + _SaxParserTarget +
+   + + _TargetParserContext
+ This class maps SAX2 events to the ET parser target interface. +
+   + + _TargetParserResult +
+   + + _TempStore +
+   + + _Validator
+ Base class for XML validators. +
+   + + _XPathContext +
+   + + _XPathEvaluatorBase +
+   + + _XPathFunctionNamespaceRegistry +
+   + + _XSLTContext +
+   + + _XSLTProcessingInstruction +
+   + + _XSLTQuotedStringParam
+ A wrapper class for literal XSLT string parameters that require +quote escaping. +
+   + + _XSLTResolverContext +
+   + + _XSLTResultTree +
+   + + __ContentOnlyElement +
+   + + iterparse
+ 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) +
+   + + iterwalk
+ iterwalk(self, element_or_tree, events=("end",), tag=None) +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
Comment(text=None)
+ Comment element factory.
+ + +
+ +
+   + + + + + + +
Element(_tag, + attrib=None, + nsmap=None, + **_extra)
+ Element factory.
+ + +
+ +
+   + + + + + + +
ElementTree(element=None, + file=None, + parser=None)
+ ElementTree wrapper class.
+ + +
+ +
+   + + + + + + +
Entity(name)
+ Entity factory.
+ + +
+ +
+   + + + + + + +
Extension(module, + function_mapping=None, + ns=None)
+ Build a dictionary of extension functions from the functions +defined in a module or the methods of an object.
+ + +
+ +
+   + + + + + + +
FunctionNamespace(ns_uri)
+ Retrieve the function namespace object associated with the given +URI.
+ + +
+ +
+   + + + + + + +
HTML(text, + parser=None, + base_url=None)
+ Parses an HTML document from a string constant.
+ + +
+ +
+   + + + + + + +
PI(target, + text=None)
+ ProcessingInstruction element factory.
+ + +
+ +
+   + + + + + + +
ProcessingInstruction(target, + text=None)
+ ProcessingInstruction element factory.
+ + +
+ +
+   + + + + + + +
SubElement(_parent, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Subelement factory.
+ + +
+ +
+   + + + + + + +
XML(text, + parser=None, + base_url=None)
+ Parses an XML document or fragment from a string constant.
+ + +
+ +
+   + + + + + + +
XMLDTDID(text)
+ Parse the text and return a tuple (root node, ID dictionary).
+ + +
+ +
+   + + + + + + +
XMLID(text)
+ Parse the text and return a tuple (root node, ID dictionary).
+ + +
+ +
+   + + + + + + +
XPathEvaluator(etree_or_element, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True)
+ Creates an XPath evaluator for an ElementTree or an Element.
+ + +
+ +
+   + + + + + + +
cleanup_namespaces(tree_or_element)
+ Remove all namespace declarations from a subtree that are not used +by any of the elements or attributes in that tree.
+ + +
+ +
+   + + + + + + +
clear_error_log()
+ Clear the global error log.
+ + +
+ +
+   + + + + + + +
dump(elem, + pretty_print=True, + with_tail=True)
+ Writes an element tree or element structure to sys.stdout.
+ + +
+ +
+   + + + + + + +
fromstring(text, + parser=None, + base_url=None)
+ Parses an XML document or fragment from a string.
+ + +
+ +
+   + + + + + + +
fromstringlist(strings, + parser=None)
+ Parses an XML document from a sequence of strings.
+ + +
+ +
+   + + + + + + +
get_default_parser() + + +
+ +
+   + + + + + + +
iselement(element)
+ Checks if an object appears to be a valid element object.
+ + +
+ +
+   + + + + + + +
parse(source, + parser=None, + base_url=None)
+ Return an ElementTree object loaded with source elements.
+ + +
+ +
+   + + + + + + +
parseid(source, + parser=None)
+ Parses the source into a tuple containing an ElementTree object and an +ID dictionary.
+ + +
+ +
+   + + + + + + +
set_default_parser(parser=None)
+ Set a default parser for the current thread.
+ + +
+ +
+   + + + + + + +
set_element_class_lookup(lookup= None)
+ Set the global default element class lookup method.
+ + +
+ +
+   + + + + + + +
strip_attributes(tree_or_element, + *attribute_names)
+ Delete all attributes with the provided attribute names from an +Element (or ElementTree) and its descendants.
+ + +
+ +
+   + + + + + + +
strip_elements(tree_or_element, + with_tail=True, + *tag_names)
+ Delete all elements with the provided tag names from a tree or +subtree.
+ + +
+ +
+   + + + + + + +
strip_tags(tree_or_element, + *tag_names)
+ Delete all elements with the provided tag names from a tree or +subtree.
+ + +
+ +
+   + + + + + + +
tostring(element_or_tree, + encoding=None, + method="xml", + xml_declaration=None, + pretty_print=False, + with_tail=True, + standalone=None)
+ Serialize an element to an encoded string representation of its XML +tree.
+ + +
+ +
+   + + + + + + +
tostringlist(element_or_tree, + *args, + **kwargs)
+ Serialize an element to an encoded string representation of its XML +tree, stored in a list of partial strings.
+ + +
+ +
+   + + + + + + +
tounicode(element_or_tree, + method="xml", + pretty_print=False, + with_tail=True)
+ Serialize an element to the Python unicode representation of its XML +tree.
+ + +
+ +
+   + + + + + + +
use_global_python_log(log)
+ Replace the global error log by an etree.PyErrorLog that uses the +standard Python logging package.
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + DEBUG = 1 +
+   + + LIBXML_COMPILED_VERSION = (2, 6, 32) +
+   + + LIBXML_VERSION = (2, 6, 32) +
+   + + LIBXSLT_COMPILED_VERSION = (1, 1, 24) +
+   + + LIBXSLT_VERSION = (1, 1, 24) +
+   + + LXML_VERSION = (2, 2, 3, 68552) +
+   + + __pyx_capi__ = {'appendChild': <PyCObject object at 0x8b7a2c0>... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

Comment(text=None) +

+
  +
+ + Comment element factory. This factory function creates a special element that will +be serialized as an XML comment. +
+
+
+
+ +
+ +
+ + +
+

Element(_tag, + attrib=None, + nsmap=None, + **_extra) +

+
  +
+ +

Element factory. This function returns an object implementing the +Element interface.

+

Also look at the _Element.makeelement() and +_BaseParser.makeelement() methods, which provide a faster way to +create an Element within a specific document or parser context.

+
+
+
+
+ +
+ +
+ + +
+

Entity(name) +

+
  +
+ + Entity factory. This factory function creates a special element +that will be serialized as an XML entity reference or character +reference. Note, however, that entities will not be automatically +declared in the document. A document that uses entity references +requires a DTD to define the entities. +
+
+
+
+ +
+ +
+ + +
+

Extension(module, + function_mapping=None, + ns=None) +

+
  +
+ +

Build a dictionary of extension functions from the functions +defined in a module or the methods of an object.

+

As second argument, you can pass an additional mapping of +attribute names to XPath function names, or a list of function +names that should be taken.

+

The ns keyword argument accepts a namespace URI for the XPath +functions.

+
+
+
+
+ +
+ +
+ + +
+

FunctionNamespace(ns_uri) +

+
  +
+ +

Retrieve the function namespace object associated with the given +URI.

+

Creates a new one if it does not yet exist. A function namespace +can only be used to register extension functions.

+
+
+
+
+ +
+ +
+ + +
+

HTML(text, + parser=None, + base_url=None) +

+
  +
+ +

Parses an HTML document from a string constant. Returns the root +node (or the result returned by a parser target). This function +can be used to embed "HTML literals" in Python code.

+

To override the parser with a different HTMLParser you can pass it to +the parser keyword argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+ +
+ +
+ + +
+

PI(target, + text=None) +

+
  +
+ + ProcessingInstruction element factory. This factory function creates a +special element that will be serialized as an XML processing instruction. +
+
+
+
+ +
+ +
+ + +
+

ProcessingInstruction(target, + text=None) +

+
  +
+ + ProcessingInstruction element factory. This factory function creates a +special element that will be serialized as an XML processing instruction. +
+
+
+
+ +
+ +
+ + +
+

SubElement(_parent, + _tag, + attrib=None, + nsmap=None, + **_extra) +

+
  +
+ + Subelement factory. This function creates an element instance, and +appends it to an existing element. +
+
+
+
+ +
+ +
+ + +
+

XML(text, + parser=None, + base_url=None) +

+
  +
+ +

Parses an XML document or fragment from a string constant. +Returns the root node (or the result returned by a parser target). +This function can be used to embed "XML literals" in Python code, +like in

+
+
+>>> root = etree.XML("<root><test/></root>")
+
+

To override the parser with a different XMLParser you can pass it to +the parser keyword argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+ +
+ +
+ + +
+

XMLDTDID(text) +

+
  +
+ +

Parse the text and return a tuple (root node, ID dictionary). The root +node is the same as returned by the XML() function. The dictionary +contains string-element pairs. The dictionary keys are the values of ID +attributes as defined by the DTD. The elements referenced by the ID are +stored as dictionary values.

+

Note that you must not modify the XML tree if you use the ID dictionary. +The results are undefined.

+
+
+
+
+ +
+ +
+ + +
+

XMLID(text) +

+
  +
+ + Parse the text and return a tuple (root node, ID dictionary). The root +node is the same as returned by the XML() function. The dictionary +contains string-element pairs. The dictionary keys are the values of 'id' +attributes. The elements referenced by the ID are stored as dictionary +values. +
+
+
+
+ +
+ +
+ + +
+

XPathEvaluator(etree_or_element, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True) +

+
  +
+ +

Creates an XPath evaluator for an ElementTree or an Element.

+

The resulting object can be called with an XPath expression as argument +and XPath variables provided as keyword arguments.

+

Additional namespace declarations can be passed with the +'namespace' keyword argument. EXSLT regular expression support +can be disabled with the 'regexp' boolean keyword (defaults to +True). Smart strings will be returned for string results unless +you pass smart_strings=False.

+
+
+
+
+ +
+ +
+ + +
+

clear_error_log() +

+
  +
+ +

Clear the global error log. Note that this log is already bound to a +fixed size.

+

Note: since lxml 2.2, the global error log is local to a thread +and this function will only clear the global error log of the +current thread.

+
+
+
+
+ +
+ +
+ + +
+

dump(elem, + pretty_print=True, + with_tail=True) +

+
  +
+ + Writes an element tree or element structure to sys.stdout. This function +should be used for debugging only. +
+
+
+
+ +
+ +
+ + +
+

fromstring(text, + parser=None, + base_url=None) +

+
  +
+ +

Parses an XML document or fragment from a string. Returns the +root node (or the result returned by a parser target).

+

To override the default parser with a different parser you can pass it to +the parser keyword argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+ +
+ +
+ + +
+

fromstringlist(strings, + parser=None) +

+
  +
+ +

Parses an XML document from a sequence of strings. Returns the +root node (or the result returned by a parser target).

+

To override the default parser with a different parser you can pass it to +the parser keyword argument.

+
+
+
+
+ +
+ +
+ + +
+

parse(source, + parser=None, + base_url=None) +

+
  +
+ +

Return an ElementTree object loaded with source elements. If no parser +is provided as second argument, the default parser is used.

+

The base_url keyword allows setting a URL for the document +when parsing from a file-like object. This is needed when looking +up external entities (DTD, XInclude, ...) with relative paths.

+
+
+
+
+ +
+ +
+ + +
+

parseid(source, + parser=None) +

+
  +
+ +

Parses the source into a tuple containing an ElementTree object and an +ID dictionary. If no parser is provided as second argument, the default +parser is used.

+

Note that you must not modify the XML tree if you use the ID dictionary. +The results are undefined.

+
+
+
+
+ +
+ +
+ + +
+

set_default_parser(parser=None) +

+
  +
+ +

Set a default parser for the current thread. This parser is used +globally whenever no parser is supplied to the various parse functions of +the lxml API. If this function is called without a parser (or if it is +None), the default parser is reset to the original configuration.

+

Note that the pre-installed default parser is not thread-safe. Avoid the +default parser in multi-threaded environments. You can create a separate +parser for each thread explicitly or use a parser pool.

+
+
+
+
+ +
+ +
+ + +
+

strip_attributes(tree_or_element, + *attribute_names) +

+
  +
+ +

Delete all attributes with the provided attribute names from an +Element (or ElementTree) and its descendants.

+

Example usage:

+
+strip_attributes(root_element,
+                 'simpleattr',
+                 '{http://some/ns}attrname')
+
+
+
+
+
+ +
+ +
+ + +
+

strip_elements(tree_or_element, + with_tail=True, + *tag_names) +

+
  +
+ +

Delete all elements with the provided tag names from a tree or +subtree. This will remove the elements and their entire subtree, +including all their attributes, text content and descendants. It +will also remove the tail text of the element unless you +explicitly set the with_tail option to False.

+

Note that this will not delete the element (or ElementTree root +element) that you passed even if it matches. It will only treat +its descendants. If you want to include the root element, check +its tag name directly before even calling this function.

+

Example usage:

+
+strip_elements(some_element,
+    'simpletagname',             # non-namespaced tag
+    '{http://some/ns}tagname',   # namespaced tag
+    '{http://some/other/ns}*'    # any tag from a namespace
+    Comment                      # comments
+    )
+
+
+
+
+
+ +
+ +
+ + +
+

strip_tags(tree_or_element, + *tag_names) +

+
  +
+ +

Delete all elements with the provided tag names from a tree or +subtree. This will remove the elements and their attributes, but +not their text/tail content or descendants. Instead, it will +merge the text content and children of the element into its +parent.

+

Note that this will not delete the element (or ElementTree root +element) that you passed even if it matches. It will only treat +its descendants.

+

Example usage:

+
+strip_tags(some_element,
+    'simpletagname',             # non-namespaced tag
+    '{http://some/ns}tagname',   # namespaced tag
+    '{http://some/other/ns}*'    # any tag from a namespace
+    Comment                      # comments (including their text!)
+    )
+
+
+
+
+
+ +
+ +
+ + +
+

tostring(element_or_tree, + encoding=None, + method="xml", + xml_declaration=None, + pretty_print=False, + with_tail=True, + standalone=None) +

+
  +
+ +

Serialize an element to an encoded string representation of its XML +tree.

+

Defaults to ASCII encoding without XML declaration. This behaviour can be +configured with the keyword arguments 'encoding' (string) and +'xml_declaration' (bool). Note that changing the encoding to a non UTF-8 +compatible encoding will enable a declaration by default.

+

You can also serialise to a Unicode string without declaration by +passing the unicode function as encoding.

+

The keyword argument 'pretty_print' (bool) enables formatted XML.

+

The keyword argument 'method' selects the output method: 'xml', +'html' or plain 'text'.

+

Passing a boolean value to the standalone option will output +an XML declaration with the corresponding standalone flag.

+

You can prevent the tail text of the element from being serialised +by passing the boolean with_tail option. This has no impact +on the tail text of children, which will always be serialised.

+
+
+
+
+ +
+ +
+ + +
+

tostringlist(element_or_tree, + *args, + **kwargs) +

+
  +
+ +

Serialize an element to an encoded string representation of its XML +tree, stored in a list of partial strings.

+

This is purely for ElementTree 1.3 compatibility. The result is a +single string wrapped in a list.

+
+
+
+
+ +
+ +
+ + +
+

tounicode(element_or_tree, + method="xml", + pretty_print=False, + with_tail=True) +

+
  +
+ +

Serialize an element to the Python unicode representation of its XML +tree.

+

Note that the result does not carry an XML encoding declaration and is +therefore not necessarily suited for serialization to byte streams without +further treatment.

+

The boolean keyword argument 'pretty_print' enables formatted XML.

+

The keyword argument 'method' selects the output method: 'xml', +'html' or plain 'text'.

+

You can prevent the tail text of the element from being serialised +by passing the boolean with_tail option. This has no impact +on the tail text of children, which will always be serialised.

+
+
+

Deprecated: + use tostring(el, encoding=unicode) instead. +

+
+
+ +
+ +
+ + +
+

use_global_python_log(log) +

+
  +
+ +

Replace the global error log by an etree.PyErrorLog that uses the +standard Python logging package.

+

Note that this disables access to the global error log from exceptions. +Parsers, XSLT etc. will continue to provide their normal local error log.

+

Note: prior to lxml 2.2, this changed the error log globally. +Since lxml 2.2, the global error log is local to a thread and this +function will only set the global error log of the current thread.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

__pyx_capi__

+ +
+
+
+
Value:
+
+{'appendChild': <PyCObject object at 0x8b7a2c0>,
+ 'attributeValue': <PyCObject object at 0x8b7a170>,
+ 'attributeValueFromNsName': <PyCObject object at 0x8b7a188>,
+ 'callLookupFallback': <PyCObject object at 0x8b7a080>,
+ 'collectAttributes': <PyCObject object at 0x8b7a1d0>,
+ 'deepcopyNodeToDocument': <PyCObject object at 0x8b77f80>,
+ 'delAttribute': <PyCObject object at 0x8b7a200>,
+ 'delAttributeFromNsName': <PyCObject object at 0x8b7a218>,
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.AncestorsIterator-class.html b/doc/html/api/lxml.etree.AncestorsIterator-class.html new file mode 100644 index 0000000..4cbca6d --- /dev/null +++ b/doc/html/api/lxml.etree.AncestorsIterator-class.html @@ -0,0 +1,297 @@ + + + + + lxml.etree.AncestorsIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class AncestorsIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class AncestorsIterator

+
+        object --+        
+                 |        
+_ElementTagMatcher --+    
+                     |    
+      _ElementIterator --+
+                         |
+                        AncestorsIterator
+
+ +
+AncestorsIterator(self, node, tag=None) +Iterates over the ancestors of an element (from parent to parent). + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + node, + tag=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _ElementIterator: + __iter__, + __next__, + next +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + node, + tag=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.AttributeBasedElementClassLookup-class.html b/doc/html/api/lxml.etree.AttributeBasedElementClassLookup-class.html new file mode 100644 index 0000000..ed3b289 --- /dev/null +++ b/doc/html/api/lxml.etree.AttributeBasedElementClassLookup-class.html @@ -0,0 +1,312 @@ + + + + + lxml.etree.AttributeBasedElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class AttributeBasedElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class AttributeBasedElementClassLookup

+
+            object --+        
+                     |        
+    ElementClassLookup --+    
+                         |    
+FallbackElementClassLookup --+
+                             |
+                            AttributeBasedElementClassLookup
+
+ +
+

AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None) +Checks an attribute of an Element and looks up the value in a +class dictionary.

+
+
Arguments:
+
    +
  • attribute name - '{ns}name' style string
  • +
  • class mapping - Python dict mapping attribute values to Element classes
  • +
  • fallback - optional fallback lookup mechanism
  • +
+
+
+

A None key in the class mapping will be checked if the attribute is +missing.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + attribute_name, + class_mapping, + fallback=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from FallbackElementClassLookup: + set_fallback +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from FallbackElementClassLookup: + fallback +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + attribute_name, + class_mapping, + fallback=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.C14NError-class.html b/doc/html/api/lxml.etree.C14NError-class.html new file mode 100644 index 0000000..ae591fa --- /dev/null +++ b/doc/html/api/lxml.etree.C14NError-class.html @@ -0,0 +1,204 @@ + + + + + lxml.etree.C14NError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class C14NError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class C14NError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      C14NError
+
+ +
+Error during C14N serialisation. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.CDATA-class.html b/doc/html/api/lxml.etree.CDATA-class.html new file mode 100644 index 0000000..161f86f --- /dev/null +++ b/doc/html/api/lxml.etree.CDATA-class.html @@ -0,0 +1,290 @@ + + + + + lxml.etree.CDATA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class CDATA + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CDATA

+
+object --+
+         |
+        CDATA
+
+ +
+

CDATA(data)

+

CDATA factory. This factory creates an opaque data object that +can be used to set Element text. The usual way to use it is:

+
+>>> from lxml import etree
+>>> el = etree.Element('content')
+>>> el.text = etree.CDATA('a string')
+
+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(data)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(data) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.CommentBase-class.html b/doc/html/api/lxml.etree.CommentBase-class.html new file mode 100644 index 0000000..521d56f --- /dev/null +++ b/doc/html/api/lxml.etree.CommentBase-class.html @@ -0,0 +1,329 @@ + + + + + lxml.etree.CommentBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class CommentBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CommentBase

+
+      object --+            
+               |            
+        _Element --+        
+                   |        
+__ContentOnlyElement --+    
+                       |    
+                _Comment --+
+                           |
+                          CommentBase
+
+ +
Known Subclasses:
+
+ +
+ +
+

All custom Comment classes must inherit from this one.

+

Note that you cannot (and must not) instantiate this class or its +subclasses.

+

Subclasses must not override __init__ or __new__ as it is +absolutely undefined when these objects will be created or +destroyed. All persistent state of Comments must be stored in the +underlying XML. If you really need to initialize the object after +creation, you can implement an _init(self) method that will be +called after object creation.

+ + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Comment: + __repr__ +

+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Comment: + tag +

+

Inherited from __ContentOnlyElement: + attrib, + text +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.CustomElementClassLookup-class.html b/doc/html/api/lxml.etree.CustomElementClassLookup-class.html new file mode 100644 index 0000000..691e228 --- /dev/null +++ b/doc/html/api/lxml.etree.CustomElementClassLookup-class.html @@ -0,0 +1,291 @@ + + + + + lxml.etree.CustomElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class CustomElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CustomElementClassLookup

+
+            object --+        
+                     |        
+    ElementClassLookup --+    
+                         |    
+FallbackElementClassLookup --+
+                             |
+                            CustomElementClassLookup
+
+ +
Known Subclasses:
+
+ +
+ +
+

CustomElementClassLookup(self, fallback=None) +Element class lookup based on a subclass method.

+

You can inherit from this class and override the method:

+
+lookup(self, type, doc, namespace, name)
+
+

to lookup the element class for a node. Arguments of the method: +* type: one of 'element', 'comment', 'PI', 'entity' +* doc: document that the node is in +* namespace: namespace URI of the node (or None for comments/PIs/entities) +* name: name of the element/entity, None for comments, target for PIs

+

If you return None from this method, the fallback will be called.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
lookup(self, + type, + doc, + namespace, + name) + + +
+ +
+

Inherited from FallbackElementClassLookup: + __init__, + set_fallback +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from FallbackElementClassLookup: + fallback +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.DTD-class.html b/doc/html/api/lxml.etree.DTD-class.html new file mode 100644 index 0000000..fb30359 --- /dev/null +++ b/doc/html/api/lxml.etree.DTD-class.html @@ -0,0 +1,341 @@ + + + + + lxml.etree.DTD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class DTD + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DTD

+
+object --+    
+         |    
+_Validator --+
+             |
+            DTD
+
+ +
+

DTD(self, file=None, external_id=None) +A DTD validator.

+

Can load from filesystem directly given a filename or file-like object. +Alternatively, pass the keyword parameter external_id to load from a +catalog.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + etree)
+ Validate doc using the DTD.
+ + +
+ +
+   + + + + + + +
__init__(self, + file=None, + external_id=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Validator: + assertValid, + assert_, + validate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Validator: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + etree) +
(Call operator) +

+
  +
+ +

Validate doc using the DTD.

+

Returns true if the document is valid, false if not.

+
+
+
+
+ +
+ +
+ + +
+

__init__(self, + file=None, + external_id=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.DTDError-class.html b/doc/html/api/lxml.etree.DTDError-class.html new file mode 100644 index 0000000..c38523f --- /dev/null +++ b/doc/html/api/lxml.etree.DTDError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.DTDError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class DTDError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DTDError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      DTDError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class for DTD errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.DTDParseError-class.html b/doc/html/api/lxml.etree.DTDParseError-class.html new file mode 100644 index 0000000..21e3f7b --- /dev/null +++ b/doc/html/api/lxml.etree.DTDParseError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.DTDParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class DTDParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DTDParseError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                                DTDError --+
+                                           |
+                                          DTDParseError
+
+ +
+Error while parsing a DTD. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.DTDValidateError-class.html b/doc/html/api/lxml.etree.DTDValidateError-class.html new file mode 100644 index 0000000..9904388 --- /dev/null +++ b/doc/html/api/lxml.etree.DTDValidateError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.DTDValidateError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class DTDValidateError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DTDValidateError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                                DTDError --+
+                                           |
+                                          DTDValidateError
+
+ +
+Error while validating an XML document with a DTD. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.DocInfo-class.html b/doc/html/api/lxml.etree.DocInfo-class.html new file mode 100644 index 0000000..466cdf0 --- /dev/null +++ b/doc/html/api/lxml.etree.DocInfo-class.html @@ -0,0 +1,398 @@ + + + + + lxml.etree.DocInfo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class DocInfo + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DocInfo

+
+object --+
+         |
+        DocInfo
+
+ +
+Document information provided by parser and DTD. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + URL
+ The source URL of the document (or None if unknown). +
+   + + doctype
+ Returns a DOCTYPE declaration string for the document. +
+   + + encoding
+ Returns the encoding name as declared by the document. +
+   + + externalDTD
+ Returns a DTD validator based on the external subset of the document. +
+   + + internalDTD
+ Returns a DTD validator based on the internal subset of the document. +
+   + + public_id
+ Returns the public ID of the DOCTYPE. +
+   + + root_name
+ Returns the name of the root node as defined by the DOCTYPE. +
+   + + standalone
+ Returns the standalone flag as declared by the document. +
+   + + system_url
+ Returns the system ID of the DOCTYPE. +
+   + + xml_version
+ Returns the XML version as declared by the document. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

standalone

+ Returns the standalone flag as declared by the document. The possible +values are True (standalone='yes'), False +(standalone='no' or flag not provided in the declaration), +and None (unknown or no declaration found). Note that a +normal truth test on this value will always tell if the +standalone flag was set to 'yes' or not. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.DocumentInvalid-class.html b/doc/html/api/lxml.etree.DocumentInvalid-class.html new file mode 100644 index 0000000..76c3a73 --- /dev/null +++ b/doc/html/api/lxml.etree.DocumentInvalid-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.DocumentInvalid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class DocumentInvalid + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DocumentInvalid

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      DocumentInvalid
+
+ +
+

Validation error.

+

Raised by all document validators when their assertValid(tree) +method fails.

+ + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ETCompatXMLParser-class.html b/doc/html/api/lxml.etree.ETCompatXMLParser-class.html new file mode 100644 index 0000000..b61d631 --- /dev/null +++ b/doc/html/api/lxml.etree.ETCompatXMLParser-class.html @@ -0,0 +1,341 @@ + + + + + lxml.etree.ETCompatXMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ETCompatXMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETCompatXMLParser

+
+ object --+            
+          |            
+_BaseParser --+        
+              |        
+    _FeedParser --+    
+                  |    
+          XMLParser --+
+                      |
+                     ETCompatXMLParser
+
+ +
+

ETCompatXMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=True, remove_pis=True, strip_cdata=True, target=None, compact=True)

+

An XML parser with an ElementTree compatible default setup.

+

See the XMLParser class for details.

+

This parser has remove_comments and remove_pis enabled by default +and thus ignores comments and processing instructions.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + encoding=None, + attribute_defaults=False, + dtd_validation=False, + load_dtd=False, + no_network=True, + ns_clean=False, + recover=False, + schema=None, + remove_blank_text=False, + resolve_entities=True, + remove_comments=True, + remove_pis=True, + strip_cdata=True, + target=None, + compact=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

Inherited from _BaseParser: + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _FeedParser: + feed_error_log +

+

Inherited from _BaseParser: + error_log, + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + encoding=None, + attribute_defaults=False, + dtd_validation=False, + load_dtd=False, + no_network=True, + ns_clean=False, + recover=False, + schema=None, + remove_blank_text=False, + resolve_entities=True, + remove_comments=True, + remove_pis=True, + strip_cdata=True, + target=None, + compact=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ETXPath-class.html b/doc/html/api/lxml.etree.ETXPath-class.html new file mode 100644 index 0000000..5f54d83 --- /dev/null +++ b/doc/html/api/lxml.etree.ETXPath-class.html @@ -0,0 +1,310 @@ + + + + + lxml.etree.ETXPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ETXPath + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETXPath

+
+         object --+        
+                  |        
+_XPathEvaluatorBase --+    
+                      |    
+                  XPath --+
+                          |
+                         ETXPath
+
+ +
+

ETXPath(self, path, extensions=None, regexp=True) +Special XPath class that supports the ElementTree {uri} notation for namespaces.

+

Note that this class does not accept the namespace keyword +argument. All namespaces must be passed as part of the path +string. Smart strings will be returned for string results unless +you pass smart_strings=False.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + path, + extensions=None, + regexp=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from XPath: + __call__, + __repr__ +

+

Inherited from _XPathEvaluatorBase: + evaluate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from XPath: + path +

+

Inherited from _XPathEvaluatorBase: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + path, + extensions=None, + regexp=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementBase-class.html b/doc/html/api/lxml.etree.ElementBase-class.html new file mode 100644 index 0000000..00e1e9c --- /dev/null +++ b/doc/html/api/lxml.etree.ElementBase-class.html @@ -0,0 +1,380 @@ + + + + + lxml.etree.ElementBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementBase

+
+object --+    
+         |    
+  _Element --+
+             |
+            ElementBase
+
+ +
Known Subclasses:
+
+ +
+ +
+

ElementBase(*children, attrib=None, nsmap=None, **_extra)

+

The public Element class. All custom Element classes must inherit +from this one. To create an Element, use the Element() factory.

+

BIG FAT WARNING: Subclasses must not override __init__ or +__new__ as it is absolutely undefined when these objects will be +created or destroyed. All persistent state of Elements must be +stored in the underlying XML. If you really need to initialize +the object after creation, you can implement an _init(self) +method that will be called directly after object creation.

+

Subclasses of this class can be instantiated to create a new +Element. By default, the tag name will be the class name and the +namespace will be empty. You can modify this with the following +class attributes:

+
    +
  • TAG - the tag name, possibly containing a namespace in Clark +notation
  • +
  • NAMESPACE - the default namespace URI, unless provided as part +of the TAG attribute.
  • +
  • HTML - flag if the class is an HTML tag, as opposed to an XML +tag. This only applies to un-namespaced tags and defaults to +false (i.e. XML).
  • +
  • PARSER - the parser that provides the configuration for the +newly created document. Providing an HTML parser here will +default to creating an HTML element.
  • +
+

In user code, the latter three are commonly inherited in class +hierarchies that implement a common namespace.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(attrib=None, + nsmap=None, + *children, + **_extra)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(attrib=None, + nsmap=None, + *children, + **_extra) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementChildIterator-class.html b/doc/html/api/lxml.etree.ElementChildIterator-class.html new file mode 100644 index 0000000..bc1c654 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementChildIterator-class.html @@ -0,0 +1,299 @@ + + + + + lxml.etree.ElementChildIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementChildIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementChildIterator

+
+        object --+        
+                 |        
+_ElementTagMatcher --+    
+                     |    
+      _ElementIterator --+
+                         |
+                        ElementChildIterator
+
+ +
+ElementChildIterator(self, node, tag=None, reversed=False) +Iterates over the children of an element. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + node, + tag=None, + reversed=False)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _ElementIterator: + __iter__, + __next__, + next +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + node, + tag=None, + reversed=False) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementClassLookup-class.html b/doc/html/api/lxml.etree.ElementClassLookup-class.html new file mode 100644 index 0000000..1ad84ff --- /dev/null +++ b/doc/html/api/lxml.etree.ElementClassLookup-class.html @@ -0,0 +1,251 @@ + + + + + lxml.etree.ElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementClassLookup

+
+object --+
+         |
+        ElementClassLookup
+
+ +
Known Subclasses:
+
+ +
+ +
+ElementClassLookup(self) +Superclass of Element class lookups. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementDefaultClassLookup-class.html b/doc/html/api/lxml.etree.ElementDefaultClassLookup-class.html new file mode 100644 index 0000000..eb5cb9d --- /dev/null +++ b/doc/html/api/lxml.etree.ElementDefaultClassLookup-class.html @@ -0,0 +1,325 @@ + + + + + lxml.etree.ElementDefaultClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementDefaultClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementDefaultClassLookup

+
+        object --+    
+                 |    
+ElementClassLookup --+
+                     |
+                    ElementDefaultClassLookup
+
+ +
+

ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None) +Element class lookup scheme that always returns the default Element +class.

+

The keyword arguments element, comment, pi and entity +accept the respective Element classes.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element=None, + comment=None, + pi=None, + entity=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + comment_class +
+   + + element_class +
+   + + entity_class +
+   + + pi_class +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element=None, + comment=None, + pi=None, + entity=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementDepthFirstIterator-class.html b/doc/html/api/lxml.etree.ElementDepthFirstIterator-class.html new file mode 100644 index 0000000..a935b9a --- /dev/null +++ b/doc/html/api/lxml.etree.ElementDepthFirstIterator-class.html @@ -0,0 +1,352 @@ + + + + + lxml.etree.ElementDepthFirstIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementDepthFirstIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementDepthFirstIterator

+
+        object --+    
+                 |    
+_ElementTagMatcher --+
+                     |
+                    ElementDepthFirstIterator
+
+ +
+

ElementDepthFirstIterator(self, node, tag=None, inclusive=True) +Iterates over an element and its sub-elements in document order (depth +first pre-order).

+

Note that this also includes comments, entities and processing +instructions. To filter them out, check if the tag property +of the returned element is a string (i.e. not None and not a +factory function), or pass the Element factory for the tag +keyword.

+

If the optional tag argument is not None, the iterator returns only +the elements that match the respective name and namespace.

+

The optional boolean argument 'inclusive' defaults to True and can be set +to False to exclude the start element itself.

+

Note that the behaviour of this iterator is completely undefined if the +tree it traverses is modified during iteration.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + node, + tag=None, + inclusive=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + node, + tag=None, + inclusive=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementNamespaceClassLookup-class.html b/doc/html/api/lxml.etree.ElementNamespaceClassLookup-class.html new file mode 100644 index 0000000..92cf600 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementNamespaceClassLookup-class.html @@ -0,0 +1,336 @@ + + + + + lxml.etree.ElementNamespaceClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementNamespaceClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementNamespaceClassLookup

+
+            object --+        
+                     |        
+    ElementClassLookup --+    
+                         |    
+FallbackElementClassLookup --+
+                             |
+                            ElementNamespaceClassLookup
+
+ +
+

ElementNamespaceClassLookup(self, fallback=None)

+

Element class lookup scheme that searches the Element class in the +Namespace registry.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + fallback=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
get_namespace(self, + ns_uri)
+ Retrieve the namespace object associated with the given URI.
+ + +
+ +
+

Inherited from FallbackElementClassLookup: + set_fallback +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from FallbackElementClassLookup: + fallback +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + fallback=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

get_namespace(self, + ns_uri) +

+
  +
+ +

Retrieve the namespace object associated with the given URI.

+

Creates a new one if it does not yet exist.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ElementTextIterator-class.html b/doc/html/api/lxml.etree.ElementTextIterator-class.html new file mode 100644 index 0000000..7025966 --- /dev/null +++ b/doc/html/api/lxml.etree.ElementTextIterator-class.html @@ -0,0 +1,342 @@ + + + + + lxml.etree.ElementTextIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ElementTextIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTextIterator

+
+object --+
+         |
+        ElementTextIterator
+
+ +
+

ElementTextIterator(self, element, tag=None, with_tail=True) +Iterates over the text content of a subtree.

+

You can pass the tag keyword argument to restrict text content to a +specific tag name.

+

You can set the with_tail keyword argument to False to skip over +tail text.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element, + tag=None, + with_tail=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element, + tag=None, + with_tail=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.EntityBase-class.html b/doc/html/api/lxml.etree.EntityBase-class.html new file mode 100644 index 0000000..1606123 --- /dev/null +++ b/doc/html/api/lxml.etree.EntityBase-class.html @@ -0,0 +1,330 @@ + + + + + lxml.etree.EntityBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class EntityBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class EntityBase

+
+      object --+            
+               |            
+        _Element --+        
+                   |        
+__ContentOnlyElement --+    
+                       |    
+                 _Entity --+
+                           |
+                          EntityBase
+
+ +
Known Subclasses:
+
+ +
+ +
+

All custom Entity classes must inherit from this one.

+

Note that you cannot (and must not) instantiate this class or its +subclasses.

+

Subclasses must not override __init__ or __new__ as it is +absolutely undefined when these objects will be created or +destroyed. All persistent state of Entities must be stored in the +underlying XML. If you really need to initialize the object after +creation, you can implement an _init(self) method that will be +called after object creation.

+ + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Entity: + __repr__ +

+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Entity: + name, + tag, + text +

+

Inherited from __ContentOnlyElement: + attrib +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.Error-class.html b/doc/html/api/lxml.etree.Error-class.html new file mode 100644 index 0000000..7d5be4f --- /dev/null +++ b/doc/html/api/lxml.etree.Error-class.html @@ -0,0 +1,202 @@ + + + + + lxml.etree.Error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class Error + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Error

+
+              object --+        
+                       |        
+exceptions.BaseException --+    
+                           |    
+        exceptions.Exception --+
+                               |
+                              Error
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from exceptions.Exception: + __init__, + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ErrorDomains-class.html b/doc/html/api/lxml.etree.ErrorDomains-class.html new file mode 100644 index 0000000..15267dc --- /dev/null +++ b/doc/html/api/lxml.etree.ErrorDomains-class.html @@ -0,0 +1,435 @@ + + + + + lxml.etree.ErrorDomains + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ErrorDomains + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorDomains

+Libxml2 error domains + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + C14N = 21 +
+   + + CATALOG = 20 +
+   + + CHECK = 24 +
+   + + DATATYPE = 15 +
+   + + DTD = 4 +
+   + + FTP = 9 +
+   + + HTML = 5 +
+   + + HTTP = 10 +
+   + + I18N = 27 +
+   + + IO = 8 +
+   + + MEMORY = 6 +
+   + + MODULE = 26 +
+   + + NAMESPACE = 3 +
+   + + NONE = 0 +
+   + + OUTPUT = 7 +
+   + + PARSER = 1 +
+   + + REGEXP = 14 +
+   + + RELAXNGP = 18 +
+   + + RELAXNGV = 19 +
+   + + SCHEMASP = 16 +
+   + + SCHEMASV = 17 +
+   + + SCHEMATRONV = 28 +
+   + + TREE = 2 +
+   + + VALID = 23 +
+   + + WRITER = 25 +
+   + + XINCLUDE = 11 +
+   + + XPATH = 12 +
+   + + XPOINTER = 13 +
+   + + XSLT = 22 +
+   + + _names = {0: u'NONE', 1: u'PARSER', 2: u'TREE', 3: u'NAMESPACE... +
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_names

+ +
+
+
+
Value:
+
+{0: u'NONE',
+ 1: u'PARSER',
+ 2: u'TREE',
+ 3: u'NAMESPACE',
+ 4: u'DTD',
+ 5: u'HTML',
+ 6: u'MEMORY',
+ 7: u'OUTPUT',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ErrorLevels-class.html b/doc/html/api/lxml.etree.ErrorLevels-class.html new file mode 100644 index 0000000..df364fc --- /dev/null +++ b/doc/html/api/lxml.etree.ErrorLevels-class.html @@ -0,0 +1,207 @@ + + + + + lxml.etree.ErrorLevels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ErrorLevels + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorLevels

+Libxml2 error levels + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + ERROR = 2 +
+   + + FATAL = 3 +
+   + + NONE = 0 +
+   + + WARNING = 1 +
+   + + _names = {0: u'NONE', 1: u'WARNING', 2: u'ERROR', 3: u'FATAL'} +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ErrorTypes-class.html b/doc/html/api/lxml.etree.ErrorTypes-class.html new file mode 100644 index 0000000..884569d --- /dev/null +++ b/doc/html/api/lxml.etree.ErrorTypes-class.html @@ -0,0 +1,5363 @@ + + + + + lxml.etree.ErrorTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ErrorTypes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorTypes

+Libxml2 error types + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + C14N_CREATE_CTXT = 1950 +
+   + + C14N_CREATE_STACK = 1952 +
+   + + C14N_INVALID_NODE = 1953 +
+   + + C14N_RELATIVE_NAMESPACE = 1955 +
+   + + C14N_REQUIRES_UTF8 = 1951 +
+   + + C14N_UNKNOW_NODE = 1954 +
+   + + CATALOG_ENTRY_BROKEN = 1651 +
+   + + CATALOG_MISSING_ATTR = 1650 +
+   + + CATALOG_NOT_CATALOG = 1653 +
+   + + CATALOG_PREFER_VALUE = 1652 +
+   + + CATALOG_RECURSION = 1654 +
+   + + CHECK_ = 6005 +
+   + + CHECK_ENTITY_TYPE = 5012 +
+   + + CHECK_FOUND_ATTRIBUTE = 5001 +
+   + + CHECK_FOUND_CDATA = 5003 +
+   + + CHECK_FOUND_COMMENT = 5007 +
+   + + CHECK_FOUND_DOCTYPE = 5008 +
+   + + CHECK_FOUND_ELEMENT = 5000 +
+   + + CHECK_FOUND_ENTITY = 5005 +
+   + + CHECK_FOUND_ENTITYREF = 5004 +
+   + + CHECK_FOUND_FRAGMENT = 5009 +
+   + + CHECK_FOUND_NOTATION = 5010 +
+   + + CHECK_FOUND_PI = 5006 +
+   + + CHECK_FOUND_TEXT = 5002 +
+   + + CHECK_NAME_NOT_NULL = 5037 +
+   + + CHECK_NOT_ATTR = 5023 +
+   + + CHECK_NOT_ATTR_DECL = 5024 +
+   + + CHECK_NOT_DTD = 5022 +
+   + + CHECK_NOT_ELEM_DECL = 5025 +
+   + + CHECK_NOT_ENTITY_DECL = 5026 +
+   + + CHECK_NOT_NCNAME = 5034 +
+   + + CHECK_NOT_NS_DECL = 5027 +
+   + + CHECK_NOT_UTF8 = 5032 +
+   + + CHECK_NO_DICT = 5033 +
+   + + CHECK_NO_DOC = 5014 +
+   + + CHECK_NO_ELEM = 5016 +
+   + + CHECK_NO_HREF = 5028 +
+   + + CHECK_NO_NAME = 5015 +
+   + + CHECK_NO_NEXT = 5020 +
+   + + CHECK_NO_PARENT = 5013 +
+   + + CHECK_NO_PREV = 5018 +
+   + + CHECK_NS_ANCESTOR = 5031 +
+   + + CHECK_NS_SCOPE = 5030 +
+   + + CHECK_OUTSIDE_DICT = 5035 +
+   + + CHECK_UNKNOWN_NODE = 5011 +
+   + + CHECK_WRONG_DOC = 5017 +
+   + + CHECK_WRONG_NAME = 5036 +
+   + + CHECK_WRONG_NEXT = 5021 +
+   + + CHECK_WRONG_PARENT = 5029 +
+   + + CHECK_WRONG_PREV = 5019 +
+   + + CHECK_X = 6006 +
+   + + DTD_ATTRIBUTE_DEFAULT = 500 +
+   + + DTD_ATTRIBUTE_REDEFINED = 501 +
+   + + DTD_ATTRIBUTE_VALUE = 502 +
+   + + DTD_CONTENT_ERROR = 503 +
+   + + DTD_CONTENT_MODEL = 504 +
+   + + DTD_CONTENT_NOT_DETERMINIST = 505 +
+   + + DTD_DIFFERENT_PREFIX = 506 +
+   + + DTD_DUP_TOKEN = 541 +
+   + + DTD_ELEM_DEFAULT_NAMESPACE = 507 +
+   + + DTD_ELEM_NAMESPACE = 508 +
+   + + DTD_ELEM_REDEFINED = 509 +
+   + + DTD_EMPTY_NOTATION = 510 +
+   + + DTD_ENTITY_TYPE = 511 +
+   + + DTD_ID_FIXED = 512 +
+   + + DTD_ID_REDEFINED = 513 +
+   + + DTD_ID_SUBSET = 514 +
+   + + DTD_INVALID_CHILD = 515 +
+   + + DTD_INVALID_DEFAULT = 516 +
+   + + DTD_LOAD_ERROR = 517 +
+   + + DTD_MISSING_ATTRIBUTE = 518 +
+   + + DTD_MIXED_CORRUPT = 519 +
+   + + DTD_MULTIPLE_ID = 520 +
+   + + DTD_NOTATION_REDEFINED = 526 +
+   + + DTD_NOTATION_VALUE = 527 +
+   + + DTD_NOT_EMPTY = 528 +
+   + + DTD_NOT_PCDATA = 529 +
+   + + DTD_NOT_STANDALONE = 530 +
+   + + DTD_NO_DOC = 521 +
+   + + DTD_NO_DTD = 522 +
+   + + DTD_NO_ELEM_NAME = 523 +
+   + + DTD_NO_PREFIX = 524 +
+   + + DTD_NO_ROOT = 525 +
+   + + DTD_ROOT_NAME = 531 +
+   + + DTD_STANDALONE_DEFAULTED = 538 +
+   + + DTD_STANDALONE_WHITE_SPACE = 532 +
+   + + DTD_UNKNOWN_ATTRIBUTE = 533 +
+   + + DTD_UNKNOWN_ELEM = 534 +
+   + + DTD_UNKNOWN_ENTITY = 535 +
+   + + DTD_UNKNOWN_ID = 536 +
+   + + DTD_UNKNOWN_NOTATION = 537 +
+   + + DTD_XMLID_TYPE = 540 +
+   + + DTD_XMLID_VALUE = 539 +
+   + + ERR_ATTLIST_NOT_FINISHED = 51 +
+   + + ERR_ATTLIST_NOT_STARTED = 50 +
+   + + ERR_ATTRIBUTE_NOT_FINISHED = 40 +
+   + + ERR_ATTRIBUTE_NOT_STARTED = 39 +
+   + + ERR_ATTRIBUTE_REDEFINED = 42 +
+   + + ERR_ATTRIBUTE_WITHOUT_VALUE = 41 +
+   + + ERR_CDATA_NOT_FINISHED = 63 +
+   + + ERR_CHARREF_AT_EOF = 10 +
+   + + ERR_CHARREF_IN_DTD = 13 +
+   + + ERR_CHARREF_IN_EPILOG = 12 +
+   + + ERR_CHARREF_IN_PROLOG = 11 +
+   + + ERR_COMMENT_NOT_FINISHED = 45 +
+   + + ERR_CONDSEC_INVALID = 83 +
+   + + ERR_CONDSEC_INVALID_KEYWORD = 95 +
+   + + ERR_CONDSEC_NOT_FINISHED = 59 +
+   + + ERR_CONDSEC_NOT_STARTED = 58 +
+   + + ERR_DOCTYPE_NOT_FINISHED = 61 +
+   + + ERR_DOCUMENT_EMPTY = 4 +
+   + + ERR_DOCUMENT_END = 5 +
+   + + ERR_DOCUMENT_START = 3 +
+   + + ERR_ELEMCONTENT_NOT_FINISHED = 55 +
+   + + ERR_ELEMCONTENT_NOT_STARTED = 54 +
+   + + ERR_ENCODING_NAME = 79 +
+   + + ERR_ENTITYREF_AT_EOF = 14 +
+   + + ERR_ENTITYREF_IN_DTD = 17 +
+   + + ERR_ENTITYREF_IN_EPILOG = 16 +
+   + + ERR_ENTITYREF_IN_PROLOG = 15 +
+   + + ERR_ENTITYREF_NO_NAME = 22 +
+   + + ERR_ENTITYREF_SEMICOL_MISSING = 23 +
+   + + ERR_ENTITY_BOUNDARY = 90 +
+   + + ERR_ENTITY_CHAR_ERROR = 87 +
+   + + ERR_ENTITY_IS_EXTERNAL = 29 +
+   + + ERR_ENTITY_IS_PARAMETER = 30 +
+   + + ERR_ENTITY_LOOP = 89 +
+   + + ERR_ENTITY_NOT_FINISHED = 37 +
+   + + ERR_ENTITY_NOT_STARTED = 36 +
+   + + ERR_ENTITY_PE_INTERNAL = 88 +
+   + + ERR_ENTITY_PROCESSING = 104 +
+   + + ERR_EQUAL_REQUIRED = 75 +
+   + + ERR_EXTRA_CONTENT = 86 +
+   + + ERR_EXT_ENTITY_STANDALONE = 82 +
+   + + ERR_EXT_SUBSET_NOT_FINISHED = 60 +
+   + + ERR_GT_REQUIRED = 73 +
+   + + ERR_HYPHEN_IN_COMMENT = 80 +
+   + + ERR_INTERNAL_ERROR = 1 +
+   + + ERR_INVALID_CHAR = 9 +
+   + + ERR_INVALID_CHARREF = 8 +
+   + + ERR_INVALID_DEC_CHARREF = 7 +
+   + + ERR_INVALID_ENCODING = 81 +
+   + + ERR_INVALID_HEX_CHARREF = 6 +
+   + + ERR_INVALID_URI = 91 +
+   + + ERR_LITERAL_NOT_FINISHED = 44 +
+   + + ERR_LITERAL_NOT_STARTED = 43 +
+   + + ERR_LTSLASH_REQUIRED = 74 +
+   + + ERR_LT_IN_ATTRIBUTE = 38 +
+   + + ERR_LT_REQUIRED = 72 +
+   + + ERR_MISPLACED_CDATA_END = 62 +
+   + + ERR_MISSING_ENCODING = 101 +
+   + + ERR_MIXED_NOT_FINISHED = 53 +
+   + + ERR_MIXED_NOT_STARTED = 52 +
+   + + ERR_NAME_REQUIRED = 68 +
+   + + ERR_NMTOKEN_REQUIRED = 67 +
+   + + ERR_NOTATION_NOT_FINISHED = 49 +
+   + + ERR_NOTATION_NOT_STARTED = 48 +
+   + + ERR_NOTATION_PROCESSING = 105 +
+   + + ERR_NOT_STANDALONE = 103 +
+   + + ERR_NOT_WELL_BALANCED = 85 +
+   + + ERR_NO_DTD = 94 +
+   + + ERR_NO_MEMORY = 2 +
+   + + ERR_NS_DECL_ERROR = 35 +
+   + + ERR_OK = 0 +
+   + + ERR_PCDATA_REQUIRED = 69 +
+   + + ERR_PEREF_AT_EOF = 18 +
+   + + ERR_PEREF_IN_EPILOG = 20 +
+   + + ERR_PEREF_IN_INT_SUBSET = 21 +
+   + + ERR_PEREF_IN_PROLOG = 19 +
+   + + ERR_PEREF_NO_NAME = 24 +
+   + + ERR_PEREF_SEMICOL_MISSING = 25 +
+   + + ERR_PI_NOT_FINISHED = 47 +
+   + + ERR_PI_NOT_STARTED = 46 +
+   + + ERR_PUBID_REQUIRED = 71 +
+   + + ERR_RESERVED_XML_NAME = 64 +
+   + + ERR_SEPARATOR_REQUIRED = 66 +
+   + + ERR_SPACE_REQUIRED = 65 +
+   + + ERR_STANDALONE_VALUE = 78 +
+   + + ERR_STRING_NOT_CLOSED = 34 +
+   + + ERR_STRING_NOT_STARTED = 33 +
+   + + ERR_TAG_NAME_MISMATCH = 76 +
+   + + ERR_TAG_NOT_FINISHED = 77 +
+   + + ERR_UNDECLARED_ENTITY = 26 +
+   + + ERR_UNKNOWN_ENCODING = 31 +
+   + + ERR_UNKNOWN_VERSION = 108 +
+   + + ERR_UNPARSED_ENTITY = 28 +
+   + + ERR_UNSUPPORTED_ENCODING = 32 +
+   + + ERR_URI_FRAGMENT = 92 +
+   + + ERR_URI_REQUIRED = 70 +
+   + + ERR_VALUE_REQUIRED = 84 +
+   + + ERR_VERSION_MISMATCH = 109 +
+   + + ERR_VERSION_MISSING = 96 +
+   + + ERR_XMLDECL_NOT_FINISHED = 57 +
+   + + ERR_XMLDECL_NOT_STARTED = 56 +
+   + + FTP_ACCNT = 2002 +
+   + + FTP_EPSV_ANSWER = 2001 +
+   + + FTP_PASV_ANSWER = 2000 +
+   + + FTP_URL_SYNTAX = 2003 +
+   + + HTML_STRUCURE_ERROR = 800 +
+   + + HTML_UNKNOWN_TAG = 801 +
+   + + HTTP_UNKNOWN_HOST = 2022 +
+   + + HTTP_URL_SYNTAX = 2020 +
+   + + HTTP_USE_IP = 2021 +
+   + + I18N_CONV_FAILED = 6003 +
+   + + I18N_EXCESS_HANDLER = 6002 +
+   + + I18N_NO_HANDLER = 6001 +
+   + + I18N_NO_NAME = 6000 +
+   + + I18N_NO_OUTPUT = 6004 +
+   + + IO_BUFFER_FULL = 1548 +
+   + + IO_EACCES = 1501 +
+   + + IO_EADDRINUSE = 1554 +
+   + + IO_EAFNOSUPPORT = 1556 +
+   + + IO_EAGAIN = 1502 +
+   + + IO_EALREADY = 1555 +
+   + + IO_EBADF = 1503 +
+   + + IO_EBADMSG = 1504 +
+   + + IO_EBUSY = 1505 +
+   + + IO_ECANCELED = 1506 +
+   + + IO_ECHILD = 1507 +
+   + + IO_ECONNREFUSED = 1552 +
+   + + IO_EDEADLK = 1508 +
+   + + IO_EDOM = 1509 +
+   + + IO_EEXIST = 1510 +
+   + + IO_EFAULT = 1511 +
+   + + IO_EFBIG = 1512 +
+   + + IO_EINPROGRESS = 1513 +
+   + + IO_EINTR = 1514 +
+   + + IO_EINVAL = 1515 +
+   + + IO_EIO = 1516 +
+   + + IO_EISCONN = 1551 +
+   + + IO_EISDIR = 1517 +
+   + + IO_EMFILE = 1518 +
+   + + IO_EMLINK = 1519 +
+   + + IO_EMSGSIZE = 1520 +
+   + + IO_ENAMETOOLONG = 1521 +
+   + + IO_ENCODER = 1544 +
+   + + IO_ENETUNREACH = 1553 +
+   + + IO_ENFILE = 1522 +
+   + + IO_ENODEV = 1523 +
+   + + IO_ENOENT = 1524 +
+   + + IO_ENOEXEC = 1525 +
+   + + IO_ENOLCK = 1526 +
+   + + IO_ENOMEM = 1527 +
+   + + IO_ENOSPC = 1528 +
+   + + IO_ENOSYS = 1529 +
+   + + IO_ENOTDIR = 1530 +
+   + + IO_ENOTEMPTY = 1531 +
+   + + IO_ENOTSOCK = 1550 +
+   + + IO_ENOTSUP = 1532 +
+   + + IO_ENOTTY = 1533 +
+   + + IO_ENXIO = 1534 +
+   + + IO_EPERM = 1535 +
+   + + IO_EPIPE = 1536 +
+   + + IO_ERANGE = 1537 +
+   + + IO_EROFS = 1538 +
+   + + IO_ESPIPE = 1539 +
+   + + IO_ESRCH = 1540 +
+   + + IO_ETIMEDOUT = 1541 +
+   + + IO_EXDEV = 1542 +
+   + + IO_FLUSH = 1545 +
+   + + IO_LOAD_ERROR = 1549 +
+   + + IO_NETWORK_ATTEMPT = 1543 +
+   + + IO_NO_INPUT = 1547 +
+   + + IO_UNKNOWN = 1500 +
+   + + IO_WRITE = 1546 +
+   + + MODULE_CLOSE = 4901 +
+   + + MODULE_OPEN = 4900 +
+   + + NS_ERR_ATTRIBUTE_REDEFINED = 203 +
+   + + NS_ERR_COLON = 205 +
+   + + NS_ERR_EMPTY = 204 +
+   + + NS_ERR_QNAME = 202 +
+   + + NS_ERR_UNDEFINED_NAMESPACE = 201 +
+   + + NS_ERR_XML_NAMESPACE = 200 +
+   + + REGEXP_COMPILE_ERROR = 1450 +
+   + + RNGP_ANYNAME_ATTR_ANCESTOR = 1000 +
+   + + RNGP_ATTRIBUTE_CHILDREN = 1002 +
+   + + RNGP_ATTRIBUTE_CONTENT = 1003 +
+   + + RNGP_ATTRIBUTE_EMPTY = 1004 +
+   + + RNGP_ATTRIBUTE_NOOP = 1005 +
+   + + RNGP_ATTR_CONFLICT = 1001 +
+   + + RNGP_CHOICE_CONTENT = 1006 +
+   + + RNGP_CHOICE_EMPTY = 1007 +
+   + + RNGP_CREATE_FAILURE = 1008 +
+   + + RNGP_DATA_CONTENT = 1009 +
+   + + RNGP_DEFINE_CREATE_FAILED = 1011 +
+   + + RNGP_DEFINE_EMPTY = 1012 +
+   + + RNGP_DEFINE_MISSING = 1013 +
+   + + RNGP_DEFINE_NAME_MISSING = 1014 +
+   + + RNGP_DEF_CHOICE_AND_INTERLEAVE = 1010 +
+   + + RNGP_ELEMENT_CONTENT = 1018 +
+   + + RNGP_ELEMENT_EMPTY = 1017 +
+   + + RNGP_ELEMENT_NAME = 1019 +
+   + + RNGP_ELEMENT_NO_CONTENT = 1020 +
+   + + RNGP_ELEM_CONTENT_EMPTY = 1015 +
+   + + RNGP_ELEM_CONTENT_ERROR = 1016 +
+   + + RNGP_ELEM_TEXT_CONFLICT = 1021 +
+   + + RNGP_EMPTY = 1022 +
+   + + RNGP_EMPTY_CONSTRUCT = 1023 +
+   + + RNGP_EMPTY_CONTENT = 1024 +
+   + + RNGP_EMPTY_NOT_EMPTY = 1025 +
+   + + RNGP_ERROR_TYPE_LIB = 1026 +
+   + + RNGP_EXCEPT_EMPTY = 1027 +
+   + + RNGP_EXCEPT_MISSING = 1028 +
+   + + RNGP_EXCEPT_MULTIPLE = 1029 +
+   + + RNGP_EXCEPT_NO_CONTENT = 1030 +
+   + + RNGP_EXTERNALREF_EMTPY = 1031 +
+   + + RNGP_EXTERNALREF_RECURSE = 1033 +
+   + + RNGP_EXTERNAL_REF_FAILURE = 1032 +
+   + + RNGP_FORBIDDEN_ATTRIBUTE = 1034 +
+   + + RNGP_FOREIGN_ELEMENT = 1035 +
+   + + RNGP_GRAMMAR_CONTENT = 1036 +
+   + + RNGP_GRAMMAR_EMPTY = 1037 +
+   + + RNGP_GRAMMAR_MISSING = 1038 +
+   + + RNGP_GRAMMAR_NO_START = 1039 +
+   + + RNGP_GROUP_ATTR_CONFLICT = 1040 +
+   + + RNGP_HREF_ERROR = 1041 +
+   + + RNGP_INCLUDE_EMPTY = 1042 +
+   + + RNGP_INCLUDE_FAILURE = 1043 +
+   + + RNGP_INCLUDE_RECURSE = 1044 +
+   + + RNGP_INTERLEAVE_ADD = 1045 +
+   + + RNGP_INTERLEAVE_CREATE_FAILED = 1046 +
+   + + RNGP_INTERLEAVE_EMPTY = 1047 +
+   + + RNGP_INTERLEAVE_NO_CONTENT = 1048 +
+   + + RNGP_INVALID_DEFINE_NAME = 1049 +
+   + + RNGP_INVALID_URI = 1050 +
+   + + RNGP_INVALID_VALUE = 1051 +
+   + + RNGP_MISSING_HREF = 1052 +
+   + + RNGP_NAME_MISSING = 1053 +
+   + + RNGP_NEED_COMBINE = 1054 +
+   + + RNGP_NOTALLOWED_NOT_EMPTY = 1055 +
+   + + RNGP_NSNAME_ATTR_ANCESTOR = 1056 +
+   + + RNGP_NSNAME_NO_NS = 1057 +
+   + + RNGP_PARAM_FORBIDDEN = 1058 +
+   + + RNGP_PARAM_NAME_MISSING = 1059 +
+   + + RNGP_PARENTREF_CREATE_FAILED = 1060 +
+   + + RNGP_PARENTREF_NAME_INVALID = 1061 +
+   + + RNGP_PARENTREF_NOT_EMPTY = 1064 +
+   + + RNGP_PARENTREF_NO_NAME = 1062 +
+   + + RNGP_PARENTREF_NO_PARENT = 1063 +
+   + + RNGP_PARSE_ERROR = 1065 +
+   + + RNGP_PAT_ANYNAME_EXCEPT_ANYNAME = 1066 +
+   + + RNGP_PAT_ATTR_ATTR = 1067 +
+   + + RNGP_PAT_ATTR_ELEM = 1068 +
+   + + RNGP_PAT_DATA_EXCEPT_ATTR = 1069 +
+   + + RNGP_PAT_DATA_EXCEPT_ELEM = 1070 +
+   + + RNGP_PAT_DATA_EXCEPT_EMPTY = 1071 +
+   + + RNGP_PAT_DATA_EXCEPT_GROUP = 1072 +
+   + + RNGP_PAT_DATA_EXCEPT_INTERLEAVE = 1073 +
+   + + RNGP_PAT_DATA_EXCEPT_LIST = 1074 +
+   + + RNGP_PAT_DATA_EXCEPT_ONEMORE = 1075 +
+   + + RNGP_PAT_DATA_EXCEPT_REF = 1076 +
+   + + RNGP_PAT_DATA_EXCEPT_TEXT = 1077 +
+   + + RNGP_PAT_LIST_ATTR = 1078 +
+   + + RNGP_PAT_LIST_ELEM = 1079 +
+   + + RNGP_PAT_LIST_INTERLEAVE = 1080 +
+   + + RNGP_PAT_LIST_LIST = 1081 +
+   + + RNGP_PAT_LIST_REF = 1082 +
+   + + RNGP_PAT_LIST_TEXT = 1083 +
+   + + RNGP_PAT_NSNAME_EXCEPT_ANYNAME = 1084 +
+   + + RNGP_PAT_NSNAME_EXCEPT_NSNAME = 1085 +
+   + + RNGP_PAT_ONEMORE_GROUP_ATTR = 1086 +
+   + + RNGP_PAT_ONEMORE_INTERLEAVE_ATTR = 1087 +
+   + + RNGP_PAT_START_ATTR = 1088 +
+   + + RNGP_PAT_START_DATA = 1089 +
+   + + RNGP_PAT_START_EMPTY = 1090 +
+   + + RNGP_PAT_START_GROUP = 1091 +
+   + + RNGP_PAT_START_INTERLEAVE = 1092 +
+   + + RNGP_PAT_START_LIST = 1093 +
+   + + RNGP_PAT_START_ONEMORE = 1094 +
+   + + RNGP_PAT_START_TEXT = 1095 +
+   + + RNGP_PAT_START_VALUE = 1096 +
+   + + RNGP_PREFIX_UNDEFINED = 1097 +
+   + + RNGP_REF_CREATE_FAILED = 1098 +
+   + + RNGP_REF_CYCLE = 1099 +
+   + + RNGP_REF_NAME_INVALID = 1100 +
+   + + RNGP_REF_NOT_EMPTY = 1103 +
+   + + RNGP_REF_NO_DEF = 1101 +
+   + + RNGP_REF_NO_NAME = 1102 +
+   + + RNGP_START_CHOICE_AND_INTERLEAVE = 1104 +
+   + + RNGP_START_CONTENT = 1105 +
+   + + RNGP_START_EMPTY = 1106 +
+   + + RNGP_START_MISSING = 1107 +
+   + + RNGP_TEXT_EXPECTED = 1108 +
+   + + RNGP_TEXT_HAS_CHILD = 1109 +
+   + + RNGP_TYPE_MISSING = 1110 +
+   + + RNGP_TYPE_NOT_FOUND = 1111 +
+   + + RNGP_TYPE_VALUE = 1112 +
+   + + RNGP_UNKNOWN_ATTRIBUTE = 1113 +
+   + + RNGP_UNKNOWN_COMBINE = 1114 +
+   + + RNGP_UNKNOWN_CONSTRUCT = 1115 +
+   + + RNGP_UNKNOWN_TYPE_LIB = 1116 +
+   + + RNGP_URI_FRAGMENT = 1117 +
+   + + RNGP_URI_NOT_ABSOLUTE = 1118 +
+   + + RNGP_VALUE_EMPTY = 1119 +
+   + + RNGP_VALUE_NO_CONTENT = 1120 +
+   + + RNGP_XMLNS_NAME = 1121 +
+   + + RNGP_XML_NS = 1122 +
+   + + SAVE_CHAR_INVALID = 1401 +
+   + + SAVE_NOT_UTF8 = 1400 +
+   + + SAVE_NO_DOCTYPE = 1402 +
+   + + SAVE_UNKNOWN_ENCODING = 1403 +
+   + + SCHEMAP_AG_PROPS_CORRECT = 3087 +
+   + + SCHEMAP_ATTRFORMDEFAULT_VALUE = 1701 +
+   + + SCHEMAP_ATTRGRP_NONAME_NOREF = 1702 +
+   + + SCHEMAP_ATTR_NONAME_NOREF = 1703 +
+   + + SCHEMAP_AU_PROPS_CORRECT = 3089 +
+   + + SCHEMAP_AU_PROPS_CORRECT_2 = 3078 +
+   + + SCHEMAP_A_PROPS_CORRECT_2 = 3079 +
+   + + SCHEMAP_A_PROPS_CORRECT_3 = 3090 +
+   + + SCHEMAP_COMPLEXTYPE_NONAME_NOREF = 1704 +
+   + + SCHEMAP_COS_ALL_LIMITED = 3091 +
+   + + SCHEMAP_COS_CT_EXTENDS_1_1 = 3063 +
+   + + SCHEMAP_COS_CT_EXTENDS_1_2 = 3088 +
+   + + SCHEMAP_COS_CT_EXTENDS_1_3 = 1800 +
+   + + SCHEMAP_COS_ST_DERIVED_OK_2_1 = 3031 +
+   + + SCHEMAP_COS_ST_DERIVED_OK_2_2 = 3032 +
+   + + SCHEMAP_COS_ST_RESTRICTS_1_1 = 3011 +
+   + + SCHEMAP_COS_ST_RESTRICTS_1_2 = 3012 +
+   + + SCHEMAP_COS_ST_RESTRICTS_1_3_1 = 3013 +
+   + + SCHEMAP_COS_ST_RESTRICTS_1_3_2 = 3014 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_1 = 3015 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 = 3016 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 = 3017 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 = 3018 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 = 3019 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 = 3020 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 = 3021 +
+   + + SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 = 3022 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_1 = 3023 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_1 = 3024 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 = 3025 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 = 3027 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 = 3026 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 = 3028 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 = 3029 +
+   + + SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 = 3030 +
+   + + SCHEMAP_COS_VALID_DEFAULT_1 = 3058 +
+   + + SCHEMAP_COS_VALID_DEFAULT_2_1 = 3059 +
+   + + SCHEMAP_COS_VALID_DEFAULT_2_2_1 = 3060 +
+   + + SCHEMAP_COS_VALID_DEFAULT_2_2_2 = 3061 +
+   + + SCHEMAP_CT_PROPS_CORRECT_1 = 1782 +
+   + + SCHEMAP_CT_PROPS_CORRECT_2 = 1783 +
+   + + SCHEMAP_CT_PROPS_CORRECT_3 = 1784 +
+   + + SCHEMAP_CT_PROPS_CORRECT_4 = 1785 +
+   + + SCHEMAP_CT_PROPS_CORRECT_5 = 1786 +
+   + + SCHEMAP_CVC_SIMPLE_TYPE = 3062 +
+   + + SCHEMAP_C_PROPS_CORRECT = 3080 +
+   + + SCHEMAP_DEF_AND_PREFIX = 1768 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_1 = 1787 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 = 1788 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 = 1789 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 = 3077 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 = 1790 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_3 = 1791 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 = 1797 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 = 1798 +
+   + + SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 = 1799 +
+   + + SCHEMAP_ELEMFORMDEFAULT_VALUE = 1705 +
+   + + SCHEMAP_ELEM_DEFAULT_FIXED = 1755 +
+   + + SCHEMAP_ELEM_NONAME_NOREF = 1706 +
+   + + SCHEMAP_EXTENSION_NO_BASE = 1707 +
+   + + SCHEMAP_E_PROPS_CORRECT_2 = 3045 +
+   + + SCHEMAP_E_PROPS_CORRECT_3 = 3046 +
+   + + SCHEMAP_E_PROPS_CORRECT_4 = 3047 +
+   + + SCHEMAP_E_PROPS_CORRECT_5 = 3048 +
+   + + SCHEMAP_E_PROPS_CORRECT_6 = 3049 +
+   + + SCHEMAP_FACET_NO_VALUE = 1708 +
+   + + SCHEMAP_FAILED_BUILD_IMPORT = 1709 +
+   + + SCHEMAP_FAILED_LOAD = 1757 +
+   + + SCHEMAP_FAILED_PARSE = 1766 +
+   + + SCHEMAP_GROUP_NONAME_NOREF = 1710 +
+   + + SCHEMAP_IMPORT_NAMESPACE_NOT_URI = 1711 +
+   + + SCHEMAP_IMPORT_REDEFINE_NSNAME = 1712 +
+   + + SCHEMAP_IMPORT_SCHEMA_NOT_URI = 1713 +
+   + + SCHEMAP_INCLUDE_SCHEMA_NOT_URI = 1770 +
+   + + SCHEMAP_INCLUDE_SCHEMA_NO_URI = 1771 +
+   + + SCHEMAP_INTERNAL = 3069 +
+   + + SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE = 1793 +
+   + + SCHEMAP_INVALID_ATTR_COMBINATION = 1777 +
+   + + SCHEMAP_INVALID_ATTR_INLINE_COMBINATION = 1778 +
+   + + SCHEMAP_INVALID_ATTR_NAME = 1780 +
+   + + SCHEMAP_INVALID_ATTR_USE = 1774 +
+   + + SCHEMAP_INVALID_BOOLEAN = 1714 +
+   + + SCHEMAP_INVALID_ENUM = 1715 +
+   + + SCHEMAP_INVALID_FACET = 1716 +
+   + + SCHEMAP_INVALID_FACET_VALUE = 1717 +
+   + + SCHEMAP_INVALID_MAXOCCURS = 1718 +
+   + + SCHEMAP_INVALID_MINOCCURS = 1719 +
+   + + SCHEMAP_INVALID_REF_AND_SUBTYPE = 1720 +
+   + + SCHEMAP_INVALID_WHITE_SPACE = 1721 +
+   + + SCHEMAP_MG_PROPS_CORRECT_1 = 3074 +
+   + + SCHEMAP_MG_PROPS_CORRECT_2 = 3075 +
+   + + SCHEMAP_MISSING_SIMPLETYPE_CHILD = 1779 +
+   + + SCHEMAP_NOATTR_NOREF = 1722 +
+   + + SCHEMAP_NOROOT = 1759 +
+   + + SCHEMAP_NOTATION_NO_NAME = 1723 +
+   + + SCHEMAP_NOTHING_TO_PARSE = 1758 +
+   + + SCHEMAP_NOTYPE_NOREF = 1724 +
+   + + SCHEMAP_NOT_DETERMINISTIC = 3070 +
+   + + SCHEMAP_NOT_SCHEMA = 1772 +
+   + + SCHEMAP_NO_XMLNS = 3056 +
+   + + SCHEMAP_NO_XSI = 3057 +
+   + + SCHEMAP_PREFIX_UNDEFINED = 1700 +
+   + + SCHEMAP_P_PROPS_CORRECT_1 = 3042 +
+   + + SCHEMAP_P_PROPS_CORRECT_2_1 = 3043 +
+   + + SCHEMAP_P_PROPS_CORRECT_2_2 = 3044 +
+   + + SCHEMAP_RECURSIVE = 1775 +
+   + + SCHEMAP_REDEFINED_ATTR = 1764 +
+   + + SCHEMAP_REDEFINED_ATTRGROUP = 1763 +
+   + + SCHEMAP_REDEFINED_ELEMENT = 1762 +
+   + + SCHEMAP_REDEFINED_GROUP = 1760 +
+   + + SCHEMAP_REDEFINED_NOTATION = 1765 +
+   + + SCHEMAP_REDEFINED_TYPE = 1761 +
+   + + SCHEMAP_REF_AND_CONTENT = 1781 +
+   + + SCHEMAP_REF_AND_SUBTYPE = 1725 +
+   + + SCHEMAP_REGEXP_INVALID = 1756 +
+   + + SCHEMAP_RESTRICTION_NONAME_NOREF = 1726 +
+   + + SCHEMAP_S4S_ATTR_INVALID_VALUE = 3037 +
+   + + SCHEMAP_S4S_ATTR_MISSING = 3036 +
+   + + SCHEMAP_S4S_ATTR_NOT_ALLOWED = 3035 +
+   + + SCHEMAP_S4S_ELEM_MISSING = 3034 +
+   + + SCHEMAP_S4S_ELEM_NOT_ALLOWED = 3033 +
+   + + SCHEMAP_SIMPLETYPE_NONAME = 1727 +
+   + + SCHEMAP_SRC_ATTRIBUTE_1 = 3051 +
+   + + SCHEMAP_SRC_ATTRIBUTE_2 = 3052 +
+   + + SCHEMAP_SRC_ATTRIBUTE_3_1 = 3053 +
+   + + SCHEMAP_SRC_ATTRIBUTE_3_2 = 3054 +
+   + + SCHEMAP_SRC_ATTRIBUTE_4 = 3055 +
+   + + SCHEMAP_SRC_ATTRIBUTE_GROUP_1 = 3071 +
+   + + SCHEMAP_SRC_ATTRIBUTE_GROUP_2 = 3072 +
+   + + SCHEMAP_SRC_ATTRIBUTE_GROUP_3 = 3073 +
+   + + SCHEMAP_SRC_CT_1 = 3076 +
+   + + SCHEMAP_SRC_ELEMENT_1 = 3038 +
+   + + SCHEMAP_SRC_ELEMENT_2_1 = 3039 +
+   + + SCHEMAP_SRC_ELEMENT_2_2 = 3040 +
+   + + SCHEMAP_SRC_ELEMENT_3 = 3041 +
+   + + SCHEMAP_SRC_IMPORT = 3082 +
+   + + SCHEMAP_SRC_IMPORT_1_1 = 3064 +
+   + + SCHEMAP_SRC_IMPORT_1_2 = 3065 +
+   + + SCHEMAP_SRC_IMPORT_2 = 3066 +
+   + + SCHEMAP_SRC_IMPORT_2_1 = 3067 +
+   + + SCHEMAP_SRC_IMPORT_2_2 = 3068 +
+   + + SCHEMAP_SRC_IMPORT_3_1 = 1795 +
+   + + SCHEMAP_SRC_IMPORT_3_2 = 1796 +
+   + + SCHEMAP_SRC_INCLUDE = 3050 +
+   + + SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE = 3006 +
+   + + SCHEMAP_SRC_REDEFINE = 3081 +
+   + + SCHEMAP_SRC_RESOLVE = 3004 +
+   + + SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE = 3005 +
+   + + SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000 +
+   + + SCHEMAP_SRC_SIMPLE_TYPE_2 = 3001 +
+   + + SCHEMAP_SRC_SIMPLE_TYPE_3 = 3002 +
+   + + SCHEMAP_SRC_SIMPLE_TYPE_4 = 3003 +
+   + + SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES = 3007 +
+   + + SCHEMAP_ST_PROPS_CORRECT_1 = 3008 +
+   + + SCHEMAP_ST_PROPS_CORRECT_2 = 3009 +
+   + + SCHEMAP_ST_PROPS_CORRECT_3 = 3010 +
+   + + SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE = 1776 +
+   + + SCHEMAP_TYPE_AND_SUBTYPE = 1728 +
+   + + SCHEMAP_UNION_NOT_EXPRESSIBLE = 1794 +
+   + + SCHEMAP_UNKNOWN_ALL_CHILD = 1729 +
+   + + SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD = 1730 +
+   + + SCHEMAP_UNKNOWN_ATTRGRP_CHILD = 1732 +
+   + + SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP = 1733 +
+   + + SCHEMAP_UNKNOWN_ATTR_CHILD = 1731 +
+   + + SCHEMAP_UNKNOWN_BASE_TYPE = 1734 +
+   + + SCHEMAP_UNKNOWN_CHOICE_CHILD = 1735 +
+   + + SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD = 1736 +
+   + + SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD = 1737 +
+   + + SCHEMAP_UNKNOWN_ELEM_CHILD = 1738 +
+   + + SCHEMAP_UNKNOWN_EXTENSION_CHILD = 1739 +
+   + + SCHEMAP_UNKNOWN_FACET_CHILD = 1740 +
+   + + SCHEMAP_UNKNOWN_FACET_TYPE = 1741 +
+   + + SCHEMAP_UNKNOWN_GROUP_CHILD = 1742 +
+   + + SCHEMAP_UNKNOWN_IMPORT_CHILD = 1743 +
+   + + SCHEMAP_UNKNOWN_INCLUDE_CHILD = 1769 +
+   + + SCHEMAP_UNKNOWN_LIST_CHILD = 1744 +
+   + + SCHEMAP_UNKNOWN_MEMBER_TYPE = 1773 +
+   + + SCHEMAP_UNKNOWN_NOTATION_CHILD = 1745 +
+   + + SCHEMAP_UNKNOWN_PREFIX = 1767 +
+   + + SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD = 1746 +
+   + + SCHEMAP_UNKNOWN_REF = 1747 +
+   + + SCHEMAP_UNKNOWN_RESTRICTION_CHILD = 1748 +
+   + + SCHEMAP_UNKNOWN_SCHEMAS_CHILD = 1749 +
+   + + SCHEMAP_UNKNOWN_SEQUENCE_CHILD = 1750 +
+   + + SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD = 1751 +
+   + + SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD = 1752 +
+   + + SCHEMAP_UNKNOWN_TYPE = 1753 +
+   + + SCHEMAP_UNKNOWN_UNION_CHILD = 1754 +
+   + + SCHEMAP_WARN_ATTR_POINTLESS_PROH = 3086 +
+   + + SCHEMAP_WARN_ATTR_REDECL_PROH = 3085 +
+   + + SCHEMAP_WARN_SKIP_SCHEMA = 3083 +
+   + + SCHEMAP_WARN_UNLOCATED_SCHEMA = 3084 +
+   + + SCHEMAP_WILDCARD_INVALID_NS_MEMBER = 1792 +
+   + + SCHEMATRONV_ASSERT = 4000 +
+   + + SCHEMATRONV_REPORT = 4001 +
+   + + SCHEMAV_ATTRINVALID = 1821 +
+   + + SCHEMAV_ATTRUNKNOWN = 1820 +
+   + + SCHEMAV_CONSTRUCT = 1817 +
+   + + SCHEMAV_CVC_ATTRIBUTE_1 = 1861 +
+   + + SCHEMAV_CVC_ATTRIBUTE_2 = 1862 +
+   + + SCHEMAV_CVC_ATTRIBUTE_3 = 1863 +
+   + + SCHEMAV_CVC_ATTRIBUTE_4 = 1864 +
+   + + SCHEMAV_CVC_AU = 1874 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_1 = 1873 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_2_1 = 1841 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_2_2 = 1842 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_2_3 = 1843 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_2_4 = 1844 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_3_1 = 1865 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 = 1866 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 = 1867 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_4 = 1868 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_5_1 = 1869 +
+   + + SCHEMAV_CVC_COMPLEX_TYPE_5_2 = 1870 +
+   + + SCHEMAV_CVC_DATATYPE_VALID_1_2_1 = 1824 +
+   + + SCHEMAV_CVC_DATATYPE_VALID_1_2_2 = 1825 +
+   + + SCHEMAV_CVC_DATATYPE_VALID_1_2_3 = 1826 +
+   + + SCHEMAV_CVC_ELT_1 = 1845 +
+   + + SCHEMAV_CVC_ELT_2 = 1846 +
+   + + SCHEMAV_CVC_ELT_3_1 = 1847 +
+   + + SCHEMAV_CVC_ELT_3_2_1 = 1848 +
+   + + SCHEMAV_CVC_ELT_3_2_2 = 1849 +
+   + + SCHEMAV_CVC_ELT_4_1 = 1850 +
+   + + SCHEMAV_CVC_ELT_4_2 = 1851 +
+   + + SCHEMAV_CVC_ELT_4_3 = 1852 +
+   + + SCHEMAV_CVC_ELT_5_1_1 = 1853 +
+   + + SCHEMAV_CVC_ELT_5_1_2 = 1854 +
+   + + SCHEMAV_CVC_ELT_5_2_1 = 1855 +
+   + + SCHEMAV_CVC_ELT_5_2_2_1 = 1856 +
+   + + SCHEMAV_CVC_ELT_5_2_2_2_1 = 1857 +
+   + + SCHEMAV_CVC_ELT_5_2_2_2_2 = 1858 +
+   + + SCHEMAV_CVC_ELT_6 = 1859 +
+   + + SCHEMAV_CVC_ELT_7 = 1860 +
+   + + SCHEMAV_CVC_ENUMERATION_VALID = 1840 +
+   + + SCHEMAV_CVC_FACET_VALID = 1829 +
+   + + SCHEMAV_CVC_FRACTIONDIGITS_VALID = 1838 +
+   + + SCHEMAV_CVC_IDC = 1877 +
+   + + SCHEMAV_CVC_LENGTH_VALID = 1830 +
+   + + SCHEMAV_CVC_MAXEXCLUSIVE_VALID = 1836 +
+   + + SCHEMAV_CVC_MAXINCLUSIVE_VALID = 1834 +
+   + + SCHEMAV_CVC_MAXLENGTH_VALID = 1832 +
+   + + SCHEMAV_CVC_MINEXCLUSIVE_VALID = 1835 +
+   + + SCHEMAV_CVC_MININCLUSIVE_VALID = 1833 +
+   + + SCHEMAV_CVC_MINLENGTH_VALID = 1831 +
+   + + SCHEMAV_CVC_PATTERN_VALID = 1839 +
+   + + SCHEMAV_CVC_TOTALDIGITS_VALID = 1837 +
+   + + SCHEMAV_CVC_TYPE_1 = 1875 +
+   + + SCHEMAV_CVC_TYPE_2 = 1876 +
+   + + SCHEMAV_CVC_TYPE_3_1_1 = 1827 +
+   + + SCHEMAV_CVC_TYPE_3_1_2 = 1828 +
+   + + SCHEMAV_CVC_WILDCARD = 1878 +
+   + + SCHEMAV_DOCUMENT_ELEMENT_MISSING = 1872 +
+   + + SCHEMAV_ELEMCONT = 1810 +
+   + + SCHEMAV_ELEMENT_CONTENT = 1871 +
+   + + SCHEMAV_EXTRACONTENT = 1813 +
+   + + SCHEMAV_FACET = 1823 +
+   + + SCHEMAV_HAVEDEFAULT = 1811 +
+   + + SCHEMAV_INTERNAL = 1818 +
+   + + SCHEMAV_INVALIDATTR = 1814 +
+   + + SCHEMAV_INVALIDELEM = 1815 +
+   + + SCHEMAV_ISABSTRACT = 1808 +
+   + + SCHEMAV_MISC = 1879 +
+   + + SCHEMAV_MISSING = 1804 +
+   + + SCHEMAV_NOROLLBACK = 1807 +
+   + + SCHEMAV_NOROOT = 1801 +
+   + + SCHEMAV_NOTDETERMINIST = 1816 +
+   + + SCHEMAV_NOTEMPTY = 1809 +
+   + + SCHEMAV_NOTNILLABLE = 1812 +
+   + + SCHEMAV_NOTSIMPLE = 1819 +
+   + + SCHEMAV_NOTTOPLEVEL = 1803 +
+   + + SCHEMAV_NOTYPE = 1806 +
+   + + SCHEMAV_UNDECLAREDELEM = 1802 +
+   + + SCHEMAV_VALUE = 1822 +
+   + + SCHEMAV_WRONGELEM = 1805 +
+   + + TREE_INVALID_DEC = 1301 +
+   + + TREE_INVALID_HEX = 1300 +
+   + + TREE_NOT_UTF8 = 1303 +
+   + + TREE_UNTERMINATED_ENTITY = 1302 +
+   + + WAR_CATALOG_PI = 93 +
+   + + WAR_ENTITY_REDEFINED = 107 +
+   + + WAR_LANG_VALUE = 98 +
+   + + WAR_NS_COLUMN = 106 +
+   + + WAR_NS_URI = 99 +
+   + + WAR_NS_URI_RELATIVE = 100 +
+   + + WAR_SPACE_VALUE = 102 +
+   + + WAR_UNDECLARED_ENTITY = 27 +
+   + + WAR_UNKNOWN_VERSION = 97 +
+   + + XINCLUDE_BUILD_FAILED = 1609 +
+   + + XINCLUDE_DEPRECATED_NS = 1617 +
+   + + XINCLUDE_ENTITY_DEF_MISMATCH = 1602 +
+   + + XINCLUDE_FALLBACKS_IN_INCLUDE = 1615 +
+   + + XINCLUDE_FALLBACK_NOT_IN_INCLUDE = 1616 +
+   + + XINCLUDE_FRAGMENT_ID = 1618 +
+   + + XINCLUDE_HREF_URI = 1605 +
+   + + XINCLUDE_INCLUDE_IN_INCLUDE = 1614 +
+   + + XINCLUDE_INVALID_CHAR = 1608 +
+   + + XINCLUDE_MULTIPLE_ROOT = 1611 +
+   + + XINCLUDE_NO_FALLBACK = 1604 +
+   + + XINCLUDE_NO_HREF = 1603 +
+   + + XINCLUDE_PARSE_VALUE = 1601 +
+   + + XINCLUDE_RECURSION = 1600 +
+   + + XINCLUDE_TEXT_DOCUMENT = 1607 +
+   + + XINCLUDE_TEXT_FRAGMENT = 1606 +
+   + + XINCLUDE_UNKNOWN_ENCODING = 1610 +
+   + + XINCLUDE_XPTR_FAILED = 1612 +
+   + + XINCLUDE_XPTR_RESULT = 1613 +
+   + + XPATH_ENCODING_ERROR = 1220 +
+   + + XPATH_EXPRESSION_OK = 1200 +
+   + + XPATH_EXPR_ERROR = 1207 +
+   + + XPATH_INVALID_ARITY = 1212 +
+   + + XPATH_INVALID_CHAR_ERROR = 1221 +
+   + + XPATH_INVALID_CTXT_POSITION = 1214 +
+   + + XPATH_INVALID_CTXT_SIZE = 1213 +
+   + + XPATH_INVALID_OPERAND = 1210 +
+   + + XPATH_INVALID_PREDICATE_ERROR = 1206 +
+   + + XPATH_INVALID_TYPE = 1211 +
+   + + XPATH_MEMORY_ERROR = 1215 +
+   + + XPATH_NUMBER_ERROR = 1201 +
+   + + XPATH_START_LITERAL_ERROR = 1203 +
+   + + XPATH_UNCLOSED_ERROR = 1208 +
+   + + XPATH_UNDEF_PREFIX_ERROR = 1219 +
+   + + XPATH_UNDEF_VARIABLE_ERROR = 1205 +
+   + + XPATH_UNFINISHED_LITERAL_ERROR = 1202 +
+   + + XPATH_UNKNOWN_FUNC_ERROR = 1209 +
+   + + XPATH_VARIABLE_REF_ERROR = 1204 +
+   + + XPTR_CHILDSEQ_START = 1901 +
+   + + XPTR_EVAL_FAILED = 1902 +
+   + + XPTR_EXTRA_OBJECTS = 1903 +
+   + + XPTR_RESOURCE_ERROR = 1217 +
+   + + XPTR_SUB_RESOURCE_ERROR = 1218 +
+   + + XPTR_SYNTAX_ERROR = 1216 +
+   + + XPTR_UNKNOWN_SCHEME = 1900 +
+   + + _names = {0: u'ERR_OK', 1: u'ERR_INTERNAL_ERROR', 2: u'ERR_NO_... +
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_names

+ +
+
+
+
Value:
+
+{0: u'ERR_OK',
+ 1: u'ERR_INTERNAL_ERROR',
+ 2: u'ERR_NO_MEMORY',
+ 3: u'ERR_DOCUMENT_START',
+ 4: u'ERR_DOCUMENT_EMPTY',
+ 5: u'ERR_DOCUMENT_END',
+ 6: u'ERR_INVALID_HEX_CHARREF',
+ 7: u'ERR_INVALID_DEC_CHARREF',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.FallbackElementClassLookup-class.html b/doc/html/api/lxml.etree.FallbackElementClassLookup-class.html new file mode 100644 index 0000000..e237c1f --- /dev/null +++ b/doc/html/api/lxml.etree.FallbackElementClassLookup-class.html @@ -0,0 +1,319 @@ + + + + + lxml.etree.FallbackElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class FallbackElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FallbackElementClassLookup

+
+        object --+    
+                 |    
+ElementClassLookup --+
+                     |
+                    FallbackElementClassLookup
+
+ +
Known Subclasses:
+
+ +
+ +
+

FallbackElementClassLookup(self, fallback=None)

+

Superclass of Element class lookups with additional fallback.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + fallback=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
set_fallback(self, + lookup)
+ Sets the fallback scheme for this lookup method.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + fallback +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + fallback=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.HTMLParser-class.html b/doc/html/api/lxml.etree.HTMLParser-class.html new file mode 100644 index 0000000..c34878f --- /dev/null +++ b/doc/html/api/lxml.etree.HTMLParser-class.html @@ -0,0 +1,354 @@ + + + + + lxml.etree.HTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class HTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HTMLParser

+
+ object --+        
+          |        
+_BaseParser --+    
+              |    
+    _FeedParser --+
+                  |
+                 HTMLParser
+
+ +
Known Subclasses:
+
+ +
+ +
+

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)

+

The HTML parser.

+

This parser allows reading HTML into a normal XML tree. By +default, it can read broken (non well-formed) HTML, depending on +the capabilities of libxml2. Use the 'recover' option to switch +this off.

+

Available boolean keyword arguments:

+
    +
  • recover - try hard to parse through broken HTML (default: True)
  • +
  • no_network - prevent network access for related files (default: True)
  • +
  • remove_blank_text - discard empty text nodes
  • +
  • remove_comments - discard comments
  • +
  • remove_pis - discard processing instructions
  • +
  • strip_cdata - replace CDATA sections by normal text content (default: True)
  • +
  • compact - safe memory for short text content (default: True)
  • +
+

Other keyword arguments:

+
    +
  • encoding - override the document encoding
  • +
  • target - a parser target object that will receive the parse events
  • +
  • schema - an XMLSchema to validate against
  • +
+

Note that you should avoid sharing parsers between threads for performance +reasons.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__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)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

Inherited from _BaseParser: + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _FeedParser: + feed_error_log +

+

Inherited from _BaseParser: + error_log, + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__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) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.LxmlError-class.html b/doc/html/api/lxml.etree.LxmlError-class.html new file mode 100644 index 0000000..694f8ba --- /dev/null +++ b/doc/html/api/lxml.etree.LxmlError-class.html @@ -0,0 +1,266 @@ + + + + + lxml.etree.LxmlError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class LxmlError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LxmlError

+
+              object --+            
+                       |            
+exceptions.BaseException --+        
+                           |        
+        exceptions.Exception --+    
+                               |    
+                           Error --+
+                                   |
+                                  LxmlError
+
+ +
Known Subclasses:
+
+ +
+ +
+Main exception base class for lxml. All other exceptions inherit from +this one. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.LxmlRegistryError-class.html b/doc/html/api/lxml.etree.LxmlRegistryError-class.html new file mode 100644 index 0000000..eaa3d7d --- /dev/null +++ b/doc/html/api/lxml.etree.LxmlRegistryError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.LxmlRegistryError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class LxmlRegistryError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LxmlRegistryError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      LxmlRegistryError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class of lxml registry errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.LxmlSyntaxError-class.html b/doc/html/api/lxml.etree.LxmlSyntaxError-class.html new file mode 100644 index 0000000..09287b6 --- /dev/null +++ b/doc/html/api/lxml.etree.LxmlSyntaxError-class.html @@ -0,0 +1,228 @@ + + + + + lxml.etree.LxmlSyntaxError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class LxmlSyntaxError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LxmlSyntaxError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+              object --+               |
+                       |               |
+exceptions.BaseException --+           |
+                           |           |
+        exceptions.Exception --+       |
+                               |       |
+        exceptions.StandardError --+   |
+                                   |   |
+              exceptions.SyntaxError --+
+                                       |
+                                      LxmlSyntaxError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class for all syntax errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.SyntaxError: + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.NamespaceRegistryError-class.html b/doc/html/api/lxml.etree.NamespaceRegistryError-class.html new file mode 100644 index 0000000..5cee087 --- /dev/null +++ b/doc/html/api/lxml.etree.NamespaceRegistryError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.NamespaceRegistryError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class NamespaceRegistryError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class NamespaceRegistryError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                       LxmlRegistryError --+
+                                           |
+                                          NamespaceRegistryError
+
+ +
+Error registering a namespace extension. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.PIBase-class.html b/doc/html/api/lxml.etree.PIBase-class.html new file mode 100644 index 0000000..ce16bb2 --- /dev/null +++ b/doc/html/api/lxml.etree.PIBase-class.html @@ -0,0 +1,330 @@ + + + + + lxml.etree.PIBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class PIBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class PIBase

+
+      object --+            
+               |            
+        _Element --+        
+                   |        
+__ContentOnlyElement --+    
+                       |    
+  _ProcessingInstruction --+
+                           |
+                          PIBase
+
+ +
Known Subclasses:
+
+ +
+ +
+

All custom Processing Instruction classes must inherit from this one.

+

Note that you cannot (and must not) instantiate this class or its +subclasses.

+

Subclasses must not override __init__ or __new__ as it is +absolutely undefined when these objects will be created or +destroyed. All persistent state of PIs must be stored in the +underlying XML. If you really need to initialize the object after +creation, you can implement an _init(self) method that will be +called after object creation.

+ + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _ProcessingInstruction: + __repr__ +

+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _ProcessingInstruction: + tag, + target +

+

Inherited from __ContentOnlyElement: + attrib, + text +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ParseError-class.html b/doc/html/api/lxml.etree.ParseError-class.html new file mode 100644 index 0000000..faa6a4e --- /dev/null +++ b/doc/html/api/lxml.etree.ParseError-class.html @@ -0,0 +1,231 @@ + + + + + lxml.etree.ParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParseError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+              object --+               |    
+                       |               |    
+exceptions.BaseException --+           |    
+                           |           |    
+        exceptions.Exception --+       |    
+                               |       |    
+        exceptions.StandardError --+   |    
+                                   |   |    
+              exceptions.SyntaxError --+    
+                                       |    
+                         LxmlSyntaxError --+
+                                           |
+                                          ParseError
+
+ +
Known Subclasses:
+
+ +
+ +
+

Syntax error while parsing an XML document.

+

For compatibility with ElementTree 1.3 and later.

+ + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.SyntaxError: + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ParserBasedElementClassLookup-class.html b/doc/html/api/lxml.etree.ParserBasedElementClassLookup-class.html new file mode 100644 index 0000000..79014c0 --- /dev/null +++ b/doc/html/api/lxml.etree.ParserBasedElementClassLookup-class.html @@ -0,0 +1,255 @@ + + + + + lxml.etree.ParserBasedElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ParserBasedElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParserBasedElementClassLookup

+
+            object --+        
+                     |        
+    ElementClassLookup --+    
+                         |    
+FallbackElementClassLookup --+
+                             |
+                            ParserBasedElementClassLookup
+
+ +
+ParserBasedElementClassLookup(self, fallback=None) +Element class lookup based on the XML parser. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from FallbackElementClassLookup: + __init__, + set_fallback +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from FallbackElementClassLookup: + fallback +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.ParserError-class.html b/doc/html/api/lxml.etree.ParserError-class.html new file mode 100644 index 0000000..a00468b --- /dev/null +++ b/doc/html/api/lxml.etree.ParserError-class.html @@ -0,0 +1,204 @@ + + + + + lxml.etree.ParserError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class ParserError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParserError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      ParserError
+
+ +
+Internal lxml parser error. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.PyErrorLog-class.html b/doc/html/api/lxml.etree.PyErrorLog-class.html new file mode 100644 index 0000000..01babf7 --- /dev/null +++ b/doc/html/api/lxml.etree.PyErrorLog-class.html @@ -0,0 +1,444 @@ + + + + + lxml.etree.PyErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class PyErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class PyErrorLog

+
+   object --+    
+            |    
+_BaseErrorLog --+
+                |
+               PyErrorLog
+
+ +
+

PyErrorLog(self, logger_name=None) +A global error log that connects to the Python stdlib logging package.

+

The constructor accepts an optional logger name.

+

If you want to change the mapping between libxml2's ErrorLevels and Python +logging levels, you can modify the level_map dictionary from a subclass.

+

The default mapping is:

+
+ErrorLevels.WARNING = logging.WARNING
+ErrorLevels.ERROR   = logging.ERROR
+ErrorLevels.FATAL   = logging.CRITICAL
+
+

You can also override the method receive() that takes a LogEntry +object and calls self.log(log_entry, format_string, arg1, arg2, ...) +with appropriate data.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + logger_name=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
copy(...)
+ Dummy method that returns an empty error log.
+ + +
+ +
+   + + + + + + +
log(self, + log_entry, + message, + *args)
+ Called by the .receive() method to log a _LogEntry instance to +the Python logging system.
+ + +
+ +
+   + + + + + + +
receive(self, + log_entry)
+ Receive a _LogEntry instance from the logging system.
+ + +
+ +
+

Inherited from _BaseErrorLog: + __repr__ +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + level_map +
+

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + logger_name=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

copy(...) +

+
  +
+ + Dummy method that returns an empty error log. +
+
Overrides: + _BaseErrorLog.copy +
+
+
+
+ +
+ +
+ + +
+

log(self, + log_entry, + message, + *args) +

+
  +
+ +

Called by the .receive() method to log a _LogEntry instance to +the Python logging system. This handles the error level +mapping.

+

In the default implementation, the message argument +receives a complete log line, and there are no further +args. To change the message format, it is best to +override the .receive() method instead of this one.

+
+
+
+
+ +
+ +
+ + +
+

receive(self, + log_entry) +

+
  +
+ +

Receive a _LogEntry instance from the logging system. Calls +the .log() method with appropriate parameters:

+
+self.log(log_entry, repr(log_entry))
+
+

You can override this method to provide your own log output +format.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.PythonElementClassLookup-class.html b/doc/html/api/lxml.etree.PythonElementClassLookup-class.html new file mode 100644 index 0000000..fbecbbe --- /dev/null +++ b/doc/html/api/lxml.etree.PythonElementClassLookup-class.html @@ -0,0 +1,308 @@ + + + + + lxml.etree.PythonElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class PythonElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class PythonElementClassLookup

+
+            object --+        
+                     |        
+    ElementClassLookup --+    
+                         |    
+FallbackElementClassLookup --+
+                             |
+                            PythonElementClassLookup
+
+ +
+

PythonElementClassLookup(self, fallback=None) +Element class lookup based on a subclass method.

+

This class lookup scheme allows access to the entire XML tree in +read-only mode. To use it, re-implement the lookup(self, doc, +root) method in a subclass:

+
+>>> from lxml import etree, pyclasslookup
+>>>
+>>> class MyElementClass(etree.ElementBase):
+...     honkey = True
+...
+>>> class MyLookup(pyclasslookup.PythonElementClassLookup):
+...     def lookup(self, doc, root):
+...         if root.tag == "sometag":
+...             return MyElementClass
+...         else:
+...             for child in root:
+...                 if child.tag == "someothertag":
+...                     return MyElementClass
+...         # delegate to default
+...         return None
+
+

If you return None from this method, the fallback will be called.

+

The first argument is the opaque document instance that contains +the Element. The second argument is a lightweight Element proxy +implementation that is only valid during the lookup. Do not try +to keep a reference to it. Once the lookup is done, the proxy +will be invalid.

+

Also, you cannot wrap such a read-only Element in an ElementTree, +and you must take care not to keep a reference to them outside of +the lookup() method.

+

Note that the API of the Element objects is not complete. It is +purely read-only and does not support all features of the normal +lxml.etree API (such as XPath, extended slicing or some +iteration methods).

+

See http://codespeak.net/lxml/element_classes.html

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
lookup(self, + doc, + element)
+ Override this method to implement your own lookup scheme.
+ + +
+ +
+

Inherited from FallbackElementClassLookup: + __init__, + set_fallback +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from FallbackElementClassLookup: + fallback +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.QName-class.html b/doc/html/api/lxml.etree.QName-class.html new file mode 100644 index 0000000..b401e04 --- /dev/null +++ b/doc/html/api/lxml.etree.QName-class.html @@ -0,0 +1,503 @@ + + + + + lxml.etree.QName + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class QName + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class QName

+
+object --+
+         |
+        QName
+
+ +
+

QName(text_or_uri, tag=None)

+

QName wrapper for qualified XML names.

+

Pass a tag name by itself or a namespace URI and a tag name to +create a qualified name.

+

The text property holds the qualified name in +{namespace}tagname notation. The namespace and +localname properties hold the respective parts of the tag +name.

+

You can pass QName objects wherever a tag name is expected. Also, +setting Element text from a QName will resolve the namespace +prefix and set a qualified text value.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__hash__(x)
+ hash(x)
+ + +
+ +
+   + + + + + + +
__init__(text_or_uri, + tag=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + localname +
+   + + namespace +
+   + + text +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__hash__(x) +
(Hashing function) +

+
  +
+ + hash(x) +
+
Overrides: + object.__hash__ +
+
+
+
+ +
+ +
+ + +
+

__init__(text_or_uri, + tag=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.RelaxNG-class.html b/doc/html/api/lxml.etree.RelaxNG-class.html new file mode 100644 index 0000000..441293e --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNG-class.html @@ -0,0 +1,340 @@ + + + + + lxml.etree.RelaxNG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class RelaxNG + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNG

+
+object --+    
+         |    
+_Validator --+
+             |
+            RelaxNG
+
+ +
+

RelaxNG(self, etree=None, file=None) +Turn a document into a Relax NG validator.

+

Either pass a schema as Element or ElementTree, or pass a file or +filename through the file keyword argument.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + etree)
+ Validate doc using Relax NG.
+ + +
+ +
+   + + + + + + +
__init__(self, + etree=None, + file=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Validator: + assertValid, + assert_, + validate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Validator: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + etree) +
(Call operator) +

+
  +
+ +

Validate doc using Relax NG.

+

Returns true if document is valid, false if not.

+
+
+
+
+ +
+ +
+ + +
+

__init__(self, + etree=None, + file=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.RelaxNGError-class.html b/doc/html/api/lxml.etree.RelaxNGError-class.html new file mode 100644 index 0000000..06e1ccf --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.RelaxNGError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class RelaxNGError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNGError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      RelaxNGError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class for RelaxNG errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.RelaxNGErrorTypes-class.html b/doc/html/api/lxml.etree.RelaxNGErrorTypes-class.html new file mode 100644 index 0000000..3a2d568 --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGErrorTypes-class.html @@ -0,0 +1,512 @@ + + + + + lxml.etree.RelaxNGErrorTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class RelaxNGErrorTypes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNGErrorTypes

+Libxml2 RelaxNG error types + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ D[k] if k in D, else d + + + + + + +
_getName(D, + k, + d=...)
+ d defaults to None.
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + RELAXNG_ERR_ATTREXTRANS = 20 +
+   + + RELAXNG_ERR_ATTRNAME = 14 +
+   + + RELAXNG_ERR_ATTRNONS = 16 +
+   + + RELAXNG_ERR_ATTRVALID = 24 +
+   + + RELAXNG_ERR_ATTRWRONGNS = 18 +
+   + + RELAXNG_ERR_CONTENTVALID = 25 +
+   + + RELAXNG_ERR_DATAELEM = 28 +
+   + + RELAXNG_ERR_DATATYPE = 31 +
+   + + RELAXNG_ERR_DUPID = 4 +
+   + + RELAXNG_ERR_ELEMEXTRANS = 19 +
+   + + RELAXNG_ERR_ELEMNAME = 13 +
+   + + RELAXNG_ERR_ELEMNONS = 15 +
+   + + RELAXNG_ERR_ELEMNOTEMPTY = 21 +
+   + + RELAXNG_ERR_ELEMWRONG = 38 +
+   + + RELAXNG_ERR_ELEMWRONGNS = 17 +
+   + + RELAXNG_ERR_EXTRACONTENT = 26 +
+   + + RELAXNG_ERR_EXTRADATA = 35 +
+   + + RELAXNG_ERR_INTEREXTRA = 12 +
+   + + RELAXNG_ERR_INTERNAL = 37 +
+   + + RELAXNG_ERR_INTERNODATA = 10 +
+   + + RELAXNG_ERR_INTERSEQ = 11 +
+   + + RELAXNG_ERR_INVALIDATTR = 27 +
+   + + RELAXNG_ERR_LACKDATA = 36 +
+   + + RELAXNG_ERR_LIST = 33 +
+   + + RELAXNG_ERR_LISTELEM = 30 +
+   + + RELAXNG_ERR_LISTEMPTY = 9 +
+   + + RELAXNG_ERR_LISTEXTRA = 8 +
+   + + RELAXNG_ERR_MEMORY = 1 +
+   + + RELAXNG_ERR_NODEFINE = 7 +
+   + + RELAXNG_ERR_NOELEM = 22 +
+   + + RELAXNG_ERR_NOGRAMMAR = 34 +
+   + + RELAXNG_ERR_NOSTATE = 6 +
+   + + RELAXNG_ERR_NOTELEM = 23 +
+   + + RELAXNG_ERR_TEXTWRONG = 39 +
+   + + RELAXNG_ERR_TYPE = 2 +
+   + + RELAXNG_ERR_TYPECMP = 5 +
+   + + RELAXNG_ERR_TYPEVAL = 3 +
+   + + RELAXNG_ERR_VALELEM = 29 +
+   + + RELAXNG_ERR_VALUE = 32 +
+   + + RELAXNG_OK = 0 +
+   + + _names = {0: u'RELAXNG_OK', 1: u'RELAXNG_ERR_MEMORY', 2: u'REL... +
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_names

+ +
+
+
+
Value:
+
+{0: u'RELAXNG_OK',
+ 1: u'RELAXNG_ERR_MEMORY',
+ 2: u'RELAXNG_ERR_TYPE',
+ 3: u'RELAXNG_ERR_TYPEVAL',
+ 4: u'RELAXNG_ERR_DUPID',
+ 5: u'RELAXNG_ERR_TYPECMP',
+ 6: u'RELAXNG_ERR_NOSTATE',
+ 7: u'RELAXNG_ERR_NODEFINE',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.RelaxNGParseError-class.html b/doc/html/api/lxml.etree.RelaxNGParseError-class.html new file mode 100644 index 0000000..0a998a4 --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGParseError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.RelaxNGParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class RelaxNGParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNGParseError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                            RelaxNGError --+
+                                           |
+                                          RelaxNGParseError
+
+ +
+Error while parsing an XML document as RelaxNG. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.RelaxNGValidateError-class.html b/doc/html/api/lxml.etree.RelaxNGValidateError-class.html new file mode 100644 index 0000000..127cb6d --- /dev/null +++ b/doc/html/api/lxml.etree.RelaxNGValidateError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.RelaxNGValidateError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class RelaxNGValidateError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RelaxNGValidateError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                            RelaxNGError --+
+                                           |
+                                          RelaxNGValidateError
+
+ +
+Error while validating an XML document with a RelaxNG schema. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.Resolver-class.html b/doc/html/api/lxml.etree.Resolver-class.html new file mode 100644 index 0000000..173c841 --- /dev/null +++ b/doc/html/api/lxml.etree.Resolver-class.html @@ -0,0 +1,469 @@ + + + + + lxml.etree.Resolver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class Resolver + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Resolver

+
+object --+
+         |
+        Resolver
+
+ +
Known Subclasses:
+
+ +
+ +
+This is the base class of all resolvers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
resolve(self, + system_url, + public_id, + context)
+ Override this method to resolve an external source by +system_url and public_id.
+ + +
+ +
+   + + + + + + +
resolve_empty(self, + context)
+ Return an empty input document.
+ + +
+ +
+   + + + + + + +
resolve_file(self, + f, + context, + base_url=None)
+ Return an open file-like object as input document.
+ + +
+ +
+   + + + + + + +
resolve_filename(self, + filename, + context)
+ Return the name of a parsable file as input document.
+ + +
+ +
+   + + + + + + +
resolve_string(self, + string, + context, + base_url=None)
+ Return a parsable string as input document.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

resolve(self, + system_url, + public_id, + context) +

+
  +
+ +

Override this method to resolve an external source by +system_url and public_id. The third argument is an +opaque context object.

+

Return the result of one of the resolve_*() methods.

+
+
+
+
+ +
+ +
+ + +
+

resolve_empty(self, + context) +

+
  +
+ +

Return an empty input document.

+

Pass context as parameter.

+
+
+
+
+ +
+ +
+ + +
+

resolve_file(self, + f, + context, + base_url=None) +

+
  +
+ +

Return an open file-like object as input document.

+

Pass open file and context as parameters. You can pass the +base URL or filename of the file through the base_url +keyword argument.

+

Note that using .resolve_filename() is more efficient, +especially in threaded environments.

+
+
+
+
+ +
+ +
+ + +
+

resolve_filename(self, + filename, + context) +

+
  +
+ +

Return the name of a parsable file as input document.

+

Pass filename and context as parameters. You can also pass a +URL with an HTTP, FTP or file target.

+
+
+
+
+ +
+ +
+ + +
+

resolve_string(self, + string, + context, + base_url=None) +

+
  +
+ +

Return a parsable string as input document.

+

Pass data string and context as parameters. You can pass the +source URL or filename through the base_url keyword +argument.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.Schematron-class.html b/doc/html/api/lxml.etree.Schematron-class.html new file mode 100644 index 0000000..30516a9 --- /dev/null +++ b/doc/html/api/lxml.etree.Schematron-class.html @@ -0,0 +1,381 @@ + + + + + lxml.etree.Schematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class Schematron + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Schematron

+
+object --+    
+         |    
+_Validator --+
+             |
+            Schematron
+
+ +
+

Schematron(self, etree=None, file=None) +A Schematron validator.

+

Pass a root Element or an ElementTree to turn it into a validator. +Alternatively, pass a filename as keyword argument 'file' to parse from +the file system.

+

Schematron is a less well known, but very powerful schema language. The main +idea is to use the capabilities of XPath to put restrictions on the structure +and the content of XML documents. Here is a simple example:

+
+>>> schematron = etree.Schematron(etree.XML('''
+... <schema xmlns="http://www.ascc.net/xml/schematron" >
+...   <pattern name="id is the only permited attribute name">
+...     <rule context="*">
+...       <report test="@*[not(name()='id')]">Attribute
+...         <name path="@*[not(name()='id')]"/> is forbidden<name/>
+...       </report>
+...     </rule>
+...   </pattern>
+... </schema>
+... '''))
+
+>>> xml = etree.XML('''
+... <AAA name="aaa">
+...   <BBB id="bbb"/>
+...   <CCC color="ccc"/>
+... </AAA>
+... ''')
+
+>>> schematron.validate(xml)
+0
+
+>>> xml = etree.XML('''
+... <AAA id="aaa">
+...   <BBB id="bbb"/>
+...   <CCC/>
+... </AAA>
+... ''')
+
+>>> schematron.validate(xml)
+1
+
+

Schematron was added to libxml2 in version 2.6.21. Before version 2.6.32, +however, Schematron lacked support for error reporting other than to stderr. +This version is therefore required to retrieve validation warnings and +errors in lxml.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + etree)
+ Validate doc using Schematron.
+ + +
+ +
+   + + + + + + +
__init__(self, + etree=None, + file=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Validator: + assertValid, + assert_, + validate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Validator: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + etree) +
(Call operator) +

+
  +
+ +

Validate doc using Schematron.

+

Returns true if document is valid, false if not.

+
+
+
+
+ +
+ +
+ + +
+

__init__(self, + etree=None, + file=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.SchematronError-class.html b/doc/html/api/lxml.etree.SchematronError-class.html new file mode 100644 index 0000000..7d1a8e5 --- /dev/null +++ b/doc/html/api/lxml.etree.SchematronError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.SchematronError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SchematronError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SchematronError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      SchematronError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class of all Schematron errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.SchematronParseError-class.html b/doc/html/api/lxml.etree.SchematronParseError-class.html new file mode 100644 index 0000000..5c7e6b6 --- /dev/null +++ b/doc/html/api/lxml.etree.SchematronParseError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.SchematronParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SchematronParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SchematronParseError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                         SchematronError --+
+                                           |
+                                          SchematronParseError
+
+ +
+Error while parsing an XML document as Schematron schema. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.SchematronValidateError-class.html b/doc/html/api/lxml.etree.SchematronValidateError-class.html new file mode 100644 index 0000000..22234c4 --- /dev/null +++ b/doc/html/api/lxml.etree.SchematronValidateError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.SchematronValidateError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SchematronValidateError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SchematronValidateError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                         SchematronError --+
+                                           |
+                                          SchematronValidateError
+
+ +
+Error while validating an XML document with a Schematron schema. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.SerialisationError-class.html b/doc/html/api/lxml.etree.SerialisationError-class.html new file mode 100644 index 0000000..87be052 --- /dev/null +++ b/doc/html/api/lxml.etree.SerialisationError-class.html @@ -0,0 +1,204 @@ + + + + + lxml.etree.SerialisationError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SerialisationError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SerialisationError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      SerialisationError
+
+ +
+A libxml2 error that occurred during serialisation. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.SiblingsIterator-class.html b/doc/html/api/lxml.etree.SiblingsIterator-class.html new file mode 100644 index 0000000..b9ca168 --- /dev/null +++ b/doc/html/api/lxml.etree.SiblingsIterator-class.html @@ -0,0 +1,300 @@ + + + + + lxml.etree.SiblingsIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class SiblingsIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SiblingsIterator

+
+        object --+        
+                 |        
+_ElementTagMatcher --+    
+                     |    
+      _ElementIterator --+
+                         |
+                        SiblingsIterator
+
+ +
+

SiblingsIterator(self, node, tag=None, preceding=False) +Iterates over the siblings of an element.

+

You can pass the boolean keyword preceding to specify the direction.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + node, + tag=None, + preceding=False)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _ElementIterator: + __iter__, + __next__, + next +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + node, + tag=None, + preceding=False) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.TreeBuilder-class.html b/doc/html/api/lxml.etree.TreeBuilder-class.html new file mode 100644 index 0000000..be81c1b --- /dev/null +++ b/doc/html/api/lxml.etree.TreeBuilder-class.html @@ -0,0 +1,421 @@ + + + + + lxml.etree.TreeBuilder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class TreeBuilder + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class TreeBuilder

+
+      object --+    
+               |    
+_SaxParserTarget --+
+                   |
+                  TreeBuilder
+
+ +
+

TreeBuilder(self, element_factory=None, parser=None) +Parser target that builds a tree.

+

The final tree is returned by the close() method.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element_factory=None, + parser=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
close(self)
+ Flushes the builder buffers, and returns the toplevel document +element.
+ + +
+ +
+   + + + + + + +
comment(self, + comment) + + +
+ +
+   + + + + + + +
data(self, + data)
+ Adds text to the current element.
+ + +
+ +
+   + + + + + + +
end(self, + tag)
+ Closes the current element.
+ + +
+ +
+   + + + + + + +
pi(self, + target, + data) + + +
+ +
+   + + + + + + +
start(self, + tag, + attrs, + nsmap=None)
+ Opens a new element.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element_factory=None, + parser=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

data(self, + data) +

+
  +
+ + Adds text to the current element. The value should be either an +8-bit string containing ASCII text, or a Unicode string. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XInclude-class.html b/doc/html/api/lxml.etree.XInclude-class.html new file mode 100644 index 0000000..11f7f07 --- /dev/null +++ b/doc/html/api/lxml.etree.XInclude-class.html @@ -0,0 +1,310 @@ + + + + + lxml.etree.XInclude + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XInclude + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XInclude

+
+object --+
+         |
+        XInclude
+
+ +
+

XInclude(self) +XInclude processor.

+

Create an instance and call it on an Element to run XInclude +processing.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + node) + + +
+ +
+   + + + + + + +
__init__(self)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XIncludeError-class.html b/doc/html/api/lxml.etree.XIncludeError-class.html new file mode 100644 index 0000000..3d0253a --- /dev/null +++ b/doc/html/api/lxml.etree.XIncludeError-class.html @@ -0,0 +1,204 @@ + + + + + lxml.etree.XIncludeError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XIncludeError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XIncludeError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      XIncludeError
+
+ +
+Error during XInclude processing. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XMLParser-class.html b/doc/html/api/lxml.etree.XMLParser-class.html new file mode 100644 index 0000000..50298e9 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLParser-class.html @@ -0,0 +1,394 @@ + + + + + lxml.etree.XMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLParser

+
+ object --+        
+          |        
+_BaseParser --+    
+              |    
+    _FeedParser --+
+                  |
+                 XMLParser
+
+ +
Known Subclasses:
+
+ +
+ +
+

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)

+

The XML parser.

+

Parsers can be supplied as additional argument to various parse +functions of the lxml API. A default parser is always available +and can be replaced by a call to the global function +'set_default_parser'. New parsers can be created at any time +without a major run-time overhead.

+

The keyword arguments in the constructor are mainly based on the +libxml2 parser configuration. A DTD will also be loaded if DTD +validation or attribute default values are requested (unless you +additionally provide an XMLSchema from which the default +attributes can be read).

+

Available boolean keyword arguments:

+
    +
  • attribute_defaults - inject default attributes from DTD or XMLSchema

    +
  • +
  • dtd_validation - validate against a DTD referenced by the document

    +
  • +
  • load_dtd - use DTD for parsing

    +
  • +
  • no_network - prevent network access for related files (default: True)

    +
  • +
  • ns_clean - clean up redundant namespace declarations

    +
  • +
  • recover - try hard to parse through broken XML

    +
  • +
  • remove_blank_text - discard blank text nodes

    +
  • +
  • remove_comments - discard comments

    +
  • +
  • remove_pis - discard processing instructions

    +
  • +
  • strip_cdata - replace CDATA sections by normal text content (default: True)

    +
  • +
  • compact - safe memory for short text content (default: True)

    +
  • +
  • resolve_entities - replace entities by their text value (default: True)

    +
  • +
  • +
    huge_tree - disable security restrictions and support very deep trees
    +

    and very long text content (only affects libxml2 2.7+)

    +
    +
    +
  • +
+

Other keyword arguments:

+
    +
  • encoding - override the document encoding
  • +
  • target - a parser target object that will receive the parse events
  • +
  • schema - an XMLSchema to validate against
  • +
+

Note that you should avoid sharing parsers between threads. While this is +not harmful, it is more efficient to use separate parsers. This does not +apply to the default parser.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(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)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FeedParser: + close, + feed +

+

Inherited from _BaseParser: + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _FeedParser: + feed_error_log +

+

Inherited from _BaseParser: + error_log, + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(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) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XMLSchema-class.html b/doc/html/api/lxml.etree.XMLSchema-class.html new file mode 100644 index 0000000..ad49264 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchema-class.html @@ -0,0 +1,342 @@ + + + + + lxml.etree.XMLSchema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLSchema + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLSchema

+
+object --+    
+         |    
+_Validator --+
+             |
+            XMLSchema
+
+ +
+

XMLSchema(self, etree=None, file=None) +Turn a document into an XML Schema validator.

+

Either pass a schema as Element or ElementTree, or pass a file or +filename through the file keyword argument.

+

Passing the attribute_defaults boolean option will make the +schema insert default/fixed attributes into validated documents.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + etree)
+ Validate doc using XML Schema.
+ + +
+ +
+   + + + + + + +
__init__(self, + etree=None, + file=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _Validator: + assertValid, + assert_, + validate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _Validator: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + etree) +
(Call operator) +

+
  +
+ +

Validate doc using XML Schema.

+

Returns true if document is valid, false if not.

+
+
+
+
+ +
+ +
+ + +
+

__init__(self, + etree=None, + file=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XMLSchemaError-class.html b/doc/html/api/lxml.etree.XMLSchemaError-class.html new file mode 100644 index 0000000..0daa6a2 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchemaError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.XMLSchemaError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLSchemaError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLSchemaError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      XMLSchemaError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class of all XML Schema errors + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XMLSchemaParseError-class.html b/doc/html/api/lxml.etree.XMLSchemaParseError-class.html new file mode 100644 index 0000000..09e76fd --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchemaParseError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.XMLSchemaParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLSchemaParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLSchemaParseError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                          XMLSchemaError --+
+                                           |
+                                          XMLSchemaParseError
+
+ +
+Error while parsing an XML document as XML Schema. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XMLSchemaValidateError-class.html b/doc/html/api/lxml.etree.XMLSchemaValidateError-class.html new file mode 100644 index 0000000..466f0f3 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSchemaValidateError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.XMLSchemaValidateError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLSchemaValidateError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLSchemaValidateError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                          XMLSchemaError --+
+                                           |
+                                          XMLSchemaValidateError
+
+ +
+Error while validating an XML document with an XML Schema. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XMLSyntaxError-class.html b/doc/html/api/lxml.etree.XMLSyntaxError-class.html new file mode 100644 index 0000000..fe289f0 --- /dev/null +++ b/doc/html/api/lxml.etree.XMLSyntaxError-class.html @@ -0,0 +1,283 @@ + + + + + lxml.etree.XMLSyntaxError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XMLSyntaxError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XMLSyntaxError

+
+              object --+                        
+                       |                        
+exceptions.BaseException --+                    
+                           |                    
+        exceptions.Exception --+                
+                               |                
+                           Error --+            
+                                   |            
+                           LxmlError --+        
+                                       |        
+              object --+               |        
+                       |               |        
+exceptions.BaseException --+           |        
+                           |           |        
+        exceptions.Exception --+       |        
+                               |       |        
+        exceptions.StandardError --+   |        
+                                   |   |        
+              exceptions.SyntaxError --+        
+                                       |        
+                         LxmlSyntaxError --+    
+                                           |    
+                                  ParseError --+
+                                               |
+                                              XMLSyntaxError
+
+ +
+Syntax error while parsing an XML document. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+

Inherited from exceptions.SyntaxError: + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPath-class.html b/doc/html/api/lxml.etree.XPath-class.html new file mode 100644 index 0000000..d598137 --- /dev/null +++ b/doc/html/api/lxml.etree.XPath-class.html @@ -0,0 +1,380 @@ + + + + + lxml.etree.XPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPath + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPath

+
+         object --+    
+                  |    
+_XPathEvaluatorBase --+
+                      |
+                     XPath
+
+ +
Known Subclasses:
+
+ +
+ +
+

XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True) +A compiled XPath expression that can be called on Elements and ElementTrees.

+

Besides the XPath expression, you can pass prefix-namespace +mappings and extension functions to the constructor through the +keyword arguments namespaces and extensions. EXSLT +regular expression support can be disabled with the 'regexp' +boolean keyword (defaults to True). Smart strings will be +returned for string results unless you pass +smart_strings=False.

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + _etree_or_element, + **_variables) + + +
+ +
+   + + + + + + +
__init__(self, + path, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+

Inherited from _XPathEvaluatorBase: + evaluate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + path +
+

Inherited from _XPathEvaluatorBase: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + path, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathDocumentEvaluator-class.html b/doc/html/api/lxml.etree.XPathDocumentEvaluator-class.html new file mode 100644 index 0000000..7928152 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathDocumentEvaluator-class.html @@ -0,0 +1,359 @@ + + + + + lxml.etree.XPathDocumentEvaluator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathDocumentEvaluator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathDocumentEvaluator

+
+         object --+        
+                  |        
+_XPathEvaluatorBase --+    
+                      |    
+  XPathElementEvaluator --+
+                          |
+                         XPathDocumentEvaluator
+
+ +
+

XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True) +Create an XPath evaluator for an ElementTree.

+

Additional namespace declarations can be passed with the +'namespace' keyword argument. EXSLT regular expression support +can be disabled with the 'regexp' boolean keyword (defaults to +True). Smart strings will be returned for string results unless +you pass smart_strings=False.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + _path, + **_variables)
+ Evaluate an XPath expression on the document.
+ + +
+ +
+   + + + + + + +
__init__(self, + etree, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from XPathElementEvaluator: + register_namespace, + register_namespaces +

+

Inherited from _XPathEvaluatorBase: + evaluate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _XPathEvaluatorBase: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + _path, + **_variables) +
(Call operator) +

+
  +
+ +

Evaluate an XPath expression on the document.

+

Variables may be provided as keyword arguments. Note that namespaces +are currently not supported for variables.

+
+
Overrides: + XPathElementEvaluator.__call__ +
+
+
+
+ +
+ +
+ + +
+

__init__(self, + etree, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathElementEvaluator-class.html b/doc/html/api/lxml.etree.XPathElementEvaluator-class.html new file mode 100644 index 0000000..742e258 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathElementEvaluator-class.html @@ -0,0 +1,394 @@ + + + + + lxml.etree.XPathElementEvaluator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathElementEvaluator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathElementEvaluator

+
+         object --+    
+                  |    
+_XPathEvaluatorBase --+
+                      |
+                     XPathElementEvaluator
+
+ +
Known Subclasses:
+
+ +
+ +
+

XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True) +Create an XPath evaluator for an element.

+

Absolute XPath expressions (starting with '/') will be evaluated against +the ElementTree as returned by getroottree().

+

Additional namespace declarations can be passed with the +'namespace' keyword argument. EXSLT regular expression support +can be disabled with the 'regexp' boolean keyword (defaults to +True). Smart strings will be returned for string results unless +you pass smart_strings=False.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + _path, + **_variables)
+ Evaluate an XPath expression on the document.
+ + +
+ +
+   + + + + + + +
__init__(self, + element, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
register_namespace(...)
+ Register a namespace with the XPath context.
+ + +
+ +
+   + + + + + + +
register_namespaces(...)
+ Register a prefix -> uri dict.
+ + +
+ +
+

Inherited from _XPathEvaluatorBase: + evaluate +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _XPathEvaluatorBase: + error_log +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + _path, + **_variables) +
(Call operator) +

+
  +
+ +

Evaluate an XPath expression on the document.

+

Variables may be provided as keyword arguments. Note that namespaces +are currently not supported for variables.

+

Absolute XPath expressions (starting with '/') will be evaluated +against the ElementTree as returned by getroottree().

+
+
+
+
+ +
+ +
+ + +
+

__init__(self, + element, + namespaces=None, + extensions=None, + regexp=True, + smart_strings=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathError-class.html b/doc/html/api/lxml.etree.XPathError-class.html new file mode 100644 index 0000000..8ca5fe6 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.XPathError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      XPathError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class of all XPath errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathEvalError-class.html b/doc/html/api/lxml.etree.XPathEvalError-class.html new file mode 100644 index 0000000..e5f8f89 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathEvalError-class.html @@ -0,0 +1,212 @@ + + + + + lxml.etree.XPathEvalError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathEvalError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathEvalError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                              XPathError --+
+                                           |
+                                          XPathEvalError
+
+ +
Known Subclasses:
+
+ +
+ +
+Error during XPath evaluation. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathFunctionError-class.html b/doc/html/api/lxml.etree.XPathFunctionError-class.html new file mode 100644 index 0000000..d55ed87 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathFunctionError-class.html @@ -0,0 +1,208 @@ + + + + + lxml.etree.XPathFunctionError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathFunctionError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathFunctionError

+
+              object --+                        
+                       |                        
+exceptions.BaseException --+                    
+                           |                    
+        exceptions.Exception --+                
+                               |                
+                           Error --+            
+                                   |            
+                           LxmlError --+        
+                                       |        
+                              XPathError --+    
+                                           |    
+                              XPathEvalError --+
+                                               |
+                                              XPathFunctionError
+
+ +
+Internal error looking up an XPath extension function. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathResultError-class.html b/doc/html/api/lxml.etree.XPathResultError-class.html new file mode 100644 index 0000000..554c19b --- /dev/null +++ b/doc/html/api/lxml.etree.XPathResultError-class.html @@ -0,0 +1,208 @@ + + + + + lxml.etree.XPathResultError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathResultError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathResultError

+
+              object --+                        
+                       |                        
+exceptions.BaseException --+                    
+                           |                    
+        exceptions.Exception --+                
+                               |                
+                           Error --+            
+                                   |            
+                           LxmlError --+        
+                                       |        
+                              XPathError --+    
+                                           |    
+                              XPathEvalError --+
+                                               |
+                                              XPathResultError
+
+ +
+Error handling an XPath result. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XPathSyntaxError-class.html b/doc/html/api/lxml.etree.XPathSyntaxError-class.html new file mode 100644 index 0000000..77c7588 --- /dev/null +++ b/doc/html/api/lxml.etree.XPathSyntaxError-class.html @@ -0,0 +1,234 @@ + + + + + lxml.etree.XPathSyntaxError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XPathSyntaxError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XPathSyntaxError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+              object --+               |    
+                       |               |    
+exceptions.BaseException --+           |    
+                           |           |    
+        exceptions.Exception --+       |    
+                               |       |    
+        exceptions.StandardError --+   |    
+                                   |   |    
+              exceptions.SyntaxError --+    
+                                       |    
+                         LxmlSyntaxError --+
+                                           |
+              object --+                   |
+                       |                   |
+exceptions.BaseException --+               |
+                           |               |
+        exceptions.Exception --+           |
+                               |           |
+                           Error --+       |
+                                   |       |
+                           LxmlError --+   |
+                                       |   |
+                              XPathError --+
+                                           |
+                                          XPathSyntaxError
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.SyntaxError: + __new__, + __str__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.SyntaxError: + filename, + lineno, + message, + msg, + offset, + print_file_and_line, + text +

+

Inherited from exceptions.BaseException: + args +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLT-class.html b/doc/html/api/lxml.etree.XSLT-class.html new file mode 100644 index 0000000..a3186a9 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLT-class.html @@ -0,0 +1,526 @@ + + + + + lxml.etree.XSLT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLT + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLT

+
+object --+
+         |
+        XSLT
+
+ +
+

XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)

+

Turn an XSL document into an XSLT object.

+

Calling this object on a tree or Element will execute the XSLT:

+
+>>> transform = etree.XSLT(xsl_tree)
+>>> result = transform(xml_tree)
+
+

Keyword arguments of the constructor:

+
    +
  • extensions: a dict mapping (namespace, name) pairs to +extension functions or extension elements
  • +
  • regexp: enable exslt regular expression support in XPath +(default: True)
  • +
  • access_control: access restrictions for network or file +system (see XSLTAccessControl)
  • +
+

Keyword arguments of the XSLT call:

+
    +
  • profile_run: enable XSLT profiling (default: False)
  • +
+

Other keyword arguments of the call are passed to the stylesheet +as parameters.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + _input, + profile_run=False, + **kw)
+ Execute the XSL transformation on a tree or Element.
+ + +
+ +
+   + + + + + + +
__copy__(...) + + +
+ +
+   + + + + + + +
__deepcopy__(...) + + +
+ +
+   + + + + + + +
__init__(self, + xslt_input, + extensions=None, + regexp=True, + access_control=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
apply(self, + _input, + profile_run=False, + **kw) + + +
+ +
+   + + + + + + +
strparam(strval)
+ Mark an XSLT string parameter that requires quote escaping +before passing it into the transformation.
+ + +
+ +
+   + + + + + + +
tostring(self, + result_tree)
+ Save result doc to string based on stylesheet output method.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log
+ The log of errors and warnings of an XSLT execution. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(self, + _input, + profile_run=False, + **kw) +
(Call operator) +

+
  +
+ +

Execute the XSL transformation on a tree or Element.

+

Pass the profile_run option to get profile information +about the XSLT. The result of the XSLT will have a property +xslt_profile that holds an XML tree with profiling data.

+
+
+
+
+ +
+ +
+ + +
+

__init__(self, + xslt_input, + extensions=None, + regexp=True, + access_control=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

apply(self, + _input, + profile_run=False, + **kw) +

+
  +
+ + +
+
+

Deprecated: + call the object, not this method. +

+
+
+ +
+ +
+ + +
+

strparam(strval) +

+
  +
+ +

Mark an XSLT string parameter that requires quote escaping +before passing it into the transformation. Use it like this:

+
+result = transform(doc, some_strval = XSLT.strparam(
+    '''it's "Monty Python's" ...'''))
+
+

Escaped string parameters can be reused without restriction.

+
+
+
+
+ +
+ +
+ + +
+

tostring(self, + result_tree) +

+
  +
+ + Save result doc to string based on stylesheet output method. +
+
+

Deprecated: + use str(result_tree) instead. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTAccessControl-class.html b/doc/html/api/lxml.etree.XSLTAccessControl-class.html new file mode 100644 index 0000000..e41437f --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTAccessControl-class.html @@ -0,0 +1,448 @@ + + + + + lxml.etree.XSLTAccessControl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTAccessControl + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTAccessControl

+
+object --+
+         |
+        XSLTAccessControl
+
+ +
+

XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)

+

Access control for XSLT: reading/writing files, directories and +network I/O. Access to a type of resource is granted or denied by +passing any of the following boolean keyword arguments. All of +them default to True to allow access.

+
    +
  • read_file
  • +
  • write_file
  • +
  • create_dir
  • +
  • read_network
  • +
  • write_network
  • +
+

For convenience, there is also a class member DENY_ALL that +provides an XSLTAccessControl instance that is readily configured +to deny everything, and a DENY_WRITE member that denies all +write access but allows read access.

+

See XSLT.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + read_file=True, + write_file=True, + create_dir=True, + read_network=True, + write_network=True)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + DENY_ALL = XSLTAccessControl(create_dir=False, read_file=False... +
+   + + DENY_WRITE = XSLTAccessControl(create_dir=False, read_file=Tru... +
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + options
+ The access control configuration as a map of options. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + read_file=True, + write_file=True, + create_dir=True, + read_network=True, + write_network=True) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

DENY_ALL

+ +
+
+
+
Value:
+
+XSLTAccessControl(create_dir=False, read_file=False, read_network=Fals\
+e, write_file=False, write_network=False)
+
+
+
+
+
+ +
+ +
+

DENY_WRITE

+ +
+
+
+
Value:
+
+XSLTAccessControl(create_dir=False, read_file=True, read_network=True,\
+ write_file=False, write_network=False)
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTApplyError-class.html b/doc/html/api/lxml.etree.XSLTApplyError-class.html new file mode 100644 index 0000000..efa3703 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTApplyError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.XSLTApplyError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTApplyError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTApplyError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                               XSLTError --+
+                                           |
+                                          XSLTApplyError
+
+ +
+Error running an XSL transformation. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTError-class.html b/doc/html/api/lxml.etree.XSLTError-class.html new file mode 100644 index 0000000..3ffa97d --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTError-class.html @@ -0,0 +1,210 @@ + + + + + lxml.etree.XSLTError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTError

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                           Error --+    
+                                   |    
+                           LxmlError --+
+                                       |
+                                      XSLTError
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class of all XSLT errors. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTExtension-class.html b/doc/html/api/lxml.etree.XSLTExtension-class.html new file mode 100644 index 0000000..1f51c31 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTExtension-class.html @@ -0,0 +1,337 @@ + + + + + lxml.etree.XSLTExtension + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTExtension + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTExtension

+
+object --+
+         |
+        XSLTExtension
+
+ +
+Base class of an XSLT extension element. + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
apply_templates(self, + context, + node)
+ Call this method to retrieve the result of applying templates +to an element.
+ + +
+ +
+   + + + + + + +
execute(self, + context, + self_node, + input_node, + output_parent)
+ Execute this extension element.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

apply_templates(self, + context, + node) +

+
  +
+ +

Call this method to retrieve the result of applying templates +to an element.

+

The return value is a list of elements or text strings that +were generated by the XSLT processor.

+
+
+
+
+ +
+ +
+ + +
+

execute(self, + context, + self_node, + input_node, + output_parent) +

+
  +
+ +

Execute this extension element.

+

Subclasses must override this method. They may append +elements to the output_parent element here, or set its text +content. To this end, the input_node provides read-only +access to the current node in the input document, and the +self_node points to the extension element in the stylesheet.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTExtensionError-class.html b/doc/html/api/lxml.etree.XSLTExtensionError-class.html new file mode 100644 index 0000000..af60198 --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTExtensionError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.XSLTExtensionError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTExtensionError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTExtensionError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                               XSLTError --+
+                                           |
+                                          XSLTExtensionError
+
+ +
+Error registering an XSLT extension. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTParseError-class.html b/doc/html/api/lxml.etree.XSLTParseError-class.html new file mode 100644 index 0000000..efe33fe --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTParseError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.XSLTParseError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTParseError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTParseError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                               XSLTError --+
+                                           |
+                                          XSLTParseError
+
+ +
+Error parsing a stylesheet document. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.XSLTSaveError-class.html b/doc/html/api/lxml.etree.XSLTSaveError-class.html new file mode 100644 index 0000000..cb729ed --- /dev/null +++ b/doc/html/api/lxml.etree.XSLTSaveError-class.html @@ -0,0 +1,206 @@ + + + + + lxml.etree.XSLTSaveError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class XSLTSaveError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XSLTSaveError

+
+              object --+                    
+                       |                    
+exceptions.BaseException --+                
+                           |                
+        exceptions.Exception --+            
+                               |            
+                           Error --+        
+                                   |        
+                           LxmlError --+    
+                                       |    
+                               XSLTError --+
+                                           |
+                                          XSLTSaveError
+
+ +
+Error serialising an XSLT result. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._AppendOnlyElementProxy-class.html b/doc/html/api/lxml.etree._AppendOnlyElementProxy-class.html new file mode 100644 index 0000000..39c9c15 --- /dev/null +++ b/doc/html/api/lxml.etree._AppendOnlyElementProxy-class.html @@ -0,0 +1,345 @@ + + + + + lxml.etree._AppendOnlyElementProxy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _AppendOnlyElementProxy + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _AppendOnlyElementProxy

+
+           object --+    
+                    |    
+_ReadOnlyElementProxy --+
+                        |
+                       _AppendOnlyElementProxy
+
+ +
+A read-only element that allows adding children and changing the +text content (i.e. everything that adds to the subtree). + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
append(...)
+ Append a copy of an Element to the list of children.
+ + +
+ +
+   + + + + + + +
extend(...)
+ Append a copy of all Elements from a sequence to the list of +children.
+ + +
+ +
+

Inherited from _ReadOnlyElementProxy: + __copy__, + __deepcopy__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + get, + getchildren, + getnext, + getparent, + getprevious, + items, + iterchildren, + keys, + values +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + text
+ Text before the first subelement. +
+

Inherited from _ReadOnlyElementProxy: + attrib, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

text

+ Text before the first subelement. This is either a string or the +value None, if there was no text. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._Attrib-class.html b/doc/html/api/lxml.etree._Attrib-class.html new file mode 100644 index 0000000..89f63fc --- /dev/null +++ b/doc/html/api/lxml.etree._Attrib-class.html @@ -0,0 +1,728 @@ + + + + + lxml.etree._Attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _Attrib + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _Attrib

+
+object --+
+         |
+        _Attrib
+
+ +
+A dict-like proxy for the Element.attrib property. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__contains__(x, + y)
+ y in x
+ + +
+ +
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__getitem__(...) + + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+   + + + + + + +
clear(...) + + +
+ +
+   + + + + + + +
get(...) + + +
+ +
+   + + + + + + +
has_key(...) + + +
+ +
+   + + + + + + +
items(...) + + +
+ +
+   + + + + + + +
iteritems(...) + + +
+ +
+   + + + + + + +
iterkeys(...) + + +
+ +
+   + + + + + + +
itervalues(...) + + +
+ +
+   + + + + + + +
keys(...) + + +
+ +
+   + + + + + + +
pop(...) + + +
+ +
+   + + + + + + +
update(...) + + +
+ +
+   + + + + + + +
values(...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._AttribIterator-class.html b/doc/html/api/lxml.etree._AttribIterator-class.html new file mode 100644 index 0000000..d47529a --- /dev/null +++ b/doc/html/api/lxml.etree._AttribIterator-class.html @@ -0,0 +1,292 @@ + + + + + lxml.etree._AttribIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _AttribIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _AttribIterator

+
+object --+
+         |
+        _AttribIterator
+
+ +
+Attribute iterator - for internal use only! + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._BaseContext-class.html b/doc/html/api/lxml.etree._BaseContext-class.html new file mode 100644 index 0000000..bca4e34 --- /dev/null +++ b/doc/html/api/lxml.etree._BaseContext-class.html @@ -0,0 +1,301 @@ + + + + + lxml.etree._BaseContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _BaseContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _BaseContext

+
+object --+
+         |
+        _BaseContext
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + context_node +
+   + + eval_context +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._BaseErrorLog-class.html b/doc/html/api/lxml.etree._BaseErrorLog-class.html new file mode 100644 index 0000000..33c7828 --- /dev/null +++ b/doc/html/api/lxml.etree._BaseErrorLog-class.html @@ -0,0 +1,350 @@ + + + + + lxml.etree._BaseErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _BaseErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _BaseErrorLog

+
+object --+
+         |
+        _BaseErrorLog
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
copy(...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + last_error +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._BaseParser-class.html b/doc/html/api/lxml.etree._BaseParser-class.html new file mode 100644 index 0000000..bce0919 --- /dev/null +++ b/doc/html/api/lxml.etree._BaseParser-class.html @@ -0,0 +1,426 @@ + + + + + lxml.etree._BaseParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _BaseParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _BaseParser

+
+object --+
+         |
+        _BaseParser
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
copy(self)
+ Create a new parser with the same configuration.
+ + +
+ +
+   + + + + + + +
makeelement(self, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Creates a new element associated with this parser.
+ + +
+ +
+   + + + + + + +
setElementClassLookup(...) + + +
+ +
+   + + + + + + +
set_element_class_lookup(self, + lookup= None)
+ Set a lookup scheme for element classes generated from this parser.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log
+ The error log of the last parser run. +
+   + + resolvers
+ The custom resolver registry of this parser. +
+   + + version
+ The version of the underlying XML parser. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

setElementClassLookup(...) +

+
  +
+ + +
+
+

Deprecated: + use parser.set_element_class_lookup(lookup) instead. +

+
+
+ +
+ +
+ + +
+

set_element_class_lookup(self, + lookup= None) +

+
  +
+ +

Set a lookup scheme for element classes generated from this parser.

+

Reset it by passing None or nothing.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ClassNamespaceRegistry-class.html b/doc/html/api/lxml.etree._ClassNamespaceRegistry-class.html new file mode 100644 index 0000000..989dfe1 --- /dev/null +++ b/doc/html/api/lxml.etree._ClassNamespaceRegistry-class.html @@ -0,0 +1,380 @@ + + + + + lxml.etree._ClassNamespaceRegistry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ClassNamespaceRegistry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ClassNamespaceRegistry

+
+        object --+    
+                 |    
+_NamespaceRegistry --+
+                     |
+                    _ClassNamespaceRegistry
+
+ +
+Dictionary-like registry for namespace implementation classes + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+

Inherited from _NamespaceRegistry: + __getitem__, + __init__, + __iter__, + clear, + items, + iteritems, + update +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__delitem__(x, + y) +
(Index deletion operator) +

+
  +
+ + del x[y] +
+
Overrides: + _NamespaceRegistry.__delitem__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__setitem__(x, + i, + y) +
(Index assignment operator) +

+
  +
+ + x[i]=y +
+
Overrides: + _NamespaceRegistry.__setitem__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._Comment-class.html b/doc/html/api/lxml.etree._Comment-class.html new file mode 100644 index 0000000..227dbf4 --- /dev/null +++ b/doc/html/api/lxml.etree._Comment-class.html @@ -0,0 +1,360 @@ + + + + + lxml.etree._Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _Comment + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _Comment

+
+      object --+        
+               |        
+        _Element --+    
+                   |    
+__ContentOnlyElement --+
+                       |
+                      _Comment
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + tag
+ Element tag +
+

Inherited from __ContentOnlyElement: + attrib, + text +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._Document-class.html b/doc/html/api/lxml.etree._Document-class.html new file mode 100644 index 0000000..3e29f1b --- /dev/null +++ b/doc/html/api/lxml.etree._Document-class.html @@ -0,0 +1,246 @@ + + + + + lxml.etree._Document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _Document + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _Document

+
+object --+
+         |
+        _Document
+
+ +
+

Internal base class to reference a libxml document.

+

When instances of this class are garbage collected, the libxml +document is cleaned up.

+ + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._DomainErrorLog-class.html b/doc/html/api/lxml.etree._DomainErrorLog-class.html new file mode 100644 index 0000000..757a974 --- /dev/null +++ b/doc/html/api/lxml.etree._DomainErrorLog-class.html @@ -0,0 +1,346 @@ + + + + + lxml.etree._DomainErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _DomainErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _DomainErrorLog

+
+   object --+            
+            |            
+_BaseErrorLog --+        
+                |        
+    _ListErrorLog --+    
+                    |    
+            _ErrorLog --+
+                        |
+                       _DomainErrorLog
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
receive(...) + + +
+ +
+

Inherited from _ErrorLog: + __iter__, + clear, + copy +

+

Inherited from _ListErrorLog: + __contains__, + __getitem__, + __len__, + __nonzero__, + __repr__, + filter_domains, + filter_from_errors, + filter_from_fatals, + filter_from_level, + filter_from_warnings, + filter_levels, + filter_types +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

receive(...) +

+
  +
+ + +
+
Overrides: + _ErrorLog.receive +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._Element-class.html b/doc/html/api/lxml.etree._Element-class.html new file mode 100644 index 0000000..79fab90 --- /dev/null +++ b/doc/html/api/lxml.etree._Element-class.html @@ -0,0 +1,1629 @@ + + + + + lxml.etree._Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _Element + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _Element

+
+object --+
+         |
+        _Element
+
+ +
Known Subclasses:
+
+ +
+ +
+

Element class.

+

References a document object and a libxml node.

+

By pointing to a Document instance, a reference is kept to +_Document as long as there is some pointer to a node in it.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__contains__(x, + y)
+ y in x
+ + +
+ +
+   + + + + + + +
__copy__(self) + + +
+ +
+   + + + + + + +
__deepcopy__(self, + memo) + + +
+ +
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+   + + + + + + +
__getitem__(...)
+ Returns the subelement at the given position or the requested +slice.
+ + +
+ +
+   + + + + + + +
__iter__(self) + + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__reversed__(self) + + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+   + + + + + + +
_init(self)
+ Called after object initialisation.
+ + +
+ +
+   + + + + + + +
addnext(self, + element)
+ Adds the element as a following sibling directly after this +element.
+ + +
+ +
+   + + + + + + +
addprevious(self, + element)
+ Adds the element as a preceding sibling directly before this +element.
+ + +
+ +
+   + + + + + + +
append(self, + element)
+ Adds a subelement to the end of this element.
+ + +
+ +
+   + + + + + + +
clear(self)
+ Resets an element.
+ + +
+ +
+   + + + + + + +
extend(self, + elements)
+ Extends the current children by the elements in the iterable.
+ + +
+ +
+   + + + + + + +
find(self, + path)
+ Finds the first matching subelement, by tag name or path.
+ + +
+ +
+   + + + + + + +
findall(self, + path)
+ Finds all matching subelements, by tag name or path.
+ + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None)
+ Finds text for the first matching subelement, by tag name or path.
+ + +
+ +
+   + + + + + + +
get(self, + key, + default=None)
+ Gets an element attribute.
+ + +
+ +
+   + + + + + + +
getchildren(self)
+ Returns all direct children.
+ + +
+ +
+   + + + + + + +
getiterator(self, + tag=None)
+ Returns a sequence or iterator of all elements in the subtree in +document order (depth first pre-order), starting with this +element.
+ + +
+ +
+   + + + + + + +
getnext(self)
+ Returns the following sibling of this element or None.
+ + +
+ +
+   + + + + + + +
getparent(self)
+ Returns the parent of this element or None for the root element.
+ + +
+ +
+   + + + + + + +
getprevious(self)
+ Returns the preceding sibling of this element or None.
+ + +
+ +
+   + + + + + + +
getroottree(self)
+ Return an ElementTree for the root node of the document that +contains this element.
+ + +
+ +
+   + + + + + + +
index(self, + child, + start=None, + stop=None)
+ Find the position of the child within the parent.
+ + +
+ +
+   + + + + + + +
insert(self, + index, + element)
+ Inserts a subelement at the given position in this element
+ + +
+ +
+   + + + + + + +
items(self)
+ Gets element attributes, as a sequence.
+ + +
+ +
+   + + + + + + +
iter(self, + tag=None)
+ Iterate over all elements in the subtree in document order (depth +first pre-order), starting with this element.
+ + +
+ +
+   + + + + + + +
iterancestors(self, + tag=None)
+ Iterate over the ancestors of this element (from parent to parent).
+ + +
+ +
+   + + + + + + +
iterchildren(self, + tag=None, + reversed=False)
+ Iterate over the children of this element.
+ + +
+ +
+   + + + + + + +
iterdescendants(self, + tag=None)
+ Iterate over the descendants of this element in document order.
+ + +
+ +
+   + + + + + + +
iterfind(self, + path)
+ Iterates over all matching subelements, by tag name or path.
+ + +
+ +
+   + + + + + + +
itersiblings(self, + tag=None, + preceding=False)
+ Iterate over the following or preceding siblings of this element.
+ + +
+ +
+   + + + + + + +
itertext(self, + tag=None, + with_tail=True)
+ Iterates over the text content of a subtree.
+ + +
+ +
+   + + + + + + +
keys(self)
+ Gets a list of attribute names.
+ + +
+ +
+   + + + + + + +
makeelement(self, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Creates a new element associated with the same document.
+ + +
+ +
+   + + + + + + +
remove(self, + element)
+ Removes a matching subelement.
+ + +
+ +
+   + + + + + + +
replace(self, + old_element, + new_element)
+ Replaces a subelement with the element passed as second argument.
+ + +
+ +
+   + + + + + + +
set(self, + key, + value)
+ Sets an element attribute.
+ + +
+ +
+   + + + + + + +
values(self)
+ Gets element attribute values as a sequence of strings.
+ + +
+ +
+   + + + + + + +
xpath(self, + _path, + namespaces=None, + extensions=None, + smart_strings=True, + **_variables)
+ Evaluate an xpath expression using the element as context node.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + attrib
+ Element attribute dictionary. +
+   + + base
+ The base URI of the Element (xml:base or HTML base URL). +
+   + + nsmap
+ Namespace prefix->URI mapping known in the context of this Element. +
+   + + prefix
+ Namespace prefix or None. +
+   + + sourceline
+ Original line number as found by the parser or None if unknown. +
+   + + tag
+ Element tag +
+   + + tail
+ Text after this element's end tag, but before the next sibling +element's start tag. +
+   + + text
+ Text before the first subelement. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

_init(self) +

+
  +
+ + Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses. +
+
+
+
+ +
+ +
+ + +
+

addnext(self, + element) +

+
  +
+ +

Adds the element as a following sibling directly after this +element.

+

This is normally used to set a processing instruction or comment after +the root node of a document. Note that tail text is automatically +discarded when adding at the root level.

+
+
+
+
+ +
+ +
+ + +
+

addprevious(self, + element) +

+
  +
+ +

Adds the element as a preceding sibling directly before this +element.

+

This is normally used to set a processing instruction or comment +before the root node of a document. Note that tail text is +automatically discarded when adding at the root level.

+
+
+
+
+ +
+ +
+ + +
+

clear(self) +

+
  +
+ + Resets an element. This function removes all subelements, clears +all attributes and sets the text and tail properties to None. +
+
+
+
+ +
+ +
+ + +
+

getchildren(self) +

+
  +
+ + Returns all direct children. The elements are returned in document +order. +
+
+

Deprecated: + Note that this method has been deprecated as of +ElementTree 1.3 and lxml 2.0. New code should use +list(element) or simply iterate over elements. +

+
+
+ +
+ +
+ + +
+

getiterator(self, + tag=None) +

+
  +
+ +

Returns a sequence or iterator of all elements in the subtree in +document order (depth first pre-order), starting with this +element.

+

Can be restricted to find only elements with a specific tag +(pass tag="xyz") or from a namespace (pass tag="{ns}*").

+

You can also pass the Element, Comment, ProcessingInstruction and +Entity factory functions to look only for the specific element type.

+
+
+

Deprecated: + Note that this method is deprecated as of +ElementTree 1.3 and lxml 2.0. It returns an iterator in +lxml, which diverges from the original ElementTree +behaviour. If you want an efficient iterator, use the +element.iter() method instead. You should only use this +method in new code if you require backwards compatibility +with older versions of lxml or ElementTree. +

+
+
+ +
+ +
+ + +
+

getroottree(self) +

+
  +
+ +

Return an ElementTree for the root node of the document that +contains this element.

+

This is the same as following element.getparent() up the tree until it +returns None (for the root element) and then build an ElementTree for +the last parent that was returned.

+
+
+
+
+ +
+ +
+ + +
+

index(self, + child, + start=None, + stop=None) +

+
  +
+ +

Find the position of the child within the parent.

+

This method is not part of the original ElementTree API.

+
+
+
+
+ +
+ +
+ + +
+

items(self) +

+
  +
+ + Gets element attributes, as a sequence. The attributes are returned in +an arbitrary order. +
+
+
+
+ +
+ +
+ + +
+

iter(self, + tag=None) +

+
  +
+ +

Iterate over all elements in the subtree in document order (depth +first pre-order), starting with this element.

+

Can be restricted to find only elements with a specific tag +(pass tag="xyz") or from a namespace (pass tag="{ns}*").

+

You can also pass the Element, Comment, ProcessingInstruction and +Entity factory functions to look only for the specific element type.

+
+
+
+
+ +
+ +
+ + +
+

iterancestors(self, + tag=None) +

+
  +
+ +

Iterate over the ancestors of this element (from parent to parent).

+

The generated elements can be restricted to a specific tag name with +the 'tag' keyword.

+
+
+
+
+ +
+ +
+ + +
+

iterchildren(self, + tag=None, + reversed=False) +

+
  +
+ +

Iterate over the children of this element.

+

As opposed to using normal iteration on this element, the generated +elements can be restricted to a specific tag name with the 'tag' +keyword and reversed with the 'reversed' keyword.

+
+
+
+
+ +
+ +
+ + +
+

iterdescendants(self, + tag=None) +

+
  +
+ +

Iterate over the descendants of this element in document order.

+

As opposed to el.iter(), this iterator does not yield the element +itself. The generated elements can be restricted to a specific tag +name with the 'tag' keyword.

+
+
+
+
+ +
+ +
+ + +
+

itersiblings(self, + tag=None, + preceding=False) +

+
  +
+ +

Iterate over the following or preceding siblings of this element.

+

The direction is determined by the 'preceding' keyword which defaults +to False, i.e. forward iteration over the following siblings. The +generated elements can be restricted to a specific tag name with the +'tag' keyword.

+
+
+
+
+ +
+ +
+ + +
+

itertext(self, + tag=None, + with_tail=True) +

+
  +
+ +

Iterates over the text content of a subtree.

+

You can pass the tag keyword argument to restrict text content to +a specific tag name.

+

You can set the with_tail keyword argument to False to skip +over tail text.

+
+
+
+
+ +
+ +
+ + +
+

keys(self) +

+
  +
+ + Gets a list of attribute names. The names are returned in an +arbitrary order (just like for an ordinary Python dictionary). +
+
+
+
+ +
+ +
+ + +
+

remove(self, + element) +

+
  +
+ + Removes a matching subelement. Unlike the find methods, this +method compares elements based on identity, not on tag value +or contents. +
+
+
+
+ +
+ +
+ + +
+

values(self) +

+
  +
+ + Gets element attribute values as a sequence of strings. The +attributes are returned in an arbitrary order. +
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

attrib

+ Element attribute dictionary. Where possible, use get(), set(), +keys(), values() and items() to access element attributes. +
+
+
+
+ +
+ +
+

base

+

The base URI of the Element (xml:base or HTML base URL). +None if the base URI is unknown.

+

Note that the value depends on the URL of the document that +holds the Element if there is no xml:base attribute on the +Element or its ancestors.

+

Setting this property will set an xml:base attribute on the +Element, regardless of the document type (XML or HTML).

+
+
+
+
+ +
+ +
+

tail

+ Text after this element's end tag, but before the next sibling +element's start tag. This is either a string or the value None, if +there was no text. +
+
+
+
+ +
+ +
+

text

+ Text before the first subelement. This is either a string or +the value None, if there was no text. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ElementIterator-class.html b/doc/html/api/lxml.etree._ElementIterator-class.html new file mode 100644 index 0000000..bd19067 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementIterator-class.html @@ -0,0 +1,298 @@ + + + + + lxml.etree._ElementIterator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementIterator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementIterator

+
+        object --+    
+                 |    
+_ElementTagMatcher --+
+                     |
+                    _ElementIterator
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ElementStringResult-class.html b/doc/html/api/lxml.etree._ElementStringResult-class.html new file mode 100644 index 0000000..0ab32ed --- /dev/null +++ b/doc/html/api/lxml.etree._ElementStringResult-class.html @@ -0,0 +1,256 @@ + + + + + lxml.etree._ElementStringResult + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementStringResult + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementStringResult

+
+object --+        
+         |        
+basestring --+    
+             |    
+           str --+
+                 |
+                _ElementStringResult
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
getparent(...) + + +
+ +
+

Inherited from str: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __new__, + __repr__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdigit, + islower, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ElementTagMatcher-class.html b/doc/html/api/lxml.etree._ElementTagMatcher-class.html new file mode 100644 index 0000000..fc3fa61 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementTagMatcher-class.html @@ -0,0 +1,248 @@ + + + + + lxml.etree._ElementTagMatcher + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementTagMatcher + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementTagMatcher

+
+object --+
+         |
+        _ElementTagMatcher
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ElementTree-class.html b/doc/html/api/lxml.etree._ElementTree-class.html new file mode 100644 index 0000000..803fcd0 --- /dev/null +++ b/doc/html/api/lxml.etree._ElementTree-class.html @@ -0,0 +1,993 @@ + + + + + lxml.etree._ElementTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementTree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementTree

+
+object --+
+         |
+        _ElementTree
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__copy__(...) + + +
+ +
+   + + + + + + +
__deepcopy__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_setroot(self, + root)
+ Relocate the ElementTree to a new root node.
+ + +
+ +
+   + + + + + + +
find(self, + path)
+ Finds the first toplevel element with given tag.
+ + +
+ +
+   + + + + + + +
findall(self, + path)
+ Finds all elements matching the ElementPath expression.
+ + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None)
+ Finds the text for the first element matching the ElementPath +expression.
+ + +
+ +
+   + + + + + + +
getiterator(self, + tag=None)
+ Returns a sequence or iterator of all elements in document order +(depth first pre-order), starting with the root element.
+ + +
+ +
+   + + + + + + +
getpath(self, + element)
+ Returns a structural, absolute XPath expression to find that element.
+ + +
+ +
+   + + + + + + +
getroot(self)
+ Gets the root element for this tree.
+ + +
+ +
+   + + + + + + +
iter(self, + tag=None)
+ Creates an iterator for the root element.
+ + +
+ +
+   + + + + + + +
iterfind(self, + path)
+ Iterates over all elements matching the ElementPath expression.
+ + +
+ +
+   + + + + + + +
parse(self, + source, + parser=None, + base_url=None)
+ Updates self with the content of source and returns its root
+ + +
+ +
+   + + + + + + +
relaxng(self, + relaxng)
+ Validate this document using other document.
+ + +
+ +
+   + + + + + + +
write(self, + file, + encoding=None, + method="xml", + pretty_print=False, + xml_declaration=None, + with_tail=True, + standalone=None, + compression=0)
+ Write the tree to a filename, file or file-like object.
+ + +
+ +
+   + + + + + + +
write_c14n(self, + file, + exclusive=False, + with_comments=True, + compression=0)
+ C14N write of document.
+ + +
+ +
+   + + + + + + +
xinclude(self)
+ Process the XInclude nodes in this document and include the +referenced XML fragments.
+ + +
+ +
+   + + + + + + +
xmlschema(self, + xmlschema)
+ Validate this document using other document.
+ + +
+ +
+   + + + + + + +
xpath(self, + _path, + namespaces=None, + extensions=None, + smart_strings=True, + **_variables)
+ XPath evaluate in context of document.
+ + +
+ +
+   + + + + + + +
xslt(self, + _xslt, + extensions=None, + access_control=None, + **_kw)
+ Transform this document using other document.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + docinfo
+ Information about the document provided by parser and DTD. +
+   + + parser
+ The parser that was used to parse the document in this ElementTree. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

find(self, + path) +

+
  +
+ + Finds the first toplevel element with given tag. Same as +tree.getroot().find(path). +
+
+
+
+ +
+ +
+ + +
+

findall(self, + path) +

+
  +
+ + Finds all elements matching the ElementPath expression. Same as +getroot().findall(path). +
+
+
+
+ +
+ +
+ + +
+

findtext(self, + path, + default=None) +

+
  +
+ + Finds the text for the first element matching the ElementPath +expression. Same as getroot().findtext(path) +
+
+
+
+ +
+ +
+ + +
+

getiterator(self, + tag=None) +

+
  +
+ +

Returns a sequence or iterator of all elements in document order +(depth first pre-order), starting with the root element.

+

Can be restricted to find only elements with a specific tag +(pass tag="xyz" or tag="{ns}xyz") or from a namespace +(pass tag="{ns}*").

+

You can also pass the Element, Comment, ProcessingInstruction and +Entity factory functions to look only for the specific element type.

+
+
+

Deprecated: + Note that this method is deprecated as of +ElementTree 1.3 and lxml 2.0. It returns an iterator in +lxml, which diverges from the original ElementTree +behaviour. If you want an efficient iterator, use the +tree.iter() method instead. You should only use this +method in new code if you require backwards compatibility +with older versions of lxml or ElementTree. +

+
+
+ +
+ +
+ + +
+

iter(self, + tag=None) +

+
  +
+ + Creates an iterator for the root element. The iterator loops over +all elements in this tree, in document order. +
+
+
+
+ +
+ +
+ + +
+

iterfind(self, + path) +

+
  +
+ + Iterates over all elements matching the ElementPath expression. +Same as getroot().finditer(path). +
+
+
+
+ +
+ +
+ + +
+

relaxng(self, + relaxng) +

+
  +
+ +

Validate this document using other document.

+

The relaxng argument is a tree that should contain a Relax NG schema.

+

Returns True or False, depending on whether validation +succeeded.

+

Note: if you are going to apply the same Relax NG schema against +multiple documents, it is more efficient to use the RelaxNG +class directly.

+
+
+
+
+ +
+ +
+ + +
+

write(self, + file, + encoding=None, + method="xml", + pretty_print=False, + xml_declaration=None, + with_tail=True, + standalone=None, + compression=0) +

+
  +
+ +

Write the tree to a filename, file or file-like object.

+

Defaults to ASCII encoding and writing a declaration as needed.

+

The keyword argument 'method' selects the output method: 'xml' or +'html'.

+

Passing a boolean value to the standalone option will +output an XML declaration with the corresponding +standalone flag.

+

The compression option enables GZip compression level 1-9.

+
+
+
+
+ +
+ +
+ + +
+

write_c14n(self, + file, + exclusive=False, + with_comments=True, + compression=0) +

+
  +
+ +

C14N write of document. Always writes UTF-8.

+

The compression option enables GZip compression level 1-9.

+
+
+
+
+ +
+ +
+ + +
+

xinclude(self) +

+
  +
+ +

Process the XInclude nodes in this document and include the +referenced XML fragments.

+

There is support for loading files through the file system, HTTP and +FTP.

+

Note that XInclude does not support custom resolvers in Python space +due to restrictions of libxml2 <= 2.6.29.

+
+
+
+
+ +
+ +
+ + +
+

xmlschema(self, + xmlschema) +

+
  +
+ +

Validate this document using other document.

+

The xmlschema argument is a tree that should contain an XML Schema.

+

Returns True or False, depending on whether validation +succeeded.

+

Note: If you are going to apply the same XML Schema against +multiple documents, it is more efficient to use the XMLSchema +class directly.

+
+
+
+
+ +
+ +
+ + +
+

xpath(self, + _path, + namespaces=None, + extensions=None, + smart_strings=True, + **_variables) +

+
  +
+ +

XPath evaluate in context of document.

+

namespaces is an optional dictionary with prefix to namespace URI +mappings, used by XPath. extensions defines additional extension +functions.

+

Returns a list (nodeset), or bool, float or string.

+

In case of a list result, return Element for element nodes, +string for text and attribute values.

+

Note: if you are going to apply multiple XPath expressions +against the same document, it is more efficient to use +XPathEvaluator directly.

+
+
+
+
+ +
+ +
+ + +
+

xslt(self, + _xslt, + extensions=None, + access_control=None, + **_kw) +

+
  +
+ +

Transform this document using other document.

+

xslt is a tree that should be XSLT +keyword parameters are XSLT transformation parameters.

+

Returns the transformed tree.

+

Note: if you are going to apply the same XSLT stylesheet against +multiple documents, it is more efficient to use the XSLT +class directly.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

docinfo

+ Information about the document provided by parser and DTD. This +value is only defined for ElementTree objects based on the root node +of a parsed document (e.g. those returned by the parse functions), +not for trees that were built manually. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ElementUnicodeResult-class.html b/doc/html/api/lxml.etree._ElementUnicodeResult-class.html new file mode 100644 index 0000000..4f2572d --- /dev/null +++ b/doc/html/api/lxml.etree._ElementUnicodeResult-class.html @@ -0,0 +1,340 @@ + + + + + lxml.etree._ElementUnicodeResult + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ElementUnicodeResult + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ElementUnicodeResult

+
+object --+        
+         |        
+basestring --+    
+             |    
+       unicode --+
+                 |
+                _ElementUnicodeResult
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
getparent(...) + + +
+ +
+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __repr__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + is_attribute +
+   + + is_tail +
+   + + is_text +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._Entity-class.html b/doc/html/api/lxml.etree._Entity-class.html new file mode 100644 index 0000000..e71a840 --- /dev/null +++ b/doc/html/api/lxml.etree._Entity-class.html @@ -0,0 +1,374 @@ + + + + + lxml.etree._Entity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _Entity + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _Entity

+
+      object --+        
+               |        
+        _Element --+    
+                   |    
+__ContentOnlyElement --+
+                       |
+                      _Entity
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + name +
+   + + tag
+ Element tag +
+   + + text
+ Text before the first subelement. +
+

Inherited from __ContentOnlyElement: + attrib +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ErrorLog-class.html b/doc/html/api/lxml.etree._ErrorLog-class.html new file mode 100644 index 0000000..7a5f9fd --- /dev/null +++ b/doc/html/api/lxml.etree._ErrorLog-class.html @@ -0,0 +1,416 @@ + + + + + lxml.etree._ErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ErrorLog

+
+   object --+        
+            |        
+_BaseErrorLog --+    
+                |    
+    _ListErrorLog --+
+                    |
+                   _ErrorLog
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
clear(...) + + +
+ +
+   + + + + + + +
copy(...)
+ Creates a shallow copy of this error log and the list of entries.
+ + +
+ +
+   + + + + + + +
receive(...) + + +
+ +
+

Inherited from _ListErrorLog: + __contains__, + __getitem__, + __len__, + __nonzero__, + __repr__, + filter_domains, + filter_from_errors, + filter_from_fatals, + filter_from_level, + filter_from_warnings, + filter_levels, + filter_types +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__iter__(...) +

+
  +
+ + +
+
Overrides: + _ListErrorLog.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

copy(...) +

+
  +
+ + Creates a shallow copy of this error log and the list of entries. +
+
Overrides: + _BaseErrorLog.copy +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ExceptionContext-class.html b/doc/html/api/lxml.etree._ExceptionContext-class.html new file mode 100644 index 0000000..14794c1 --- /dev/null +++ b/doc/html/api/lxml.etree._ExceptionContext-class.html @@ -0,0 +1,248 @@ + + + + + lxml.etree._ExceptionContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ExceptionContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ExceptionContext

+
+object --+
+         |
+        _ExceptionContext
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ExsltRegExp-class.html b/doc/html/api/lxml.etree._ExsltRegExp-class.html new file mode 100644 index 0000000..0ebd92e --- /dev/null +++ b/doc/html/api/lxml.etree._ExsltRegExp-class.html @@ -0,0 +1,329 @@ + + + + + lxml.etree._ExsltRegExp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ExsltRegExp + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ExsltRegExp

+
+object --+
+         |
+        _ExsltRegExp
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
match(...) + + +
+ +
+   + + + + + + +
replace(...) + + +
+ +
+   + + + + + + +
test(...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._FeedParser-class.html b/doc/html/api/lxml.etree._FeedParser-class.html new file mode 100644 index 0000000..195ad5d --- /dev/null +++ b/doc/html/api/lxml.etree._FeedParser-class.html @@ -0,0 +1,391 @@ + + + + + lxml.etree._FeedParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _FeedParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _FeedParser

+
+ object --+    
+          |    
+_BaseParser --+
+              |
+             _FeedParser
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
close(self)
+ Terminates feeding data to this parser.
+ + +
+ +
+   + + + + + + +
feed(self, + data)
+ Feeds data to the parser.
+ + +
+ +
+

Inherited from _BaseParser: + __init__, + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + feed_error_log
+ The error log of the last (or current) run of the feed parser. +
+

Inherited from _BaseParser: + error_log, + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

close(self) +

+
  +
+ +

Terminates feeding data to this parser. This tells the parser to +process any remaining data in the feed buffer, and then returns the +root Element of the tree that was parsed.

+

This method must be called after passing the last chunk of data into +the feed() method. It should only be called when using the feed +parser interface, all other usage is undefined.

+
+
+
+
+ +
+ +
+ + +
+

feed(self, + data) +

+
  +
+ +

Feeds data to the parser. The argument should be an 8-bit string +buffer containing encoded data, although Unicode is supported as long +as both string types are not mixed.

+

This is the main entry point to the consumer interface of a +parser. The parser will parse as much of the XML stream as it +can on each call. To finish parsing or to reset the parser, +call the close() method. Both methods may raise +ParseError if errors occur in the input data. If an error is +raised, there is no longer a need to call close().

+

The feed parser interface is independent of the normal parser +usage. You can use the same parser as a feed parser and in +the parse() function concurrently.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

feed_error_log

+

The error log of the last (or current) run of the feed parser.

+

Note that this is local to the feed parser and thus is +different from what the error_log property returns.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._FileReaderContext-class.html b/doc/html/api/lxml.etree._FileReaderContext-class.html new file mode 100644 index 0000000..5fdaa2f --- /dev/null +++ b/doc/html/api/lxml.etree._FileReaderContext-class.html @@ -0,0 +1,281 @@ + + + + + lxml.etree._FileReaderContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _FileReaderContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _FileReaderContext

+
+object --+
+         |
+        _FileReaderContext
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._FilelikeWriter-class.html b/doc/html/api/lxml.etree._FilelikeWriter-class.html new file mode 100644 index 0000000..c601f32 --- /dev/null +++ b/doc/html/api/lxml.etree._FilelikeWriter-class.html @@ -0,0 +1,281 @@ + + + + + lxml.etree._FilelikeWriter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _FilelikeWriter + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _FilelikeWriter

+
+object --+
+         |
+        _FilelikeWriter
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._FunctionNamespaceRegistry-class.html b/doc/html/api/lxml.etree._FunctionNamespaceRegistry-class.html new file mode 100644 index 0000000..0ffc5ee --- /dev/null +++ b/doc/html/api/lxml.etree._FunctionNamespaceRegistry-class.html @@ -0,0 +1,384 @@ + + + + + lxml.etree._FunctionNamespaceRegistry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _FunctionNamespaceRegistry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _FunctionNamespaceRegistry

+
+        object --+    
+                 |    
+_NamespaceRegistry --+
+                     |
+                    _FunctionNamespaceRegistry
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+

Inherited from _NamespaceRegistry: + __getitem__, + __init__, + __iter__, + clear, + items, + iteritems, + update +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__delitem__(x, + y) +
(Index deletion operator) +

+
  +
+ + del x[y] +
+
Overrides: + _NamespaceRegistry.__delitem__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__setitem__(x, + i, + y) +
(Index assignment operator) +

+
  +
+ + x[i]=y +
+
Overrides: + _NamespaceRegistry.__setitem__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._IDDict-class.html b/doc/html/api/lxml.etree._IDDict-class.html new file mode 100644 index 0000000..ac8ba43 --- /dev/null +++ b/doc/html/api/lxml.etree._IDDict-class.html @@ -0,0 +1,540 @@ + + + + + lxml.etree._IDDict + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _IDDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _IDDict

+
+object --+
+         |
+        _IDDict
+
+ +
+

IDDict(self, etree) +A dictionary-like proxy class that mapps ID attributes to elements.

+

The dictionary must be instantiated with the root element of a parsed XML +document, otherwise the behaviour is undefined. Elements and XML trees +that were created or modified 'by hand' are not supported.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__contains__(x, + y)
+ y in x
+ + +
+ +
+   + + + + + + +
__getitem__(...) + + +
+ +
+   + + + + + + +
__init__(self, + etree)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
copy(...) + + +
+ +
+   + + + + + + +
get(...) + + +
+ +
+   + + + + + + +
has_key(...) + + +
+ +
+   + + + + + + +
items(...) + + +
+ +
+   + + + + + + +
iteritems(...) + + +
+ +
+   + + + + + + +
iterkeys(...) + + +
+ +
+   + + + + + + +
itervalues(...) + + +
+ +
+   + + + + + + +
keys(...) + + +
+ +
+   + + + + + + +
values(...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + etree) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._InputDocument-class.html b/doc/html/api/lxml.etree._InputDocument-class.html new file mode 100644 index 0000000..a3e67fc --- /dev/null +++ b/doc/html/api/lxml.etree._InputDocument-class.html @@ -0,0 +1,242 @@ + + + + + lxml.etree._InputDocument + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _InputDocument + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _InputDocument

+
+object --+
+         |
+        _InputDocument
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._IterparseContext-class.html b/doc/html/api/lxml.etree._IterparseContext-class.html new file mode 100644 index 0000000..2b77e98 --- /dev/null +++ b/doc/html/api/lxml.etree._IterparseContext-class.html @@ -0,0 +1,287 @@ + + + + + lxml.etree._IterparseContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _IterparseContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _IterparseContext

+
+       object --+            
+                |            
+_ExceptionContext --+        
+                    |        
+     _ResolverContext --+    
+                        |    
+           _ParserContext --+
+                            |
+                           _IterparseContext
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ListErrorLog-class.html b/doc/html/api/lxml.etree._ListErrorLog-class.html new file mode 100644 index 0000000..60406dc --- /dev/null +++ b/doc/html/api/lxml.etree._ListErrorLog-class.html @@ -0,0 +1,583 @@ + + + + + lxml.etree._ListErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ListErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ListErrorLog

+
+   object --+    
+            |    
+_BaseErrorLog --+
+                |
+               _ListErrorLog
+
+ +
Known Subclasses:
+
+ +
+ +
+Immutable base version of a list based error log. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__contains__(x, + y)
+ y in x
+ + +
+ +
+   + + + + + + +
__getitem__(...) + + +
+ +
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
copy(...)
+ Creates a shallow copy of this error log.
+ + +
+ +
+   + + + + + + +
filter_domains(...)
+ Filter the errors by the given domains and return a new error log +containing the matches.
+ + +
+ +
+   + + + + + + +
filter_from_errors(self)
+ Convenience method to get all error messages or worse.
+ + +
+ +
+   + + + + + + +
filter_from_fatals(self)
+ Convenience method to get all fatal error messages.
+ + +
+ +
+   + + + + + + +
filter_from_level(self, + level)
+ Return a log with all messages of the requested level of worse.
+ + +
+ +
+   + + + + + + +
filter_from_warnings(self)
+ Convenience method to get all warnings or worse.
+ + +
+ +
+   + + + + + + +
filter_levels(self, + levels)
+ Filter the errors by the given error levels and return a new +error log containing the matches.
+ + +
+ +
+   + + + + + + +
filter_types(self, + types)
+ Filter the errors by the given types and return a new error +log containing the matches.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

copy(...) +

+
  +
+ + Creates a shallow copy of this error log. Reuses the list of +entries. +
+
Overrides: + _BaseErrorLog.copy +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._LogEntry-class.html b/doc/html/api/lxml.etree._LogEntry-class.html new file mode 100644 index 0000000..b3bcb8e --- /dev/null +++ b/doc/html/api/lxml.etree._LogEntry-class.html @@ -0,0 +1,352 @@ + + + + + lxml.etree._LogEntry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _LogEntry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _LogEntry

+
+object --+
+         |
+        _LogEntry
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + column +
+   + + domain +
+   + + domain_name +
+   + + filename +
+   + + level +
+   + + level_name +
+   + + line +
+   + + message +
+   + + type +
+   + + type_name +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._NamespaceRegistry-class.html b/doc/html/api/lxml.etree._NamespaceRegistry-class.html new file mode 100644 index 0000000..b10b484 --- /dev/null +++ b/doc/html/api/lxml.etree._NamespaceRegistry-class.html @@ -0,0 +1,448 @@ + + + + + lxml.etree._NamespaceRegistry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _NamespaceRegistry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _NamespaceRegistry

+
+object --+
+         |
+        _NamespaceRegistry
+
+ +
Known Subclasses:
+
+ +
+ +
+Dictionary-like namespace registry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+   + + + + + + +
__getitem__(...) + + +
+ +
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+   + + + + + + +
clear(...) + + +
+ +
+   + + + + + + +
items(...) + + +
+ +
+   + + + + + + +
iteritems(...) + + +
+ +
+   + + + + + + +
update(self, + class_dict_iterable)
+ Forgivingly update the registry.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

update(self, + class_dict_iterable) +

+
  +
+ +

Forgivingly update the registry.

+

If registered values do not match the required type for this +registry, or if their name starts with '_', they will be +silently discarded. This allows registrations at the module or +class level using vars(), globals() etc.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ParserContext-class.html b/doc/html/api/lxml.etree._ParserContext-class.html new file mode 100644 index 0000000..9c96a13 --- /dev/null +++ b/doc/html/api/lxml.etree._ParserContext-class.html @@ -0,0 +1,252 @@ + + + + + lxml.etree._ParserContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ParserContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ParserContext

+
+       object --+        
+                |        
+_ExceptionContext --+    
+                    |    
+     _ResolverContext --+
+                        |
+                       _ParserContext
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ParserDictionaryContext-class.html b/doc/html/api/lxml.etree._ParserDictionaryContext-class.html new file mode 100644 index 0000000..6b38afe --- /dev/null +++ b/doc/html/api/lxml.etree._ParserDictionaryContext-class.html @@ -0,0 +1,281 @@ + + + + + lxml.etree._ParserDictionaryContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ParserDictionaryContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ParserDictionaryContext

+
+object --+
+         |
+        _ParserDictionaryContext
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ParserSchemaValidationContext-class.html b/doc/html/api/lxml.etree._ParserSchemaValidationContext-class.html new file mode 100644 index 0000000..30aa2c8 --- /dev/null +++ b/doc/html/api/lxml.etree._ParserSchemaValidationContext-class.html @@ -0,0 +1,242 @@ + + + + + lxml.etree._ParserSchemaValidationContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ParserSchemaValidationContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ParserSchemaValidationContext

+
+object --+
+         |
+        _ParserSchemaValidationContext
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ProcessingInstruction-class.html b/doc/html/api/lxml.etree._ProcessingInstruction-class.html new file mode 100644 index 0000000..ad1dabc --- /dev/null +++ b/doc/html/api/lxml.etree._ProcessingInstruction-class.html @@ -0,0 +1,367 @@ + + + + + lxml.etree._ProcessingInstruction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ProcessingInstruction + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ProcessingInstruction

+
+      object --+        
+               |        
+        _Element --+    
+                   |    
+__ContentOnlyElement --+
+                       |
+                      _ProcessingInstruction
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + tag
+ Element tag +
+   + + target +
+

Inherited from __ContentOnlyElement: + attrib, + text +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._PythonSaxParserTarget-class.html b/doc/html/api/lxml.etree._PythonSaxParserTarget-class.html new file mode 100644 index 0000000..90ed239 --- /dev/null +++ b/doc/html/api/lxml.etree._PythonSaxParserTarget-class.html @@ -0,0 +1,283 @@ + + + + + lxml.etree._PythonSaxParserTarget + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _PythonSaxParserTarget + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _PythonSaxParserTarget

+
+      object --+    
+               |    
+_SaxParserTarget --+
+                   |
+                  _PythonSaxParserTarget
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ReadOnlyElementProxy-class.html b/doc/html/api/lxml.etree._ReadOnlyElementProxy-class.html new file mode 100644 index 0000000..c643122 --- /dev/null +++ b/doc/html/api/lxml.etree._ReadOnlyElementProxy-class.html @@ -0,0 +1,718 @@ + + + + + lxml.etree._ReadOnlyElementProxy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ReadOnlyElementProxy + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ReadOnlyElementProxy

+
+object --+
+         |
+        _ReadOnlyElementProxy
+
+ +
Known Subclasses:
+
+ +
+ +
+The main read-only Element proxy class (for internal use only!). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__copy__(self) + + +
+ +
+   + + + + + + +
__deepcopy__(self, + memo) + + +
+ +
+   + + + + + + +
__getitem__(...)
+ Returns the subelement at the given position or the requested +slice.
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
get(...)
+ Gets an element attribute.
+ + +
+ +
+   + + + + + + +
getchildren(...)
+ Returns all subelements.
+ + +
+ +
+   + + + + + + +
getnext(...)
+ Returns the following sibling of this element or None.
+ + +
+ +
+   + + + + + + +
getparent(...)
+ Returns the parent of this element or None for the root element.
+ + +
+ +
+   + + + + + + +
getprevious(...)
+ Returns the preceding sibling of this element or None.
+ + +
+ +
+   + + + + + + +
items(...)
+ Gets element attributes, as a sequence.
+ + +
+ +
+   + + + + + + +
iterchildren(self, + tag=None, + reversed=False)
+ Iterate over the children of this element.
+ + +
+ +
+   + + + + + + +
keys(...)
+ Gets a list of attribute names.
+ + +
+ +
+   + + + + + + +
values(...)
+ Gets element attributes, as a sequence.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + attrib +
+   + + prefix
+ Namespace prefix or None. +
+   + + sourceline
+ Original line number as found by the parser or None if unknown. +
+   + + tag
+ Element tag +
+   + + tail
+ Text after this element's end tag, but before the next sibling +element's start tag. +
+   + + text
+ Text before the first subelement. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

getchildren(...) +

+
  +
+ + Returns all subelements. The elements are returned in document +order. +
+
+
+
+ +
+ +
+ + +
+

items(...) +

+
  +
+ + Gets element attributes, as a sequence. The attributes are returned +in an arbitrary order. +
+
+
+
+ +
+ +
+ + +
+

keys(...) +

+
  +
+ + Gets a list of attribute names. The names are returned in an +arbitrary order (just like for an ordinary Python dictionary). +
+
+
+
+ +
+ +
+ + +
+

values(...) +

+
  +
+ + Gets element attributes, as a sequence. The attributes are returned +in an arbitrary order. +
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

tail

+ Text after this element's end tag, but before the next sibling +element's start tag. This is either a string or the value None, if +there was no text. +
+
+
+
+ +
+ +
+

text

+ Text before the first subelement. This is either a string or +the value None, if there was no text. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ResolverContext-class.html b/doc/html/api/lxml.etree._ResolverContext-class.html new file mode 100644 index 0000000..6311cd5 --- /dev/null +++ b/doc/html/api/lxml.etree._ResolverContext-class.html @@ -0,0 +1,250 @@ + + + + + lxml.etree._ResolverContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ResolverContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ResolverContext

+
+       object --+    
+                |    
+_ExceptionContext --+
+                    |
+                   _ResolverContext
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._ResolverRegistry-class.html b/doc/html/api/lxml.etree._ResolverRegistry-class.html new file mode 100644 index 0000000..a712d19 --- /dev/null +++ b/doc/html/api/lxml.etree._ResolverRegistry-class.html @@ -0,0 +1,416 @@ + + + + + lxml.etree._ResolverRegistry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _ResolverRegistry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ResolverRegistry

+
+object --+
+         |
+        _ResolverRegistry
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
add(self, + resolver)
+ Register a resolver.
+ + +
+ +
+   + + + + + + +
copy(self) + + +
+ +
+   + + + + + + +
remove(self, + resolver) + + +
+ +
+   + + + + + + +
resolve(self, + system_url, + public_id, + context) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

add(self, + resolver) +

+
  +
+ +

Register a resolver.

+

For each requested entity, the 'resolve' method of the resolver will +be called and the result will be passed to the parser. If this method +returns None, the request will be delegated to other resolvers or the +default resolver. The resolvers will be tested in an arbitrary order +until the first match is found.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._RotatingErrorLog-class.html b/doc/html/api/lxml.etree._RotatingErrorLog-class.html new file mode 100644 index 0000000..1159f5d --- /dev/null +++ b/doc/html/api/lxml.etree._RotatingErrorLog-class.html @@ -0,0 +1,346 @@ + + + + + lxml.etree._RotatingErrorLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _RotatingErrorLog + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _RotatingErrorLog

+
+   object --+            
+            |            
+_BaseErrorLog --+        
+                |        
+    _ListErrorLog --+    
+                    |    
+            _ErrorLog --+
+                        |
+                       _RotatingErrorLog
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
receive(...) + + +
+ +
+

Inherited from _ErrorLog: + __iter__, + clear, + copy +

+

Inherited from _ListErrorLog: + __contains__, + __getitem__, + __len__, + __nonzero__, + __repr__, + filter_domains, + filter_from_errors, + filter_from_fatals, + filter_from_level, + filter_from_warnings, + filter_levels, + filter_types +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _BaseErrorLog: + last_error +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

receive(...) +

+
  +
+ + +
+
Overrides: + _ErrorLog.receive +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._SaxParserContext-class.html b/doc/html/api/lxml.etree._SaxParserContext-class.html new file mode 100644 index 0000000..b16313a --- /dev/null +++ b/doc/html/api/lxml.etree._SaxParserContext-class.html @@ -0,0 +1,256 @@ + + + + + lxml.etree._SaxParserContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _SaxParserContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _SaxParserContext

+
+       object --+            
+                |            
+_ExceptionContext --+        
+                    |        
+     _ResolverContext --+    
+                        |    
+           _ParserContext --+
+                            |
+                           _SaxParserContext
+
+ +
Known Subclasses:
+
+ +
+ +
+This class maps SAX2 events to method calls. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._SaxParserTarget-class.html b/doc/html/api/lxml.etree._SaxParserTarget-class.html new file mode 100644 index 0000000..1e4e2a9 --- /dev/null +++ b/doc/html/api/lxml.etree._SaxParserTarget-class.html @@ -0,0 +1,248 @@ + + + + + lxml.etree._SaxParserTarget + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _SaxParserTarget + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _SaxParserTarget

+
+object --+
+         |
+        _SaxParserTarget
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._TargetParserContext-class.html b/doc/html/api/lxml.etree._TargetParserContext-class.html new file mode 100644 index 0000000..45af8a4 --- /dev/null +++ b/doc/html/api/lxml.etree._TargetParserContext-class.html @@ -0,0 +1,252 @@ + + + + + lxml.etree._TargetParserContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _TargetParserContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _TargetParserContext

+
+       object --+                
+                |                
+_ExceptionContext --+            
+                    |            
+     _ResolverContext --+        
+                        |        
+           _ParserContext --+    
+                            |    
+            _SaxParserContext --+
+                                |
+                               _TargetParserContext
+
+ +
+This class maps SAX2 events to the ET parser target interface. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._TargetParserResult-class.html b/doc/html/api/lxml.etree._TargetParserResult-class.html new file mode 100644 index 0000000..d18fec6 --- /dev/null +++ b/doc/html/api/lxml.etree._TargetParserResult-class.html @@ -0,0 +1,255 @@ + + + + + lxml.etree._TargetParserResult + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _TargetParserResult + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _TargetParserResult

+
+              object --+        
+                       |        
+exceptions.BaseException --+    
+                           |    
+        exceptions.Exception --+
+                               |
+                              _TargetParserResult
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._TempStore-class.html b/doc/html/api/lxml.etree._TempStore-class.html new file mode 100644 index 0000000..620679f --- /dev/null +++ b/doc/html/api/lxml.etree._TempStore-class.html @@ -0,0 +1,281 @@ + + + + + lxml.etree._TempStore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _TempStore + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _TempStore

+
+object --+
+         |
+        _TempStore
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._Validator-class.html b/doc/html/api/lxml.etree._Validator-class.html new file mode 100644 index 0000000..3d087f8 --- /dev/null +++ b/doc/html/api/lxml.etree._Validator-class.html @@ -0,0 +1,372 @@ + + + + + lxml.etree._Validator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _Validator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _Validator

+
+object --+
+         |
+        _Validator
+
+ +
Known Subclasses:
+
+ +
+ +
+Base class for XML validators. + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
assertValid(self, + etree)
+ Raises DocumentInvalid if the document does not comply with the schema.
+ + +
+ +
+   + + + + + + +
assert_(self, + etree)
+ Raises AssertionError if the document does not comply with the schema.
+ + +
+ +
+   + + + + + + +
validate(self, + etree)
+ Validate the document using this schema.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log
+ The log of validation errors and warnings. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

validate(self, + etree) +

+
  +
+ +

Validate the document using this schema.

+

Returns true if document is valid, false if not.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XPathContext-class.html b/doc/html/api/lxml.etree._XPathContext-class.html new file mode 100644 index 0000000..8902d7e --- /dev/null +++ b/doc/html/api/lxml.etree._XPathContext-class.html @@ -0,0 +1,287 @@ + + + + + lxml.etree._XPathContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XPathContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XPathContext

+
+  object --+    
+           |    
+_BaseContext --+
+               |
+              _XPathContext
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _BaseContext: + context_node, + eval_context +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XPathEvaluatorBase-class.html b/doc/html/api/lxml.etree._XPathEvaluatorBase-class.html new file mode 100644 index 0000000..9c02226 --- /dev/null +++ b/doc/html/api/lxml.etree._XPathEvaluatorBase-class.html @@ -0,0 +1,341 @@ + + + + + lxml.etree._XPathEvaluatorBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XPathEvaluatorBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XPathEvaluatorBase

+
+object --+
+         |
+        _XPathEvaluatorBase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
evaluate(self, + _eval_arg, + **_variables)
+ Evaluate an XPath expression.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

evaluate(self, + _eval_arg, + **_variables) +

+
  +
+ +

Evaluate an XPath expression.

+

Instead of calling this method, you can also call the evaluator object +itself.

+

Variables may be provided as keyword arguments. Note that namespaces +are currently not supported for variables.

+
+
+

Deprecated: + call the object, not its method. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XPathFunctionNamespaceRegistry-class.html b/doc/html/api/lxml.etree._XPathFunctionNamespaceRegistry-class.html new file mode 100644 index 0000000..f030d8b --- /dev/null +++ b/doc/html/api/lxml.etree._XPathFunctionNamespaceRegistry-class.html @@ -0,0 +1,266 @@ + + + + + lxml.etree._XPathFunctionNamespaceRegistry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XPathFunctionNamespaceRegistry + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XPathFunctionNamespaceRegistry

+
+            object --+        
+                     |        
+    _NamespaceRegistry --+    
+                         |    
+_FunctionNamespaceRegistry --+
+                             |
+                            _XPathFunctionNamespaceRegistry
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from _FunctionNamespaceRegistry: + __delitem__, + __repr__, + __setitem__ +

+

Inherited from _NamespaceRegistry: + __getitem__, + __init__, + __iter__, + clear, + items, + iteritems, + update +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + prefix
+ Namespace prefix for extension functions. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XSLTContext-class.html b/doc/html/api/lxml.etree._XSLTContext-class.html new file mode 100644 index 0000000..e3af689 --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTContext-class.html @@ -0,0 +1,287 @@ + + + + + lxml.etree._XSLTContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XSLTContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XSLTContext

+
+  object --+    
+           |    
+_BaseContext --+
+               |
+              _XSLTContext
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _BaseContext: + context_node, + eval_context +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XSLTProcessingInstruction-class.html b/doc/html/api/lxml.etree._XSLTProcessingInstruction-class.html new file mode 100644 index 0000000..7a92bfa --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTProcessingInstruction-class.html @@ -0,0 +1,444 @@ + + + + + lxml.etree._XSLTProcessingInstruction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XSLTProcessingInstruction + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XSLTProcessingInstruction

+
+      object --+                
+               |                
+        _Element --+            
+                   |            
+__ContentOnlyElement --+        
+                       |        
+  _ProcessingInstruction --+    
+                           |    
+                      PIBase --+
+                               |
+                              _XSLTProcessingInstruction
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
get(self, + key, + default=None)
+ Gets an element attribute.
+ + +
+ +
+   + + + + + + +
parseXSL(...)
+ Try to parse the stylesheet referenced by this PI and return an +ElementTree for it.
+ + +
+ +
+   + + + + + + +
set(self, + key, + value)
+ Sets an element attribute.
+ + +
+ +
+

Inherited from _ProcessingInstruction: + __repr__ +

+

Inherited from __ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + insert, + items, + keys, + values +

+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from _ProcessingInstruction: + tag, + target +

+

Inherited from __ContentOnlyElement: + attrib, + text +

+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

get(self, + key, + default=None) +

+
  +
+ + Gets an element attribute. +
+
Overrides: + _Element.get +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

parseXSL(...) +

+
  +
+ +

Try to parse the stylesheet referenced by this PI and return an +ElementTree for it. If the stylesheet is embedded in the same +document (referenced via xml:id), find and return an ElementTree for +the stylesheet Element.

+

The optional parser keyword argument can be passed to specify the +parser used to read from external stylesheet URLs.

+
+
+
+
+ +
+ +
+ + +
+

set(self, + key, + value) +

+
  +
+ + Sets an element attribute. +
+
Overrides: + _Element.set +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XSLTQuotedStringParam-class.html b/doc/html/api/lxml.etree._XSLTQuotedStringParam-class.html new file mode 100644 index 0000000..f8da9f7 --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTQuotedStringParam-class.html @@ -0,0 +1,284 @@ + + + + + lxml.etree._XSLTQuotedStringParam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XSLTQuotedStringParam + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XSLTQuotedStringParam

+
+object --+
+         |
+        _XSLTQuotedStringParam
+
+ +
+A wrapper class for literal XSLT string parameters that require +quote escaping. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(...)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(...) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XSLTResolverContext-class.html b/doc/html/api/lxml.etree._XSLTResolverContext-class.html new file mode 100644 index 0000000..05beb2d --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTResolverContext-class.html @@ -0,0 +1,246 @@ + + + + + lxml.etree._XSLTResolverContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XSLTResolverContext + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XSLTResolverContext

+
+       object --+        
+                |        
+_ExceptionContext --+    
+                    |    
+     _ResolverContext --+
+                        |
+                       _XSLTResolverContext
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree._XSLTResultTree-class.html b/doc/html/api/lxml.etree._XSLTResultTree-class.html new file mode 100644 index 0000000..ea857dc --- /dev/null +++ b/doc/html/api/lxml.etree._XSLTResultTree-class.html @@ -0,0 +1,335 @@ + + + + + lxml.etree._XSLTResultTree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class _XSLTResultTree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _XSLTResultTree

+
+  object --+    
+           |    
+_ElementTree --+
+               |
+              _XSLTResultTree
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+   + + + + + + +
__unicode__(...) + + +
+ +
+

Inherited from _ElementTree: + __copy__, + __deepcopy__, + find, + findall, + findtext, + getiterator, + getpath, + getroot, + iter, + iterfind, + parse, + relaxng, + write, + write_c14n, + xinclude, + xmlschema, + xpath, + xslt +

+

Inherited from _ElementTree (private): + _setroot +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + xslt_profile
+ Return an ElementTree with profiling data for the stylesheet run. +
+

Inherited from _ElementTree: + docinfo, + parser +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.__ContentOnlyElement-class.html b/doc/html/api/lxml.etree.__ContentOnlyElement-class.html new file mode 100644 index 0000000..e884c02 --- /dev/null +++ b/doc/html/api/lxml.etree.__ContentOnlyElement-class.html @@ -0,0 +1,770 @@ + + + + + lxml.etree.__ContentOnlyElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class __ContentOnlyElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class __ContentOnlyElement

+
+object --+    
+         |    
+  _Element --+
+             |
+            __ContentOnlyElement
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+   + + + + + + +
__getitem__(self, + x)
+ Returns the subelement at the given position or the requested +slice.
+ + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+   + + + + + + +
append(self, + value)
+ Adds a subelement to the end of this element.
+ + +
+ +
+   + + + + + + +
get(self, + key, + default=None)
+ Gets an element attribute.
+ + +
+ +
+   + + + + + + +
insert(self, + index, + value)
+ Inserts a subelement at the given position in this element
+ + +
+ +
+   + + + + + + +
items(self)
+ Gets element attributes, as a sequence.
+ + +
+ +
+   + + + + + + +
keys(self)
+ Gets a list of attribute names.
+ + +
+ +
+   + + + + + + +
set(self, + key, + value)
+ Sets an element attribute.
+ + +
+ +
+   + + + + + + +
values(self)
+ Gets element attribute values as a sequence of strings.
+ + +
+ +
+

Inherited from _Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __repr__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from _Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + attrib
+ Element attribute dictionary. +
+   + + text
+ Text before the first subelement. +
+

Inherited from _Element: + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__delitem__(x, + y) +
(Index deletion operator) +

+
  +
+ + del x[y] +
+
Overrides: + _Element.__delitem__ +
+
+
+
+ +
+ +
+ + +
+

__getitem__(self, + x) +
(Indexing operator) +

+
  +
+ + Returns the subelement at the given position or the requested +slice. +
+
Overrides: + _Element.__getitem__ +
+
+
+
+ +
+ +
+ + +
+

__len__(x) +
(Length operator) +

+
  +
+ + len(x) +
+
Overrides: + _Element.__len__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__setitem__(x, + i, + y) +
(Index assignment operator) +

+
  +
+ + x[i]=y +
+
Overrides: + _Element.__setitem__ +
+
+
+
+ +
+ +
+ + +
+

append(self, + value) +

+
  +
+ + Adds a subelement to the end of this element. +
+
Overrides: + _Element.append +
+
+
+
+ +
+ +
+ + +
+

get(self, + key, + default=None) +

+
  +
+ + Gets an element attribute. +
+
Overrides: + _Element.get +
+
+
+
+ +
+ +
+ + +
+

insert(self, + index, + value) +

+
  +
+ + Inserts a subelement at the given position in this element +
+
Overrides: + _Element.insert +
+
+
+
+ +
+ +
+ + +
+

items(self) +

+
  +
+ + Gets element attributes, as a sequence. The attributes are returned in +an arbitrary order. +
+
Overrides: + _Element.items +
+
+
+
+ +
+ +
+ + +
+

keys(self) +

+
  +
+ + Gets a list of attribute names. The names are returned in an +arbitrary order (just like for an ordinary Python dictionary). +
+
Overrides: + _Element.keys +
+
+
+
+ +
+ +
+ + +
+

set(self, + key, + value) +

+
  +
+ + Sets an element attribute. +
+
Overrides: + _Element.set +
+
+
+
+ +
+ +
+ + +
+

values(self) +

+
  +
+ + Gets element attribute values as a sequence of strings. The +attributes are returned in an arbitrary order. +
+
Overrides: + _Element.values +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.iterparse-class.html b/doc/html/api/lxml.etree.iterparse-class.html new file mode 100644 index 0000000..8bba428 --- /dev/null +++ b/doc/html/api/lxml.etree.iterparse-class.html @@ -0,0 +1,483 @@ + + + + + lxml.etree.iterparse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class iterparse + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class iterparse

+
+ object --+    
+          |    
+_BaseParser --+
+              |
+             iterparse
+
+ +
+

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)

+

Incremental parser.

+

Parses XML into a tree and generates tuples (event, element) in a +SAX-like fashion. event is any of 'start', 'end', 'start-ns', +'end-ns'.

+

For 'start' and 'end', element is the Element that the parser just +found opening or closing. For 'start-ns', it is a tuple (prefix, URI) of +a new namespace declaration. For 'end-ns', it is simply None. Note that +all start and end events are guaranteed to be properly nested.

+

The keyword argument events specifies a sequence of event type names +that should be generated. By default, only 'end' events will be +generated.

+

The additional tag argument restricts the 'start' and 'end' events to +those elements that match the given tag. By default, events are generated +for all elements. Note that the 'start-ns' and 'end-ns' events are not +impacted by this restriction.

+

The other keyword arguments in the constructor are mainly based on the +libxml2 parser configuration. A DTD will also be loaded if validation or +attribute default values are requested.

+
+
Available boolean keyword arguments:
+
    +
  • attribute_defaults: read default attributes from DTD

    +
  • +
  • dtd_validation: validate (if DTD is available)

    +
  • +
  • load_dtd: use DTD for parsing

    +
  • +
  • no_network: prevent network access for related files

    +
  • +
  • remove_blank_text: discard blank text nodes

    +
  • +
  • remove_comments: discard comments

    +
  • +
  • remove_pis: discard processing instructions

    +
  • +
  • strip_cdata: replace CDATA sections by normal text content (default: True)

    +
  • +
  • compact: safe memory for short text content (default: True)

    +
  • +
  • resolve_entities: replace entities by their text value (default: True)

    +
  • +
  • +
    huge_tree: disable security restrictions and support very deep trees
    +

    and very long text content (only affects libxml2 2.7+)

    +
    +
    +
  • +
+
+
Other keyword arguments:
+
    +
  • encoding: override the document encoding
  • +
  • schema: an XMLSchema to validate against
  • +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(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)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+   + + + + + + +
copy(self)
+ Create a new parser with the same configuration.
+ + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+

Inherited from _BaseParser: + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + error_log
+ The error log of the last (or current) parser run. +
+   + + root +
+

Inherited from _BaseParser: + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(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) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

copy(self) +

+
  +
+ + Create a new parser with the same configuration. +
+
Overrides: + _BaseParser.copy +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.etree.iterwalk-class.html b/doc/html/api/lxml.etree.iterwalk-class.html new file mode 100644 index 0000000..2f83af7 --- /dev/null +++ b/doc/html/api/lxml.etree.iterwalk-class.html @@ -0,0 +1,341 @@ + + + + + lxml.etree.iterwalk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module etree :: + Class iterwalk + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class iterwalk

+
+object --+
+         |
+        iterwalk
+
+ +
+

iterwalk(self, element_or_tree, events=("end",), tag=None)

+

A tree walker that generates events from an existing tree as if it +was parsing XML data with iterparse().

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element_or_tree, + events=("end", + ), + tag=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+   + + + + + + +
__iter__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__next__(...) + + +
+ +
+ the next value, or raise StopIteration + + + + + + +
next(x) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element_or_tree, + events=("end", + ), + tag=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html-module.html b/doc/html/api/lxml.html-module.html new file mode 100644 index 0000000..703b877 --- /dev/null +++ b/doc/html/api/lxml.html-module.html @@ -0,0 +1,1241 @@ + + + + + lxml.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package html

source code

+The lxml.html tool set for HTML handling. + + + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + HtmlMixin +
+   + + _MethodFunc
+ An object that represents a method on an element as a function; +the function takes either an element or an HTML string. +
+   + + HtmlComment +
+   + + HtmlElement +
+   + + HtmlProcessingInstruction +
+   + + HtmlEntity +
+   + + HtmlElementClassLookup
+ A lookup scheme for HTML Element classes. +
+   + + FormElement
+ Represents a <form> element. +
+   + + FieldsDict +
+   + + InputGetter
+ An accessor that represents all the input fields in a form. +
+   + + InputMixin
+ Mix-in for all input elements (input, select, and textarea) +
+   + + TextareaElement
+ <textarea> element. +
+   + + SelectElement
+ <select> element. +
+   + + MultipleSelectOptions
+ Represents all the selected options in a <select multiple> element. +
+   + + RadioGroup
+ This object represents several <input type=radio> elements +that have the same name. +
+   + + CheckboxGroup
+ Represents a group of checkboxes (<input type=checkbox>) that +have the same name. +
+   + + CheckboxValues
+ Represents the values of the checked checkboxes in a group of +checkboxes with the same name. +
+   + + InputElement
+ Represents an <input> element. +
+   + + LabelElement
+ Represents a <label> element. +
+   + + HTMLParser +
+   + + XHTMLParser +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
__fix_docstring(s) + source code + +
+ +
+   + + + + + + +
_unquote_match(s, + pos) + source code + +
+ +
+   + + + + + + +
_transform_result(typ, + result)
+ Convert the result back into the input type.
+ source code + +
+ +
+   + + + + + + +
_nons(tag) + source code + +
+ +
+   + + + + + + +
document_fromstring(html, + parser=None, + **kw) + source code + +
+ +
+   + + + + + + +
fragments_fromstring(html, + no_leading_text=False, + base_url=None, + parser=None, + **kw)
+ Parses several HTML elements, returning a list of elements.
+ source code + +
+ +
+   + + + + + + +
fragment_fromstring(html, + create_parent=False, + base_url=None, + parser=None, + **kw)
+ Parses a single HTML element; it is an error if there is more than +one element, or if anything but whitespace precedes or follows the +element.
+ source code + +
+ +
+   + + + + + + +
fromstring(html, + base_url=None, + parser=None, + **kw)
+ Parse the html, returning a single element/document.
+ source code + +
+ +
+   + + + + + + +
parse(filename_or_url, + parser=None, + base_url=None, + **kw)
+ Parse a filename, URL, or file-like object into an HTML document +tree.
+ source code + +
+ +
+   + + + + + + +
_contains_block_level_tag(el) + source code + +
+ +
+   + + + + + + +
_element_name(el) + source code + +
+ +
+   + + + + + + +
submit_form(form, + extra_values=None, + open_http=None)
+ Helper function to submit a form.
+ source code + +
+ +
+   + + + + + + +
open_http_urllib(method, + url, + values) + source code + +
+ +
+   + + + + + + +
html_to_xhtml(html)
+ Convert all tags in an HTML tree to XHTML by moving them to the +XHTML namespace.
+ source code + +
+ +
+   + + + + + + +
xhtml_to_html(xhtml)
+ Convert all tags in an XHTML tree to HTML by removing their +XHTML namespace.
+ source code + +
+ +
+   + + + + + + +
__str_replace_meta_content_type(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
__bytes_replace_meta_content_type(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
tostring(doc, + pretty_print=False, + include_meta_content_type=False, + encoding=None, + method='html')
+ Return an HTML string representation of the document.
+ source code + +
+ +
+   + + + + + + +
open_in_browser(doc)
+ Open the HTML document in a web browser (saving it to a temporary +file to open it).
+ source code + +
+ +
+   + + + + + + +
Element(*args, + **kw)
+ Create a new HTML Element.
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml' +
+   + + _rel_links_xpath = descendant-or-self::a[@rel]|descendant-or-s... +
+   + + _options_xpath = descendant-or-self::option|descendant-or-self... +
+   + + _forms_xpath = descendant-or-self::form|descendant-or-self::x:... +
+   + + _class_xpath = descendant-or-self::*[@class and contains(conca... +
+   + + _id_xpath = descendant-or-self::*[@id=$id] +
+   + + _collect_string_content = string() +
+   + + _css_url_re = re.compile(r'(?i)url\(("[^"]*"|\'[^\']*\'|[^\)]*... +
+   + + _css_import_re = re.compile(r'@import "(.*?)"') +
+   + + _label_xpath = //label[@for=$id]|//x:label[@for=$id] +
+   + + _archive_re = re.compile(r'[^ ]+') +
+   + + find_rel_links = _MethodFunc('find_rel_links', copy= False) +
+   + + find_class = _MethodFunc('find_class', copy= False) +
+   + + make_links_absolute = _MethodFunc('make_links_absolute', copy=... +
+   + + resolve_base_href = _MethodFunc('resolve_base_href', copy= True) +
+   + + iterlinks = _MethodFunc('iterlinks', copy= False) +
+   + + rewrite_links = _MethodFunc('rewrite_links', copy= True) +
+   + + html_parser = HTMLParser() +
+   + + xhtml_parser = XHTMLParser() +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

fragments_fromstring(html, + no_leading_text=False, + base_url=None, + parser=None, + **kw) +

+
source code  +
+ +

Parses several HTML elements, returning a list of elements.

+

The first item in the list may be a string (though leading +whitespace is removed). If no_leading_text is true, then it will +be an error if there is leading text, and it will always be a list +of only elements.

+

base_url will set the document's base_url attribute (and the tree's docinfo.URL)

+
+
+
+
+ +
+ +
+ + +
+

fragment_fromstring(html, + create_parent=False, + base_url=None, + parser=None, + **kw) +

+
source code  +
+ +

Parses a single HTML element; it is an error if there is more than +one element, or if anything but whitespace precedes or follows the +element.

+

If create_parent is true (or is a tag name) then a parent node +will be created to encapsulate the HTML in a single element.

+

base_url will set the document's base_url attribute (and the tree's docinfo.URL)

+
+
+
+
+ +
+ +
+ + +
+

fromstring(html, + base_url=None, + parser=None, + **kw) +

+
source code  +
+ +

Parse the html, returning a single element/document.

+

This tries to minimally parse the chunk of text, without knowing if it +is a fragment or a document.

+

base_url will set the document's base_url attribute (and the tree's docinfo.URL)

+
+
+
+
+ +
+ +
+ + +
+

parse(filename_or_url, + parser=None, + base_url=None, + **kw) +

+
source code  +
+ +

Parse a filename, URL, or file-like object into an HTML document +tree. Note: this returns a tree, not an element. Use +parse(...).getroot() to get the document root.

+

You can override the base URL with the base_url keyword. This +is most useful when parsing from a file-like object.

+
+
+
+
+ +
+ +
+ + +
+

submit_form(form, + extra_values=None, + open_http=None) +

+
source code  +
+ +

Helper function to submit a form. Returns a file-like object, as from +urllib.urlopen(). This object also has a .geturl() function, +which shows the URL if there were any redirects.

+

You can use this like:

+
+form = doc.forms[0]
+form.inputs['foo'].value = 'bar' # etc
+response = form.submit()
+doc = parse(response)
+doc.make_links_absolute(response.geturl())
+
+

To change the HTTP requester, pass a function as open_http keyword +argument that opens the URL for you. The function must have the following +signature:

+
+open_http(method, URL, values)
+
+

The action is one of 'GET' or 'POST', the URL is the target URL as a +string, and the values are a sequence of (name, value) tuples with the +form data.

+
+
+
+
+ +
+ +
+ + +
+

tostring(doc, + pretty_print=False, + include_meta_content_type=False, + encoding=None, + method='html') +

+
source code  +
+ +

Return an HTML string representation of the document.

+

Note: if include_meta_content_type is true this will create a +<meta http-equiv="Content-Type" ...> tag in the head; +regardless of the value of include_meta_content_type any existing +<meta http-equiv="Content-Type" ...> tag will be removed

+

The encoding argument controls the output encoding (defauts to +ASCII, with &#...; character references for any characters outside +of ASCII).

+

The method argument defines the output method. It defaults to +'html', but can also be 'xml' for xhtml output, or 'text' to +serialise to plain text without markup. Note that you can pass +the builtin unicode type as encoding argument to serialise +to a unicode string.

+

Example:

+
+>>> from lxml import html
+>>> root = html.fragment_fromstring('<p>Hello<br>world!</p>')
+
+>>> html.tostring(root)
+'<p>Hello<br>world!</p>'
+>>> html.tostring(root, method='html')
+'<p>Hello<br>world!</p>'
+
+>>> html.tostring(root, method='xml')
+'<p>Hello<br/>world!</p>'
+
+>>> html.tostring(root, method='text')
+'Helloworld!'
+
+>>> html.tostring(root, method='text', encoding=unicode)
+u'Helloworld!'
+
+
+
+
+
+ +
+ +
+ + +
+

Element(*args, + **kw) +

+
source code  +
+ +

Create a new HTML Element.

+

This can also be used for XHTML documents.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

_rel_links_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]
+
+
+
+
+
+ +
+ +
+

_options_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::option|descendant-or-self::x:option
+
+
+
+
+
+ +
+ +
+

_forms_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::form|descendant-or-self::x:form
+
+
+
+
+
+ +
+ +
+

_class_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::*[@class and contains(concat(' ', normalize-space(\
+@class), ' '), concat(' ', $class_name, ' '))]
+
+
+
+
+
+ +
+ +
+

_css_url_re

+ +
+
+
+
Value:
+
+re.compile(r'(?i)url\(("[^"]*"|\'[^\']*\'|[^\)]*)\)')
+
+
+
+
+
+ +
+ +
+

make_links_absolute

+ +
+
+
+
Value:
+
+_MethodFunc('make_links_absolute', copy= True)
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html-pysrc.html b/doc/html/api/lxml.html-pysrc.html new file mode 100644 index 0000000..98131a6 --- /dev/null +++ b/doc/html/api/lxml.html-pysrc.html @@ -0,0 +1,3900 @@ + + + + + lxml.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml.html

+
+   1  """The ``lxml.html`` tool set for HTML handling. 
+   2  """ 
+   3   
+   4  import threading 
+   5  import re 
+   6  try: 
+   7      from urlparse import urljoin 
+   8  except ImportError: 
+   9      # Python 3 
+  10      from urllib.parse import urljoin 
+  11  import copy 
+  12  from lxml import etree 
+  13  from lxml.html import defs 
+  14  from lxml import cssselect 
+  15  from lxml.html._setmixin import SetMixin 
+  16  try: 
+  17      from UserDict import DictMixin 
+  18  except ImportError: 
+  19      # DictMixin was introduced in Python 2.4 
+  20      from lxml.html._dictmixin import DictMixin 
+  21  try: 
+  22      set 
+  23  except NameError: 
+  24      # Python 2.3 
+  25      from sets import Set as set 
+  26  try: 
+  27      bytes = __builtins__["bytes"] 
+  28  except (KeyError, NameError): 
+  29      # Python < 2.6 
+  30      bytes = str 
+  31  try: 
+  32      unicode = __builtins__["unicode"] 
+  33  except (KeyError, NameError): 
+  34      # Python 3 
+  35      unicode = str 
+  36  try: 
+  37      basestring = __builtins__["basestring"] 
+  38  except (KeyError, NameError): 
+  39      # Python 3 
+  40      basestring = (str, bytes) 
+  41   
+
42 -def __fix_docstring(s): +
43 if not s: + 44 return s + 45 import sys + 46 if sys.version_info[0] >= 3: + 47 sub = re.compile(r"^(\s*)u'", re.M).sub + 48 else: + 49 sub = re.compile(r"^(\s*)b'", re.M).sub + 50 return sub(r"\1'", s) +
51 + 52 __all__ = [ + 53 'document_fromstring', 'fragment_fromstring', 'fragments_fromstring', 'fromstring', + 54 'tostring', 'Element', 'defs', 'open_in_browser', 'submit_form', + 55 'find_rel_links', 'find_class', 'make_links_absolute', + 56 'resolve_base_href', 'iterlinks', 'rewrite_links', 'open_in_browser', 'parse'] + 57 + 58 XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" + 59 + 60 _rel_links_xpath = etree.XPath("descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]", + 61 namespaces={'x':XHTML_NAMESPACE}) + 62 _options_xpath = etree.XPath("descendant-or-self::option|descendant-or-self::x:option", + 63 namespaces={'x':XHTML_NAMESPACE}) + 64 _forms_xpath = etree.XPath("descendant-or-self::form|descendant-or-self::x:form", + 65 namespaces={'x':XHTML_NAMESPACE}) + 66 #_class_xpath = etree.XPath(r"descendant-or-self::*[regexp:match(@class, concat('\b', $class_name, '\b'))]", {'regexp': 'http://exslt.org/regular-expressions'}) + 67 _class_xpath = etree.XPath("descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), concat(' ', $class_name, ' '))]") + 68 _id_xpath = etree.XPath("descendant-or-self::*[@id=$id]") + 69 _collect_string_content = etree.XPath("string()") + 70 _css_url_re = re.compile(r'url\(('+'["][^"]*["]|'+"['][^']*[']|"+r'[^)]*)\)', re.I) + 71 _css_import_re = re.compile(r'@import "(.*?)"') + 72 _label_xpath = etree.XPath("//label[@for=$id]|//x:label[@for=$id]", + 73 namespaces={'x':XHTML_NAMESPACE}) + 74 _archive_re = re.compile(r'[^ ]+') + 75 +
76 -def _unquote_match(s, pos): +
77 if s[:1] == '"' and s[-1:] == '"' or s[:1] == "'" and s[-1:] == "'": + 78 return s[1:-1], pos+1 + 79 else: + 80 return s,pos +
81 +
82 -def _transform_result(typ, result): +
83 """Convert the result back into the input type. + 84 """ + 85 if issubclass(typ, bytes): + 86 return tostring(result, encoding='utf-8') + 87 elif issubclass(typ, unicode): + 88 return tostring(result, encoding=unicode) + 89 else: + 90 return result +
91 +
92 -def _nons(tag): +
93 if isinstance(tag, basestring): + 94 if tag[0] == '{' and tag[1:len(XHTML_NAMESPACE)+1] == XHTML_NAMESPACE: + 95 return tag.split('}')[-1] + 96 return tag +
97 +
98 -class HtmlMixin(object): +
99 +
100 - def base_url(self): +
101 """ + 102 Returns the base URL, given when the page was parsed. + 103 + 104 Use with ``urlparse.urljoin(el.base_url, href)`` to get + 105 absolute URLs. + 106 """ + 107 return self.getroottree().docinfo.URL +
108 base_url = property(base_url, doc=base_url.__doc__) + 109 +
110 - def forms(self): +
111 """ + 112 Return a list of all the forms + 113 """ + 114 return _forms_xpath(self) +
115 forms = property(forms, doc=forms.__doc__) + 116 +
117 - def body(self): +
118 """ + 119 Return the <body> element. Can be called from a child element + 120 to get the document's head. + 121 """ + 122 return self.xpath('//body|//x:body', namespaces={'x':XHTML_NAMESPACE})[0] +
123 body = property(body, doc=body.__doc__) + 124 +
125 - def head(self): +
126 """ + 127 Returns the <head> element. Can be called from a child + 128 element to get the document's head. + 129 """ + 130 return self.xpath('//head|//x:head', namespaces={'x':XHTML_NAMESPACE})[0] +
131 head = property(head, doc=head.__doc__) + 132 +
133 - def _label__get(self): +
134 """ + 135 Get or set any <label> element associated with this element. + 136 """ + 137 id = self.get('id') + 138 if not id: + 139 return None + 140 result = _label_xpath(self, id=id) + 141 if not result: + 142 return None + 143 else: + 144 return result[0] +
145 - def _label__set(self, label): +
146 id = self.get('id') + 147 if not id: + 148 raise TypeError( + 149 "You cannot set a label for an element (%r) that has no id" + 150 % self) + 151 if _nons(label.tag) != 'label': + 152 raise TypeError( + 153 "You can only assign label to a label element (not %r)" + 154 % label) + 155 label.set('for', id) +
156 - def _label__del(self): +
157 label = self.label + 158 if label is not None: + 159 del label.attrib['for'] +
160 label = property(_label__get, _label__set, _label__del, doc=_label__get.__doc__) + 161 +
162 - def drop_tree(self): +
163 """ + 164 Removes this element from the tree, including its children and + 165 text. The tail text is joined to the previous element or + 166 parent. + 167 """ + 168 parent = self.getparent() + 169 assert parent is not None + 170 if self.tail: + 171 previous = self.getprevious() + 172 if previous is None: + 173 parent.text = (parent.text or '') + self.tail + 174 else: + 175 previous.tail = (previous.tail or '') + self.tail + 176 parent.remove(self) +
177 +
178 - def drop_tag(self): +
179 """ + 180 Remove the tag, but not its children or text. The children and text + 181 are merged into the parent. + 182 + 183 Example:: + 184 + 185 >>> h = fragment_fromstring('<div>Hello <b>World!</b></div>') + 186 >>> h.find('.//b').drop_tag() + 187 >>> print(tostring(h, encoding=unicode)) + 188 <div>Hello World!</div> + 189 """ + 190 parent = self.getparent() + 191 assert parent is not None + 192 previous = self.getprevious() + 193 if self.text and isinstance(self.tag, basestring): + 194 # not a Comment, etc. + 195 if previous is None: + 196 parent.text = (parent.text or '') + self.text + 197 else: + 198 previous.tail = (previous.tail or '') + self.text + 199 if self.tail: + 200 if len(self): + 201 last = self[-1] + 202 last.tail = (last.tail or '') + self.tail + 203 elif previous is None: + 204 parent.text = (parent.text or '') + self.tail + 205 else: + 206 previous.tail = (previous.tail or '') + self.tail + 207 index = parent.index(self) + 208 parent[index:index+1] = self[:] +
209 + 217 +
218 - def find_class(self, class_name): +
219 """ + 220 Find any elements with the given class name. + 221 """ + 222 return _class_xpath(self, class_name=class_name) +
223 +
224 - def get_element_by_id(self, id, *default): +
225 """ + 226 Get the first element in a document with the given id. If none is + 227 found, return the default argument if provided or raise KeyError + 228 otherwise. + 229 + 230 Note that there can be more than one element with the same id, + 231 and this isn't uncommon in HTML documents found in the wild. + 232 Browsers return only the first match, and this function does + 233 the same. + 234 """ + 235 try: + 236 # FIXME: should this check for multiple matches? + 237 # browsers just return the first one + 238 return _id_xpath(self, id=id)[0] + 239 except IndexError: + 240 if default: + 241 return default[0] + 242 else: + 243 raise KeyError(id) +
244 +
245 - def text_content(self): +
246 """ + 247 Return the text content of the tag (and the text in any children). + 248 """ + 249 return _collect_string_content(self) +
250 +
251 - def cssselect(self, expr): +
252 """ + 253 Run the CSS expression on this element and its children, + 254 returning a list of the results. + 255 + 256 Equivalent to lxml.cssselect.CSSSelect(expr)(self) -- note + 257 that pre-compiling the expression can provide a substantial + 258 speedup. + 259 """ + 260 return cssselect.CSSSelector(expr)(self) +
261 + 262 ######################################## + 263 ## Link functions + 264 ######################################## + 265 + 285 self.rewrite_links(link_repl) +
286 +
287 - def resolve_base_href(self): +
288 """ + 289 Find any ``<base href>`` tag in the document, and apply its + 290 values to all links found in the document. Also remove the + 291 tag once it has been applied. + 292 """ + 293 base_href = None + 294 basetags = self.xpath('//base[@href]|//x:base[@href]', namespaces={'x':XHTML_NAMESPACE}) + 295 for b in basetags: + 296 base_href = b.get('href') + 297 b.drop_tree() + 298 if not base_href: + 299 return + 300 self.make_links_absolute(base_href, resolve_base_href=False) +
301 + 359 + 406 + 407 +
408 -class _MethodFunc(object): +
409 """ + 410 An object that represents a method on an element as a function; + 411 the function takes either an element or an HTML string. It + 412 returns whatever the function normally returns, or if the function + 413 works in-place (and so returns None) it returns a serialized form + 414 of the resulting document. + 415 """ +
416 - def __init__(self, name, copy=False, source_class=HtmlMixin): +
417 self.name = name + 418 self.copy = copy + 419 self.__doc__ = getattr(source_class, self.name).__doc__ +
420 - def __call__(self, doc, *args, **kw): +
421 result_type = type(doc) + 422 if isinstance(doc, basestring): + 423 if 'copy' in kw: + 424 raise TypeError( + 425 "The keyword 'copy' can only be used with element inputs to %s, not a string input" % self.name) + 426 doc = fromstring(doc, **kw) + 427 else: + 428 if 'copy' in kw: + 429 copy = kw.pop('copy') + 430 else: + 431 copy = self.copy + 432 if copy: + 433 doc = copy.deepcopy(doc) + 434 meth = getattr(doc, self.name) + 435 result = meth(*args, **kw) + 436 # FIXME: this None test is a bit sloppy + 437 if result is None: + 438 # Then return what we got in + 439 return _transform_result(result_type, doc) + 440 else: + 441 return result +
442 + 443 find_rel_links = _MethodFunc('find_rel_links', copy=False) + 444 find_class = _MethodFunc('find_class', copy=False) + 445 make_links_absolute = _MethodFunc('make_links_absolute', copy=True) + 446 resolve_base_href = _MethodFunc('resolve_base_href', copy=True) + 447 iterlinks = _MethodFunc('iterlinks', copy=False) + 448 rewrite_links = _MethodFunc('rewrite_links', copy=True) + 449 +
450 -class HtmlComment(etree.CommentBase, HtmlMixin): +
451 pass +
452 +
453 -class HtmlElement(etree.ElementBase, HtmlMixin): +
454 pass +
455 +
456 -class HtmlProcessingInstruction(etree.PIBase, HtmlMixin): +
457 pass +
458 +
459 -class HtmlEntity(etree.EntityBase, HtmlMixin): +
460 pass +
461 + 462 +
463 -class HtmlElementClassLookup(etree.CustomElementClassLookup): +
464 """A lookup scheme for HTML Element classes. + 465 + 466 To create a lookup instance with different Element classes, pass a tag + 467 name mapping of Element classes in the ``classes`` keyword argument and/or + 468 a tag name mapping of Mixin classes in the ``mixins`` keyword argument. + 469 The special key '*' denotes a Mixin class that should be mixed into all + 470 Element classes. + 471 """ + 472 _default_element_classes = {} + 473 +
474 - def __init__(self, classes=None, mixins=None): +
475 etree.CustomElementClassLookup.__init__(self) + 476 if classes is None: + 477 classes = self._default_element_classes.copy() + 478 if mixins: + 479 mixers = {} + 480 for name, value in mixins: + 481 if name == '*': + 482 for n in classes.keys(): + 483 mixers.setdefault(n, []).append(value) + 484 else: + 485 mixers.setdefault(name, []).append(value) + 486 for name, mix_bases in mixers.items(): + 487 cur = classes.get(name, HtmlElement) + 488 bases = tuple(mix_bases + [cur]) + 489 classes[name] = type(cur.__name__, bases, {}) + 490 self._element_classes = classes +
491 +
492 - def lookup(self, node_type, document, namespace, name): +
493 if node_type == 'element': + 494 return self._element_classes.get(name.lower(), HtmlElement) + 495 elif node_type == 'comment': + 496 return HtmlComment + 497 elif node_type == 'PI': + 498 return HtmlProcessingInstruction + 499 elif node_type == 'entity': + 500 return HtmlEntity + 501 # Otherwise normal lookup + 502 return None +
503 + 504 ################################################################################ + 505 # parsing + 506 ################################################################################ + 507 +
508 -def document_fromstring(html, parser=None, **kw): +
509 if parser is None: + 510 parser = html_parser + 511 value = etree.fromstring(html, parser, **kw) + 512 if value is None: + 513 raise etree.ParserError( + 514 "Document is empty") + 515 return value +
516 +
517 -def fragments_fromstring(html, no_leading_text=False, base_url=None, + 518 parser=None, **kw): +
519 """ + 520 Parses several HTML elements, returning a list of elements. + 521 + 522 The first item in the list may be a string (though leading + 523 whitespace is removed). If no_leading_text is true, then it will + 524 be an error if there is leading text, and it will always be a list + 525 of only elements. + 526 + 527 base_url will set the document's base_url attribute (and the tree's docinfo.URL) + 528 """ + 529 if parser is None: + 530 parser = html_parser + 531 # FIXME: check what happens when you give html with a body, head, etc. + 532 start = html[:20].lstrip().lower() + 533 if not start.startswith('<html') and not start.startswith('<!doctype'): + 534 html = '<html><body>%s</body></html>' % html + 535 doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) + 536 assert _nons(doc.tag) == 'html' + 537 bodies = [e for e in doc if _nons(e.tag) == 'body'] + 538 assert len(bodies) == 1, ("too many bodies: %r in %r" % (bodies, html)) + 539 body = bodies[0] + 540 elements = [] + 541 if no_leading_text and body.text and body.text.strip(): + 542 raise etree.ParserError( + 543 "There is leading text: %r" % body.text) + 544 if body.text and body.text.strip(): + 545 elements.append(body.text) + 546 elements.extend(body) + 547 # FIXME: removing the reference to the parent artificial document + 548 # would be nice + 549 return elements +
550 +
551 -def fragment_fromstring(html, create_parent=False, base_url=None, + 552 parser=None, **kw): +
553 """ + 554 Parses a single HTML element; it is an error if there is more than + 555 one element, or if anything but whitespace precedes or follows the + 556 element. + 557 + 558 If create_parent is true (or is a tag name) then a parent node + 559 will be created to encapsulate the HTML in a single element. + 560 + 561 base_url will set the document's base_url attribute (and the tree's docinfo.URL) + 562 """ + 563 if parser is None: + 564 parser = html_parser + 565 if create_parent: + 566 if not isinstance(create_parent, basestring): + 567 create_parent = 'div' + 568 return fragment_fromstring('<%s>%s</%s>' % ( + 569 create_parent, html, create_parent), + 570 parser=parser, base_url=base_url, **kw) + 571 elements = fragments_fromstring(html, parser=parser, no_leading_text=True, + 572 base_url=base_url, **kw) + 573 if not elements: + 574 raise etree.ParserError( + 575 "No elements found") + 576 if len(elements) > 1: + 577 raise etree.ParserError( + 578 "Multiple elements found (%s)" + 579 % ', '.join([_element_name(e) for e in elements])) + 580 el = elements[0] + 581 if el.tail and el.tail.strip(): + 582 raise etree.ParserError( + 583 "Element followed by text: %r" % el.tail) + 584 el.tail = None + 585 return el +
586 +
587 -def fromstring(html, base_url=None, parser=None, **kw): +
588 """ + 589 Parse the html, returning a single element/document. + 590 + 591 This tries to minimally parse the chunk of text, without knowing if it + 592 is a fragment or a document. + 593 + 594 base_url will set the document's base_url attribute (and the tree's docinfo.URL) + 595 """ + 596 if parser is None: + 597 parser = html_parser + 598 start = html[:10].lstrip().lower() + 599 if start.startswith('<html') or start.startswith('<!doctype'): + 600 # Looks like a full HTML document + 601 return document_fromstring(html, parser=parser, base_url=base_url, **kw) + 602 # otherwise, lets parse it out... + 603 doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) + 604 bodies = doc.findall('body') + 605 if not bodies: + 606 bodies = doc.findall('{%s}body' % XHTML_NAMESPACE) + 607 if bodies: + 608 body = bodies[0] + 609 if len(bodies) > 1: + 610 # Somehow there are multiple bodies, which is bad, but just + 611 # smash them into one body + 612 for other_body in bodies[1:]: + 613 if other_body.text: + 614 if len(body): + 615 body[-1].tail = (body[-1].tail or '') + other_body.text + 616 else: + 617 body.text = (body.text or '') + other_body.text + 618 body.extend(other_body) + 619 # We'll ignore tail + 620 # I guess we are ignoring attributes too + 621 other_body.drop_tree() + 622 else: + 623 body = None + 624 heads = doc.findall('head') + 625 if not heads: + 626 heads = doc.findall('{%s}head' % XHTML_NAMESPACE) + 627 if heads: + 628 # Well, we have some sort of structure, so lets keep it all + 629 head = heads[0] + 630 if len(heads) > 1: + 631 for other_head in heads[1:]: + 632 head.extend(other_head) + 633 # We don't care about text or tail in a head + 634 other_head.drop_tree() + 635 return doc + 636 if (len(body) == 1 and (not body.text or not body.text.strip()) + 637 and (not body[-1].tail or not body[-1].tail.strip())): + 638 # The body has just one element, so it was probably a single + 639 # element passed in + 640 return body[0] + 641 # Now we have a body which represents a bunch of tags which have the + 642 # content that was passed in. We will create a fake container, which + 643 # is the body tag, except <body> implies too much structure. + 644 if _contains_block_level_tag(body): + 645 body.tag = 'div' + 646 else: + 647 body.tag = 'span' + 648 return body +
649 +
650 -def parse(filename_or_url, parser=None, base_url=None, **kw): +
651 """ + 652 Parse a filename, URL, or file-like object into an HTML document + 653 tree. Note: this returns a tree, not an element. Use + 654 ``parse(...).getroot()`` to get the document root. + 655 + 656 You can override the base URL with the ``base_url`` keyword. This + 657 is most useful when parsing from a file-like object. + 658 """ + 659 if parser is None: + 660 parser = html_parser + 661 return etree.parse(filename_or_url, parser, base_url=base_url, **kw) +
662 +
664 # FIXME: I could do this with XPath, but would that just be + 665 # unnecessarily slow? + 666 for el in el.iter(): + 667 if _nons(el.tag) in defs.block_tags: + 668 return True + 669 return False +
670 +
671 -def _element_name(el): +
672 if isinstance(el, etree.CommentBase): + 673 return 'comment' + 674 elif isinstance(el, basestring): + 675 return 'string' + 676 else: + 677 return _nons(el.tag) +
678 + 679 ################################################################################ + 680 # form handling + 681 ################################################################################ + 682 +
683 -class FormElement(HtmlElement): +
684 """ + 685 Represents a <form> element. + 686 """ + 687 +
688 - def inputs(self): +
689 """ + 690 Returns an accessor for all the input elements in the form. + 691 + 692 See `InputGetter` for more information about the object. + 693 """ + 694 return InputGetter(self) +
695 inputs = property(inputs, doc=inputs.__doc__) + 696 +
697 - def _fields__get(self): +
698 """ + 699 Dictionary-like object that represents all the fields in this + 700 form. You can set values in this dictionary to effect the + 701 form. + 702 """ + 703 return FieldsDict(self.inputs) +
704 - def _fields__set(self, value): +
705 prev_keys = self.fields.keys() + 706 for key, value in value.iteritems(): + 707 if key in prev_keys: + 708 prev_keys.remove(key) + 709 self.fields[key] = value + 710 for key in prev_keys: + 711 if key is None: + 712 # Case of an unnamed input; these aren't really + 713 # expressed in form_values() anyway. + 714 continue + 715 self.fields[key] = None +
716 + 717 fields = property(_fields__get, _fields__set, doc=_fields__get.__doc__) + 718 +
719 - def _name(self): +
720 if self.get('name'): + 721 return self.get('name') + 722 elif self.get('id'): + 723 return '#' + self.get('id') + 724 forms = list(self.body.iter('form')) + 725 if not forms: + 726 forms = list(self.body.iter('{%s}form' % XHTML_NAMESPACE)) + 727 return str(forms.index(self)) +
728 +
729 - def form_values(self): +
730 """ + 731 Return a list of tuples of the field values for the form. + 732 This is suitable to be passed to ``urllib.urlencode()``. + 733 """ + 734 results = [] + 735 for el in self.inputs: + 736 name = el.name + 737 if not name: + 738 continue + 739 tag = _nons(el.tag) + 740 if tag == 'textarea': + 741 results.append((name, el.value)) + 742 elif tag == 'select': + 743 value = el.value + 744 if el.multiple: + 745 for v in value: + 746 results.append((name, v)) + 747 elif value is not None: + 748 results.append((name, el.value)) + 749 else: + 750 assert tag == 'input', ( + 751 "Unexpected tag: %r" % el) + 752 if el.checkable and not el.checked: + 753 continue + 754 if el.type in ('submit', 'image', 'reset'): + 755 continue + 756 value = el.value + 757 if value is not None: + 758 results.append((name, el.value)) + 759 return results +
760 +
761 - def _action__get(self): +
762 """ + 763 Get/set the form's ``action`` attribute. + 764 """ + 765 base_url = self.base_url + 766 action = self.get('action') + 767 if base_url and action is not None: + 768 return urljoin(base_url, action) + 769 else: + 770 return action +
771 - def _action__set(self, value): +
772 self.set('action', value) +
773 - def _action__del(self): +
774 if 'action' in self.attrib: + 775 del self.attrib['action'] +
776 action = property(_action__get, _action__set, _action__del, doc=_action__get.__doc__) + 777 +
778 - def _method__get(self): +
779 """ + 780 Get/set the form's method. Always returns a capitalized + 781 string, and defaults to ``'GET'`` + 782 """ + 783 return self.get('method', 'GET').upper() +
784 - def _method__set(self, value): +
785 self.set('method', value.upper()) +
786 method = property(_method__get, _method__set, doc=_method__get.__doc__) +
787 + 788 HtmlElementClassLookup._default_element_classes['form'] = FormElement + 789 +
790 -def submit_form(form, extra_values=None, open_http=None): +
791 """ + 792 Helper function to submit a form. Returns a file-like object, as from + 793 ``urllib.urlopen()``. This object also has a ``.geturl()`` function, + 794 which shows the URL if there were any redirects. + 795 + 796 You can use this like:: + 797 + 798 form = doc.forms[0] + 799 form.inputs['foo'].value = 'bar' # etc + 800 response = form.submit() + 801 doc = parse(response) + 802 doc.make_links_absolute(response.geturl()) + 803 + 804 To change the HTTP requester, pass a function as ``open_http`` keyword + 805 argument that opens the URL for you. The function must have the following + 806 signature:: + 807 + 808 open_http(method, URL, values) + 809 + 810 The action is one of 'GET' or 'POST', the URL is the target URL as a + 811 string, and the values are a sequence of ``(name, value)`` tuples with the + 812 form data. + 813 """ + 814 values = form.form_values() + 815 if extra_values: + 816 if hasattr(extra_values, 'items'): + 817 extra_values = extra_values.items() + 818 values.extend(extra_values) + 819 if open_http is None: + 820 open_http = open_http_urllib + 821 return open_http(form.method, form.action, values) +
822 +
823 -def open_http_urllib(method, url, values): +
824 import urllib + 825 ## FIXME: should test that it's not a relative URL or something + 826 if method == 'GET': + 827 if '?' in url: + 828 url += '&' + 829 else: + 830 url += '?' + 831 url += urllib.urlencode(values) + 832 data = None + 833 else: + 834 data = urllib.urlencode(values) + 835 return urllib.urlopen(url, data) +
836 +
837 -class FieldsDict(DictMixin): +
838 +
839 - def __init__(self, inputs): +
840 self.inputs = inputs +
841 - def __getitem__(self, item): +
842 return self.inputs[item].value +
843 - def __setitem__(self, item, value): +
844 self.inputs[item].value = value +
845 - def __delitem__(self, item): +
846 raise KeyError( + 847 "You cannot remove keys from ElementDict") +
848 - def keys(self): +
849 return self.inputs.keys() +
850 - def __contains__(self, item): +
851 return item in self.inputs +
852 +
853 - def __repr__(self): +
854 return '<%s for form %s>' % ( + 855 self.__class__.__name__, + 856 self.inputs.form._name()) +
857 +
858 -class InputGetter(object): +
859 + 860 """ + 861 An accessor that represents all the input fields in a form. + 862 + 863 You can get fields by name from this, with + 864 ``form.inputs['field_name']``. If there are a set of checkboxes + 865 with the same name, they are returned as a list (a `CheckboxGroup` + 866 which also allows value setting). Radio inputs are handled + 867 similarly. + 868 + 869 You can also iterate over this to get all input elements. This + 870 won't return the same thing as if you get all the names, as + 871 checkboxes and radio elements are returned individually. + 872 """ + 873 + 874 _name_xpath = etree.XPath(".//*[@name = $name and (local-name(.) = 'select' or local-name(.) = 'input' or local-name(.) = 'textarea')]") + 875 _all_xpath = etree.XPath(".//*[local-name() = 'select' or local-name() = 'input' or local-name() = 'textarea']") + 876 +
877 - def __init__(self, form): +
878 self.form = form +
879 +
880 - def __repr__(self): +
881 return '<%s for form %s>' % ( + 882 self.__class__.__name__, + 883 self.form._name()) +
884 + 885 ## FIXME: there should be more methods, and it's unclear if this is + 886 ## a dictionary-like object or list-like object + 887 +
888 - def __getitem__(self, name): +
889 results = self._name_xpath(self.form, name=name) + 890 if results: + 891 type = results[0].get('type') + 892 if type == 'radio' and len(results) > 1: + 893 group = RadioGroup(results) + 894 group.name = name + 895 return group + 896 elif type == 'checkbox' and len(results) > 1: + 897 group = CheckboxGroup(results) + 898 group.name = name + 899 return group + 900 else: + 901 # I don't like throwing away elements like this + 902 return results[0] + 903 else: + 904 raise KeyError( + 905 "No input element with the name %r" % name) +
906 +
907 - def __contains__(self, name): +
908 results = self._name_xpath(self.form, name=name) + 909 return bool(results) +
910 +
911 - def keys(self): +
912 names = set() + 913 for el in self: + 914 names.add(el.name) + 915 if None in names: + 916 names.remove(None) + 917 return list(names) +
918 +
919 - def __iter__(self): +
920 ## FIXME: kind of dumb to turn a list into an iterator, only + 921 ## to have it likely turned back into a list again :( + 922 return iter(self._all_xpath(self.form)) +
923 +
924 -class InputMixin(object): +
925 + 926 """ + 927 Mix-in for all input elements (input, select, and textarea) + 928 """ + 929 + 930 +
931 - def _name__get(self): +
932 """ + 933 Get/set the name of the element + 934 """ + 935 return self.get('name') +
936 - def _name__set(self, value): +
937 self.set('name', value) +
938 - def _name__del(self): +
939 if 'name' in self.attrib: + 940 del self.attrib['name'] +
941 name = property(_name__get, _name__set, _name__del, doc=_name__get.__doc__) + 942 +
943 - def __repr__(self): +
944 type = getattr(self, 'type', None) + 945 if type: + 946 type = ' type=%r' % type + 947 else: + 948 type = '' + 949 return '<%s %x name=%r%s>' % ( + 950 self.__class__.__name__, id(self), self.name, type) +
951 +
952 -class TextareaElement(InputMixin, HtmlElement): +
953 """ + 954 ``<textarea>`` element. You can get the name with ``.name`` and + 955 get/set the value with ``.value`` + 956 """ + 957 +
958 - def _value__get(self): +
959 """ + 960 Get/set the value (which is the contents of this element) + 961 """ + 962 return self.text or '' +
963 - def _value__set(self, value): +
964 self.text = value +
965 - def _value__del(self): +
966 self.text = '' +
967 value = property(_value__get, _value__set, _value__del, doc=_value__get.__doc__) +
968 + 969 HtmlElementClassLookup._default_element_classes['textarea'] = TextareaElement + 970 +
971 -class SelectElement(InputMixin, HtmlElement): +
972 """ + 973 ``<select>`` element. You can get the name with ``.name``. + 974 + 975 ``.value`` will be the value of the selected option, unless this + 976 is a multi-select element (``<select multiple>``), in which case + 977 it will be a set-like object. In either case ``.value_options`` + 978 gives the possible values. + 979 + 980 The boolean attribute ``.multiple`` shows if this is a + 981 multi-select. + 982 """ + 983 +
984 - def _value__get(self): +
985 """ + 986 Get/set the value of this select (the selected option). + 987 + 988 If this is a multi-select, this is a set-like object that + 989 represents all the selected options. + 990 """ + 991 if self.multiple: + 992 return MultipleSelectOptions(self) + 993 for el in _options_xpath(self): + 994 if el.get('selected') is not None: + 995 value = el.get('value') + 996 if value is None: + 997 value = el.text or '' + 998 if value: + 999 value = value.strip() +1000 return value +1001 return None +
1002 +
1003 - def _value__set(self, value): +
1004 if self.multiple: +1005 if isinstance(value, basestring): +1006 raise TypeError( +1007 "You must pass in a sequence") +1008 self.value.clear() +1009 self.value.update(value) +1010 return +1011 if value is not None: +1012 value = value.strip() +1013 for el in _options_xpath(self): +1014 opt_value = el.get('value') +1015 if opt_value is None: +1016 opt_value = el.text or '' +1017 if opt_value: +1018 opt_value = opt_value.strip() +1019 if opt_value == value: +1020 checked_option = el +1021 break +1022 else: +1023 raise ValueError( +1024 "There is no option with the value of %r" % value) +1025 for el in _options_xpath(self): +1026 if 'selected' in el.attrib: +1027 del el.attrib['selected'] +1028 if value is not None: +1029 checked_option.set('selected', '') +
1030 +
1031 - def _value__del(self): +
1032 # FIXME: should del be allowed at all? +1033 if self.multiple: +1034 self.value.clear() +1035 else: +1036 self.value = None +
1037 +1038 value = property(_value__get, _value__set, _value__del, doc=_value__get.__doc__) +1039 +
1040 - def value_options(self): +
1041 """ +1042 All the possible values this select can have (the ``value`` +1043 attribute of all the ``<option>`` elements. +1044 """ +1045 options = [] +1046 for el in _options_xpath(self): +1047 value = el.get('value') +1048 if value is None: +1049 value = el.text or '' +1050 if value: +1051 value = value.strip() +1052 options.append(value) +1053 return options +
1054 value_options = property(value_options, doc=value_options.__doc__) +1055 +
1056 - def _multiple__get(self): +
1057 """ +1058 Boolean attribute: is there a ``multiple`` attribute on this element. +1059 """ +1060 return 'multiple' in self.attrib +
1061 - def _multiple__set(self, value): +
1062 if value: +1063 self.set('multiple', '') +1064 elif 'multiple' in self.attrib: +1065 del self.attrib['multiple'] +
1066 multiple = property(_multiple__get, _multiple__set, doc=_multiple__get.__doc__) +
1067 +1068 HtmlElementClassLookup._default_element_classes['select'] = SelectElement +1069 +
1070 -class MultipleSelectOptions(SetMixin): +
1071 """ +1072 Represents all the selected options in a ``<select multiple>`` element. +1073 +1074 You can add to this set-like option to select an option, or remove +1075 to unselect the option. +1076 """ +1077 +
1078 - def __init__(self, select): +
1079 self.select = select +
1080 +
1081 - def options(self): +
1082 """ +1083 Iterator of all the ``<option>`` elements. +1084 """ +1085 return iter(_options_xpath(self.select)) +
1086 options = property(options) +1087 +
1088 - def __iter__(self): +
1089 for option in self.options: +1090 yield option.get('value') +
1091 +
1092 - def add(self, item): +
1093 for option in self.options: +1094 if option.get('value') == item: +1095 option.set('selected', '') +1096 break +1097 else: +1098 raise ValueError( +1099 "There is no option with the value %r" % item) +
1100 +
1101 - def remove(self, item): +
1102 for option in self.options: +1103 if option.get('value') == item: +1104 if 'selected' in option.attrib: +1105 del option.attrib['selected'] +1106 else: +1107 raise ValueError( +1108 "The option %r is not currently selected" % item) +1109 break +1110 else: +1111 raise ValueError( +1112 "There is not option with the value %r" % item) +
1113 +
1114 - def __repr__(self): +
1115 return '<%s {%s} for select name=%r>' % ( +1116 self.__class__.__name__, +1117 ', '.join([repr(v) for v in self]), +1118 self.select.name) +
1119 +
1120 -class RadioGroup(list): +
1121 """ +1122 This object represents several ``<input type=radio>`` elements +1123 that have the same name. +1124 +1125 You can use this like a list, but also use the property +1126 ``.value`` to check/uncheck inputs. Also you can use +1127 ``.value_options`` to get the possible values. +1128 """ +1129 +
1130 - def _value__get(self): +
1131 """ +1132 Get/set the value, which checks the radio with that value (and +1133 unchecks any other value). +1134 """ +1135 for el in self: +1136 if 'checked' in el.attrib: +1137 return el.get('value') +1138 return None +
1139 +
1140 - def _value__set(self, value): +
1141 if value is not None: +1142 for el in self: +1143 if el.get('value') == value: +1144 checked_option = el +1145 break +1146 else: +1147 raise ValueError( +1148 "There is no radio input with the value %r" % value) +1149 for el in self: +1150 if 'checked' in el.attrib: +1151 del el.attrib['checked'] +1152 if value is not None: +1153 checked_option.set('checked', '') +
1154 +
1155 - def _value__del(self): +
1156 self.value = None +
1157 +1158 value = property(_value__get, _value__set, _value__del, doc=_value__get.__doc__) +1159 +
1160 - def value_options(self): +
1161 """ +1162 Returns a list of all the possible values. +1163 """ +1164 return [el.get('value') for el in self] +
1165 value_options = property(value_options, doc=value_options.__doc__) +1166 +
1167 - def __repr__(self): +
1168 return '%s(%s)' % ( +1169 self.__class__.__name__, +1170 list.__repr__(self)) +
1171 +
1172 -class CheckboxGroup(list): +
1173 """ +1174 Represents a group of checkboxes (``<input type=checkbox>``) that +1175 have the same name. +1176 +1177 In addition to using this like a list, the ``.value`` attribute +1178 returns a set-like object that you can add to or remove from to +1179 check and uncheck checkboxes. You can also use ``.value_options`` +1180 to get the possible values. +1181 """ +1182 +
1183 - def _value__get(self): +
1184 """ +1185 Return a set-like object that can be modified to check or +1186 uncheck individual checkboxes according to their value. +1187 """ +1188 return CheckboxValues(self) +
1189 - def _value__set(self, value): +
1190 self.value.clear() +1191 if not hasattr(value, '__iter__'): +1192 raise ValueError( +1193 "A CheckboxGroup (name=%r) must be set to a sequence (not %r)" +1194 % (self[0].name, value)) +1195 self.value.update(value) +
1196 - def _value__del(self): +
1197 self.value.clear() +
1198 value = property(_value__get, _value__set, _value__del, doc=_value__get.__doc__) +1199 +
1200 - def __repr__(self): +
1201 return '%s(%s)' % ( +1202 self.__class__.__name__, list.__repr__(self)) +
1203 +
1204 -class CheckboxValues(SetMixin): +
1205 +1206 """ +1207 Represents the values of the checked checkboxes in a group of +1208 checkboxes with the same name. +1209 """ +1210 +
1211 - def __init__(self, group): +
1212 self.group = group +
1213 +
1214 - def __iter__(self): +
1215 return iter([ +1216 el.get('value') +1217 for el in self.group +1218 if 'checked' in el.attrib]) +
1219 +
1220 - def add(self, value): +
1221 for el in self.group: +1222 if el.get('value') == value: +1223 el.set('checked', '') +1224 break +1225 else: +1226 raise KeyError("No checkbox with value %r" % value) +
1227 +
1228 - def remove(self, value): +
1229 for el in self.group: +1230 if el.get('value') == value: +1231 if 'checked' in el.attrib: +1232 del el.attrib['checked'] +1233 else: +1234 raise KeyError( +1235 "The checkbox with value %r was already unchecked" % value) +1236 break +1237 else: +1238 raise KeyError( +1239 "No checkbox with value %r" % value) +
1240 +
1241 - def __repr__(self): +
1242 return '<%s {%s} for checkboxes name=%r>' % ( +1243 self.__class__.__name__, +1244 ', '.join([repr(v) for v in self]), +1245 self.group.name) +
1246 +
1247 -class InputElement(InputMixin, HtmlElement): +
1248 """ +1249 Represents an ``<input>`` element. +1250 +1251 You can get the type with ``.type`` (which is lower-cased and +1252 defaults to ``'text'``). +1253 +1254 Also you can get and set the value with ``.value`` +1255 +1256 Checkboxes and radios have the attribute ``input.checkable == +1257 True`` (for all others it is false) and a boolean attribute +1258 ``.checked``. +1259 +1260 """ +1261 +1262 ## FIXME: I'm a little uncomfortable with the use of .checked +
1263 - def _value__get(self): +
1264 """ +1265 Get/set the value of this element, using the ``value`` attribute. +1266 +1267 Also, if this is a checkbox and it has no value, this defaults +1268 to ``'on'``. If it is a checkbox or radio that is not +1269 checked, this returns None. +1270 """ +1271 if self.checkable: +1272 if self.checked: +1273 return self.get('value') or 'on' +1274 else: +1275 return None +1276 return self.get('value') +
1277 - def _value__set(self, value): +
1278 if self.checkable: +1279 if not value: +1280 self.checked = False +1281 else: +1282 self.checked = True +1283 if isinstance(value, basestring): +1284 self.set('value', value) +1285 else: +1286 self.set('value', value) +
1287 - def _value__del(self): +
1288 if self.checkable: +1289 self.checked = False +1290 else: +1291 if 'value' in self.attrib: +1292 del self.attrib['value'] +
1293 value = property(_value__get, _value__set, _value__del, doc=_value__get.__doc__) +1294 +
1295 - def _type__get(self): +
1296 """ +1297 Return the type of this element (using the type attribute). +1298 """ +1299 return self.get('type', 'text').lower() +
1300 - def _type__set(self, value): +
1301 self.set('type', value) +
1302 type = property(_type__get, _type__set, doc=_type__get.__doc__) +1303 +
1304 - def checkable(self): +
1305 """ +1306 Boolean: can this element be checked? +1307 """ +1308 return self.type in ['checkbox', 'radio'] +
1309 checkable = property(checkable, doc=checkable.__doc__) +1310 +
1311 - def _checked__get(self): +
1312 """ +1313 Boolean attribute to get/set the presence of the ``checked`` +1314 attribute. +1315 +1316 You can only use this on checkable input types. +1317 """ +1318 if not self.checkable: +1319 raise AttributeError('Not a checkable input type') +1320 return 'checked' in self.attrib +
1321 - def _checked__set(self, value): +
1322 if not self.checkable: +1323 raise AttributeError('Not a checkable input type') +1324 if value: +1325 self.set('checked', '') +1326 else: +1327 if 'checked' in self.attrib: +1328 del self.attrib['checked'] +
1329 checked = property(_checked__get, _checked__set, doc=_checked__get.__doc__) +
1330 +1331 HtmlElementClassLookup._default_element_classes['input'] = InputElement +1332 +
1333 -class LabelElement(HtmlElement): +
1334 """ +1335 Represents a ``<label>`` element. +1336 +1337 Label elements are linked to other elements with their ``for`` +1338 attribute. You can access this element with ``label.for_element``. +1339 """ +1340 +
1341 - def _for_element__get(self): +
1342 """ +1343 Get/set the element this label points to. Return None if it +1344 can't be found. +1345 """ +1346 id = self.get('for') +1347 if not id: +1348 return None +1349 return self.body.get_element_by_id(id) +
1350 - def _for_element__set(self, other): +
1351 id = other.get('id') +1352 if not id: +1353 raise TypeError( +1354 "Element %r has no id attribute" % other) +1355 self.set('for', id) +
1356 - def _for_element__del(self): +
1357 if 'id' in self.attrib: +1358 del self.attrib['id'] +
1359 for_element = property(_for_element__get, _for_element__set, _for_element__del, +1360 doc=_for_element__get.__doc__) +
1361 +1362 HtmlElementClassLookup._default_element_classes['label'] = LabelElement +1363 +1364 ############################################################ +1365 ## Serialization +1366 ############################################################ +1367 +
1368 -def html_to_xhtml(html): +
1369 """Convert all tags in an HTML tree to XHTML by moving them to the +1370 XHTML namespace. +1371 """ +1372 try: +1373 html = html.getroot() +1374 except AttributeError: +1375 pass +1376 prefix = "{%s}" % XHTML_NAMESPACE +1377 for el in html.iter(): +1378 tag = el.tag +1379 if isinstance(tag, basestring): +1380 if tag[0] != '{': +1381 el.tag = prefix + tag +
1382 +
1383 -def xhtml_to_html(xhtml): +
1384 """Convert all tags in an XHTML tree to HTML by removing their +1385 XHTML namespace. +1386 """ +1387 try: +1388 xhtml = xhtml.getroot() +1389 except AttributeError: +1390 pass +1391 prefix = "{%s}" % XHTML_NAMESPACE +1392 prefix_len = len(prefix) +1393 for el in xhtml.iter(prefix + "*"): +1394 el.tag = el.tag[prefix_len:] +
1395 +1396 # This isn't a general match, but it's a match for what libxml2 +1397 # specifically serialises: +1398 __str_replace_meta_content_type = re.compile( +1399 r'<meta http-equiv="Content-Type"[^>]*>').sub +1400 __bytes_replace_meta_content_type = re.compile( +1401 r'<meta http-equiv="Content-Type"[^>]*>'.encode('ASCII')).sub +1402 +
1403 -def tostring(doc, pretty_print=False, include_meta_content_type=False, +1404 encoding=None, method="html"): +
1405 """Return an HTML string representation of the document. +1406 +1407 Note: if include_meta_content_type is true this will create a +1408 ``<meta http-equiv="Content-Type" ...>`` tag in the head; +1409 regardless of the value of include_meta_content_type any existing +1410 ``<meta http-equiv="Content-Type" ...>`` tag will be removed +1411 +1412 The ``encoding`` argument controls the output encoding (defauts to +1413 ASCII, with &#...; character references for any characters outside +1414 of ASCII). +1415 +1416 The ``method`` argument defines the output method. It defaults to +1417 'html', but can also be 'xml' for xhtml output, or 'text' to +1418 serialise to plain text without markup. Note that you can pass +1419 the builtin ``unicode`` type as ``encoding`` argument to serialise +1420 to a unicode string. +1421 +1422 Example:: +1423 +1424 >>> from lxml import html +1425 >>> root = html.fragment_fromstring('<p>Hello<br>world!</p>') +1426 +1427 >>> html.tostring(root) +1428 b'<p>Hello<br>world!</p>' +1429 >>> html.tostring(root, method='html') +1430 b'<p>Hello<br>world!</p>' +1431 +1432 >>> html.tostring(root, method='xml') +1433 b'<p>Hello<br/>world!</p>' +1434 +1435 >>> html.tostring(root, method='text') +1436 b'Helloworld!' +1437 +1438 >>> html.tostring(root, method='text', encoding=unicode) +1439 u'Helloworld!' +1440 """ +1441 html = etree.tostring(doc, method=method, pretty_print=pretty_print, +1442 encoding=encoding) +1443 if not include_meta_content_type: +1444 if isinstance(html, str): +1445 html = __str_replace_meta_content_type('', html) +1446 else: +1447 html = __bytes_replace_meta_content_type(bytes(), html) +1448 return html +
1449 +1450 tostring.__doc__ = __fix_docstring(tostring.__doc__) +1451 +
1452 -def open_in_browser(doc): +
1453 """ +1454 Open the HTML document in a web browser (saving it to a temporary +1455 file to open it). +1456 """ +1457 import os +1458 import webbrowser +1459 try: +1460 write_doc = doc.write +1461 except AttributeError: +1462 write_doc = etree.ElementTree(element=doc).write +1463 fn = os.tempnam() + '.html' +1464 write_doc(fn, method="html") +1465 url = 'file://' + fn.replace(os.path.sep, '/') +1466 print(url) +1467 webbrowser.open(url) +
1468 +1469 ################################################################################ +1470 # configure Element class lookup +1471 ################################################################################ +1472 +
1473 -class HTMLParser(etree.HTMLParser): +
1474 - def __init__(self, **kwargs): +
1475 super(HTMLParser, self).__init__(**kwargs) +1476 self.set_element_class_lookup(HtmlElementClassLookup()) +
1477 +
1478 -class XHTMLParser(etree.XMLParser): +
1479 - def __init__(self, **kwargs): +
1480 super(XHTMLParser, self).__init__(**kwargs) +1481 self.set_element_class_lookup(HtmlElementClassLookup()) +
1482 +
1483 -def Element(*args, **kw): +
1484 """Create a new HTML Element. +1485 +1486 This can also be used for XHTML documents. +1487 """ +1488 v = html_parser.makeelement(*args, **kw) +1489 return v +
1490 +1491 html_parser = HTMLParser() +1492 xhtml_parser = XHTMLParser() +1493 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.CheckboxGroup-class.html b/doc/html/api/lxml.html.CheckboxGroup-class.html new file mode 100644 index 0000000..4233888 --- /dev/null +++ b/doc/html/api/lxml.html.CheckboxGroup-class.html @@ -0,0 +1,384 @@ + + + + + lxml.html.CheckboxGroup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class CheckboxGroup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CheckboxGroup

source code

+
+object --+    
+         |    
+      list --+
+             |
+            CheckboxGroup
+
+ +
+

Represents a group of checkboxes (<input type=checkbox>) that +have the same name.

+

In addition to using this like a list, the .value attribute +returns a set-like object that you can add to or remove from to +check and uncheck checkboxes. You can also use .value_options +to get the possible values.

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_value__get(self)
+ Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their value.
+ source code + +
+ +
+   + + + + + + +
_value__set(self, + value) + source code + +
+ +
+   + + + + + + +
_value__del(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from list: + __add__, + __contains__, + __delitem__, + __delslice__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getslice__, + __gt__, + __hash__, + __iadd__, + __imul__, + __init__, + __iter__, + __le__, + __len__, + __lt__, + __mul__, + __ne__, + __new__, + __reversed__, + __rmul__, + __setitem__, + __setslice__, + append, + count, + extend, + index, + insert, + pop, + remove, + reverse, + sort +

+

Inherited from object: + __delattr__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + value
+ Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their value. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

value

+ Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their value. +
+
Get Method:
+
_value__get(self) + - Return a set-like object that can be modified to check or +uncheck individual checkboxes according to their value. +
+
Set Method:
+
_value__set(self, + value) +
+
Delete Method:
+
_value__del(self) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.CheckboxValues-class.html b/doc/html/api/lxml.html.CheckboxValues-class.html new file mode 100644 index 0000000..3872b27 --- /dev/null +++ b/doc/html/api/lxml.html.CheckboxValues-class.html @@ -0,0 +1,364 @@ + + + + + lxml.html.CheckboxValues + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class CheckboxValues + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CheckboxValues

source code

+
+        object --+    
+                 |    
+_setmixin.SetMixin --+
+                     |
+                    CheckboxValues
+
+ +
+Represents the values of the checked checkboxes in a group of +checkboxes with the same name. + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + group)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
add(self, + value) + source code + +
+ +
+   + + + + + + +
remove(self, + value) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from _setmixin.SetMixin: + __and__, + __contains__, + __ge__, + __iand__, + __ior__, + __isub__, + __ixor__, + __le__, + __len__, + __or__, + __sub__, + __xor__, + clear, + copy, + difference, + difference_update, + discard, + intersection, + intersection_update, + issubset, + issuperset, + symmetric_difference, + symmetric_difference_update, + union, + update +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + group) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.ElementSoup-module.html b/doc/html/api/lxml.html.ElementSoup-module.html new file mode 100644 index 0000000..342e30b --- /dev/null +++ b/doc/html/api/lxml.html.ElementSoup-module.html @@ -0,0 +1,278 @@ + + + + + lxml.html.ElementSoup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module ElementSoup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ElementSoup

source code

+Legacy interface to the BeautifulSoup HTML parser. + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
convert_tree(beautiful_soup_tree, + makeelement=None)
+ Convert a BeautifulSoup tree to a list of Element trees.
+ source code + +
+ +
+   + + + + + + +
parse(file, + beautifulsoup=None, + makeelement=None) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __doc__ = """Legacy interface to the BeautifulSoup HTML pars... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

convert_tree(beautiful_soup_tree, + makeelement=None) +

+
source code  +
+ +

Convert a BeautifulSoup tree to a list of Element trees.

+

Returns a list instead of a single root Element to support +HTML-like soup with more than one root element.

+

You can pass a different Element factory through the makeelement +keyword.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

__doc__

+ +
+
+
+
Value:
+
+"""Legacy interface to the BeautifulSoup HTML parser.
+"""
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.ElementSoup-pysrc.html b/doc/html/api/lxml.html.ElementSoup-pysrc.html new file mode 100644 index 0000000..d958d90 --- /dev/null +++ b/doc/html/api/lxml.html.ElementSoup-pysrc.html @@ -0,0 +1,143 @@ + + + + + lxml.html.ElementSoup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module ElementSoup + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.ElementSoup

+
+ 1  __doc__ = """Legacy interface to the BeautifulSoup HTML parser. 
+ 2  """ 
+ 3   
+ 4  __all__ = ["parse", "convert_tree"] 
+ 5   
+ 6  from soupparser import convert_tree, parse as _parse 
+ 7   
+
8 -def parse(file, beautifulsoup=None, makeelement=None): +
9 root = _parse(file, beautifulsoup=beautifulsoup, makeelement=makeelement) +10 return root.getroot() +
11 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.FieldsDict-class.html b/doc/html/api/lxml.html.FieldsDict-class.html new file mode 100644 index 0000000..60dccf5 --- /dev/null +++ b/doc/html/api/lxml.html.FieldsDict-class.html @@ -0,0 +1,345 @@ + + + + + lxml.html.FieldsDict + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class FieldsDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FieldsDict

source code

+
+UserDict.DictMixin --+
+                     |
+                    FieldsDict
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + inputs) + source code + +
+ +
+   + + + + + + +
__getitem__(self, + item) + source code + +
+ +
+   + + + + + + +
__setitem__(self, + item, + value) + source code + +
+ +
+   + + + + + + +
__delitem__(self, + item) + source code + +
+ +
+   + + + + + + +
keys(self) + source code + +
+ +
+   + + + + + + +
__contains__(self, + item) + source code + +
+ +
+   + + + + + + +
__repr__(self) + source code + +
+ +
+

Inherited from UserDict.DictMixin: + __cmp__, + __iter__, + __len__, + clear, + get, + has_key, + items, + iteritems, + iterkeys, + itervalues, + pop, + popitem, + setdefault, + update, + values +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__contains__(self, + item) +
(In operator) +

+
source code  +
+ + +
+
Overrides: + UserDict.DictMixin.__contains__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + +
+
Overrides: + UserDict.DictMixin.__repr__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.FormElement-class.html b/doc/html/api/lxml.html.FormElement-class.html new file mode 100644 index 0000000..b41b5e5 --- /dev/null +++ b/doc/html/api/lxml.html.FormElement-class.html @@ -0,0 +1,641 @@ + + + + + lxml.html.FormElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class FormElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FormElement

source code

+
+    object --+            
+             |            
+etree._Element --+        
+                 |        
+ etree.ElementBase --+    
+                     |    
+        object --+   |    
+                 |   |    
+         HtmlMixin --+    
+                     |    
+           HtmlElement --+
+                         |
+                        FormElement
+
+ +
+Represents a <form> element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_fields__get(self)
+ Dictionary-like object that represents all the fields in this +form.
+ source code + +
+ +
+   + + + + + + +
_fields__set(self, + value) + source code + +
+ +
+   + + + + + + +
_name(self) + source code + +
+ +
+   + + + + + + +
form_values(self)
+ Return a list of tuples of the field values for the form.
+ source code + +
+ +
+   + + + + + + +
_action__get(self)
+ Get/set the form's action attribute.
+ source code + +
+ +
+   + + + + + + +
_action__set(self, + value) + source code + +
+ +
+   + + + + + + +
_action__del(self) + source code + +
+ +
+   + + + + + + +
_method__get(self)
+ Get/set the form's method.
+ source code + +
+ +
+   + + + + + + +
_method__set(self, + value) + source code + +
+ +
+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + inputs
+ Returns an accessor for all the input elements in the form. +
+   + + fields
+ Dictionary-like object that represents all the fields in this +form. +
+   + + action
+ Get/set the form's action attribute. +
+   + + method
+ Get/set the form's method. +
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

_fields__get(self) +

+
source code  +
+ + Dictionary-like object that represents all the fields in this +form. You can set values in this dictionary to effect the +form. +
+
+
+
+ +
+ +
+ + +
+

form_values(self) +

+
source code  +
+ + Return a list of tuples of the field values for the form. +This is suitable to be passed to urllib.urlencode(). +
+
+
+
+ +
+ +
+ + +
+

_method__get(self) +

+
source code  +
+ + Get/set the form's method. Always returns a capitalized +string, and defaults to 'GET' +
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

inputs

+

Returns an accessor for all the input elements in the form.

+

See InputGetter for more information about the object.

+
+
Get Method:
+
unreachable.inputs(self) + - Returns an accessor for all the input elements in the form. +
+
+
+
+ +
+ +
+

fields

+ Dictionary-like object that represents all the fields in this +form. You can set values in this dictionary to effect the +form. +
+
Get Method:
+
_fields__get(self) + - Dictionary-like object that represents all the fields in this +form. +
+
Set Method:
+
_fields__set(self, + value) +
+
+
+
+ +
+ +
+

action

+ Get/set the form's action attribute. +
+
Get Method:
+
_action__get(self) + - Get/set the form's action attribute. +
+
Set Method:
+
_action__set(self, + value) +
+
Delete Method:
+
_action__del(self) +
+
+
+
+ +
+ +
+

method

+ Get/set the form's method. Always returns a capitalized +string, and defaults to 'GET' +
+
Get Method:
+
_method__get(self) + - Get/set the form's method. +
+
Set Method:
+
_method__set(self, + value) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HTMLParser-class.html b/doc/html/api/lxml.html.HTMLParser-class.html new file mode 100644 index 0000000..6998915 --- /dev/null +++ b/doc/html/api/lxml.html.HTMLParser-class.html @@ -0,0 +1,268 @@ + + + + + lxml.html.HTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HTMLParser

source code

+
+       object --+            
+                |            
+etree._BaseParser --+        
+                    |        
+    etree._FeedParser --+    
+                        |    
+         etree.HTMLParser --+
+                            |
+                           HTMLParser
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kwargs)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+

Inherited from etree.HTMLParser: + __new__ +

+

Inherited from etree._FeedParser: + close, + feed +

+

Inherited from etree._BaseParser: + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._FeedParser: + feed_error_log +

+

Inherited from etree._BaseParser: + error_log, + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + **kwargs) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HtmlComment-class.html b/doc/html/api/lxml.html.HtmlComment-class.html new file mode 100644 index 0000000..3248644 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlComment-class.html @@ -0,0 +1,285 @@ + + + + + lxml.html.HtmlComment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HtmlComment + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlComment

source code

+
+            object --+                
+                     |                
+        etree._Element --+            
+                         |            
+etree.__ContentOnlyElement --+        
+                             |        
+                etree._Comment --+    
+                                 |    
+                 etree.CommentBase --+
+                                     |
+                        object --+   |
+                                 |   |
+                         HtmlMixin --+
+                                     |
+                                    HtmlComment
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.CommentBase: + __new__ +

+

Inherited from etree._Comment: + __repr__ +

+

Inherited from etree.__ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._Comment: + tag +

+

Inherited from etree.__ContentOnlyElement: + attrib, + text +

+

Inherited from etree._Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HtmlElement-class.html b/doc/html/api/lxml.html.HtmlElement-class.html new file mode 100644 index 0000000..b3191b6 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlElement-class.html @@ -0,0 +1,279 @@ + + + + + lxml.html.HtmlElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HtmlElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlElement

source code

+
+    object --+        
+             |        
+etree._Element --+    
+                 |    
+ etree.ElementBase --+
+                     |
+        object --+   |
+                 |   |
+         HtmlMixin --+
+                     |
+                    HtmlElement
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HtmlElementClassLookup-class.html b/doc/html/api/lxml.html.HtmlElementClassLookup-class.html new file mode 100644 index 0000000..241e056 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlElementClassLookup-class.html @@ -0,0 +1,382 @@ + + + + + lxml.html.HtmlElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HtmlElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlElementClassLookup

source code

+
+                  object --+            
+                           |            
+    etree.ElementClassLookup --+        
+                               |        
+etree.FallbackElementClassLookup --+    
+                                   |    
+      etree.CustomElementClassLookup --+
+                                       |
+                                      HtmlElementClassLookup
+
+ +
+

A lookup scheme for HTML Element classes.

+

To create a lookup instance with different Element classes, pass a tag +name mapping of Element classes in the classes keyword argument and/or +a tag name mapping of Mixin classes in the mixins keyword argument. +The special key '*' denotes a Mixin class that should be mixed into all +Element classes.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + classes=None, + mixins=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
lookup(self, + node_type, + document, + namespace, + name) + source code + +
+ +
+

Inherited from etree.CustomElementClassLookup: + __new__ +

+

Inherited from etree.FallbackElementClassLookup: + set_fallback +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _default_element_classes = {'form': <class 'lxml.html.FormElem... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree.FallbackElementClassLookup: + fallback +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + classes=None, + mixins=None) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

lookup(self, + node_type, + document, + namespace, + name) +

+
source code  +
+ + +
+
Overrides: + etree.CustomElementClassLookup.lookup +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_default_element_classes

+ +
+
+
+
Value:
+
+{'form': <class 'lxml.html.FormElement'>,
+ 'input': <class 'lxml.html.InputElement'>,
+ 'label': <class 'lxml.html.LabelElement'>,
+ 'select': <class 'lxml.html.SelectElement'>,
+ 'textarea': <class 'lxml.html.TextareaElement'>}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HtmlEntity-class.html b/doc/html/api/lxml.html.HtmlEntity-class.html new file mode 100644 index 0000000..314eb39 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlEntity-class.html @@ -0,0 +1,286 @@ + + + + + lxml.html.HtmlEntity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HtmlEntity + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlEntity

source code

+
+            object --+                
+                     |                
+        etree._Element --+            
+                         |            
+etree.__ContentOnlyElement --+        
+                             |        
+                 etree._Entity --+    
+                                 |    
+                  etree.EntityBase --+
+                                     |
+                        object --+   |
+                                 |   |
+                         HtmlMixin --+
+                                     |
+                                    HtmlEntity
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.EntityBase: + __new__ +

+

Inherited from etree._Entity: + __repr__ +

+

Inherited from etree.__ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._Entity: + name, + tag, + text +

+

Inherited from etree.__ContentOnlyElement: + attrib +

+

Inherited from etree._Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HtmlMixin-class.html b/doc/html/api/lxml.html.HtmlMixin-class.html new file mode 100644 index 0000000..ec49efc --- /dev/null +++ b/doc/html/api/lxml.html.HtmlMixin-class.html @@ -0,0 +1,806 @@ + + + + + lxml.html.HtmlMixin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HtmlMixin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlMixin

source code

+
+object --+
+         |
+        HtmlMixin
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_label__get(self)
+ Get or set any <label> element associated with this element.
+ source code + +
+ +
+   + + + + + + +
_label__set(self, + label) + source code + +
+ +
+   + + + + + + +
_label__del(self) + source code + +
+ +
+   + + + + + + +
drop_tree(self)
+ Removes this element from the tree, including its children and +text.
+ source code + +
+ +
+   + + + + + + +
drop_tag(self)
+ Remove the tag, but not its children or text.
+ source code + +
+ +
+   + + + + + + +
find_rel_links(self, + rel)
+ Find any links like <a rel="{rel}">...</a>; returns a list of elements.
+ source code + +
+ +
+   + + + + + + +
find_class(self, + class_name)
+ Find any elements with the given class name.
+ source code + +
+ +
+   + + + + + + +
get_element_by_id(self, + id, + *default)
+ Get the first element in a document with the given id.
+ source code + +
+ +
+   + + + + + + +
text_content(self)
+ Return the text content of the tag (and the text in any children).
+ source code + +
+ +
+   + + + + + + +
cssselect(self, + expr)
+ Run the CSS expression on this element and its children, +returning a list of the results.
+ source code + +
+ +
+   + + + + + + +
make_links_absolute(self, + base_url=None, + resolve_base_href=True)
+ Make all links in the document absolute, given the +base_url for the document (the full URL where the document +came from), or if no base_url is given, then the .base_url of the document.
+ source code + +
+ +
+   + + + + + + +
resolve_base_href(self)
+ Find any <base href> tag in the document, and apply its +values to all links found in the document.
+ source code + +
+ +
+   + + + + + + +
iterlinks(self)
+ Yield (element, attribute, link, pos), where attribute may be None +(indicating the link is in the text).
+ source code + +
+ +
+   + + + + + + +
rewrite_links(self, + link_repl_func, + resolve_base_href=True, + base_href=None)
+ Rewrite all the links in the document.
+ source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + base_url
+ Returns the base URL, given when the page was parsed. +
+   + + forms
+ Return a list of all the forms +
+   + + body
+ Return the <body> element. +
+   + + head
+ Returns the <head> element. +
+   + + label
+ Get or set any <label> element associated with this element. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

drop_tree(self) +

+
source code  +
+ + Removes this element from the tree, including its children and +text. The tail text is joined to the previous element or +parent. +
+
+
+
+ +
+ +
+ + +
+

drop_tag(self) +

+
source code  +
+ +

Remove the tag, but not its children or text. The children and text +are merged into the parent.

+

Example:

+
+>>> h = fragment_fromstring('<div>Hello <b>World!</b></div>')
+>>> h.find('.//b').drop_tag()
+>>> print(tostring(h, encoding=unicode))
+<div>Hello World!</div>
+
+
+
+
+
+ +
+ +
+ + +
+

get_element_by_id(self, + id, + *default) +

+
source code  +
+ +

Get the first element in a document with the given id. If none is +found, return the default argument if provided or raise KeyError +otherwise.

+

Note that there can be more than one element with the same id, +and this isn't uncommon in HTML documents found in the wild. +Browsers return only the first match, and this function does +the same.

+
+
+
+
+ +
+ +
+ + +
+

cssselect(self, + expr) +

+
source code  +
+ +

Run the CSS expression on this element and its children, +returning a list of the results.

+

Equivalent to lxml.cssselect.CSSSelect(expr)(self) -- note +that pre-compiling the expression can provide a substantial +speedup.

+
+
+
+
+ +
+ +
+ + +
+

make_links_absolute(self, + base_url=None, + resolve_base_href=True) +

+
source code  +
+ +

Make all links in the document absolute, given the +base_url for the document (the full URL where the document +came from), or if no base_url is given, then the .base_url of the document.

+

If resolve_base_href is true, then any <base href> +tags in the document are used and removed from the document. +If it is false then any such tag is ignored.

+
+
+
+
+ +
+ +
+ + +
+

resolve_base_href(self) +

+
source code  +
+ + Find any <base href> tag in the document, and apply its +values to all links found in the document. Also remove the +tag once it has been applied. +
+
+
+
+ +
+ +
+ + +
+

iterlinks(self) +

+
source code  +
+ +

Yield (element, attribute, link, pos), where attribute may be None +(indicating the link is in the text). pos is the position +where the link occurs; often 0, but sometimes something else in +the case of links in stylesheets or style tags.

+

Note: <base href> is not taken into account in any way. The +link you get is exactly the link in the document.

+
+
+
+
+ +
+ +
+ + +
+

rewrite_links(self, + link_repl_func, + resolve_base_href=True, + base_href=None) +

+
source code  +
+ +

Rewrite all the links in the document. For each link +link_repl_func(link) will be called, and the return value +will replace the old link.

+

Note that links may not be absolute (unless you first called +make_links_absolute()), and may be internal (e.g., +'#anchor'). They can also be values like +'mailto:email' or 'javascript:expr'.

+

If you give base_href then all links passed to +link_repl_func() will take that into account.

+

If the link_repl_func returns None, the attribute or +tag text will be removed completely.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

base_url

+

Returns the base URL, given when the page was parsed.

+

Use with urlparse.urljoin(el.base_url, href) to get +absolute URLs.

+
+
Get Method:
+
unreachable.base_url(self) + - Returns the base URL, given when the page was parsed. +
+
+
+
+ +
+ +
+

forms

+ Return a list of all the forms +
+
Get Method:
+
unreachable.forms(self) + - Return a list of all the forms +
+
+
+
+ +
+ +
+

body

+ Return the <body> element. Can be called from a child element +to get the document's head. +
+
Get Method:
+
unreachable.body(self) + - Return the <body> element. +
+
+
+
+ +
+ +
+

head

+ Returns the <head> element. Can be called from a child +element to get the document's head. +
+
Get Method:
+
unreachable.head(self) + - Returns the <head> element. +
+
+
+
+ +
+ +
+

label

+ Get or set any <label> element associated with this element. +
+
Get Method:
+
_label__get(self) + - Get or set any <label> element associated with this element. +
+
Set Method:
+
_label__set(self, + label) +
+
Delete Method:
+
_label__del(self) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.HtmlProcessingInstruction-class.html b/doc/html/api/lxml.html.HtmlProcessingInstruction-class.html new file mode 100644 index 0000000..4a89343 --- /dev/null +++ b/doc/html/api/lxml.html.HtmlProcessingInstruction-class.html @@ -0,0 +1,286 @@ + + + + + lxml.html.HtmlProcessingInstruction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class HtmlProcessingInstruction + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlProcessingInstruction

source code

+
+            object --+                
+                     |                
+        etree._Element --+            
+                         |            
+etree.__ContentOnlyElement --+        
+                             |        
+  etree._ProcessingInstruction --+    
+                                 |    
+                      etree.PIBase --+
+                                     |
+                        object --+   |
+                                 |   |
+                         HtmlMixin --+
+                                     |
+                                    HtmlProcessingInstruction
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.PIBase: + __new__ +

+

Inherited from etree._ProcessingInstruction: + __repr__ +

+

Inherited from etree.__ContentOnlyElement: + __delitem__, + __getitem__, + __len__, + __setitem__, + append, + get, + insert, + items, + keys, + set, + values +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __iter__, + __nonzero__, + __reversed__, + addnext, + addprevious, + clear, + extend, + find, + findall, + findtext, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + makeelement, + remove, + replace, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._ProcessingInstruction: + tag, + target +

+

Inherited from etree.__ContentOnlyElement: + attrib, + text +

+

Inherited from etree._Element: + base, + nsmap, + prefix, + sourceline, + tail +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.InputElement-class.html b/doc/html/api/lxml.html.InputElement-class.html new file mode 100644 index 0000000..924e55f --- /dev/null +++ b/doc/html/api/lxml.html.InputElement-class.html @@ -0,0 +1,611 @@ + + + + + lxml.html.InputElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class InputElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class InputElement

source code

+
+            object --+    
+                     |    
+            InputMixin --+
+                         |
+    object --+           |
+             |           |
+etree._Element --+       |
+                 |       |
+ etree.ElementBase --+   |
+                     |   |
+        object --+   |   |
+                 |   |   |
+         HtmlMixin --+   |
+                     |   |
+           HtmlElement --+
+                         |
+                        InputElement
+
+ +
+

Represents an <input> element.

+

You can get the type with .type (which is lower-cased and +defaults to 'text').

+

Also you can get and set the value with .value

+

Checkboxes and radios have the attribute input.checkable == +True (for all others it is false) and a boolean attribute +.checked.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_value__get(self)
+ Get/set the value of this element, using the value attribute.
+ source code + +
+ +
+   + + + + + + +
_value__set(self, + value) + source code + +
+ +
+   + + + + + + +
_value__del(self) + source code + +
+ +
+   + + + + + + +
_type__get(self)
+ Return the type of this element (using the type attribute).
+ source code + +
+ +
+   + + + + + + +
_type__set(self, + value) + source code + +
+ +
+   + + + + + + +
_checked__get(self)
+ Boolean attribute to get/set the presence of the checked +attribute.
+ source code + +
+ +
+   + + + + + + +
_checked__set(self, + value) + source code + +
+ +
+

Inherited from InputMixin: + __repr__ +

+

Inherited from InputMixin (private): + _name__del, + _name__get, + _name__set +

+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + value
+ Get/set the value of this element, using the value attribute. +
+   + + type
+ Return the type of this element (using the type attribute). +
+   + + checkable
+ Boolean: can this element be checked? +
+   + + checked
+ Boolean attribute to get/set the presence of the checked +attribute. +
+

Inherited from InputMixin: + name +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

_value__get(self) +

+
source code  +
+ +

Get/set the value of this element, using the value attribute.

+

Also, if this is a checkbox and it has no value, this defaults +to 'on'. If it is a checkbox or radio that is not +checked, this returns None.

+
+
+
+
+ +
+ +
+ + +
+

_checked__get(self) +

+
source code  +
+ +

Boolean attribute to get/set the presence of the checked +attribute.

+

You can only use this on checkable input types.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

value

+

Get/set the value of this element, using the value attribute.

+

Also, if this is a checkbox and it has no value, this defaults +to 'on'. If it is a checkbox or radio that is not +checked, this returns None.

+
+
Get Method:
+
_value__get(self) + - Get/set the value of this element, using the value attribute. +
+
Set Method:
+
_value__set(self, + value) +
+
Delete Method:
+
_value__del(self) +
+
+
+
+ +
+ +
+

type

+ Return the type of this element (using the type attribute). +
+
Get Method:
+
_type__get(self) + - Return the type of this element (using the type attribute). +
+
Set Method:
+
_type__set(self, + value) +
+
+
+
+ +
+ +
+

checkable

+ Boolean: can this element be checked? +
+
Get Method:
+
unreachable.checkable(self) + - Boolean: can this element be checked? +
+
+
+
+ +
+ +
+

checked

+

Boolean attribute to get/set the presence of the checked +attribute.

+

You can only use this on checkable input types.

+
+
Get Method:
+
_checked__get(self) + - Boolean attribute to get/set the presence of the checked +attribute. +
+
Set Method:
+
_checked__set(self, + value) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.InputGetter-class.html b/doc/html/api/lxml.html.InputGetter-class.html new file mode 100644 index 0000000..7fae0ff --- /dev/null +++ b/doc/html/api/lxml.html.InputGetter-class.html @@ -0,0 +1,449 @@ + + + + + lxml.html.InputGetter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class InputGetter + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class InputGetter

source code

+
+object --+
+         |
+        InputGetter
+
+ +
+

An accessor that represents all the input fields in a form.

+

You can get fields by name from this, with +form.inputs['field_name']. If there are a set of checkboxes +with the same name, they are returned as a list (a CheckboxGroup +which also allows value setting). Radio inputs are handled +similarly.

+

You can also iterate over this to get all input elements. This +won't return the same thing as if you get all the names, as +checkboxes and radio elements are returned individually.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + form)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
__getitem__(self, + name) + source code + +
+ +
+   + + + + + + +
__contains__(self, + name) + source code + +
+ +
+   + + + + + + +
keys(self) + source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + _name_xpath = .//*[@name = $name and (local-name(.) = 'select'... +
+   + + _all_xpath = .//*[local-name() = 'select' or local-name() = 'i... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + form) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_name_xpath

+ +
+
+
+
Value:
+
+.//*[@name = $name and (local-name(.) = 'select' or local-name(.) = 'i\
+nput' or local-name(.) = 'textarea')]
+
+
+
+
+
+ +
+ +
+

_all_xpath

+ +
+
+
+
Value:
+
+.//*[local-name() = 'select' or local-name() = 'input' or local-name()\
+ = 'textarea']
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.InputMixin-class.html b/doc/html/api/lxml.html.InputMixin-class.html new file mode 100644 index 0000000..dc44639 --- /dev/null +++ b/doc/html/api/lxml.html.InputMixin-class.html @@ -0,0 +1,347 @@ + + + + + lxml.html.InputMixin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class InputMixin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class InputMixin

source code

+
+object --+
+         |
+        InputMixin
+
+ +
Known Subclasses:
+
+ +
+ +
+Mix-in for all input elements (input, select, and textarea) + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_name__get(self)
+ Get/set the name of the element
+ source code + +
+ +
+   + + + + + + +
_name__set(self, + value) + source code + +
+ +
+   + + + + + + +
_name__del(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + name
+ Get/set the name of the element +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

name

+ Get/set the name of the element +
+
Get Method:
+
_name__get(self) + - Get/set the name of the element +
+
Set Method:
+
_name__set(self, + value) +
+
Delete Method:
+
_name__del(self) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.LabelElement-class.html b/doc/html/api/lxml.html.LabelElement-class.html new file mode 100644 index 0000000..e9000ac --- /dev/null +++ b/doc/html/api/lxml.html.LabelElement-class.html @@ -0,0 +1,418 @@ + + + + + lxml.html.LabelElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class LabelElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LabelElement

source code

+
+    object --+            
+             |            
+etree._Element --+        
+                 |        
+ etree.ElementBase --+    
+                     |    
+        object --+   |    
+                 |   |    
+         HtmlMixin --+    
+                     |    
+           HtmlElement --+
+                         |
+                        LabelElement
+
+ +
+

Represents a <label> element.

+

Label elements are linked to other elements with their for +attribute. You can access this element with label.for_element.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_for_element__get(self)
+ Get/set the element this label points to.
+ source code + +
+ +
+   + + + + + + +
_for_element__set(self, + other) + source code + +
+ +
+   + + + + + + +
_for_element__del(self) + source code + +
+ +
+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + for_element
+ Get/set the element this label points to. +
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

_for_element__get(self) +

+
source code  +
+ + Get/set the element this label points to. Return None if it +can't be found. +
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

for_element

+ Get/set the element this label points to. Return None if it +can't be found. +
+
Get Method:
+
_for_element__get(self) + - Get/set the element this label points to. +
+
Set Method:
+
_for_element__set(self, + other) +
+
Delete Method:
+
_for_element__del(self) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.MultipleSelectOptions-class.html b/doc/html/api/lxml.html.MultipleSelectOptions-class.html new file mode 100644 index 0000000..4d3b276 --- /dev/null +++ b/doc/html/api/lxml.html.MultipleSelectOptions-class.html @@ -0,0 +1,407 @@ + + + + + lxml.html.MultipleSelectOptions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class MultipleSelectOptions + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class MultipleSelectOptions

source code

+
+        object --+    
+                 |    
+_setmixin.SetMixin --+
+                     |
+                    MultipleSelectOptions
+
+ +
+

Represents all the selected options in a <select multiple> element.

+

You can add to this set-like option to select an option, or remove +to unselect the option.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + select)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__iter__(self) + source code + +
+ +
+   + + + + + + +
add(self, + item) + source code + +
+ +
+   + + + + + + +
remove(self, + item) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from _setmixin.SetMixin: + __and__, + __contains__, + __ge__, + __iand__, + __ior__, + __isub__, + __ixor__, + __le__, + __len__, + __or__, + __sub__, + __xor__, + clear, + copy, + difference, + difference_update, + discard, + intersection, + intersection_update, + issubset, + issuperset, + symmetric_difference, + symmetric_difference_update, + union, + update +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + options
+ Iterator of all the <option> elements. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + select) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

options

+ Iterator of all the <option> elements. +
+
Get Method:
+
unreachable.options(self) + - Iterator of all the <option> elements. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.RadioGroup-class.html b/doc/html/api/lxml.html.RadioGroup-class.html new file mode 100644 index 0000000..05e1d9d --- /dev/null +++ b/doc/html/api/lxml.html.RadioGroup-class.html @@ -0,0 +1,406 @@ + + + + + lxml.html.RadioGroup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class RadioGroup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RadioGroup

source code

+
+object --+    
+         |    
+      list --+
+             |
+            RadioGroup
+
+ +
+

This object represents several <input type=radio> elements +that have the same name.

+

You can use this like a list, but also use the property +.value to check/uncheck inputs. Also you can use +.value_options to get the possible values.

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_value__get(self)
+ Get/set the value, which checks the radio with that value (and +unchecks any other value).
+ source code + +
+ +
+   + + + + + + +
_value__set(self, + value) + source code + +
+ +
+   + + + + + + +
_value__del(self) + source code + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+

Inherited from list: + __add__, + __contains__, + __delitem__, + __delslice__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getslice__, + __gt__, + __hash__, + __iadd__, + __imul__, + __init__, + __iter__, + __le__, + __len__, + __lt__, + __mul__, + __ne__, + __new__, + __reversed__, + __rmul__, + __setitem__, + __setslice__, + append, + count, + extend, + index, + insert, + pop, + remove, + reverse, + sort +

+

Inherited from object: + __delattr__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + value
+ Get/set the value, which checks the radio with that value (and +unchecks any other value). +
+   + + value_options
+ Returns a list of all the possible values. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

value

+ Get/set the value, which checks the radio with that value (and +unchecks any other value). +
+
Get Method:
+
_value__get(self) + - Get/set the value, which checks the radio with that value (and +unchecks any other value). +
+
Set Method:
+
_value__set(self, + value) +
+
Delete Method:
+
_value__del(self) +
+
+
+
+ +
+ +
+

value_options

+ Returns a list of all the possible values. +
+
Get Method:
+
unreachable.value_options(self) + - Returns a list of all the possible values. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.SelectElement-class.html b/doc/html/api/lxml.html.SelectElement-class.html new file mode 100644 index 0000000..7832259 --- /dev/null +++ b/doc/html/api/lxml.html.SelectElement-class.html @@ -0,0 +1,525 @@ + + + + + lxml.html.SelectElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class SelectElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SelectElement

source code

+
+            object --+    
+                     |    
+            InputMixin --+
+                         |
+    object --+           |
+             |           |
+etree._Element --+       |
+                 |       |
+ etree.ElementBase --+   |
+                     |   |
+        object --+   |   |
+                 |   |   |
+         HtmlMixin --+   |
+                     |   |
+           HtmlElement --+
+                         |
+                        SelectElement
+
+ +
+

<select> element. You can get the name with .name.

+

.value will be the value of the selected option, unless this +is a multi-select element (<select multiple>), in which case +it will be a set-like object. In either case .value_options +gives the possible values.

+

The boolean attribute .multiple shows if this is a +multi-select.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_value__get(self)
+ Get/set the value of this select (the selected option).
+ source code + +
+ +
+   + + + + + + +
_value__set(self, + value) + source code + +
+ +
+   + + + + + + +
_value__del(self) + source code + +
+ +
+   + + + + + + +
_multiple__get(self)
+ Boolean attribute: is there a multiple attribute on this element.
+ source code + +
+ +
+   + + + + + + +
_multiple__set(self, + value) + source code + +
+ +
+

Inherited from InputMixin: + __repr__ +

+

Inherited from InputMixin (private): + _name__del, + _name__get, + _name__set +

+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + value
+ Get/set the value of this select (the selected option). +
+   + + value_options
+ All the possible values this select can have (the value +attribute of all the <option> elements. +
+   + + multiple
+ Boolean attribute: is there a multiple attribute on this element. +
+

Inherited from InputMixin: + name +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

_value__get(self) +

+
source code  +
+ +

Get/set the value of this select (the selected option).

+

If this is a multi-select, this is a set-like object that +represents all the selected options.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

value

+

Get/set the value of this select (the selected option).

+

If this is a multi-select, this is a set-like object that +represents all the selected options.

+
+
Get Method:
+
_value__get(self) + - Get/set the value of this select (the selected option). +
+
Set Method:
+
_value__set(self, + value) +
+
Delete Method:
+
_value__del(self) +
+
+
+
+ +
+ +
+

value_options

+ All the possible values this select can have (the value +attribute of all the <option> elements. +
+
Get Method:
+
unreachable.value_options(self) + - All the possible values this select can have (the value +attribute of all the <option> elements. +
+
+
+
+ +
+ +
+

multiple

+ Boolean attribute: is there a multiple attribute on this element. +
+
Get Method:
+
_multiple__get(self) + - Boolean attribute: is there a multiple attribute on this element. +
+
Set Method:
+
_multiple__set(self, + value) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.TextareaElement-class.html b/doc/html/api/lxml.html.TextareaElement-class.html new file mode 100644 index 0000000..55d8201 --- /dev/null +++ b/doc/html/api/lxml.html.TextareaElement-class.html @@ -0,0 +1,391 @@ + + + + + lxml.html.TextareaElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class TextareaElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class TextareaElement

source code

+
+            object --+    
+                     |    
+            InputMixin --+
+                         |
+    object --+           |
+             |           |
+etree._Element --+       |
+                 |       |
+ etree.ElementBase --+   |
+                     |   |
+        object --+   |   |
+                 |   |   |
+         HtmlMixin --+   |
+                     |   |
+           HtmlElement --+
+                         |
+                        TextareaElement
+
+ +
+<textarea> element. You can get the name with .name and +get/set the value with .value + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_value__get(self)
+ Get/set the value (which is the contents of this element)
+ source code + +
+ +
+   + + + + + + +
_value__set(self, + value) + source code + +
+ +
+   + + + + + + +
_value__del(self) + source code + +
+ +
+

Inherited from InputMixin: + __repr__ +

+

Inherited from InputMixin (private): + _name__del, + _name__get, + _name__set +

+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from HtmlMixin: + cssselect, + drop_tag, + drop_tree, + find_class, + find_rel_links, + get_element_by_id, + iterlinks, + make_links_absolute, + resolve_base_href, + rewrite_links, + text_content +

+

Inherited from HtmlMixin (private): + _label__del, + _label__get, + _label__set +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + value
+ Get/set the value (which is the contents of this element) +
+

Inherited from InputMixin: + name +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from HtmlMixin: + base_url, + body, + forms, + head, + label +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

value

+ Get/set the value (which is the contents of this element) +
+
Get Method:
+
_value__get(self) + - Get/set the value (which is the contents of this element) +
+
Set Method:
+
_value__set(self, + value) +
+
Delete Method:
+
_value__del(self) +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.XHTMLParser-class.html b/doc/html/api/lxml.html.XHTMLParser-class.html new file mode 100644 index 0000000..e6ebb75 --- /dev/null +++ b/doc/html/api/lxml.html.XHTMLParser-class.html @@ -0,0 +1,268 @@ + + + + + lxml.html.XHTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class XHTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XHTMLParser

source code

+
+       object --+            
+                |            
+etree._BaseParser --+        
+                    |        
+    etree._FeedParser --+    
+                        |    
+          etree.XMLParser --+
+                            |
+                           XHTMLParser
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kwargs)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+

Inherited from etree.XMLParser: + __new__ +

+

Inherited from etree._FeedParser: + close, + feed +

+

Inherited from etree._BaseParser: + copy, + makeelement, + setElementClassLookup, + set_element_class_lookup +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._FeedParser: + feed_error_log +

+

Inherited from etree._BaseParser: + error_log, + resolvers, + version +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + **kwargs) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html._MethodFunc-class.html b/doc/html/api/lxml.html._MethodFunc-class.html new file mode 100644 index 0000000..37c1462 --- /dev/null +++ b/doc/html/api/lxml.html._MethodFunc-class.html @@ -0,0 +1,271 @@ + + + + + lxml.html._MethodFunc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Class _MethodFunc + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _MethodFunc

source code

+
+object --+
+         |
+        _MethodFunc
+
+ +
+An object that represents a method on an element as a function; +the function takes either an element or an HTML string. It +returns whatever the function normally returns, or if the function +works in-place (and so returns None) it returns a serialized form +of the resulting document. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + name, + copy=False, + source_class=<class 'lxml.html.HtmlMixin'>)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + doc, + *args, + **kw) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + name, + copy=False, + source_class=<class 'lxml.html.HtmlMixin'>) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.builder-module.html b/doc/html/api/lxml.html.builder-module.html new file mode 100644 index 0000000..2afaa32 --- /dev/null +++ b/doc/html/api/lxml.html.builder-module.html @@ -0,0 +1,850 @@ + + + + + lxml.html.builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module builder + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module builder

source code

+

A set of HTML generator tags for building HTML documents.

+

Usage:

+
+>>> from lxml.html.builder import *
+>>> html = HTML(
+...            HEAD( TITLE("Hello World") ),
+...            BODY( CLASS("main"),
+...                  H1("Hello World !")
+...            )
+...        )
+
+>>> import lxml.etree
+>>> print lxml.etree.tostring(html, pretty_print=True)
+<html>
+  <head>
+    <title>Hello World</title>
+  </head>
+  <body class="main">
+    <h1>Hello World !</h1>
+  </body>
+</html>
+
+ + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
CLASS(v) + source code + +
+ +
+   + + + + + + +
FOR(v) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + E = ElementMaker(makeelement= html_parser.makeelement) +
+   + + A = E.a +
+   + + ABBR = E.abbr +
+   + + ACRONYM = E.acronym +
+   + + ADDRESS = E.address +
+   + + APPLET = E.applet +
+   + + AREA = E.area +
+   + + B = E.b +
+   + + BASE = E.base +
+   + + BASEFONT = E.basefont +
+   + + BDO = E.bdo +
+   + + BIG = E.big +
+   + + BLOCKQUOTE = E.blockquote +
+   + + BODY = E.body +
+   + + BR = E.br +
+   + + BUTTON = E.button +
+   + + CAPTION = E.caption +
+   + + CENTER = E.center +
+   + + CITE = E.cite +
+   + + CODE = E.code +
+   + + COL = E.col +
+   + + COLGROUP = E.colgroup +
+   + + DD = E.dd +
+   + + DEL = getattr(E, 'del') +
+   + + DFN = E.dfn +
+   + + DIR = E.dir +
+   + + DIV = E.div +
+   + + DL = E.dl +
+   + + DT = E.dt +
+   + + EM = E.em +
+   + + FIELDSET = E.fieldset +
+   + + FONT = E.font +
+   + + FORM = E.form +
+   + + FRAME = E.frame +
+   + + FRAMESET = E.frameset +
+   + + H1 = E.h1 +
+   + + H2 = E.h2 +
+   + + H3 = E.h3 +
+   + + H4 = E.h4 +
+   + + H5 = E.h5 +
+   + + H6 = E.h6 +
+   + + HEAD = E.head +
+   + + HR = E.hr +
+   + + HTML = E.html +
+   + + I = E.i +
+   + + IFRAME = E.iframe +
+   + + IMG = E.img +
+   + + INPUT = E.input +
+   + + INS = E.ins +
+   + + ISINDEX = E.isindex +
+   + + KBD = E.kbd +
+   + + LABEL = E.label +
+   + + LEGEND = E.legend +
+   + + LI = E.li +
+   + + LINK = E.link +
+   + + MAP = E.map +
+   + + MENU = E.menu +
+   + + META = E.meta +
+   + + NOFRAMES = E.noframes +
+   + + NOSCRIPT = E.noscript +
+   + + OBJECT = E.object +
+   + + OL = E.ol +
+   + + OPTGROUP = E.optgroup +
+   + + OPTION = E.option +
+   + + P = E.p +
+   + + PARAM = E.param +
+   + + PRE = E.pre +
+   + + Q = E.q +
+   + + S = E.s +
+   + + SAMP = E.samp +
+   + + SCRIPT = E.script +
+   + + SELECT = E.select +
+   + + SMALL = E.small +
+   + + SPAN = E.span +
+   + + STRIKE = E.strike +
+   + + STRONG = E.strong +
+   + + STYLE = E.style +
+   + + SUB = E.sub +
+   + + SUP = E.sup +
+   + + TABLE = E.table +
+   + + TBODY = E.tbody +
+   + + TD = E.td +
+   + + TEXTAREA = E.textarea +
+   + + TFOOT = E.tfoot +
+   + + TH = E.th +
+   + + THEAD = E.thead +
+   + + TITLE = E.title +
+   + + TR = E.tr +
+   + + TT = E.tt +
+   + + U = E.u +
+   + + UL = E.ul +
+   + + VAR = E.var +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.builder-pysrc.html b/doc/html/api/lxml.html.builder-pysrc.html new file mode 100644 index 0000000..a04ffa9 --- /dev/null +++ b/doc/html/api/lxml.html.builder-pysrc.html @@ -0,0 +1,454 @@ + + + + + lxml.html.builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module builder + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.builder

+
+  1  # -------------------------------------------------------------------- 
+  2  # The ElementTree toolkit is 
+  3  # Copyright (c) 1999-2004 by Fredrik Lundh 
+  4  # -------------------------------------------------------------------- 
+  5   
+  6  """ 
+  7  A set of HTML generator tags for building HTML documents. 
+  8   
+  9  Usage:: 
+ 10   
+ 11      >>> from lxml.html.builder import * 
+ 12      >>> html = HTML( 
+ 13      ...            HEAD( TITLE("Hello World") ), 
+ 14      ...            BODY( CLASS("main"), 
+ 15      ...                  H1("Hello World !") 
+ 16      ...            ) 
+ 17      ...        ) 
+ 18   
+ 19      >>> import lxml.etree 
+ 20      >>> print lxml.etree.tostring(html, pretty_print=True) 
+ 21      <html> 
+ 22        <head> 
+ 23          <title>Hello World</title> 
+ 24        </head> 
+ 25        <body class="main"> 
+ 26          <h1>Hello World !</h1> 
+ 27        </body> 
+ 28      </html> 
+ 29   
+ 30  """ 
+ 31   
+ 32  from lxml.builder import ElementMaker 
+ 33  from lxml.html import html_parser 
+ 34   
+ 35  E = ElementMaker(makeelement=html_parser.makeelement) 
+ 36   
+ 37  # elements 
+ 38  A = E.a # anchor 
+ 39  ABBR = E.abbr # abbreviated form (e.g., WWW, HTTP, etc.) 
+ 40  ACRONYM = E.acronym #  
+ 41  ADDRESS = E.address # information on author 
+ 42  APPLET = E.applet # Java applet (DEPRECATED) 
+ 43  AREA = E.area # client-side image map area 
+ 44  B = E.b # bold text style 
+ 45  BASE = E.base # document base URI 
+ 46  BASEFONT = E.basefont # base font size (DEPRECATED) 
+ 47  BDO = E.bdo # I18N BiDi over-ride 
+ 48  BIG = E.big # large text style 
+ 49  BLOCKQUOTE = E.blockquote # long quotation 
+ 50  BODY = E.body # document body 
+ 51  BR = E.br # forced line break 
+ 52  BUTTON = E.button # push button 
+ 53  CAPTION = E.caption # table caption 
+ 54  CENTER = E.center # shorthand for DIV align=center (DEPRECATED) 
+ 55  CITE = E.cite # citation 
+ 56  CODE = E.code # computer code fragment 
+ 57  COL = E.col # table column 
+ 58  COLGROUP = E.colgroup # table column group 
+ 59  DD = E.dd # definition description 
+ 60  DEL = getattr(E, 'del') # deleted text 
+ 61  DFN = E.dfn # instance definition 
+ 62  DIR = E.dir # directory list (DEPRECATED) 
+ 63  DIV = E.div # generic language/style container 
+ 64  DL = E.dl # definition list 
+ 65  DT = E.dt # definition term 
+ 66  EM = E.em # emphasis 
+ 67  FIELDSET = E.fieldset # form control group 
+ 68  FONT = E.font # local change to font (DEPRECATED) 
+ 69  FORM = E.form # interactive form 
+ 70  FRAME = E.frame # subwindow 
+ 71  FRAMESET = E.frameset # window subdivision 
+ 72  H1 = E.h1 # heading 
+ 73  H2 = E.h2 # heading 
+ 74  H3 = E.h3 # heading 
+ 75  H4 = E.h4 # heading 
+ 76  H5 = E.h5 # heading 
+ 77  H6 = E.h6 # heading 
+ 78  HEAD = E.head # document head 
+ 79  HR = E.hr # horizontal rule 
+ 80  HTML = E.html # document root element 
+ 81  I = E.i # italic text style 
+ 82  IFRAME = E.iframe # inline subwindow 
+ 83  IMG = E.img # Embedded image 
+ 84  INPUT = E.input # form control 
+ 85  INS = E.ins # inserted text 
+ 86  ISINDEX = E.isindex # single line prompt (DEPRECATED) 
+ 87  KBD = E.kbd # text to be entered by the user 
+ 88  LABEL = E.label # form field label text 
+ 89  LEGEND = E.legend # fieldset legend 
+ 90  LI = E.li # list item 
+ 91  LINK = E.link # a media-independent link 
+ 92  MAP = E.map # client-side image map 
+ 93  MENU = E.menu # menu list (DEPRECATED) 
+ 94  META = E.meta # generic metainformation 
+ 95  NOFRAMES = E.noframes # alternate content container for non frame-based rendering 
+ 96  NOSCRIPT = E.noscript # alternate content container for non script-based rendering 
+ 97  OBJECT = E.object # generic embedded object 
+ 98  OL = E.ol # ordered list 
+ 99  OPTGROUP = E.optgroup # option group 
+100  OPTION = E.option # selectable choice 
+101  P = E.p # paragraph 
+102  PARAM = E.param # named property value 
+103  PRE = E.pre # preformatted text 
+104  Q = E.q # short inline quotation 
+105  S = E.s # strike-through text style (DEPRECATED) 
+106  SAMP = E.samp # sample program output, scripts, etc. 
+107  SCRIPT = E.script # script statements 
+108  SELECT = E.select # option selector 
+109  SMALL = E.small # small text style 
+110  SPAN = E.span # generic language/style container 
+111  STRIKE = E.strike # strike-through text (DEPRECATED) 
+112  STRONG = E.strong # strong emphasis 
+113  STYLE = E.style # style info 
+114  SUB = E.sub # subscript 
+115  SUP = E.sup # superscript 
+116  TABLE = E.table #  
+117  TBODY = E.tbody # table body 
+118  TD = E.td # table data cell 
+119  TEXTAREA = E.textarea # multi-line text field 
+120  TFOOT = E.tfoot # table footer 
+121  TH = E.th # table header cell 
+122  THEAD = E.thead # table header 
+123  TITLE = E.title # document title 
+124  TR = E.tr # table row 
+125  TT = E.tt # teletype or monospaced text style 
+126  U = E.u # underlined text style (DEPRECATED) 
+127  UL = E.ul # unordered list 
+128  VAR = E.var # instance of a variable or program argument 
+129   
+130  # attributes (only reserved words are included here) 
+131  ATTR = dict 
+
132 -def CLASS(v): return {'class': v} +
133 -def FOR(v): return {'for': v} +
134 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.clean-module.html b/doc/html/api/lxml.html.clean-module.html new file mode 100644 index 0000000..6b0f3f8 --- /dev/null +++ b/doc/html/api/lxml.html.clean-module.html @@ -0,0 +1,701 @@ + + + + + lxml.html.clean + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module clean + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module clean

source code

+

A cleanup tool for HTML.

+

Removes unwanted tags and content. See the Cleaner class for +details.

+ + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Cleaner
+ Instances cleans the document of each of the possible offending +elements. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
_substitute_whitespace(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
clean_html(html) + source code + +
+ +
+   + + + + + + +
autolink(el, + link_regexes=[re.compile(r'(?i)(?P<body>https?://(?P<host>[a-z0-9\._-]+)(?:..., + avoid_elements=['textarea', 'pre', 'code', 'head', 'select', 'a'], + avoid_hosts=[re.compile(r'(?i)^localhost'), re.compile(r'(?i)\bexample\.(?..., + avoid_classes=['nolink'])
+ Turn any URLs into links.
+ source code + +
+ +
+   + + + + + + +
_link_text(text, + link_regexes, + avoid_hosts, + factory) + source code + +
+ +
+   + + + + + + +
autolink_html(html, + *args, + **kw)
+ Turn any URLs into links.
+ source code + +
+ +
+   + + + + + + +
word_break(el, + max_width=40, + avoid_elements=['pre', 'textarea', 'code'], + avoid_classes=['nobreak'], + break_character=u'')
+ Breaks any long words found in the body of the text (not attributes).
+ source code + +
+ +
+   + + + + + + +
word_break_html(html, + *args, + **kw) + source code + +
+ +
+   + + + + + + +
_break_text(text, + max_width, + break_character) + source code + +
+ +
+   + + + + + + +
_insert_break(word, + width, + break_character) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + _css_javascript_re = re.compile(r'(?is)expression\s*\(.*?\)') +
+   + + _css_import_re = re.compile(r'(?i)@\s*import') +
+   + + _javascript_scheme_re = re.compile(r'(?i)\s*(?:javascript|jscr... +
+   + + _conditional_comment_re = re.compile(r'(?is)\[if[\s\n\r]+.*?\]... +
+   + + _find_styled_elements = descendant-or-self::*[@style] +
+   + + _find_external_links = descendant-or-self::a [normalize-space... +
+   + + clean = Cleaner() +
+   + + _link_regexes = [re.compile(r'(?i)(?P<body>https?://(?P<host>[... +
+   + + _avoid_elements = ['textarea', 'pre', 'code', 'head', 'select'... +
+   + + _avoid_hosts = [re.compile(r'(?i)^localhost'), re.compile(r'(?... +
+   + + _avoid_classes = ['nolink'] +
+   + + _avoid_word_break_elements = ['pre', 'textarea', 'code'] +
+   + + _avoid_word_break_classes = ['nobreak'] +
+   + + _break_prefer_re = re.compile(r'(?i)[^a-z]') +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

autolink(el, + link_regexes=[re.compile(r'(?i)(?P<body>https?://(?P<host>[a-z0-9\._-]+)(?:..., + avoid_elements=['textarea', 'pre', 'code', 'head', 'select', 'a'], + avoid_hosts=[re.compile(r'(?i)^localhost'), re.compile(r'(?i)\bexample\.(?..., + avoid_classes=['nolink']) +

+
source code  +
+ +

Turn any URLs into links.

+

It will search for links identified by the given regular +expressions (by default mailto and http(s) links).

+

It won't link text in an element in avoid_elements, or an element +with a class in avoid_classes. It won't link to anything with a +host that matches one of the regular expressions in avoid_hosts +(default localhost and 127.0.0.1).

+

If you pass in an element, the element's tail will not be +substituted, only the contents of the element.

+
+
+
+
+ +
+ +
+ + +
+

autolink_html(html, + *args, + **kw) +

+
source code  +
+ +

Turn any URLs into links.

+

It will search for links identified by the given regular +expressions (by default mailto and http(s) links).

+

It won't link text in an element in avoid_elements, or an element +with a class in avoid_classes. It won't link to anything with a +host that matches one of the regular expressions in avoid_hosts +(default localhost and 127.0.0.1).

+

If you pass in an element, the element's tail will not be +substituted, only the contents of the element.

+
+
+
+
+ +
+ +
+ + +
+

word_break(el, + max_width=40, + avoid_elements=['pre', 'textarea', 'code'], + avoid_classes=['nobreak'], + break_character=u'') +

+
source code  +
+ +

Breaks any long words found in the body of the text (not attributes).

+

Doesn't effect any of the tags in avoid_elements, by default +<textarea> and <pre>

+

Breaks words by inserting &#8203;, which is a unicode character +for Zero Width Space character. This generally takes up no space +in rendering, but does copy as a space, and in monospace contexts +usually takes up space.

+

See http://www.cs.tut.fi/~jkorpela/html/nobr.html for a discussion

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

_javascript_scheme_re

+ +
+
+
+
Value:
+
+re.compile(r'(?i)\s*(?:javascript|jscript|livescript|vbscript|about|mo\
+cha):')
+
+
+
+
+
+ +
+ +
+

_conditional_comment_re

+ +
+
+
+
Value:
+
+re.compile(r'(?is)\[if[\s\n\r]+.*?\][\s\n\r]*>')
+
+
+
+
+
+ +
+ +
+

_find_external_links

+ +
+
+
+
Value:
+
+descendant-or-self::a  [normalize-space(@href) and substring(normalize\
+-space(@href),1,1) != '#'] |descendant-or-self::x:a[normalize-space(@h\
+ref) and substring(normalize-space(@href),1,1) != '#']
+
+
+
+
+
+ +
+ +
+

_link_regexes

+ +
+
+
+
Value:
+
+[re.compile(r'(?i)(?P<body>https?://(?P<host>[a-z0-9\._-]+)(?:/[/-_\.,\
+a-z0-9%&\?;=~]*)?(?:\([/-_\.,a-z0-9%&\?;=~]*\))?)'),
+ re.compile(r'(?i)mailto:(?P<body>[a-z0-9\._-]+@(?P<host>[a-z0-9_\._]+\
+[a-z]))')]
+
+
+
+
+
+ +
+ +
+

_avoid_elements

+ +
+
+
+
Value:
+
+['textarea', 'pre', 'code', 'head', 'select', 'a']
+
+
+
+
+
+ +
+ +
+

_avoid_hosts

+ +
+
+
+
Value:
+
+[re.compile(r'(?i)^localhost'),
+ re.compile(r'(?i)\bexample\.(?:com|org|net)$'),
+ re.compile(r'^127\.0\.0\.1$')]
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.clean-pysrc.html b/doc/html/api/lxml.html.clean-pysrc.html new file mode 100644 index 0000000..89a1e03 --- /dev/null +++ b/doc/html/api/lxml.html.clean-pysrc.html @@ -0,0 +1,1445 @@ + + + + + lxml.html.clean + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module clean + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.clean

+
+  1  """A cleanup tool for HTML. 
+  2   
+  3  Removes unwanted tags and content.  See the `Cleaner` class for 
+  4  details. 
+  5  """ 
+  6   
+  7  import re 
+  8  import copy 
+  9  try: 
+ 10      from urlparse import urlsplit 
+ 11  except ImportError: 
+ 12      # Python 3 
+ 13      from urllib.parse import urlsplit 
+ 14  from lxml import etree 
+ 15  from lxml.html import defs 
+ 16  from lxml.html import fromstring, tostring, XHTML_NAMESPACE 
+ 17  from lxml.html import _nons, _transform_result 
+ 18   
+ 19  try: 
+ 20      set 
+ 21  except NameError: 
+ 22      # Python 3 
+ 23      from sets import Set as set 
+ 24   
+ 25  try: 
+ 26      unichr = __builtins__['unichr'] 
+ 27  except (NameError, KeyError): 
+ 28      # Python 3 
+ 29      unichr = chr 
+ 30   
+ 31  try: 
+ 32      unicode = __builtins__['unicode'] 
+ 33  except (NameError, KeyError): 
+ 34      # Python 3 
+ 35      unicode = str 
+ 36   
+ 37  try: 
+ 38      bytes = __builtins__['bytes'] 
+ 39  except (NameError, KeyError): 
+ 40      # Python < 2.6 
+ 41      bytes = str 
+ 42   
+ 43  try: 
+ 44      basestring = __builtins__['basestring'] 
+ 45  except (NameError, KeyError): 
+ 46      basestring = (str, bytes) 
+ 47   
+ 48   
+ 49  __all__ = ['clean_html', 'clean', 'Cleaner', 'autolink', 'autolink_html', 
+ 50             'word_break', 'word_break_html'] 
+ 51   
+ 52  # Look at http://code.sixapart.com/trac/livejournal/browser/trunk/cgi-bin/cleanhtml.pl 
+ 53  #   Particularly the CSS cleaning; most of the tag cleaning is integrated now 
+ 54  # I have multiple kinds of schemes searched; but should schemes be 
+ 55  #   whitelisted instead? 
+ 56  # max height? 
+ 57  # remove images?  Also in CSS?  background attribute? 
+ 58  # Some way to whitelist object, iframe, etc (e.g., if you want to 
+ 59  #   allow *just* embedded YouTube movies) 
+ 60  # Log what was deleted and why? 
+ 61  # style="behavior: ..." might be bad in IE? 
+ 62  # Should we have something for just <meta http-equiv>?  That's the worst of the 
+ 63  #   metas. 
+ 64  # UTF-7 detections?  Example: 
+ 65  #     <HEAD><META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-7"> </HEAD>+ADw-SCRIPT+AD4-alert('XSS');+ADw-/SCRIPT+AD4- 
+ 66  #   you don't always have to have the charset set, if the page has no charset 
+ 67  #   and there's UTF7-like code in it. 
+ 68  # Look at these tests: http://htmlpurifier.org/live/smoketests/xssAttacks.php 
+ 69   
+ 70   
+ 71  # This is an IE-specific construct you can have in a stylesheet to 
+ 72  # run some Javascript: 
+ 73  _css_javascript_re = re.compile( 
+ 74      r'expression\s*\(.*?\)', re.S|re.I) 
+ 75   
+ 76  # Do I have to worry about @\nimport? 
+ 77  _css_import_re = re.compile( 
+ 78      r'@\s*import', re.I) 
+ 79   
+ 80  # All kinds of schemes besides just javascript: that can cause 
+ 81  # execution: 
+ 82  _javascript_scheme_re = re.compile( 
+ 83      r'\s*(?:javascript|jscript|livescript|vbscript|about|mocha):', re.I) 
+ 84  _substitute_whitespace = re.compile(r'\s+').sub 
+ 85  # FIXME: should data: be blocked? 
+ 86   
+ 87  # FIXME: check against: http://msdn2.microsoft.com/en-us/library/ms537512.aspx 
+ 88  _conditional_comment_re = re.compile( 
+ 89      r'\[if[\s\n\r]+.*?][\s\n\r]*>', re.I|re.S) 
+ 90   
+ 91  _find_styled_elements = etree.XPath( 
+ 92      "descendant-or-self::*[@style]") 
+ 93   
+ 94  _find_external_links = etree.XPath( 
+ 95      ("descendant-or-self::a  [normalize-space(@href) and substring(normalize-space(@href),1,1) != '#'] |" 
+ 96       "descendant-or-self::x:a[normalize-space(@href) and substring(normalize-space(@href),1,1) != '#']"), 
+ 97      namespaces={'x':XHTML_NAMESPACE}) 
+ 98   
+
99 -class Cleaner(object): +
100 """ +101 Instances cleans the document of each of the possible offending +102 elements. The cleaning is controlled by attributes; you can +103 override attributes in a subclass, or set them in the constructor. +104 +105 ``scripts``: +106 Removes any ``<script>`` tags. +107 +108 ``javascript``: +109 Removes any Javascript, like an ``onclick`` attribute. +110 +111 ``comments``: +112 Removes any comments. +113 +114 ``style``: +115 Removes any style tags or attributes. +116 +117 ``links``: +118 Removes any ``<link>`` tags +119 +120 ``meta``: +121 Removes any ``<meta>`` tags +122 +123 ``page_structure``: +124 Structural parts of a page: ``<head>``, ``<html>``, ``<title>``. +125 +126 ``processing_instructions``: +127 Removes any processing instructions. +128 +129 ``embedded``: +130 Removes any embedded objects (flash, iframes) +131 +132 ``frames``: +133 Removes any frame-related tags +134 +135 ``forms``: +136 Removes any form tags +137 +138 ``annoying_tags``: +139 Tags that aren't *wrong*, but are annoying. ``<blink>`` and ``<marque>`` +140 +141 ``remove_tags``: +142 A list of tags to remove. +143 +144 ``allow_tags``: +145 A list of tags to include (default include all). +146 +147 ``remove_unknown_tags``: +148 Remove any tags that aren't standard parts of HTML. +149 +150 ``safe_attrs_only``: +151 If true, only include 'safe' attributes (specifically the list +152 from `feedparser +153 <http://feedparser.org/docs/html-sanitization.html>`_). +154 +155 ``add_nofollow``: +156 If true, then any <a> tags will have ``rel="nofollow"`` added to them. +157 +158 ``host_whitelist``: +159 A list or set of hosts that you can use for embedded content +160 (for content like ``<object>``, ``<link rel="stylesheet">``, etc). +161 You can also implement/override the method +162 ``allow_embedded_url(el, url)`` or ``allow_element(el)`` to +163 implement more complex rules for what can be embedded. +164 Anything that passes this test will be shown, regardless of +165 the value of (for instance) ``embedded``. +166 +167 Note that this parameter might not work as intended if you do not +168 make the links absolute before doing the cleaning. +169 +170 ``whitelist_tags``: +171 A set of tags that can be included with ``host_whitelist``. +172 The default is ``iframe`` and ``embed``; you may wish to +173 include other tags like ``script``, or you may want to +174 implement ``allow_embedded_url`` for more control. Set to None to +175 include all tags. +176 +177 This modifies the document *in place*. +178 """ +179 +180 scripts = True +181 javascript = True +182 comments = True +183 style = False +184 links = True +185 meta = True +186 page_structure = True +187 processing_instructions = True +188 embedded = True +189 frames = True +190 forms = True +191 annoying_tags = True +192 remove_tags = None +193 allow_tags = None +194 remove_unknown_tags = True +195 safe_attrs_only = True +196 add_nofollow = False +197 host_whitelist = () +198 whitelist_tags = set(['iframe', 'embed']) +199 +
200 - def __init__(self, **kw): +
201 for name, value in kw.items(): +202 if not hasattr(self, name): +203 raise TypeError( +204 "Unknown parameter: %s=%r" % (name, value)) +205 setattr(self, name, value) +
206 +207 # Used to lookup the primary URL for a given tag that is up for +208 # removal: +209 _tag_link_attrs = dict( +210 script='src', +211 link='href', +212 # From: http://java.sun.com/j2se/1.4.2/docs/guide/misc/applet.html +213 # From what I can tell, both attributes can contain a link: +214 applet=['code', 'object'], +215 iframe='src', +216 embed='src', +217 layer='src', +218 # FIXME: there doesn't really seem like a general way to figure out what +219 # links an <object> tag uses; links often go in <param> tags with values +220 # that we don't really know. You'd have to have knowledge about specific +221 # kinds of plugins (probably keyed off classid), and match against those. +222 ##object=?, +223 # FIXME: not looking at the action currently, because it is more complex +224 # than than -- if you keep the form, you should keep the form controls. +225 ##form='action', +226 a='href', +227 ) +228 +
229 - def __call__(self, doc): +
230 """ +231 Cleans the document. +232 """ +233 if hasattr(doc, 'getroot'): +234 # ElementTree instance, instead of an element +235 doc = doc.getroot() +236 # convert XHTML to HTML +237 for el in doc.iter(): +238 tag = el.tag +239 if isinstance(tag, basestring): +240 el.tag = _nons(tag) +241 # Normalize a case that IE treats <image> like <img>, and that +242 # can confuse either this step or later steps. +243 for el in doc.iter('image'): +244 el.tag = 'img' +245 if not self.comments: +246 # Of course, if we were going to kill comments anyway, we don't +247 # need to worry about this +248 self.kill_conditional_comments(doc) +249 kill_tags = set() +250 remove_tags = set(self.remove_tags or ()) +251 if self.allow_tags: +252 allow_tags = set(self.allow_tags) +253 else: +254 allow_tags = set() +255 if self.scripts: +256 kill_tags.add('script') +257 if self.safe_attrs_only: +258 safe_attrs = set(defs.safe_attrs) +259 for el in doc.iter(): +260 attrib = el.attrib +261 for aname in attrib.keys(): +262 if aname not in safe_attrs: +263 del attrib[aname] +264 if self.javascript: +265 if not self.safe_attrs_only: +266 # safe_attrs handles events attributes itself +267 for el in doc.iter(): +268 attrib = el.attrib +269 for aname in attrib.keys(): +270 if aname.startswith('on'): +271 del attrib[aname] +272 doc.rewrite_links(self._remove_javascript_link, +273 resolve_base_href=False) +274 if not self.style: +275 # If we're deleting style then we don't have to remove JS links +276 # from styles, otherwise... +277 for el in _find_styled_elements(doc): +278 old = el.get('style') +279 new = _css_javascript_re.sub('', old) +280 new = _css_import_re.sub('', old) +281 if self._has_sneaky_javascript(new): +282 # Something tricky is going on... +283 del el.attrib['style'] +284 elif new != old: +285 el.set('style', new) +286 for el in list(doc.iter('style')): +287 if el.get('type', '').lower().strip() == 'text/javascript': +288 el.drop_tree() +289 continue +290 old = el.text or '' +291 new = _css_javascript_re.sub('', old) +292 # The imported CSS can do anything; we just can't allow: +293 new = _css_import_re.sub('', old) +294 if self._has_sneaky_javascript(new): +295 # Something tricky is going on... +296 el.text = '/* deleted */' +297 elif new != old: +298 el.text = new +299 if self.comments or self.processing_instructions: +300 # FIXME: why either? I feel like there's some obscure reason +301 # because you can put PIs in comments...? But I've already +302 # forgotten it +303 kill_tags.add(etree.Comment) +304 if self.processing_instructions: +305 kill_tags.add(etree.ProcessingInstruction) +306 if self.style: +307 kill_tags.add('style') +308 etree.strip_attributes(doc, 'style') +309 if self.links: +310 kill_tags.add('link') +311 elif self.style or self.javascript: +312 # We must get rid of included stylesheets if Javascript is not +313 # allowed, as you can put Javascript in them +314 for el in list(doc.iter('link')): +315 if 'stylesheet' in el.get('rel', '').lower(): +316 # Note this kills alternate stylesheets as well +317 el.drop_tree() +318 if self.meta: +319 kill_tags.add('meta') +320 if self.page_structure: +321 remove_tags.update(('head', 'html', 'title')) +322 if self.embedded: +323 # FIXME: is <layer> really embedded? +324 # We should get rid of any <param> tags not inside <applet>; +325 # These are not really valid anyway. +326 for el in list(doc.iter('param')): +327 found_parent = False +328 parent = el.getparent() +329 while parent is not None and parent.tag not in ('applet', 'object'): +330 parent = parent.getparent() +331 if parent is None: +332 el.drop_tree() +333 kill_tags.update(('applet',)) +334 # The alternate contents that are in an iframe are a good fallback: +335 remove_tags.update(('iframe', 'embed', 'layer', 'object', 'param')) +336 if self.frames: +337 # FIXME: ideally we should look at the frame links, but +338 # generally frames don't mix properly with an HTML +339 # fragment anyway. +340 kill_tags.update(defs.frame_tags) +341 if self.forms: +342 remove_tags.add('form') +343 kill_tags.update(('button', 'input', 'select', 'textarea')) +344 if self.annoying_tags: +345 remove_tags.update(('blink', 'marque')) +346 +347 _remove = [] +348 _kill = [] +349 for el in doc.iter(): +350 if el.tag in kill_tags: +351 if self.allow_element(el): +352 continue +353 _kill.append(el) +354 elif el.tag in remove_tags: +355 if self.allow_element(el): +356 continue +357 _remove.append(el) +358 +359 if _remove and _remove[0] == doc: +360 # We have to drop the parent-most tag, which we can't +361 # do. Instead we'll rewrite it: +362 el = _remove.pop(0) +363 el.tag = 'div' +364 el.attrib.clear() +365 elif _kill and _kill[0] == doc: +366 # We have to drop the parent-most element, which we can't +367 # do. Instead we'll clear it: +368 el = _kill.pop(0) +369 if el.tag != 'html': +370 el.tag = 'div' +371 el.clear() +372 +373 for el in _kill: +374 el.drop_tree() +375 for el in _remove: +376 el.drop_tag() +377 +378 allow_tags = self.allow_tags +379 if self.remove_unknown_tags: +380 if allow_tags: +381 raise ValueError( +382 "It does not make sense to pass in both allow_tags and remove_unknown_tags") +383 allow_tags = set(defs.tags) +384 if allow_tags: +385 bad = [] +386 for el in doc.iter(): +387 if el.tag not in allow_tags: +388 bad.append(el) +389 for el in bad: +390 el.drop_tag() +391 if self.add_nofollow: +392 for el in _find_external_links(doc): +393 if not self.allow_follow(el): +394 el.set('rel', 'nofollow') +
395 +
396 - def allow_follow(self, anchor): +
397 """ +398 Override to suppress rel="nofollow" on some anchors. +399 """ +400 return False +
401 +
402 - def allow_element(self, el): +
403 if el.tag not in self._tag_link_attrs: +404 return False +405 attr = self._tag_link_attrs[el.tag] +406 if isinstance(attr, (list, tuple)): +407 for one_attr in attr: +408 url = el.get(one_attr) +409 if not url: +410 return False +411 if not self.allow_embedded_url(el, url): +412 return False +413 return True +414 else: +415 url = el.get(attr) +416 if not url: +417 return False +418 return self.allow_embedded_url(el, url) +
419 +
420 - def allow_embedded_url(self, el, url): +
421 if (self.whitelist_tags is not None +422 and el.tag not in self.whitelist_tags): +423 return False +424 scheme, netloc, path, query, fragment = urlsplit(url) +425 netloc = netloc.lower().split(':', 1)[0] +426 if scheme not in ('http', 'https'): +427 return False +428 if netloc in self.host_whitelist: +429 return True +430 return False +
431 +
432 - def kill_conditional_comments(self, doc): +
433 """ +434 IE conditional comments basically embed HTML that the parser +435 doesn't normally see. We can't allow anything like that, so +436 we'll kill any comments that could be conditional. +437 """ +438 bad = [] +439 self._kill_elements( +440 doc, lambda el: _conditional_comment_re.search(el.text), +441 etree.Comment) +
442 +
443 - def _kill_elements(self, doc, condition, iterate=None): +
444 bad = [] +445 for el in doc.iter(iterate): +446 if condition(el): +447 bad.append(el) +448 for el in bad: +449 el.drop_tree() +
450 +458 +459 _substitute_comments = re.compile(r'/\*.*?\*/', re.S).sub +460 +
461 - def _has_sneaky_javascript(self, style): +
462 """ +463 Depending on the browser, stuff like ``e x p r e s s i o n(...)`` +464 can get interpreted, or ``expre/* stuff */ssion(...)``. This +465 checks for attempt to do stuff like this. +466 +467 Typically the response will be to kill the entire style; if you +468 have just a bit of Javascript in the style another rule will catch +469 that and remove only the Javascript from the style; this catches +470 more sneaky attempts. +471 """ +472 style = self._substitute_comments('', style) +473 style = style.replace('\\', '') +474 style = _substitute_whitespace('', style) +475 style = style.lower() +476 if 'javascript:' in style: +477 return True +478 if 'expression(' in style: +479 return True +480 return False +
481 +
482 - def clean_html(self, html): +
483 result_type = type(html) +484 if isinstance(html, basestring): +485 doc = fromstring(html) +486 else: +487 doc = copy.deepcopy(html) +488 self(doc) +489 return _transform_result(result_type, doc) +
490 +491 clean = Cleaner() +492 clean_html = clean.clean_html +493 +494 ############################################################ +495 ## Autolinking +496 ############################################################ +497 +498 _link_regexes = [ +499 re.compile(r'(?P<body>https?://(?P<host>[a-z0-9._-]+)(?:/[/\-_.,a-z0-9%&?;=~]*)?(?:\([/\-_.,a-z0-9%&?;=~]*\))?)', re.I), +500 # This is conservative, but autolinking can be a bit conservative: +501 re.compile(r'mailto:(?P<body>[a-z0-9._-]+@(?P<host>[a-z0-9_._]+[a-z]))', re.I), +502 ] +503 +504 _avoid_elements = ['textarea', 'pre', 'code', 'head', 'select', 'a'] +505 +506 _avoid_hosts = [ +507 re.compile(r'^localhost', re.I), +508 re.compile(r'\bexample\.(?:com|org|net)$', re.I), +509 re.compile(r'^127\.0\.0\.1$'), +510 ] +511 +512 _avoid_classes = ['nolink'] +513 +558 +616 +625 +626 autolink_html.__doc__ = autolink.__doc__ +627 +628 ############################################################ +629 ## Word wrapping +630 ############################################################ +631 +632 _avoid_word_break_elements = ['pre', 'textarea', 'code'] +633 _avoid_word_break_classes = ['nobreak'] +634 +
635 -def word_break(el, max_width=40, +636 avoid_elements=_avoid_word_break_elements, +637 avoid_classes=_avoid_word_break_classes, +638 break_character=unichr(0x200b)): +
639 """ +640 Breaks any long words found in the body of the text (not attributes). +641 +642 Doesn't effect any of the tags in avoid_elements, by default +643 ``<textarea>`` and ``<pre>`` +644 +645 Breaks words by inserting &#8203;, which is a unicode character +646 for Zero Width Space character. This generally takes up no space +647 in rendering, but does copy as a space, and in monospace contexts +648 usually takes up space. +649 +650 See http://www.cs.tut.fi/~jkorpela/html/nobr.html for a discussion +651 """ +652 # Character suggestion of &#8203 comes from: +653 # http://www.cs.tut.fi/~jkorpela/html/nobr.html +654 if el.tag in _avoid_word_break_elements: +655 return +656 class_name = el.get('class') +657 if class_name: +658 dont_break = False +659 class_name = class_name.split() +660 for avoid in avoid_classes: +661 if avoid in class_name: +662 dont_break = True +663 break +664 if dont_break: +665 return +666 if el.text: +667 el.text = _break_text(el.text, max_width, break_character) +668 for child in el: +669 word_break(child, max_width=max_width, +670 avoid_elements=avoid_elements, +671 avoid_classes=avoid_classes, +672 break_character=break_character) +673 if child.tail: +674 child.tail = _break_text(child.tail, max_width, break_character) +
675 +
676 -def word_break_html(html, *args, **kw): +
677 result_type = type(html) +678 doc = fromstring(html) +679 word_break(doc, *args, **kw) +680 return _transform_result(result_type, doc) +
681 +
682 -def _break_text(text, max_width, break_character): +
683 words = text.split() +684 for word in words: +685 if len(word) > max_width: +686 replacement = _insert_break(word, max_width, break_character) +687 text = text.replace(word, replacement) +688 return text +
689 +690 _break_prefer_re = re.compile(r'[^a-z]', re.I) +691 +
692 -def _insert_break(word, width, break_character): +
693 orig_word = word +694 result = '' +695 while len(word) > width: +696 start = word[:width] +697 breaks = list(_break_prefer_re.finditer(start)) +698 if breaks: +699 last_break = breaks[-1] +700 # Only walk back up to 10 characters to find a nice break: +701 if last_break.end() > width-10: +702 # FIXME: should the break character be at the end of the +703 # chunk, or the beginning of the next chunk? +704 start = word[:last_break.end()] +705 result += start + break_character +706 word = word[len(start):] +707 result += word +708 return result +
709 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.clean.Cleaner-class.html b/doc/html/api/lxml.html.clean.Cleaner-class.html new file mode 100644 index 0000000..e385033 --- /dev/null +++ b/doc/html/api/lxml.html.clean.Cleaner-class.html @@ -0,0 +1,738 @@ + + + + + lxml.html.clean.Cleaner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module clean :: + Class Cleaner + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Cleaner

source code

+
+object --+
+         |
+        Cleaner
+
+ +
+

Instances cleans the document of each of the possible offending +elements. The cleaning is controlled by attributes; you can +override attributes in a subclass, or set them in the constructor.

+
+
scripts:
+
Removes any <script> tags.
+
javascript:
+
Removes any Javascript, like an onclick attribute.
+
comments:
+
Removes any comments.
+
style:
+
Removes any style tags or attributes.
+
links:
+
Removes any <link> tags
+
meta:
+
Removes any <meta> tags
+
page_structure:
+
Structural parts of a page: <head>, <html>, <title>.
+
processing_instructions:
+
Removes any processing instructions.
+
embedded:
+
Removes any embedded objects (flash, iframes)
+
frames:
+
Removes any frame-related tags
+
forms:
+
Removes any form tags
+
annoying_tags:
+
Tags that aren't wrong, but are annoying. <blink> and <marque>
+
remove_tags:
+
A list of tags to remove.
+
allow_tags:
+
A list of tags to include (default include all).
+
remove_unknown_tags:
+
Remove any tags that aren't standard parts of HTML.
+
safe_attrs_only:
+
If true, only include 'safe' attributes (specifically the list +from feedparser).
+
add_nofollow:
+
If true, then any <a> tags will have rel="nofollow" added to them.
+
host_whitelist:
+

A list or set of hosts that you can use for embedded content +(for content like <object>, <link rel="stylesheet">, etc). +You can also implement/override the method +allow_embedded_url(el, url) or allow_element(el) to +implement more complex rules for what can be embedded. +Anything that passes this test will be shown, regardless of +the value of (for instance) embedded.

+

Note that this parameter might not work as intended if you do not +make the links absolute before doing the cleaning.

+
+
whitelist_tags:
+
A set of tags that can be included with host_whitelist. +The default is iframe and embed; you may wish to +include other tags like script, or you may want to +implement allow_embedded_url for more control. Set to None to +include all tags.
+
+

This modifies the document in place.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kw)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + doc)
+ Cleans the document.
+ source code + +
+ +
+   + + + + + + +
allow_follow(self, + anchor)
+ Override to suppress rel="nofollow" on some anchors.
+ source code + +
+ +
+   + + + + + + +
allow_element(self, + el) + source code + +
+ +
+   + + + + + + +
allow_embedded_url(self, + el, + url) + source code + +
+ +
+   + + + + + + +
kill_conditional_comments(self, + doc)
+ IE conditional comments basically embed HTML that the parser +doesn't normally see.
+ source code + +
+ +
+   + + + + + + +
_kill_elements(self, + doc, + condition, + iterate=None) + source code + +
+ +
+   + + + + + + +
_remove_javascript_link(self, + link) + source code + +
+ +
+   + + + + + + +
_substitute_comments(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
_has_sneaky_javascript(self, + style)
+ Depending on the browser, stuff like e x p r e s s i o n(...) +can get interpreted, or expre/* stuff */ssion(...).
+ source code + +
+ +
+   + + + + + + +
clean_html(self, + html) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + scripts = True +
+   + + javascript = True +
+   + + comments = True +
+   + + style = False +
+   + + links = True +
+   + + meta = True +
+   + + page_structure = True +
+   + + processing_instructions = True +
+   + + embedded = True +
+   + + frames = True +
+   + + forms = True +
+   + + annoying_tags = True +
+   + + remove_tags = None +
+   + + allow_tags = None +
+   + + remove_unknown_tags = True +
+   + + safe_attrs_only = True +
+   + + add_nofollow = False +
+   + + host_whitelist = () +
+   + + whitelist_tags = set(['embed', 'iframe']) +
+   + + _tag_link_attrs = {'a': 'href', 'applet': ['code', 'object'], ... +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + **kw) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

kill_conditional_comments(self, + doc) +

+
source code  +
+ + IE conditional comments basically embed HTML that the parser +doesn't normally see. We can't allow anything like that, so +we'll kill any comments that could be conditional. +
+
+
+
+ +
+ +
+ + +
+

_has_sneaky_javascript(self, + style) +

+
source code  +
+ +

Depending on the browser, stuff like e x p r e s s i o n(...) +can get interpreted, or expre/* stuff */ssion(...). This +checks for attempt to do stuff like this.

+

Typically the response will be to kill the entire style; if you +have just a bit of Javascript in the style another rule will catch +that and remove only the Javascript from the style; this catches +more sneaky attempts.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

_tag_link_attrs

+ +
+
+
+
Value:
+
+{'a': 'href',
+ 'applet': ['code', 'object'],
+ 'embed': 'src',
+ 'iframe': 'src',
+ 'layer': 'src',
+ 'link': 'href',
+ 'script': 'src'}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.defs-module.html b/doc/html/api/lxml.html.defs-module.html new file mode 100644 index 0000000..dd4f5c5 --- /dev/null +++ b/doc/html/api/lxml.html.defs-module.html @@ -0,0 +1,752 @@ + + + + + lxml.html.defs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module defs + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module defs

source code

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + empty_tags = frozenset(['area', 'base', 'basefont', 'br', 'col... +
+   + + deprecated_tags = frozenset(['applet', 'basefont', 'center', '... +
+   + + link_attrs = frozenset(['action', 'archive', 'background', 'ci... +
+   + + event_attrs = frozenset(['onblur', 'onchange', 'onclick', 'ond... +
+   + + safe_attrs = frozenset(['abbr', 'accept', 'accept-charset', 'a... +
+   + + top_level_tags = frozenset(['body', 'frameset', 'head', 'html']) +
+   + + head_tags = frozenset(['base', 'isindex', 'link', 'meta', 'scr... +
+   + + general_block_tags = frozenset(['address', 'blockquote', 'cent... +
+   + + list_tags = frozenset(['dd', 'dir', 'dl', 'dt', 'li', 'menu', ... +
+   + + table_tags = frozenset(['caption', 'col', 'colgroup', 'table',... +
+   + + block_tags = frozenset(['address', 'blockquote', 'caption', 'c... +
+   + + form_tags = frozenset(['button', 'fieldset', 'form', 'input', ... +
+   + + special_inline_tags = frozenset(['a', 'applet', 'area', 'basef... +
+   + + phrase_tags = frozenset(['abbr', 'acronym', 'cite', 'code', 'd... +
+   + + font_style_tags = frozenset(['b', 'big', 'i', 's', 'small', 's... +
+   + + frame_tags = frozenset(['frame', 'frameset', 'noframes']) +
+   + + nonstandard_tags = frozenset(['blink', 'marque']) +
+   + + tags = frozenset(['a', 'abbr', 'acronym', 'address', 'applet',... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

empty_tags

+ +
+
+
+
Value:
+
+frozenset(['area',
+           'base',
+           'basefont',
+           'br',
+           'col',
+           'frame',
+           'hr',
+           'img',
+...
+
+
+
+
+
+ +
+ +
+

deprecated_tags

+ +
+
+
+
Value:
+
+frozenset(['applet',
+           'basefont',
+           'center',
+           'dir',
+           'font',
+           'isindex',
+           'menu',
+           's',
+...
+
+
+
+
+
+ +
+ +
+

link_attrs

+ +
+
+
+
Value:
+
+frozenset(['action',
+           'archive',
+           'background',
+           'cite',
+           'classid',
+           'codebase',
+           'data',
+           'dynsrc',
+...
+
+
+
+
+
+ +
+ +
+

event_attrs

+ +
+
+
+
Value:
+
+frozenset(['onblur',
+           'onchange',
+           'onclick',
+           'ondblclick',
+           'onerror',
+           'onfocus',
+           'onkeydown',
+           'onkeypress',
+...
+
+
+
+
+
+ +
+ +
+

safe_attrs

+ +
+
+
+
Value:
+
+frozenset(['abbr',
+           'accept',
+           'accept-charset',
+           'accesskey',
+           'action',
+           'align',
+           'alt',
+           'axis',
+...
+
+
+
+
+
+ +
+ +
+

head_tags

+ +
+
+
+
Value:
+
+frozenset(['base',
+           'isindex',
+           'link',
+           'meta',
+           'script',
+           'style',
+           'title'])
+
+
+
+
+
+ +
+ +
+

general_block_tags

+ +
+
+
+
Value:
+
+frozenset(['address',
+           'blockquote',
+           'center',
+           'del',
+           'div',
+           'h1',
+           'h2',
+           'h3',
+...
+
+
+
+
+
+ +
+ +
+

list_tags

+ +
+
+
+
Value:
+
+frozenset(['dd', 'dir', 'dl', 'dt', 'li', 'menu', 'ol', 'ul'])
+
+
+
+
+
+ +
+ +
+

table_tags

+ +
+
+
+
Value:
+
+frozenset(['caption',
+           'col',
+           'colgroup',
+           'table',
+           'tbody',
+           'td',
+           'tfoot',
+           'th',
+...
+
+
+
+
+
+ +
+ +
+

block_tags

+ +
+
+
+
Value:
+
+frozenset(['address',
+           'blockquote',
+           'caption',
+           'center',
+           'col',
+           'colgroup',
+           'dd',
+           'del',
+...
+
+
+
+
+
+ +
+ +
+

form_tags

+ +
+
+
+
Value:
+
+frozenset(['button',
+           'fieldset',
+           'form',
+           'input',
+           'label',
+           'legend',
+           'optgroup',
+           'option',
+...
+
+
+
+
+
+ +
+ +
+

special_inline_tags

+ +
+
+
+
Value:
+
+frozenset(['a',
+           'applet',
+           'area',
+           'basefont',
+           'bdo',
+           'br',
+           'embed',
+           'font',
+...
+
+
+
+
+
+ +
+ +
+

phrase_tags

+ +
+
+
+
Value:
+
+frozenset(['abbr',
+           'acronym',
+           'cite',
+           'code',
+           'del',
+           'dfn',
+           'em',
+           'ins',
+...
+
+
+
+
+
+ +
+ +
+

font_style_tags

+ +
+
+
+
Value:
+
+frozenset(['b', 'big', 'i', 's', 'small', 'strike', 'tt', 'u'])
+
+
+
+
+
+ +
+ +
+

tags

+ +
+
+
+
Value:
+
+frozenset(['a',
+           'abbr',
+           'acronym',
+           'address',
+           'applet',
+           'area',
+           'b',
+           'base',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.defs-pysrc.html b/doc/html/api/lxml.html.defs-pysrc.html new file mode 100644 index 0000000..00bb20f --- /dev/null +++ b/doc/html/api/lxml.html.defs-pysrc.html @@ -0,0 +1,250 @@ + + + + + lxml.html.defs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module defs + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.defs

+
+  1  # FIXME: this should all be confirmed against what a DTD says 
+  2  # (probably in a test; this may not match the DTD exactly, but we 
+  3  # should document just how it differs). 
+  4   
+  5  # Data taken from http://www.w3.org/TR/html401/index/elements.html 
+  6   
+  7  try: 
+  8      frozenset 
+  9  except NameError: 
+ 10      from sets import Set as frozenset 
+ 11   
+ 12   
+ 13  empty_tags = frozenset([ 
+ 14      'area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 
+ 15      'img', 'input', 'isindex', 'link', 'meta', 'param']) 
+ 16   
+ 17  deprecated_tags = frozenset([ 
+ 18      'applet', 'basefont', 'center', 'dir', 'font', 'isindex', 
+ 19      'menu', 's', 'strike', 'u']) 
+ 20   
+ 21  # archive actually takes a space-separated list of URIs 
+ 22  link_attrs = frozenset([ 
+ 23      'action', 'archive', 'background', 'cite', 'classid', 
+ 24      'codebase', 'data', 'href', 'longdesc', 'profile', 'src', 
+ 25      'usemap', 
+ 26      # Not standard: 
+ 27      'dynsrc', 'lowsrc', 
+ 28      ]) 
+ 29   
+ 30  # Not in the HTML 4 spec: 
+ 31  # onerror, onresize 
+ 32  event_attrs = frozenset([ 
+ 33      'onblur', 'onchange', 'onclick', 'ondblclick', 'onerror', 
+ 34      'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 
+ 35      'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 
+ 36      'onmouseup', 'onreset', 'onresize', 'onselect', 'onsubmit', 
+ 37      'onunload', 
+ 38      ]) 
+ 39   
+ 40  safe_attrs = frozenset([ 
+ 41      'abbr', 'accept', 'accept-charset', 'accesskey', 'action', 'align', 
+ 42      'alt', 'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff', 
+ 43      'charset', 'checked', 'cite', 'class', 'clear', 'cols', 'colspan', 
+ 44      'color', 'compact', 'coords', 'datetime', 'dir', 'disabled', 'enctype', 
+ 45      'for', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 
+ 46      'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'media', 'method', 
+ 47      'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt', 'readonly', 
+ 48      'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope', 'selected', 'shape', 
+ 49      'size', 'span', 'src', 'start', 'summary', 'tabindex', 'target', 'title', 
+ 50      'type', 'usemap', 'valign', 'value', 'vspace', 'width']) 
+ 51   
+ 52  # From http://htmlhelp.com/reference/html40/olist.html 
+ 53  top_level_tags = frozenset([ 
+ 54      'html', 'head', 'body', 'frameset', 
+ 55      ]) 
+ 56   
+ 57  head_tags = frozenset([ 
+ 58      'base', 'isindex', 'link', 'meta', 'script', 'style', 'title', 
+ 59      ]) 
+ 60   
+ 61  general_block_tags = frozenset([ 
+ 62      'address', 
+ 63      'blockquote', 
+ 64      'center', 
+ 65      'del', 
+ 66      'div', 
+ 67      'h1', 
+ 68      'h2', 
+ 69      'h3', 
+ 70      'h4', 
+ 71      'h5', 
+ 72      'h6', 
+ 73      'hr', 
+ 74      'ins', 
+ 75      'isindex', 
+ 76      'noscript', 
+ 77      'p', 
+ 78      'pre', 
+ 79      ]) 
+ 80   
+ 81  list_tags = frozenset([ 
+ 82      'dir', 'dl', 'dt', 'dd', 'li', 'menu', 'ol', 'ul', 
+ 83      ]) 
+ 84   
+ 85  table_tags = frozenset([ 
+ 86      'table', 'caption', 'colgroup', 'col', 
+ 87      'thead', 'tfoot', 'tbody', 'tr', 'td', 'th', 
+ 88      ]) 
+ 89   
+ 90  # just this one from 
+ 91  # http://www.georgehernandez.com/h/XComputers/HTML/2BlockLevel.htm 
+ 92  block_tags = general_block_tags | list_tags | table_tags | frozenset([ 
+ 93      # Partial form tags 
+ 94      'fieldset', 'form', 'legend', 'optgroup', 'option', 
+ 95      ]) 
+ 96   
+ 97  form_tags = frozenset([ 
+ 98      'form', 'button', 'fieldset', 'legend', 'input', 'label', 
+ 99      'select', 'optgroup', 'option', 'textarea', 
+100      ]) 
+101   
+102  special_inline_tags = frozenset([ 
+103      'a', 'applet', 'basefont', 'bdo', 'br', 'embed', 'font', 'iframe', 
+104      'img', 'map', 'area', 'object', 'param', 'q', 'script', 
+105      'span', 'sub', 'sup', 
+106      ]) 
+107   
+108  phrase_tags = frozenset([ 
+109      'abbr', 'acronym', 'cite', 'code', 'del', 'dfn', 'em', 
+110      'ins', 'kbd', 'samp', 'strong', 'var', 
+111      ]) 
+112   
+113  font_style_tags = frozenset([ 
+114      'b', 'big', 'i', 's', 'small', 'strike', 'tt', 'u', 
+115      ]) 
+116   
+117  frame_tags = frozenset([ 
+118      'frameset', 'frame', 'noframes', 
+119      ]) 
+120   
+121  # These tags aren't standard 
+122  nonstandard_tags = frozenset(['blink', 'marque']) 
+123   
+124  tags = (top_level_tags | head_tags | general_block_tags | list_tags 
+125          | table_tags | form_tags | special_inline_tags | phrase_tags 
+126          | font_style_tags | nonstandard_tags) 
+127   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff-module.html b/doc/html/api/lxml.html.diff-module.html new file mode 100644 index 0000000..ee8e53c --- /dev/null +++ b/doc/html/api/lxml.html.diff-module.html @@ -0,0 +1,1435 @@ + + + + + lxml.html.diff + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module diff

source code

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + DEL_START +
+   + + DEL_END +
+   + + NoDeletes
+ Raised when the document no longer contains any pending deletes +(DEL_START/DEL_END) +
+   + + token
+ Represents a diffable token, generally a word that is displayed to +the user. +
+   + + tag_token
+ Represents a token that is actually a tag. +
+   + + href_token
+ Represents the href in an anchor tag. +
+   + + InsensitiveSequenceMatcher
+ Acts like SequenceMatcher, but tries not to find very small equal +blocks amidst large spans of changes +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
default_markup(text, + version) + source code + +
+ +
+   + + + + + + +
html_annotate(doclist, + markup=<function default_markup at 0x9800d4c>)
+ doclist should be ordered from oldest to newest, like:
+ source code + +
+ +
+   + + + + + + +
tokenize_annotated(doc, + annotation)
+ Tokenize a document and add an annotation attribute to each token
+ source code + +
+ +
+   + + + + + + +
html_annotate_merge_annotations(tokens_old, + tokens_new)
+ Merge the annotations from tokens_old into tokens_new, when the +tokens in the new document already existed in the old document.
+ source code + +
+ +
+   + + + + + + +
copy_annotations(src, + dest)
+ Copy annotations from the tokens listed in src to the tokens in dest
+ source code + +
+ +
+   + + + + + + +
compress_tokens(tokens)
+ Combine adjacent tokens when there is no HTML between the tokens, +and they share an annotation
+ source code + +
+ +
+   + + + + + + +
compress_merge_back(tokens, + tok)
+ Merge tok into the last element of tokens (modifying the list of +tokens in-place).
+ source code + +
+ +
+   + + + + + + +
markup_serialize_tokens(tokens, + markup_func)
+ Serialize the list of tokens into a list of text chunks, calling +markup_func around text to add annotations.
+ source code + +
+ +
+   + + + + + + +
htmldiff(old_html, + new_html)
+ Do a diff of the old and new document.
+ source code + +
+ +
+   + + + + + + +
htmldiff_tokens(html1_tokens, + html2_tokens)
+ Does a diff on the tokens themselves, returning a list of text +chunks (not tokens).
+ source code + +
+ +
+   + + + + + + +
expand_tokens(tokens, + equal=False)
+ Given a list of tokens, return a generator of the chunks of +text for the data in the tokens.
+ source code + +
+ +
+   + + + + + + +
merge_insert(ins_chunks, + doc)
+ doc is the already-handled document (as a list of text chunks); +here we add <ins>ins_chunks</ins> to the end of that.
+ source code + +
+ +
+   + + + + + + +
merge_delete(del_chunks, + doc)
+ Adds the text chunks in del_chunks to the document doc (another +list of text chunks) with marker to show it is a delete.
+ source code + +
+ +
+   + + + + + + +
cleanup_delete(chunks)
+ Cleans up any DEL_START/DEL_END markers in the document, replacing +them with <del></del>.
+ source code + +
+ +
+   + + + + + + +
split_unbalanced(chunks)
+ Return (unbalanced_start, balanced, unbalanced_end), where each is +a list of text and tag chunks.
+ source code + +
+ +
+   + + + + + + +
split_delete(chunks)
+ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END, +stuff_after_DEL_END).
+ source code + +
+ +
+   + + + + + + +
locate_unbalanced_start(unbalanced_start, + pre_delete, + post_delete)
+ pre_delete and post_delete implicitly point to a place in the +document (where the two were split).
+ source code + +
+ +
+   + + + + + + +
locate_unbalanced_end(unbalanced_end, + pre_delete, + post_delete)
+ like locate_unbalanced_start, except handling end tags and +possibly moving the point earlier in the document.
+ source code + +
+ +
+   + + + + + + +
tokenize(html, + include_hrefs=True)
+ Parse the given HTML and returns token objects (words with attached tags).
+ source code + +
+ +
+   + + + + + + +
parse_html(html, + cleanup=True)
+ Parses an HTML fragment, returning an lxml element.
+ source code + +
+ +
+   + + + + + + +
cleanup_html(html)
+ This 'cleans' the HTML, meaning that any page structure is removed +(only the contents of <body> are used, if there is any <body).
+ source code + +
+ +
+   + + + + + + +
fixup_chunks(chunks)
+ This function takes a list of chunks and produces a list of tokens.
+ source code + +
+ +
+   + + + + + + +
flatten_el(el, + include_hrefs, + skip_tag=False)
+ Takes an lxml element el, and generates all the text chunks for +that tag.
+ source code + +
+ +
+   + + + + + + +
split_words(text)
+ Splits some text into words.
+ source code + +
+ +
+   + + + + + + +
start_tag(el)
+ The text representation of the start tag for a tag.
+ source code + +
+ +
+   + + + + + + +
end_tag(el)
+ The text representation of an end tag for a tag.
+ source code + +
+ +
+   + + + + + + +
is_word(tok) + source code + +
+ +
+   + + + + + + +
is_end_tag(tok) + source code + +
+ +
+   + + + + + + +
is_start_tag(tok) + source code + +
+ +
+   + + + + + + +
fixup_ins_del_tags(html)
+ Given an html string, move any <ins> or <del> tags inside of any +block-level elements, e.g.
+ source code + +
+ +
+   + + + + + + +
serialize_html_fragment(el, + skip_outer=False)
+ Serialize a single lxml element as HTML.
+ source code + +
+ +
+   + + + + + + +
_fixup_ins_del_tags(doc)
+ fixup_ins_del_tags that works on an lxml document in-place
+ source code + +
+ +
+   + + + + + + +
_contains_block_level_tag(el)
+ True if the element contains any block-level elements, like <p>, <td>, etc.
+ source code + +
+ +
+   + + + + + + +
_move_el_inside_block(el, + tag)
+ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags +and moves them inside any block-level tags.
+ source code + +
+ +
+   + + + + + + +
_merge_element_contents(el)
+ Removes an element, but merges its contents into its place, e.g., +given <p>Hi <i>there!</i></p>, if you remove the <i> element you get +<p>Hi there!</p>
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + _body_re = re.compile(r'(?is)<body.*?>') +
+   + + _end_body_re = re.compile(r'(?is)</body.*?>') +
+   + + _ins_del_re = re.compile(r'(?is)</?(ins|del).*?>') +
+   + + end_whitespace_re = re.compile(r'[ \t\n\r]$') +
+   + + empty_tags = ('param', 'img', 'area', 'br', 'basefont', 'input... +
+   + + block_level_tags = ('address', 'blockquote', 'center', 'dir', ... +
+   + + block_level_container_tags = ('dd', 'dt', 'frameset', 'li', 't... +
+   + + start_whitespace_re = re.compile(r'^[ \t\n\r]') +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

html_annotate(doclist, + markup=<function default_markup at 0x9800d4c>) +

+
source code  +
+ +

doclist should be ordered from oldest to newest, like:

+
+>>> version1 = 'Hello World'
+>>> version2 = 'Goodbye World'
+>>> print(html_annotate([(version1, 'version 1'),
+...                      (version2, 'version 2')]))
+<span title="version 2">Goodbye</span> <span title="version 1">World</span>
+
+

The documents must be fragments (str/UTF8 or unicode), not +complete documents

+

The markup argument is a function to markup the spans of words. +This function is called like markup('Hello', 'version 2'), and +returns HTML. The first argument is text and never includes any +markup. The default uses a span with a title:

+
+
+>>> print(default_markup('Some Text', 'by Joe'))
+<span title="by Joe">Some Text</span>
+
+
+
+
+
+ +
+ +
+ + +
+

htmldiff(old_html, + new_html) +

+
source code  +
+ +

Do a diff of the old and new document. The documents are HTML +fragments (str/UTF8 or unicode), they are not complete documents +(i.e., no <html> tag).

+

Returns HTML with <ins> and <del> tags added around the +appropriate text.

+

Markup is generally ignored, with the markup from new_html +preserved, and possibly some markup from old_html (though it is +considered acceptable to lose some of the old markup). Only the +words in the HTML are diffed. The exception is <img> tags, which +are treated like words, and the href attribute of <a> tags, which +are noted inside the tag itself when there are changes.

+
+
+
+
+ +
+ +
+ + +
+

merge_delete(del_chunks, + doc) +

+
source code  +
+ + Adds the text chunks in del_chunks to the document doc (another +list of text chunks) with marker to show it is a delete. +cleanup_delete later resolves these markers into <del> tags. +
+
+
+
+ +
+ +
+ + +
+

cleanup_delete(chunks) +

+
source code  +
+ +

Cleans up any DEL_START/DEL_END markers in the document, replacing +them with <del></del>. To do this while keeping the document +valid, it may need to drop some tags (either start or end tags).

+

It may also move the del into adjacent tags to try to move it to a +similar location where it was originally located (e.g., moving a +delete into preceding <div> tag, if the del looks like (DEL_START, +'Text</div>', DEL_END)

+
+
+
+
+ +
+ +
+ + +
+

split_unbalanced(chunks) +

+
source code  +
+ +

Return (unbalanced_start, balanced, unbalanced_end), where each is +a list of text and tag chunks.

+

unbalanced_start is a list of all the tags that are opened, but +not closed in this span. Similarly, unbalanced_end is a list of +tags that are closed but were not opened. Extracting these might +mean some reordering of the chunks.

+
+
+
+
+ +
+ +
+ + +
+

split_delete(chunks) +

+
source code  +
+ + Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END, +stuff_after_DEL_END). Returns the first case found (there may be +more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if +there's no DEL_START found. +
+
+
+
+ +
+ +
+ + +
+

locate_unbalanced_start(unbalanced_start, + pre_delete, + post_delete) +

+
source code  +
+ +

pre_delete and post_delete implicitly point to a place in the +document (where the two were split). This moves that point (by +popping items from one and pushing them onto the other). It moves +the point to try to find a place where unbalanced_start applies.

+

As an example:

+
+>>> unbalanced_start = ['<div>']
+>>> doc = ['<p>', 'Text', '</p>', '<div>', 'More Text', '</div>']
+>>> pre, post = doc[:3], doc[3:]
+>>> pre, post
+(['<p>', 'Text', '</p>'], ['<div>', 'More Text', '</div>'])
+>>> locate_unbalanced_start(unbalanced_start, pre, post)
+>>> pre, post
+(['<p>', 'Text', '</p>', '<div>'], ['More Text', '</div>'])
+
+

As you can see, we moved the point so that the dangling <div> that +we found will be effectively replaced by the div in the original +document. If this doesn't work out, we just throw away +unbalanced_start without doing anything.

+
+
+
+
+ +
+ +
+ + +
+

tokenize(html, + include_hrefs=True) +

+
source code  +
+ +

Parse the given HTML and returns token objects (words with attached tags).

+

This parses only the content of a page; anything in the head is +ignored, and the <head> and <body> elements are themselves +optional. The content is then parsed by lxml, which ensures the +validity of the resulting parsed document (though lxml may make +incorrect guesses when the markup is particular bad).

+

<ins> and <del> tags are also eliminated from the document, as +that gets confusing.

+

If include_hrefs is true, then the href attribute of <a> tags is +included as a special kind of diffable token.

+
+
+
+
+ +
+ +
+ + +
+

parse_html(html, + cleanup=True) +

+
source code  +
+ +

Parses an HTML fragment, returning an lxml element. Note that the HTML will be +wrapped in a <div> tag that was not in the original document.

+

If cleanup is true, make sure there's no <head> or <body>, and get +rid of any <ins> and <del> tags.

+
+
+
+
+ +
+ +
+ + +
+

cleanup_html(html) +

+
source code  +
+ + This 'cleans' the HTML, meaning that any page structure is removed +(only the contents of <body> are used, if there is any <body). +Also <ins> and <del> tags are removed. +
+
+
+
+ +
+ +
+ + +
+

flatten_el(el, + include_hrefs, + skip_tag=False) +

+
source code  +
+ +

Takes an lxml element el, and generates all the text chunks for +that tag. Each start tag is a chunk, each word is a chunk, and each +end tag is a chunk.

+

If skip_tag is true, then the outermost container tag is +not returned (just its contents).

+
+
+
+
+ +
+ +
+ + +
+

split_words(text) +

+
source code  +
+ + Splits some text into words. Includes trailing whitespace (one +space) on each word when appropriate. +
+
+
+
+ +
+ +
+ + +
+

end_tag(el) +

+
source code  +
+ + The text representation of an end tag for a tag. Includes +trailing whitespace when appropriate. +
+
+
+
+ +
+ +
+ + +
+

fixup_ins_del_tags(html) +

+
source code  +
+ + Given an html string, move any <ins> or <del> tags inside of any +block-level elements, e.g. transform <ins><p>word</p></ins> to +<p><ins>word</ins></p> +
+
+
+
+ +
+ +
+ + +
+

serialize_html_fragment(el, + skip_outer=False) +

+
source code  +
+ +

Serialize a single lxml element as HTML. The serialized form +includes the elements tail.

+

If skip_outer is true, then don't serialize the outermost tag

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

empty_tags

+ +
+
+
+
Value:
+
+('param',
+ 'img',
+ 'area',
+ 'br',
+ 'basefont',
+ 'input',
+ 'base',
+ 'meta',
+...
+
+
+
+
+
+ +
+ +
+

block_level_tags

+ +
+
+
+
Value:
+
+('address',
+ 'blockquote',
+ 'center',
+ 'dir',
+ 'div',
+ 'dl',
+ 'fieldset',
+ 'form',
+...
+
+
+
+
+
+ +
+ +
+

block_level_container_tags

+ +
+
+
+
Value:
+
+('dd',
+ 'dt',
+ 'frameset',
+ 'li',
+ 'tbody',
+ 'td',
+ 'tfoot',
+ 'th',
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff-pysrc.html b/doc/html/api/lxml.html.diff-pysrc.html new file mode 100644 index 0000000..9110250 --- /dev/null +++ b/doc/html/api/lxml.html.diff-pysrc.html @@ -0,0 +1,2054 @@ + + + + + lxml.html.diff + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.diff

+
+  1  import difflib 
+  2  from lxml import etree 
+  3  from lxml.html import fragment_fromstring 
+  4  import cgi 
+  5  import re 
+  6   
+  7  __all__ = ['html_annotate', 'htmldiff'] 
+  8   
+  9  try: 
+ 10      _unicode = unicode 
+ 11  except NameError: 
+ 12      # Python 3 
+ 13      _unicode = str 
+ 14  try: 
+ 15      basestring = __builtins__["basestring"] 
+ 16  except (KeyError, NameError): 
+ 17      # Python 3 
+ 18      basestring = str 
+ 19   
+ 20  ############################################################ 
+ 21  ## Annotation 
+ 22  ############################################################ 
+ 23   
+
24 -def default_markup(text, version): +
25 return '<span title="%s">%s</span>' % ( + 26 cgi.escape(_unicode(version), 1), text) +
27 +
28 -def html_annotate(doclist, markup=default_markup): +
29 """ + 30 doclist should be ordered from oldest to newest, like:: + 31 + 32 >>> version1 = 'Hello World' + 33 >>> version2 = 'Goodbye World' + 34 >>> print(html_annotate([(version1, 'version 1'), + 35 ... (version2, 'version 2')])) + 36 <span title="version 2">Goodbye</span> <span title="version 1">World</span> + 37 + 38 The documents must be *fragments* (str/UTF8 or unicode), not + 39 complete documents + 40 + 41 The markup argument is a function to markup the spans of words. + 42 This function is called like markup('Hello', 'version 2'), and + 43 returns HTML. The first argument is text and never includes any + 44 markup. The default uses a span with a title: + 45 + 46 >>> print(default_markup('Some Text', 'by Joe')) + 47 <span title="by Joe">Some Text</span> + 48 """ + 49 # The basic strategy we have is to split the documents up into + 50 # logical tokens (which are words with attached markup). We then + 51 # do diffs of each of the versions to track when a token first + 52 # appeared in the document; the annotation attached to the token + 53 # is the version where it first appeared. + 54 tokenlist = [tokenize_annotated(doc, version) + 55 for doc, version in doclist] + 56 cur_tokens = tokenlist[0] + 57 for tokens in tokenlist[1:]: + 58 html_annotate_merge_annotations(cur_tokens, tokens) + 59 cur_tokens = tokens + 60 + 61 # After we've tracked all the tokens, we can combine spans of text + 62 # that are adjacent and have the same annotation + 63 cur_tokens = compress_tokens(cur_tokens) + 64 # And finally add markup + 65 result = markup_serialize_tokens(cur_tokens, markup) + 66 return ''.join(result).strip() +
67 +
68 -def tokenize_annotated(doc, annotation): +
69 """Tokenize a document and add an annotation attribute to each token + 70 """ + 71 tokens = tokenize(doc, include_hrefs=False) + 72 for tok in tokens: + 73 tok.annotation = annotation + 74 return tokens + 75 +
76 -def html_annotate_merge_annotations(tokens_old, tokens_new): +
77 """Merge the annotations from tokens_old into tokens_new, when the + 78 tokens in the new document already existed in the old document. + 79 """ + 80 s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new) + 81 commands = s.get_opcodes() + 82 + 83 for command, i1, i2, j1, j2 in commands: + 84 if command == 'equal': + 85 eq_old = tokens_old[i1:i2] + 86 eq_new = tokens_new[j1:j2] + 87 copy_annotations(eq_old, eq_new) + 88 +
89 -def copy_annotations(src, dest): +
90 """ + 91 Copy annotations from the tokens listed in src to the tokens in dest + 92 """ + 93 assert len(src) == len(dest) + 94 for src_tok, dest_tok in zip(src, dest): + 95 dest_tok.annotation = src_tok.annotation + 96 +
97 -def compress_tokens(tokens): +
98 """ + 99 Combine adjacent tokens when there is no HTML between the tokens, +100 and they share an annotation +101 """ +102 result = [tokens[0]] +103 for tok in tokens[1:]: +104 if (not result[-1].post_tags and +105 not tok.pre_tags and +106 result[-1].annotation == tok.annotation): +107 compress_merge_back(result, tok) +108 else: +109 result.append(tok) +110 return result +
111 +
112 -def compress_merge_back(tokens, tok): +
113 """ Merge tok into the last element of tokens (modifying the list of +114 tokens in-place). """ +115 last = tokens[-1] +116 if type(last) is not token or type(tok) is not token: +117 tokens.append(tok) +118 else: +119 text = _unicode(last) +120 if last.trailing_whitespace: +121 text += ' ' +122 text += tok +123 merged = token(text, +124 pre_tags=last.pre_tags, +125 post_tags=tok.post_tags, +126 trailing_whitespace=tok.trailing_whitespace) +127 merged.annotation = last.annotation +128 tokens[-1] = merged +129 +
130 -def markup_serialize_tokens(tokens, markup_func): +
131 """ +132 Serialize the list of tokens into a list of text chunks, calling +133 markup_func around text to add annotations. +134 """ +135 for token in tokens: +136 for pre in token.pre_tags: +137 yield pre +138 html = token.html() +139 html = markup_func(html, token.annotation) +140 if token.trailing_whitespace: +141 html += ' ' +142 yield html +143 for post in token.post_tags: +144 yield post +
145 +146 +147 ############################################################ +148 ## HTML Diffs +149 ############################################################ +150 +
151 -def htmldiff(old_html, new_html): +
152 ## FIXME: this should take parsed documents too, and use their body +153 ## or other content. +154 """ Do a diff of the old and new document. The documents are HTML +155 *fragments* (str/UTF8 or unicode), they are not complete documents +156 (i.e., no <html> tag). +157 +158 Returns HTML with <ins> and <del> tags added around the +159 appropriate text. +160 +161 Markup is generally ignored, with the markup from new_html +162 preserved, and possibly some markup from old_html (though it is +163 considered acceptable to lose some of the old markup). Only the +164 words in the HTML are diffed. The exception is <img> tags, which +165 are treated like words, and the href attribute of <a> tags, which +166 are noted inside the tag itself when there are changes. +167 """ +168 old_html_tokens = tokenize(old_html) +169 new_html_tokens = tokenize(new_html) +170 result = htmldiff_tokens(old_html_tokens, new_html_tokens) +171 result = ''.join(result).strip() +172 return fixup_ins_del_tags(result) +
173 +
174 -def htmldiff_tokens(html1_tokens, html2_tokens): +
175 """ Does a diff on the tokens themselves, returning a list of text +176 chunks (not tokens). +177 """ +178 # There are several passes as we do the differences. The tokens +179 # isolate the portion of the content we care to diff; difflib does +180 # all the actual hard work at that point. +181 # +182 # Then we must create a valid document from pieces of both the old +183 # document and the new document. We generally prefer to take +184 # markup from the new document, and only do a best effort attempt +185 # to keep markup from the old document; anything that we can't +186 # resolve we throw away. Also we try to put the deletes as close +187 # to the location where we think they would have been -- because +188 # we are only keeping the markup from the new document, it can be +189 # fuzzy where in the new document the old text would have gone. +190 # Again we just do a best effort attempt. +191 s = InsensitiveSequenceMatcher(a=html1_tokens, b=html2_tokens) +192 commands = s.get_opcodes() +193 result = [] +194 for command, i1, i2, j1, j2 in commands: +195 if command == 'equal': +196 result.extend(expand_tokens(html2_tokens[j1:j2], equal=True)) +197 continue +198 if command == 'insert' or command == 'replace': +199 ins_tokens = expand_tokens(html2_tokens[j1:j2]) +200 merge_insert(ins_tokens, result) +201 if command == 'delete' or command == 'replace': +202 del_tokens = expand_tokens(html1_tokens[i1:i2]) +203 merge_delete(del_tokens, result) +204 # If deletes were inserted directly as <del> then we'd have an +205 # invalid document at this point. Instead we put in special +206 # markers, and when the complete diffed document has been created +207 # we try to move the deletes around and resolve any problems. +208 result = cleanup_delete(result) +209 +210 return result +
211 +
212 -def expand_tokens(tokens, equal=False): +
213 """Given a list of tokens, return a generator of the chunks of +214 text for the data in the tokens. +215 """ +216 for token in tokens: +217 for pre in token.pre_tags: +218 yield pre +219 if not equal or not token.hide_when_equal: +220 if token.trailing_whitespace: +221 yield token.html() + ' ' +222 else: +223 yield token.html() +224 for post in token.post_tags: +225 yield post +
226 +
227 -def merge_insert(ins_chunks, doc): +
228 """ doc is the already-handled document (as a list of text chunks); +229 here we add <ins>ins_chunks</ins> to the end of that. """ +230 # Though we don't throw away unbalanced_start or unbalanced_end +231 # (we assume there is accompanying markup later or earlier in the +232 # document), we only put <ins> around the balanced portion. +233 unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks) +234 doc.extend(unbalanced_start) +235 if doc and not doc[-1].endswith(' '): +236 # Fix up the case where the word before the insert didn't end with +237 # a space +238 doc[-1] += ' ' +239 doc.append('<ins>') +240 if balanced and balanced[-1].endswith(' '): +241 # We move space outside of </ins> +242 balanced[-1] = balanced[-1][:-1] +243 doc.extend(balanced) +244 doc.append('</ins> ') +245 doc.extend(unbalanced_end) +
246 +247 # These are sentinals to represent the start and end of a <del> +248 # segment, until we do the cleanup phase to turn them into proper +249 # markup: +
250 -class DEL_START: +
251 pass +
252 -class DEL_END: +
253 pass +
254 +
255 -class NoDeletes(Exception): +
256 """ Raised when the document no longer contains any pending deletes +257 (DEL_START/DEL_END) """ +
258 +
259 -def merge_delete(del_chunks, doc): +
260 """ Adds the text chunks in del_chunks to the document doc (another +261 list of text chunks) with marker to show it is a delete. +262 cleanup_delete later resolves these markers into <del> tags.""" +263 doc.append(DEL_START) +264 doc.extend(del_chunks) +265 doc.append(DEL_END) +
266 +
267 -def cleanup_delete(chunks): +
268 """ Cleans up any DEL_START/DEL_END markers in the document, replacing +269 them with <del></del>. To do this while keeping the document +270 valid, it may need to drop some tags (either start or end tags). +271 +272 It may also move the del into adjacent tags to try to move it to a +273 similar location where it was originally located (e.g., moving a +274 delete into preceding <div> tag, if the del looks like (DEL_START, +275 'Text</div>', DEL_END)""" +276 while 1: +277 # Find a pending DEL_START/DEL_END, splitting the document +278 # into stuff-preceding-DEL_START, stuff-inside, and +279 # stuff-following-DEL_END +280 try: +281 pre_delete, delete, post_delete = split_delete(chunks) +282 except NoDeletes: +283 # Nothing found, we've cleaned up the entire doc +284 break +285 # The stuff-inside-DEL_START/END may not be well balanced +286 # markup. First we figure out what unbalanced portions there are: +287 unbalanced_start, balanced, unbalanced_end = split_unbalanced(delete) +288 # Then we move the span forward and/or backward based on these +289 # unbalanced portions: +290 locate_unbalanced_start(unbalanced_start, pre_delete, post_delete) +291 locate_unbalanced_end(unbalanced_end, pre_delete, post_delete) +292 doc = pre_delete +293 if doc and not doc[-1].endswith(' '): +294 # Fix up case where the word before us didn't have a trailing space +295 doc[-1] += ' ' +296 doc.append('<del>') +297 if balanced and balanced[-1].endswith(' '): +298 # We move space outside of </del> +299 balanced[-1] = balanced[-1][:-1] +300 doc.extend(balanced) +301 doc.append('</del> ') +302 doc.extend(post_delete) +303 chunks = doc +304 return chunks +
305 +
306 -def split_unbalanced(chunks): +
307 """Return (unbalanced_start, balanced, unbalanced_end), where each is +308 a list of text and tag chunks. +309 +310 unbalanced_start is a list of all the tags that are opened, but +311 not closed in this span. Similarly, unbalanced_end is a list of +312 tags that are closed but were not opened. Extracting these might +313 mean some reordering of the chunks.""" +314 start = [] +315 end = [] +316 tag_stack = [] +317 balanced = [] +318 for chunk in chunks: +319 if not chunk.startswith('<'): +320 balanced.append(chunk) +321 continue +322 endtag = chunk[1] == '/' +323 name = chunk.split()[0].strip('<>/') +324 if name in empty_tags: +325 balanced.append(chunk) +326 continue +327 if endtag: +328 if tag_stack and tag_stack[-1][0] == name: +329 balanced.append(chunk) +330 name, pos, tag = tag_stack.pop() +331 balanced[pos] = tag +332 elif tag_stack: +333 start.extend([tag for name, pos, tag in tag_stack]) +334 tag_stack = [] +335 end.append(chunk) +336 else: +337 end.append(chunk) +338 else: +339 tag_stack.append((name, len(balanced), chunk)) +340 balanced.append(None) +341 start.extend( +342 [chunk for name, pos, chunk in tag_stack]) +343 balanced = [chunk for chunk in balanced if chunk is not None] +344 return start, balanced, end +
345 +
346 -def split_delete(chunks): +
347 """ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END, +348 stuff_after_DEL_END). Returns the first case found (there may be +349 more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if +350 there's no DEL_START found. """ +351 try: +352 pos = chunks.index(DEL_START) +353 except ValueError: +354 raise NoDeletes +355 pos2 = chunks.index(DEL_END) +356 return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:] +
357 +
358 -def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): +
359 """ pre_delete and post_delete implicitly point to a place in the +360 document (where the two were split). This moves that point (by +361 popping items from one and pushing them onto the other). It moves +362 the point to try to find a place where unbalanced_start applies. +363 +364 As an example:: +365 +366 >>> unbalanced_start = ['<div>'] +367 >>> doc = ['<p>', 'Text', '</p>', '<div>', 'More Text', '</div>'] +368 >>> pre, post = doc[:3], doc[3:] +369 >>> pre, post +370 (['<p>', 'Text', '</p>'], ['<div>', 'More Text', '</div>']) +371 >>> locate_unbalanced_start(unbalanced_start, pre, post) +372 >>> pre, post +373 (['<p>', 'Text', '</p>', '<div>'], ['More Text', '</div>']) +374 +375 As you can see, we moved the point so that the dangling <div> that +376 we found will be effectively replaced by the div in the original +377 document. If this doesn't work out, we just throw away +378 unbalanced_start without doing anything. +379 """ +380 while 1: +381 if not unbalanced_start: +382 # We have totally succeded in finding the position +383 break +384 finding = unbalanced_start[0] +385 finding_name = finding.split()[0].strip('<>') +386 if not post_delete: +387 break +388 next = post_delete[0] +389 if next is DEL_START or not next.startswith('<'): +390 # Reached a word, we can't move the delete text forward +391 break +392 if next[1] == '/': +393 # Reached a closing tag, can we go further? Maybe not... +394 break +395 name = next.split()[0].strip('<>') +396 if name == 'ins': +397 # Can't move into an insert +398 break +399 assert name != 'del', ( +400 "Unexpected delete tag: %r" % next) +401 if name == finding_name: +402 unbalanced_start.pop(0) +403 pre_delete.append(post_delete.pop(0)) +404 else: +405 # Found a tag that doesn't match +406 break +
407 +
408 -def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): +
409 """ like locate_unbalanced_start, except handling end tags and +410 possibly moving the point earlier in the document. """ +411 while 1: +412 if not unbalanced_end: +413 # Success +414 break +415 finding = unbalanced_end[-1] +416 finding_name = finding.split()[0].strip('<>/') +417 if not pre_delete: +418 break +419 next = pre_delete[-1] +420 if next is DEL_END or not next.startswith('</'): +421 # A word or a start tag +422 break +423 name = next.split()[0].strip('<>/') +424 if name == 'ins' or name == 'del': +425 # Can't move into an insert or delete +426 break +427 if name == finding_name: +428 unbalanced_end.pop() +429 post_delete.insert(0, pre_delete.pop()) +430 else: +431 # Found a tag that doesn't match +432 break +
433 +
434 -class token(_unicode): +
435 """ Represents a diffable token, generally a word that is displayed to +436 the user. Opening tags are attached to this token when they are +437 adjacent (pre_tags) and closing tags that follow the word +438 (post_tags). Some exceptions occur when there are empty tags +439 adjacent to a word, so there may be close tags in pre_tags, or +440 open tags in post_tags. +441 +442 We also keep track of whether the word was originally followed by +443 whitespace, even though we do not want to treat the word as +444 equivalent to a similar word that does not have a trailing +445 space.""" +446 +447 # When this is true, the token will be eliminated from the +448 # displayed diff if no change has occurred: +449 hide_when_equal = False +450 +
451 - def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=False): +
452 obj = _unicode.__new__(cls, text) +453 +454 if pre_tags is not None: +455 obj.pre_tags = pre_tags +456 else: +457 obj.pre_tags = [] +458 +459 if post_tags is not None: +460 obj.post_tags = post_tags +461 else: +462 obj.post_tags = [] +463 +464 obj.trailing_whitespace = trailing_whitespace +465 +466 return obj +
467 +
468 - def __repr__(self): +
469 return 'token(%s, %r, %r)' % (_unicode.__repr__(self), self.pre_tags, self.post_tags) +
470 +
471 - def html(self): +
472 return _unicode(self) +
473 +
474 -class tag_token(token): +
475 +476 """ Represents a token that is actually a tag. Currently this is just +477 the <img> tag, which takes up visible space just like a word but +478 is only represented in a document by a tag. """ +479 +
480 - def __new__(cls, tag, data, html_repr, pre_tags=None, +481 post_tags=None, trailing_whitespace=False): +
482 obj = token.__new__(cls, "%s: %s" % (type, data), +483 pre_tags=pre_tags, +484 post_tags=post_tags, +485 trailing_whitespace=trailing_whitespace) +486 obj.tag = tag +487 obj.data = data +488 obj.html_repr = html_repr +489 return obj +
490 +
491 - def __repr__(self): +
492 return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%s)' % ( +493 self.tag, +494 self.data, +495 self.html_repr, +496 self.pre_tags, +497 self.post_tags, +498 self.trailing_whitespace) +
499 - def html(self): +
500 return self.html_repr +
501 +
502 -class href_token(token): +
503 +504 """ Represents the href in an anchor tag. Unlike other words, we only +505 show the href when it changes. """ +506 +507 hide_when_equal = True +508 +
509 - def html(self): +
510 return ' Link: %s' % self +
511 +
512 -def tokenize(html, include_hrefs=True): +
513 """ +514 Parse the given HTML and returns token objects (words with attached tags). +515 +516 This parses only the content of a page; anything in the head is +517 ignored, and the <head> and <body> elements are themselves +518 optional. The content is then parsed by lxml, which ensures the +519 validity of the resulting parsed document (though lxml may make +520 incorrect guesses when the markup is particular bad). +521 +522 <ins> and <del> tags are also eliminated from the document, as +523 that gets confusing. +524 +525 If include_hrefs is true, then the href attribute of <a> tags is +526 included as a special kind of diffable token.""" +527 if etree.iselement(html): +528 body_el = html +529 else: +530 body_el = parse_html(html, cleanup=True) +531 # Then we split the document into text chunks for each tag, word, and end tag: +532 chunks = flatten_el(body_el, skip_tag=True, include_hrefs=include_hrefs) +533 # Finally re-joining them into token objects: +534 return fixup_chunks(chunks) +
535 +
536 -def parse_html(html, cleanup=True): +
537 """ +538 Parses an HTML fragment, returning an lxml element. Note that the HTML will be +539 wrapped in a <div> tag that was not in the original document. +540 +541 If cleanup is true, make sure there's no <head> or <body>, and get +542 rid of any <ins> and <del> tags. +543 """ +544 if cleanup: +545 # This removes any extra markup or structure like <head>: +546 html = cleanup_html(html) +547 return fragment_fromstring(html, create_parent=True) +
548 +549 _body_re = re.compile(r'<body.*?>', re.I|re.S) +550 _end_body_re = re.compile(r'</body.*?>', re.I|re.S) +551 _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S) +552 +
553 -def cleanup_html(html): +
554 """ This 'cleans' the HTML, meaning that any page structure is removed +555 (only the contents of <body> are used, if there is any <body). +556 Also <ins> and <del> tags are removed. """ +557 match = _body_re.search(html) +558 if match: +559 html = html[match.end():] +560 match = _end_body_re.search(html) +561 if match: +562 html = html[:match.start()] +563 html = _ins_del_re.sub('', html) +564 return html +
565 +566 +567 end_whitespace_re = re.compile(r'[ \t\n\r]$') +568 +
569 -def fixup_chunks(chunks): +
570 """ +571 This function takes a list of chunks and produces a list of tokens. +572 """ +573 tag_accum = [] +574 cur_word = None +575 result = [] +576 for chunk in chunks: +577 if isinstance(chunk, tuple): +578 if chunk[0] == 'img': +579 src = chunk[1] +580 tag = chunk[2] +581 if tag.endswith(' '): +582 tag = tag[:-1] +583 trailing_whitespace = True +584 else: +585 trailing_whitespace = False +586 cur_word = tag_token('img', src, html_repr=tag, +587 pre_tags=tag_accum, +588 trailing_whitespace=trailing_whitespace) +589 tag_accum = [] +590 result.append(cur_word) +591 elif chunk[0] == 'href': +592 href = chunk[1] +593 cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=True) +594 tag_accum = [] +595 result.append(cur_word) +596 continue +597 if is_word(chunk): +598 if chunk.endswith(' '): +599 chunk = chunk[:-1] +600 trailing_whitespace = True +601 else: +602 trailing_whitespace = False +603 cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace) +604 tag_accum = [] +605 result.append(cur_word) +606 elif is_start_tag(chunk): +607 tag_accum.append(chunk) +608 elif is_end_tag(chunk): +609 if tag_accum: +610 tag_accum.append(chunk) +611 else: +612 assert cur_word, ( +613 "Weird state, cur_word=%r, result=%r, chunks=%r of %r" +614 % (cur_word, result, chunk, chunks)) +615 cur_word.post_tags.append(chunk) +616 else: +617 assert(0) +618 +619 if not result: +620 return [token('', pre_tags=tag_accum)] +621 else: +622 result[-1].post_tags.extend(tag_accum) +623 +624 return result +
625 +626 +627 # All the tags in HTML that don't require end tags: +628 empty_tags = ( +629 'param', 'img', 'area', 'br', 'basefont', 'input', +630 'base', 'meta', 'link', 'col') +631 +632 block_level_tags = ( +633 'address', +634 'blockquote', +635 'center', +636 'dir', +637 'div', +638 'dl', +639 'fieldset', +640 'form', +641 'h1', +642 'h2', +643 'h3', +644 'h4', +645 'h5', +646 'h6', +647 'hr', +648 'isindex', +649 'menu', +650 'noframes', +651 'noscript', +652 'ol', +653 'p', +654 'pre', +655 'table', +656 'ul', +657 ) +658 +659 block_level_container_tags = ( +660 'dd', +661 'dt', +662 'frameset', +663 'li', +664 'tbody', +665 'td', +666 'tfoot', +667 'th', +668 'thead', +669 'tr', +670 ) +671 +672 +
673 -def flatten_el(el, include_hrefs, skip_tag=False): +
674 """ Takes an lxml element el, and generates all the text chunks for +675 that tag. Each start tag is a chunk, each word is a chunk, and each +676 end tag is a chunk. +677 +678 If skip_tag is true, then the outermost container tag is +679 not returned (just its contents).""" +680 if not skip_tag: +681 if el.tag == 'img': +682 yield ('img', el.attrib['src'], start_tag(el)) +683 else: +684 yield start_tag(el) +685 if el.tag in empty_tags and not el.text and not len(el) and not el.tail: +686 return +687 start_words = split_words(el.text) +688 for word in start_words: +689 yield cgi.escape(word) +690 for child in el: +691 for item in flatten_el(child, include_hrefs=include_hrefs): +692 yield item +693 if el.tag == 'a' and el.attrib.get('href') and include_hrefs: +694 yield ('href', el.attrib['href']) +695 if not skip_tag: +696 yield end_tag(el) +697 end_words = split_words(el.tail) +698 for word in end_words: +699 yield cgi.escape(word) +
700 +
701 -def split_words(text): +
702 """ Splits some text into words. Includes trailing whitespace (one +703 space) on each word when appropriate. """ +704 if not text or not text.strip(): +705 return [] +706 words = [w + ' ' for w in text.strip().split()] +707 if not end_whitespace_re.search(text): +708 words[-1] = words[-1][:-1] +709 return words +
710 +711 start_whitespace_re = re.compile(r'^[ \t\n\r]') +712 +
713 -def start_tag(el): +
714 """ +715 The text representation of the start tag for a tag. +716 """ +717 return '<%s%s>' % ( +718 el.tag, ''.join([' %s="%s"' % (name, cgi.escape(value, True)) +719 for name, value in el.attrib.items()])) +
720 +
721 -def end_tag(el): +
722 """ The text representation of an end tag for a tag. Includes +723 trailing whitespace when appropriate. """ +724 if el.tail and start_whitespace_re.search(el.tail): +725 extra = ' ' +726 else: +727 extra = '' +728 return '</%s>%s' % (el.tag, extra) +
729 +
730 -def is_word(tok): +
731 return not tok.startswith('<') +
732 +
733 -def is_end_tag(tok): +
734 return tok.startswith('</') +
735 +
736 -def is_start_tag(tok): +
737 return tok.startswith('<') and not tok.startswith('</') +
738 +
739 -def fixup_ins_del_tags(html): +
740 """ Given an html string, move any <ins> or <del> tags inside of any +741 block-level elements, e.g. transform <ins><p>word</p></ins> to +742 <p><ins>word</ins></p> """ +743 doc = parse_html(html, cleanup=False) +744 _fixup_ins_del_tags(doc) +745 html = serialize_html_fragment(doc, skip_outer=True) +746 return html +
747 +
748 -def serialize_html_fragment(el, skip_outer=False): +
749 """ Serialize a single lxml element as HTML. The serialized form +750 includes the elements tail. +751 +752 If skip_outer is true, then don't serialize the outermost tag +753 """ +754 assert not isinstance(el, basestring), ( +755 "You should pass in an element, not a string like %r" % el) +756 html = etree.tostring(el, method="html", encoding=_unicode) +757 if skip_outer: +758 # Get rid of the extra starting tag: +759 html = html[html.find('>')+1:] +760 # Get rid of the extra end tag: +761 html = html[:html.rfind('<')] +762 return html.strip() +763 else: +764 return html +
765 +
766 -def _fixup_ins_del_tags(doc): +
767 """fixup_ins_del_tags that works on an lxml document in-place +768 """ +769 for tag in ['ins', 'del']: +770 for el in doc.xpath('descendant-or-self::%s' % tag): +771 if not _contains_block_level_tag(el): +772 continue +773 _move_el_inside_block(el, tag=tag) +774 el.drop_tag() +
775 #_merge_element_contents(el) +776 +
778 """True if the element contains any block-level elements, like <p>, <td>, etc. +779 """ +780 if el.tag in block_level_tags or el.tag in block_level_container_tags: +781 return True +782 for child in el: +783 if _contains_block_level_tag(child): +784 return True +785 return False +
786 +
787 -def _move_el_inside_block(el, tag): +
788 """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags +789 and moves them inside any block-level tags. """ +790 for child in el: +791 if _contains_block_level_tag(child): +792 break +793 else: +794 import sys +795 # No block-level tags in any child +796 children_tag = etree.Element(tag) +797 children_tag.text = el.text +798 el.text = None +799 children_tag.extend(list(el)) +800 el[:] = [children_tag] +801 return +802 for child in list(el): +803 if _contains_block_level_tag(child): +804 _move_el_inside_block(child, tag) +805 if child.tail: +806 tail_tag = etree.Element(tag) +807 tail_tag.text = child.tail +808 child.tail = None +809 el.insert(el.index(child)+1, tail_tag) +810 else: +811 child_tag = etree.Element(tag) +812 el.replace(child, child_tag) +813 child_tag.append(child) +814 if el.text: +815 text_tag = etree.Element(tag) +816 text_tag.text = el.text +817 el.text = None +818 el.insert(0, text_tag) +
819 +
821 """ +822 Removes an element, but merges its contents into its place, e.g., +823 given <p>Hi <i>there!</i></p>, if you remove the <i> element you get +824 <p>Hi there!</p> +825 """ +826 parent = el.getparent() +827 text = el.text or '' +828 if el.tail: +829 if not len(el): +830 text += el.tail +831 else: +832 if el[-1].tail: +833 el[-1].tail += el.tail +834 else: +835 el[-1].tail = el.tail +836 index = parent.index(el) +837 if text: +838 if index == 0: +839 previous = None +840 else: +841 previous = parent[index-1] +842 if previous is None: +843 if parent.text: +844 parent.text += text +845 else: +846 parent.text = text +847 else: +848 if previous.tail: +849 previous.tail += text +850 else: +851 previous.tail = text +852 parent[index:index+1] = el.getchildren() +
853 +
854 -class InsensitiveSequenceMatcher(difflib.SequenceMatcher): +
855 """ +856 Acts like SequenceMatcher, but tries not to find very small equal +857 blocks amidst large spans of changes +858 """ +859 +860 threshold = 2 +861 +
862 - def get_matching_blocks(self): +
863 size = min(len(self.b), len(self.b)) +864 threshold = min(self.threshold, size / 4) +865 actual = difflib.SequenceMatcher.get_matching_blocks(self) +866 return [item for item in actual +867 if item[2] > threshold +868 or not item[2]] +
869 +870 if __name__ == '__main__': +871 from lxml.html import _diffcommand +872 _diffcommand.main() +873 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.DEL_END-class.html b/doc/html/api/lxml.html.diff.DEL_END-class.html new file mode 100644 index 0000000..b32ae7d --- /dev/null +++ b/doc/html/api/lxml.html.diff.DEL_END-class.html @@ -0,0 +1,116 @@ + + + + + lxml.html.diff.DEL_END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class DEL_END + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DEL_END

source code

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.DEL_START-class.html b/doc/html/api/lxml.html.diff.DEL_START-class.html new file mode 100644 index 0000000..97b4947 --- /dev/null +++ b/doc/html/api/lxml.html.diff.DEL_START-class.html @@ -0,0 +1,116 @@ + + + + + lxml.html.diff.DEL_START + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class DEL_START + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DEL_START

source code

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.InsensitiveSequenceMatcher-class.html b/doc/html/api/lxml.html.diff.InsensitiveSequenceMatcher-class.html new file mode 100644 index 0000000..695b467 --- /dev/null +++ b/doc/html/api/lxml.html.diff.InsensitiveSequenceMatcher-class.html @@ -0,0 +1,257 @@ + + + + + lxml.html.diff.InsensitiveSequenceMatcher + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class InsensitiveSequenceMatcher + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class InsensitiveSequenceMatcher

source code

+
+difflib.SequenceMatcher --+
+                          |
+                         InsensitiveSequenceMatcher
+
+ +
+Acts like SequenceMatcher, but tries not to find very small equal +blocks amidst large spans of changes + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
get_matching_blocks(self)
+ Return list of triples describing matching subsequences.
+ source code + +
+ +
+

Inherited from difflib.SequenceMatcher: + __init__, + find_longest_match, + get_grouped_opcodes, + get_opcodes, + quick_ratio, + ratio, + real_quick_ratio, + set_seq1, + set_seq2, + set_seqs +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + threshold = 2 +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

get_matching_blocks(self) +

+
source code  +
+ +

Return list of triples describing matching subsequences.

+

Each triple is of the form (i, j, n), and means that +a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in +i and in j. New in Python 2.5, it's also guaranteed that if +(i, j, n) and (i', j', n') are adjacent triples in the list, and +the second is not the last triple in the list, then i+n != i' or +j+n != j'. IOW, adjacent triples never describe adjacent equal +blocks.

+

The last triple is a dummy, (len(a), len(b), 0), and is the only +triple with n==0.

+
+>>> s = SequenceMatcher(None, "abxcd", "abcd")
+>>> s.get_matching_blocks()
+[(0, 0, 2), (3, 2, 2), (5, 4, 0)]
+
+
Overrides: + difflib.SequenceMatcher.get_matching_blocks +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.NoDeletes-class.html b/doc/html/api/lxml.html.diff.NoDeletes-class.html new file mode 100644 index 0000000..8d959fb --- /dev/null +++ b/doc/html/api/lxml.html.diff.NoDeletes-class.html @@ -0,0 +1,200 @@ + + + + + lxml.html.diff.NoDeletes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class NoDeletes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class NoDeletes

source code

+
+              object --+        
+                       |        
+exceptions.BaseException --+    
+                           |    
+        exceptions.Exception --+
+                               |
+                              NoDeletes
+
+ +
+Raised when the document no longer contains any pending deletes +(DEL_START/DEL_END) + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from exceptions.Exception: + __init__, + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.href_token-class.html b/doc/html/api/lxml.html.diff.href_token-class.html new file mode 100644 index 0000000..2f90877 --- /dev/null +++ b/doc/html/api/lxml.html.diff.href_token-class.html @@ -0,0 +1,356 @@ + + + + + lxml.html.diff.href_token + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class href_token + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class href_token

source code

+
+object --+            
+         |            
+basestring --+        
+             |        
+       unicode --+    
+                 |    
+             token --+
+                     |
+                    href_token
+
+ +
+Represents the href in an anchor tag. Unlike other words, we only +show the href when it changes. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
html(self) + source code + +
+ +
+

Inherited from token: + __repr__ +

+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+

Inherited from token: + __new__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + hide_when_equal = True +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

html(self) +

+
source code  +
+ + +
+
Overrides: + token.html +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.tag_token-class.html b/doc/html/api/lxml.html.diff.tag_token-class.html new file mode 100644 index 0000000..64a1658 --- /dev/null +++ b/doc/html/api/lxml.html.diff.tag_token-class.html @@ -0,0 +1,441 @@ + + + + + lxml.html.diff.tag_token + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class tag_token + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class tag_token

source code

+
+object --+            
+         |            
+basestring --+        
+             |        
+       unicode --+    
+                 |    
+             token --+
+                     |
+                    tag_token
+
+ +
+Represents a token that is actually a tag. Currently this is just +the <img> tag, which takes up visible space just like a word but +is only represented in a document by a tag. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
html(self) + source code + +
+ +
+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(cls, + tag, + data, + html_repr, + pre_tags=None, + post_tags=None, + trailing_whitespace=False) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from token: + hide_when_equal +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(cls, + tag, + data, + html_repr, + pre_tags=None, + post_tags=None, + trailing_whitespace=False) +
Static Method +

+
source code  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

html(self) +

+
source code  +
+ + +
+
Overrides: + token.html +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.diff.token-class.html b/doc/html/api/lxml.html.diff.token-class.html new file mode 100644 index 0000000..53e7d50 --- /dev/null +++ b/doc/html/api/lxml.html.diff.token-class.html @@ -0,0 +1,426 @@ + + + + + lxml.html.diff.token + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module diff :: + Class token + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class token

source code

+
+object --+        
+         |        
+basestring --+    
+             |    
+       unicode --+
+                 |
+                token
+
+ +
Known Subclasses:
+
+ +
+ +
+

Represents a diffable token, generally a word that is displayed to +the user. Opening tags are attached to this token when they are +adjacent (pre_tags) and closing tags that follow the word +(post_tags). Some exceptions occur when there are empty tags +adjacent to a word, so there may be close tags in pre_tags, or +open tags in post_tags.

+

We also keep track of whether the word was originally followed by +whitespace, even though we do not want to treat the word as +equivalent to a similar word that does not have a trailing +space.

+ + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__repr__(self)
+ repr(x)
+ source code + +
+ +
+   + + + + + + +
html(self) + source code + +
+ +
+

Inherited from unicode: + __add__, + __contains__, + __eq__, + __ge__, + __getattribute__, + __getitem__, + __getnewargs__, + __getslice__, + __gt__, + __hash__, + __le__, + __len__, + __lt__, + __mod__, + __mul__, + __ne__, + __rmod__, + __rmul__, + __str__, + capitalize, + center, + count, + decode, + encode, + endswith, + expandtabs, + find, + index, + isalnum, + isalpha, + isdecimal, + isdigit, + islower, + isnumeric, + isspace, + istitle, + isupper, + join, + ljust, + lower, + lstrip, + partition, + replace, + rfind, + rindex, + rjust, + rpartition, + rsplit, + rstrip, + split, + splitlines, + startswith, + strip, + swapcase, + title, + translate, + upper, + zfill +

+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(cls, + text, + pre_tags=None, + post_tags=None, + trailing_whitespace=False) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + hide_when_equal = False +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(cls, + text, + pre_tags=None, + post_tags=None, + trailing_whitespace=False) +
Static Method +

+
source code  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
source code  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.formfill-module.html b/doc/html/api/lxml.html.formfill-module.html new file mode 100644 index 0000000..f5c9714 --- /dev/null +++ b/doc/html/api/lxml.html.formfill-module.html @@ -0,0 +1,553 @@ + + + + + lxml.html.formfill + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module formfill + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module formfill

source code

+ + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + FormNotFound
+ Raised when no form can be found +
+   + + DefaultErrorCreator +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
fill_form(el, + values, + form_id=None, + form_index=None) + source code + +
+ +
+   + + + + + + +
fill_form_html(html, + values, + form_id=None, + form_index=None) + source code + +
+ +
+   + + + + + + +
_fill_form(el, + values) + source code + +
+ +
+   + + + + + + +
_takes_multiple(input) + source code + +
+ +
+   + + + + + + +
_fill_multiple(input, + value) + source code + +
+ +
+   + + + + + + +
_check(el, + check) + source code + +
+ +
+   + + + + + + +
_select(el, + select) + source code + +
+ +
+   + + + + + + +
_fill_single(input, + value) + source code + +
+ +
+   + + + + + + +
_find_form(el, + form_id=None, + form_index=None) + source code + +
+ +
+   + + + + + + +
_find_form_ids(el) + source code + +
+ +
+   + + + + + + +
insert_errors(el, + errors, + form_id=None, + form_index=None, + error_class='error', + error_creator=default_error_creator) + source code + +
+ +
+   + + + + + + +
insert_errors_html(html, + values, + **kw) + source code + +
+ +
+   + + + + + + +
_insert_error(el, + error, + error_class, + error_creator) + source code + +
+ +
+   + + + + + + +
_add_class(el, + class_name) + source code + +
+ +
+   + + + + + + +
_find_elements_for_name(form, + name, + error) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + _form_name_xpath = descendant-or-self::form[name=$name]|descen... +
+   + + _input_xpath = descendant-or-self::input|descendant-or-self::s... +
+   + + _label_for_xpath = //label[@for=$for_id]|//x:label[@for=$for_id] +
+   + + _name_xpath = descendant-or-self::*[@name=$name] +
+   + + default_error_creator = default_error_creator +
+   + + _tag = 'x:textarea' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

_form_name_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::form[name=$name]|descendant-or-self::x:form[name=$\
+name]
+
+
+
+
+
+ +
+ +
+

_input_xpath

+ +
+
+
+
Value:
+
+descendant-or-self::input|descendant-or-self::select|descendant-or-sel\
+f::textarea|descendant-or-self::x:input|descendant-or-self::x:select|d\
+escendant-or-self::x:textarea
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.formfill-pysrc.html b/doc/html/api/lxml.html.formfill-pysrc.html new file mode 100644 index 0000000..7ae7160 --- /dev/null +++ b/doc/html/api/lxml.html.formfill-pysrc.html @@ -0,0 +1,897 @@ + + + + + lxml.html.formfill + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module formfill + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.formfill

+
+  1  from lxml.etree import XPath, ElementBase 
+  2  from lxml.html import fromstring, tostring, XHTML_NAMESPACE 
+  3  from lxml.html import _forms_xpath, _options_xpath, _nons, _transform_result 
+  4  from lxml.html import defs 
+  5  import copy 
+  6  try: 
+  7      basestring = __builtins__["basestring"] 
+  8  except (KeyError, NameError): 
+  9      # Python 3 
+ 10      basestring = str 
+ 11   
+ 12  __all__ = ['FormNotFound', 'fill_form', 'fill_form_html', 
+ 13             'insert_errors', 'insert_errors_html', 
+ 14             'DefaultErrorCreator'] 
+ 15   
+
16 -class FormNotFound(LookupError): +
17 """ + 18 Raised when no form can be found + 19 """ +
20 + 21 _form_name_xpath = XPath('descendant-or-self::form[name=$name]|descendant-or-self::x:form[name=$name]', namespaces={'x':XHTML_NAMESPACE}) + 22 _input_xpath = XPath('|'.join(['descendant-or-self::'+_tag for _tag in ('input','select','textarea','x:input','x:select','x:textarea')]), + 23 namespaces={'x':XHTML_NAMESPACE}) + 24 _label_for_xpath = XPath('//label[@for=$for_id]|//x:label[@for=$for_id]', + 25 namespaces={'x':XHTML_NAMESPACE}) + 26 _name_xpath = XPath('descendant-or-self::*[@name=$name]') + 27 +
28 -def fill_form( + 29 el, + 30 values, + 31 form_id=None, + 32 form_index=None, + 33 ): +
34 el = _find_form(el, form_id=form_id, form_index=form_index) + 35 _fill_form(el, values) +
36 +
37 -def fill_form_html(html, values, form_id=None, form_index=None): +
38 result_type = type(html) + 39 if isinstance(html, basestring): + 40 doc = fromstring(html) + 41 else: + 42 doc = copy.deepcopy(html) + 43 fill_form(doc, values, form_id=form_id, form_index=form_index) + 44 return _transform_result(result_type, doc) +
45 +
46 -def _fill_form(el, values): +
47 counts = {} + 48 if hasattr(values, 'mixed'): + 49 # For Paste request parameters + 50 values = values.mixed() + 51 inputs = _input_xpath(el) + 52 for input in inputs: + 53 name = input.get('name') + 54 if not name: + 55 continue + 56 if _takes_multiple(input): + 57 value = values.get(name, []) + 58 if not isinstance(value, (list, tuple)): + 59 value = [value] + 60 _fill_multiple(input, value) + 61 elif name not in values: + 62 continue + 63 else: + 64 index = counts.get(name, 0) + 65 counts[name] = index + 1 + 66 value = values[name] + 67 if isinstance(value, (list, tuple)): + 68 try: + 69 value = value[index] + 70 except IndexError: + 71 continue + 72 elif index > 0: + 73 continue + 74 _fill_single(input, value) +
75 +
76 -def _takes_multiple(input): +
77 if _nons(input.tag) == 'select' and input.get('multiple'): + 78 # FIXME: multiple="0"? + 79 return True + 80 type = input.get('type', '').lower() + 81 if type in ('radio', 'checkbox'): + 82 return True + 83 return False +
84 +
85 -def _fill_multiple(input, value): +
86 type = input.get('type', '').lower() + 87 if type == 'checkbox': + 88 v = input.get('value') + 89 if v is None: + 90 if not value: + 91 result = False + 92 else: + 93 result = value[0] + 94 if isinstance(value, basestring): + 95 # The only valid "on" value for an unnamed checkbox is 'on' + 96 result = result == 'on' + 97 _check(input, result) + 98 else: + 99 _check(input, v in value) +100 elif type == 'radio': +101 v = input.get('value') +102 _check(input, v in value) +103 else: +104 assert _nons(input.tag) == 'select' +105 for option in _options_xpath(input): +106 v = option.get('value') +107 if v is None: +108 # This seems to be the default, at least on IE +109 # FIXME: but I'm not sure +110 v = option.text_content() +111 _select(option, v in value) +
112 +
113 -def _check(el, check): +
114 if check: +115 el.set('checked', '') +116 else: +117 if 'checked' in el.attrib: +118 del el.attrib['checked'] +
119 +
120 -def _select(el, select): +
121 if select: +122 el.set('selected', '') +123 else: +124 if 'selected' in el.attrib: +125 del el.attrib['selected'] +
126 +
127 -def _fill_single(input, value): +
128 if _nons(input.tag) == 'textarea': +129 input.clear() +130 input.text = value +131 else: +132 input.set('value', value) +
133 +
134 -def _find_form(el, form_id=None, form_index=None): +
135 if form_id is None and form_index is None: +136 forms = _forms_xpath(el) +137 for form in forms: +138 return form +139 raise FormNotFound( +140 "No forms in page") +141 if form_id is not None: +142 form = el.get_element_by_id(form_id) +143 if form is not None: +144 return form +145 forms = _form_name_xpath(el, name=form_id) +146 if forms: +147 return forms[0] +148 else: +149 raise FormNotFound( +150 "No form with the name or id of %r (forms: %s)" +151 % (id, ', '.join(_find_form_ids(el)))) +152 if form_index is not None: +153 forms = _forms_xpath(el) +154 try: +155 return forms[form_index] +156 except IndexError: +157 raise FormNotFound( +158 "There is no form with the index %r (%i forms found)" +159 % (form_index, len(forms))) +
160 +
161 -def _find_form_ids(el): +
162 forms = _forms_xpath(el) +163 if not forms: +164 yield '(no forms)' +165 return +166 for index, form in enumerate(forms): +167 if form.get('id'): +168 if form.get('name'): +169 yield '%s or %s' % (form.get('id'), +170 form.get('name')) +171 else: +172 yield form.get('id') +173 elif form.get('name'): +174 yield form.get('name') +175 else: +176 yield '(unnamed form %s)' % index +
177 +178 ############################################################ +179 ## Error filling +180 ############################################################ +181 +
182 -class DefaultErrorCreator(object): +
183 insert_before = True +184 block_inside = True +185 error_container_tag = 'div' +186 error_message_class = 'error-message' +187 error_block_class = 'error-block' +188 default_message = "Invalid" +189 +
190 - def __init__(self, **kw): +
191 for name, value in kw.items(): +192 if not hasattr(self, name): +193 raise TypeError( +194 "Unexpected keyword argument: %s" % name) +195 setattr(self, name, value) +
196 +
197 - def __call__(self, el, is_block, message): +
198 error_el = el.makeelement(self.error_container_tag) +199 if self.error_message_class: +200 error_el.set('class', self.error_message_class) +201 if is_block and self.error_block_class: +202 error_el.set('class', error_el.get('class', '')+' '+self.error_block_class) +203 if message is None or message == '': +204 message = self.default_message +205 if isinstance(message, ElementBase): +206 error_el.append(message) +207 else: +208 assert isinstance(message, basestring), ( +209 "Bad message; should be a string or element: %r" % message) +210 error_el.text = message or self.default_message +211 if is_block and self.block_inside: +212 if self.insert_before: +213 error_el.tail = el.text +214 el.text = None +215 el.insert(0, error_el) +216 else: +217 el.append(error_el) +218 else: +219 parent = el.getparent() +220 pos = parent.index(el) +221 if self.insert_before: +222 parent.insert(pos, error_el) +223 else: +224 error_el.tail = el.tail +225 el.tail = None +226 parent.insert(pos+1, error_el) +
227 +228 default_error_creator = DefaultErrorCreator() +229 +230 +
231 -def insert_errors( +232 el, +233 errors, +234 form_id=None, +235 form_index=None, +236 error_class="error", +237 error_creator=default_error_creator, +238 ): +
239 el = _find_form(el, form_id=form_id, form_index=form_index) +240 for name, error in errors.items(): +241 if error is None: +242 continue +243 for error_el, message in _find_elements_for_name(el, name, error): +244 assert isinstance(message, (basestring, type(None), ElementBase)), ( +245 "Bad message: %r" % message) +246 _insert_error(error_el, message, error_class, error_creator) +
247 +
248 -def insert_errors_html(html, values, **kw): +
249 result_type = type(html) +250 if isinstance(html, basestring): +251 doc = fromstring(html) +252 else: +253 doc = copy.deepcopy(html) +254 insert_errors(doc, values, **kw) +255 return _transform_result(result_type, doc) +
256 +
257 -def _insert_error(el, error, error_class, error_creator): +
258 if _nons(el.tag) in defs.empty_tags or _nons(el.tag) == 'textarea': +259 is_block = False +260 else: +261 is_block = True +262 if _nons(el.tag) != 'form' and error_class: +263 _add_class(el, error_class) +264 if el.get('id'): +265 labels = _label_for_xpath(el, for_id=el.get('id')) +266 if labels: +267 for label in labels: +268 _add_class(label, error_class) +269 error_creator(el, is_block, error) +
270 +
271 -def _add_class(el, class_name): +
272 if el.get('class'): +273 el.set('class', el.get('class')+' '+class_name) +274 else: +275 el.set('class', class_name) +
276 +
277 -def _find_elements_for_name(form, name, error): +
278 if name is None: +279 # An error for the entire form +280 yield form, error +281 return +282 if name.startswith('#'): +283 # By id +284 el = form.get_element_by_id(name[1:]) +285 if el is not None: +286 yield el, error +287 return +288 els = _name_xpath(form, name=name) +289 if not els: +290 # FIXME: should this raise an exception? +291 return +292 if not isinstance(error, (list, tuple)): +293 yield els[0], error +294 return +295 # FIXME: if error is longer than els, should it raise an error? +296 for el, err in zip(els, error): +297 if err is None: +298 continue +299 yield el, err +
300 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.formfill.DefaultErrorCreator-class.html b/doc/html/api/lxml.html.formfill.DefaultErrorCreator-class.html new file mode 100644 index 0000000..5b225e8 --- /dev/null +++ b/doc/html/api/lxml.html.formfill.DefaultErrorCreator-class.html @@ -0,0 +1,322 @@ + + + + + lxml.html.formfill.DefaultErrorCreator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module formfill :: + Class DefaultErrorCreator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class DefaultErrorCreator

source code

+
+object --+
+         |
+        DefaultErrorCreator
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + **kw)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
__call__(self, + el, + is_block, + message) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + insert_before = True +
+   + + block_inside = True +
+   + + error_container_tag = 'div' +
+   + + error_message_class = 'error-message' +
+   + + error_block_class = 'error-block' +
+   + + default_message = 'Invalid' +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + **kw) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.formfill.FormNotFound-class.html b/doc/html/api/lxml.html.formfill.FormNotFound-class.html new file mode 100644 index 0000000..20cd60a --- /dev/null +++ b/doc/html/api/lxml.html.formfill.FormNotFound-class.html @@ -0,0 +1,203 @@ + + + + + lxml.html.formfill.FormNotFound + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module formfill :: + Class FormNotFound + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FormNotFound

source code

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+        exceptions.StandardError --+    
+                                   |    
+              exceptions.LookupError --+
+                                       |
+                                      FormNotFound
+
+ +
+Raised when no form can be found + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from exceptions.LookupError: + __init__, + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.html5parser-module.html b/doc/html/api/lxml.html.html5parser-module.html new file mode 100644 index 0000000..5cf8bb0 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser-module.html @@ -0,0 +1,438 @@ + + + + + lxml.html.html5parser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module html5parser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module html5parser

source code

+An interface to html5lib. + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + HTMLParser
+ An html5lib HTML parser with lxml as tree. +
+   + + XHTMLParser
+ An html5lib XHTML Parser with lxml as tree. +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
_find_tag(tree, + tag) + source code + +
+ +
+   + + + + + + +
document_fromstring(html, + guess_charset=True, + parser=None)
+ Parse a whole document into a string.
+ source code + +
+ +
+   + + + + + + +
fragments_fromstring(html, + no_leading_text=False, + guess_charset=False, + parser=None)
+ Parses several HTML elements, returning a list of elements.
+ source code + +
+ +
+   + + + + + + +
fragment_fromstring(html, + create_parent=False, + guess_charset=False, + parser=None)
+ Parses a single HTML element; it is an error if there is more than +one element, or if anything but whitespace precedes or follows the +element.
+ source code + +
+ +
+   + + + + + + +
fromstring(html, + guess_charset=True, + parser=None)
+ Parse the html, returning a single element/document.
+ source code + +
+ +
+   + + + + + + +
parse(filename_url_or_file, + guess_charset=True, + parser=None)
+ Parse a filename, URL, or file-like object into an HTML document +tree.
+ source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + html_parser = HTMLParser() +
+   + + xhtml_parser = XHTMLParser() +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

fragments_fromstring(html, + no_leading_text=False, + guess_charset=False, + parser=None) +

+
source code  +
+ +

Parses several HTML elements, returning a list of elements.

+

The first item in the list may be a string. If no_leading_text is true, +then it will be an error if there is leading text, and it will always be +a list of only elements.

+

If guess_charset is True and the text was not unicode but a +bytestring, the chardet library will perform charset guessing on the +string.

+
+
+
+
+ +
+ +
+ + +
+

fragment_fromstring(html, + create_parent=False, + guess_charset=False, + parser=None) +

+
source code  +
+ +

Parses a single HTML element; it is an error if there is more than +one element, or if anything but whitespace precedes or follows the +element.

+

If create_parent is true (or is a tag name) then a parent node +will be created to encapsulate the HTML in a single element.

+
+
+
+
+ +
+ +
+ + +
+

fromstring(html, + guess_charset=True, + parser=None) +

+
source code  +
+ +

Parse the html, returning a single element/document.

+

This tries to minimally parse the chunk of text, without knowing if it +is a fragment or a document.

+

base_url will set the document's base_url attribute (and the tree's docinfo.URL)

+
+
+
+
+ +
+ +
+ + +
+

parse(filename_url_or_file, + guess_charset=True, + parser=None) +

+
source code  +
+ + Parse a filename, URL, or file-like object into an HTML document +tree. Note: this returns a tree, not an element. Use +parse(...).getroot() to get the document root. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.html5parser-pysrc.html b/doc/html/api/lxml.html.html5parser-pysrc.html new file mode 100644 index 0000000..9e59935 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser-pysrc.html @@ -0,0 +1,635 @@ + + + + + lxml.html.html5parser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module html5parser + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.html5parser

+
+  1  """ 
+  2  An interface to html5lib. 
+  3  """ 
+  4   
+  5  import urllib 
+  6  from html5lib import HTMLParser as _HTMLParser, XHTMLParser as _XHTMLParser 
+  7  from lxml import etree 
+  8  from lxml.html import _contains_block_level_tag, XHTML_NAMESPACE 
+  9  from lxml.html._html5builder import TreeBuilder 
+ 10   
+ 11  # python3 compatibility 
+ 12  try: 
+ 13      _strings = basestring 
+ 14  except NameError: 
+ 15      _strings = (bytes, str) 
+ 16   
+ 17   
+
18 -class HTMLParser(_HTMLParser): +
19 """An html5lib HTML parser with lxml as tree.""" + 20 +
21 - def __init__(self, strict=False): +
22 _HTMLParser.__init__(self, strict=strict, tree=TreeBuilder) +
23 + 24 +
25 -class XHTMLParser(_XHTMLParser): +
26 """An html5lib XHTML Parser with lxml as tree.""" + 27 +
28 - def __init__(self, strict=False): +
29 _XHTMLParser.__init__(self, strict=strict, tree=TreeBuilder) +
30 + 31 +
32 -def _find_tag(tree, tag): +
33 elem = tree.find(tag) + 34 if elem is not None: + 35 return elem + 36 return tree.find('{%s}%s' % (XHTML_NAMESPACE, tag)) +
37 + 38 +
39 -def document_fromstring(html, guess_charset=True, parser=None): +
40 """Parse a whole document into a string.""" + 41 if not isinstance(html, _strings): + 42 raise TypeError('string required') + 43 + 44 if parser is None: + 45 parser = html_parser + 46 + 47 return parser.parse(html, useChardet=guess_charset).getroot() +
48 + 49 +
50 -def fragments_fromstring(html, no_leading_text=False, + 51 guess_charset=False, parser=None): +
52 """Parses several HTML elements, returning a list of elements. + 53 + 54 The first item in the list may be a string. If no_leading_text is true, + 55 then it will be an error if there is leading text, and it will always be + 56 a list of only elements. + 57 + 58 If `guess_charset` is `True` and the text was not unicode but a + 59 bytestring, the `chardet` library will perform charset guessing on the + 60 string. + 61 """ + 62 if not isinstance(html, _strings): + 63 raise TypeError('string required') + 64 + 65 if parser is None: + 66 parser = html_parser + 67 + 68 children = parser.parseFragment(html, 'div', useChardet=guess_charset) + 69 if children and isinstance(children[0], _strings): + 70 if no_leading_text: + 71 if children[0].strip(): + 72 raise etree.ParserError('There is leading text: %r' % + 73 children[0]) + 74 del children[0] + 75 return children +
76 + 77 +
78 -def fragment_fromstring(html, create_parent=False, + 79 guess_charset=False, parser=None): +
80 """Parses a single HTML element; it is an error if there is more than + 81 one element, or if anything but whitespace precedes or follows the + 82 element. + 83 + 84 If create_parent is true (or is a tag name) then a parent node + 85 will be created to encapsulate the HTML in a single element. + 86 """ + 87 if not isinstance(html, _strings): + 88 raise TypeError('string required') + 89 + 90 if create_parent: + 91 container = create_parent or 'div' + 92 html = '<%s>%s</%s>' % (container, html, container) + 93 + 94 children = fragments_fromstring(html, True, guess_charset, parser) + 95 if not children: + 96 raise etree.ParserError('No elements found') + 97 if len(children) > 1: + 98 raise etree.ParserError('Multiple elements found') + 99 +100 result = children[0] +101 if result.tail and result.tail.strip(): +102 raise etree.ParserError('Element followed by text: %r' % result.tail) +103 result.tail = None +104 return result +
105 +106 +
107 -def fromstring(html, guess_charset=True, parser=None): +
108 """Parse the html, returning a single element/document. +109 +110 This tries to minimally parse the chunk of text, without knowing if it +111 is a fragment or a document. +112 +113 base_url will set the document's base_url attribute (and the tree's docinfo.URL) +114 """ +115 if not isinstance(html, _strings): +116 raise TypeError('string required') +117 doc = document_fromstring(html, parser=parser, +118 guess_charset=guess_charset) +119 +120 # document starts with doctype or <html>, full document! +121 start = html[:50].lstrip().lower() +122 if start.startswith('<html') or start.startswith('<!doctype'): +123 return doc +124 +125 head = _find_tag(doc, 'head') +126 +127 # if the head is not empty we have a full document +128 if len(head): +129 return doc +130 +131 body = _find_tag(doc, 'body') +132 +133 # The body has just one element, so it was probably a single +134 # element passed in +135 if (len(body) == 1 and (not body.text or not body.text.strip()) +136 and (not body[-1].tail or not body[-1].tail.strip())): +137 return body[0] +138 +139 # Now we have a body which represents a bunch of tags which have the +140 # content that was passed in. We will create a fake container, which +141 # is the body tag, except <body> implies too much structure. +142 if _contains_block_level_tag(body): +143 body.tag = 'div' +144 else: +145 body.tag = 'span' +146 return body +
147 +148 +
149 -def parse(filename_url_or_file, guess_charset=True, parser=None): +
150 """Parse a filename, URL, or file-like object into an HTML document +151 tree. Note: this returns a tree, not an element. Use +152 ``parse(...).getroot()`` to get the document root. +153 """ +154 if parser is None: +155 parser = html_parser +156 if isinstance(filename_url_or_file, basestring): +157 fp = urllib.urlopen(filename_url_or_file) +158 else: +159 fp = filename_url_or_file +160 return parser.parse(fp, useChardet=guess_charset) +
161 +162 +163 html_parser = HTMLParser() +164 xhtml_parser = XHTMLParser() +165 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.html5parser.HTMLParser-class.html b/doc/html/api/lxml.html.html5parser.HTMLParser-class.html new file mode 100644 index 0000000..9682e82 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser.HTMLParser-class.html @@ -0,0 +1,265 @@ + + + + + lxml.html.html5parser.HTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module html5parser :: + Class HTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HTMLParser

source code

+
+                     object --+    
+                              |    
+html5lib.html5parser.HTMLParser --+
+                                  |
+                                 HTMLParser
+
+ +
+An html5lib HTML parser with lxml as tree. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + strict=False)
+ strict - raise an exception when a parse error is encountered
+ source code + +
+ +
+

Inherited from html5lib.html5parser.HTMLParser: + normalizeToken, + normalizedTokens, + parse, + parseError, + parseFragment, + parseRCDataCData, + resetInsertionMode +

+

Inherited from html5lib.html5parser.HTMLParser (private): + _parse +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + strict=False) +
(Constructor) +

+
source code  +
+ +

strict - raise an exception when a parse error is encountered

+

tree - a treebuilder class controlling the type of tree that will be +returned. Built in treebuilders can be accessed through +html5lib.treebuilders.getTreeBuilder(treeType)

+

tokenizer - a class that provides a stream of tokens to the treebuilder. +This may be replaced for e.g. a sanitizer which converts some tags to +text

+
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.html5parser.XHTMLParser-class.html b/doc/html/api/lxml.html.html5parser.XHTMLParser-class.html new file mode 100644 index 0000000..b058c68 --- /dev/null +++ b/doc/html/api/lxml.html.html5parser.XHTMLParser-class.html @@ -0,0 +1,273 @@ + + + + + lxml.html.html5parser.XHTMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module html5parser :: + Class XHTMLParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XHTMLParser

source code

+
+                     object --+            
+                              |            
+html5lib.html5parser.HTMLParser --+        
+                                  |        
+html5lib.liberalxmlparser.XMLParser --+    
+                                      |    
+  html5lib.liberalxmlparser.XHTMLParser --+
+                                          |
+                                         XHTMLParser
+
+ +
+An html5lib XHTML Parser with lxml as tree. + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + strict=False)
+ strict - raise an exception when a parse error is encountered
+ source code + +
+ +
+

Inherited from html5lib.liberalxmlparser.XHTMLParser: + normalizeToken +

+

Inherited from html5lib.liberalxmlparser.XMLParser: + parseRCDataCData +

+

Inherited from html5lib.liberalxmlparser.XMLParser (private): + _parse +

+

Inherited from html5lib.html5parser.HTMLParser: + normalizedTokens, + parse, + parseError, + parseFragment, + resetInsertionMode +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + strict=False) +
(Constructor) +

+
source code  +
+ +

strict - raise an exception when a parse error is encountered

+

tree - a treebuilder class controlling the type of tree that will be +returned. Built in treebuilders can be accessed through +html5lib.treebuilders.getTreeBuilder(treeType)

+

tokenizer - a class that provides a stream of tokens to the treebuilder. +This may be replaced for e.g. a sanitizer which converts some tags to +text

+
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.soupparser-module.html b/doc/html/api/lxml.html.soupparser-module.html new file mode 100644 index 0000000..3144dae --- /dev/null +++ b/doc/html/api/lxml.html.soupparser-module.html @@ -0,0 +1,464 @@ + + + + + lxml.html.soupparser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module soupparser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module soupparser

source code

+External interface to the BeautifulSoup HTML parser. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
fromstring(data, + beautifulsoup=None, + makeelement=None, + **bsargs)
+ Parse a string of HTML data into an Element tree using the +BeautifulSoup parser.
+ source code + +
+ +
+   + + + + + + +
parse(file, + beautifulsoup=None, + makeelement=None, + **bsargs)
+ Parse a file into an ElemenTree using the BeautifulSoup parser.
+ source code + +
+ +
+   + + + + + + +
convert_tree(beautiful_soup_tree, + makeelement=None)
+ Convert a BeautifulSoup tree to a list of Element trees.
+ source code + +
+ +
+   + + + + + + +
_parse(source, + beautifulsoup, + makeelement, + **bsargs) + source code + +
+ +
+   + + + + + + +
_convert_tree(beautiful_soup_tree, + makeelement) + source code + +
+ +
+   + + + + + + +
_convert_children(parent, + beautiful_soup_tree, + makeelement) + source code + +
+ +
+   + + + + + + +
_append_text(parent, + element, + text) + source code + +
+ +
+   + + + + + + +
handle_entities(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
unescape(string) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __doc__ = """External interface to the BeautifulSoup HTML pars... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

fromstring(data, + beautifulsoup=None, + makeelement=None, + **bsargs) +

+
source code  +
+ +

Parse a string of HTML data into an Element tree using the +BeautifulSoup parser.

+

Returns the root <html> Element of the tree.

+

You can pass a different BeautifulSoup parser through the +beautifulsoup keyword, and a diffent Element factory function +through the makeelement keyword. By default, the standard +BeautifulSoup class and the default factory of lxml.html are +used.

+
+
+
+
+ +
+ +
+ + +
+

parse(file, + beautifulsoup=None, + makeelement=None, + **bsargs) +

+
source code  +
+ +

Parse a file into an ElemenTree using the BeautifulSoup parser.

+

You can pass a different BeautifulSoup parser through the +beautifulsoup keyword, and a diffent Element factory function +through the makeelement keyword. By default, the standard +BeautifulSoup class and the default factory of lxml.html are +used.

+
+
+
+
+ +
+ +
+ + +
+

convert_tree(beautiful_soup_tree, + makeelement=None) +

+
source code  +
+ +

Convert a BeautifulSoup tree to a list of Element trees.

+

Returns a list instead of a single root Element to support +HTML-like soup with more than one root element.

+

You can pass a different Element factory through the makeelement +keyword.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

__doc__

+ +
+
+
+
Value:
+
+"""External interface to the BeautifulSoup HTML parser.
+"""
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.soupparser-pysrc.html b/doc/html/api/lxml.html.soupparser-pysrc.html new file mode 100644 index 0000000..8b37b30 --- /dev/null +++ b/doc/html/api/lxml.html.soupparser-pysrc.html @@ -0,0 +1,355 @@ + + + + + lxml.html.soupparser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module soupparser + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.soupparser

+
+  1  __doc__ = """External interface to the BeautifulSoup HTML parser. 
+  2  """ 
+  3   
+  4  __all__ = ["fromstring", "parse", "convert_tree"] 
+  5   
+  6  from lxml import etree, html 
+  7  from BeautifulSoup import \ 
+  8       BeautifulSoup, Tag, Comment, ProcessingInstruction, NavigableString 
+  9   
+ 10   
+
11 -def fromstring(data, beautifulsoup=None, makeelement=None, **bsargs): +
12 """Parse a string of HTML data into an Element tree using the + 13 BeautifulSoup parser. + 14 + 15 Returns the root ``<html>`` Element of the tree. + 16 + 17 You can pass a different BeautifulSoup parser through the + 18 `beautifulsoup` keyword, and a diffent Element factory function + 19 through the `makeelement` keyword. By default, the standard + 20 ``BeautifulSoup`` class and the default factory of `lxml.html` are + 21 used. + 22 """ + 23 return _parse(data, beautifulsoup, makeelement, **bsargs) +
24 +
25 -def parse(file, beautifulsoup=None, makeelement=None, **bsargs): +
26 """Parse a file into an ElemenTree using the BeautifulSoup parser. + 27 + 28 You can pass a different BeautifulSoup parser through the + 29 `beautifulsoup` keyword, and a diffent Element factory function + 30 through the `makeelement` keyword. By default, the standard + 31 ``BeautifulSoup`` class and the default factory of `lxml.html` are + 32 used. + 33 """ + 34 if not hasattr(file, 'read'): + 35 file = open(file) + 36 root = _parse(file, beautifulsoup, makeelement, **bsargs) + 37 return etree.ElementTree(root) +
38 +
39 -def convert_tree(beautiful_soup_tree, makeelement=None): +
40 """Convert a BeautifulSoup tree to a list of Element trees. + 41 + 42 Returns a list instead of a single root Element to support + 43 HTML-like soup with more than one root element. + 44 + 45 You can pass a different Element factory through the `makeelement` + 46 keyword. + 47 """ + 48 if makeelement is None: + 49 makeelement = html.html_parser.makeelement + 50 root = _convert_tree(beautiful_soup_tree, makeelement) + 51 children = root.getchildren() + 52 for child in children: + 53 root.remove(child) + 54 return children +
55 + 56 + 57 # helpers + 58 +
59 -def _parse(source, beautifulsoup, makeelement, **bsargs): +
60 if beautifulsoup is None: + 61 beautifulsoup = BeautifulSoup + 62 if makeelement is None: + 63 makeelement = html.html_parser.makeelement + 64 if 'convertEntities' not in bsargs: + 65 bsargs['convertEntities'] = 'html' + 66 tree = beautifulsoup(source, **bsargs) + 67 root = _convert_tree(tree, makeelement) + 68 # from ET: wrap the document in a html root element, if necessary + 69 if len(root) == 1 and root[0].tag == "html": + 70 return root[0] + 71 root.tag = "html" + 72 return root +
73 +
74 -def _convert_tree(beautiful_soup_tree, makeelement): +
75 root = makeelement(beautiful_soup_tree.name, + 76 attrib=dict(beautiful_soup_tree.attrs)) + 77 _convert_children(root, beautiful_soup_tree, makeelement) + 78 return root +
79 +
80 -def _convert_children(parent, beautiful_soup_tree, makeelement): +
81 SubElement = etree.SubElement + 82 et_child = None + 83 for child in beautiful_soup_tree: + 84 if isinstance(child, Tag): + 85 et_child = SubElement(parent, child.name, attrib=dict( + 86 [(k, unescape(v)) for (k,v) in child.attrs])) + 87 _convert_children(et_child, child, makeelement) + 88 elif type(child) is NavigableString: + 89 _append_text(parent, et_child, unescape(child)) + 90 else: + 91 if isinstance(child, Comment): + 92 parent.append(etree.Comment(child)) + 93 elif isinstance(child, ProcessingInstruction): + 94 parent.append(etree.ProcessingInstruction( + 95 *child.split(' ', 1))) + 96 else: # CData + 97 _append_text(parent, et_child, unescape(child)) +
98 +
99 -def _append_text(parent, element, text): +
100 if element is None: +101 parent.text = (parent.text or '') + text +102 else: +103 element.tail = (element.tail or '') + text +
104 +105 +106 # copied from ET's ElementSoup +107 +108 from htmlentitydefs import name2codepoint +109 import re +110 +111 handle_entities = re.compile("&(\w+);").sub +112 +
113 -def unescape(string): +
114 if not string: +115 return '' +116 # work around oddities in BeautifulSoup's entity handling +117 def unescape_entity(m): +118 try: +119 return unichr(name2codepoint[m.group(1)]) +120 except KeyError: +121 return m.group(0) # use as is +
122 return handle_entities(unescape_entity, string) +123 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.usedoctest-module.html b/doc/html/api/lxml.html.usedoctest-module.html new file mode 100644 index 0000000..2cc6b97 --- /dev/null +++ b/doc/html/api/lxml.html.usedoctest-module.html @@ -0,0 +1,123 @@ + + + + + lxml.html.usedoctest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module usedoctest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module usedoctest

source code

+

Doctest module for HTML comparison.

+

Usage:

+
+>>> import lxml.html.usedoctest
+>>> # now do your HTML doctests ...
+
+

See lxml.doctestcompare.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.html.usedoctest-pysrc.html b/doc/html/api/lxml.html.usedoctest-pysrc.html new file mode 100644 index 0000000..46077ed --- /dev/null +++ b/doc/html/api/lxml.html.usedoctest-pysrc.html @@ -0,0 +1,138 @@ + + + + + lxml.html.usedoctest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package html :: + Module usedoctest + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.html.usedoctest

+
+ 1  """Doctest module for HTML comparison. 
+ 2   
+ 3  Usage:: 
+ 4   
+ 5     >>> import lxml.html.usedoctest 
+ 6     >>> # now do your HTML doctests ... 
+ 7   
+ 8  See `lxml.doctestcompare`. 
+ 9  """ 
+10   
+11  from lxml import doctestcompare 
+12   
+13  doctestcompare.temp_install(html=True, del_module=__name__) 
+14   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify-module.html b/doc/html/api/lxml.objectify-module.html new file mode 100644 index 0000000..81f49e1 --- /dev/null +++ b/doc/html/api/lxml.objectify-module.html @@ -0,0 +1,1125 @@ + + + + + lxml.objectify + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module objectify

+The lxml.objectify module implements a Python object API for +XML. It is based on lxml.etree. + +
+

Version: + 2.2.3-68552 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + BoolElement
+ Boolean type base on string values: 'true' or 'false'. +
+   + + ElementMaker
+ ElementMaker(self, namespace=None, nsmap=None, annotate=True, makeelement=None) +
+   + + FloatElement +
+   + + IntElement +
+   + + LongElement +
+   + + NoneElement +
+   + + NumberElement +
+   + + ObjectPath
+ ObjectPath(path) +Immutable object that represents a compiled object path. +
+   + + ObjectifiedDataElement
+ This is the base class for all data type Elements. +
+   + + ObjectifiedElement
+ Main XML Element class. +
+   + + ObjectifyElementClassLookup
+ ObjectifyElementClassLookup(self, tree_class=None, empty_data_class=None) +Element class lookup method that uses the objectify classes. +
+   + + PyType
+ PyType(self, name, type_check, type_class, stringify=None) +User defined type. +
+   + + StringElement
+ String data class. +
+   + + _ObjectifyElementMakerCaller +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
DataElement(_value, + attrib=None, + nsmap=None, + _pytype=None, + _xsi=None, + **_attributes)
+ Create a new element from a Python value and XML attributes taken from +keyword arguments or a dictionary passed as second argument.
+ + +
+ +
+   + + + + + + +
Element(_tag, + attrib=None, + nsmap=None, + _pytype=None, + **_attributes)
+ Objectify specific version of the lxml.etree Element() factory that +always creates a structural (tree) element.
+ + +
+ +
+   + + + + + + +
XML(xml, + parser=None, + base_url=None)
+ Objectify specific version of the lxml.etree XML() literal factory +that uses the objectify parser.
+ + +
+ +
+   + + + + + + +
__checkBool(...) + + +
+ +
+   + + + + + + +
__lower_bool(...) + + +
+ +
+   + + + + + + +
__parseBool(...) + + +
+ +
+   + + + + + + +
__unpickleElementTree(...) + + +
+ +
+   + + + + + + +
annotate(element_or_tree, + ignore_old=True, + ignore_xsi=False, + empty_pytype=None, + empty_type=None, + annotate_xsi=0, + annotate_pytype=1)
+ Recursively annotates the elements of an XML tree with 'xsi:type' +and/or 'py:pytype' attributes.
+ + +
+ +
+   + + + + + + +
deannotate(element_or_tree, + pytype=True, + xsi=True, + xsi_nil=False)
+ Recursively de-annotate the elements of an XML tree by removing 'py:pytype' +and/or 'xsi:type' attributes and/or 'xsi:nil' attributes.
+ + +
+ +
+   + + + + + + +
dump(...)
+ dump(_Element element not None)
+ + +
+ +
+   + + + + + + +
enable_recursive_str(on=True)
+ Enable a recursively generated tree representation for str(element), +based on objectify.dump(element).
+ + +
+ +
+   + + + + + + +
fromstring(xml, + parser=None, + base_url=None)
+ Objectify specific version of the lxml.etree fromstring() function +that uses the objectify parser.
+ + +
+ +
+   + + + + + + +
getRegisteredTypes()
+ Returns a list of the currently registered PyType objects.
+ + +
+ +
+   + + + + + + +
makeparser(remove_blank_text=True, + **kw)
+ Create a new XML parser for objectify trees.
+ + +
+ +
+   + + + + + + +
parse(f, + parser=None, + base_url=None)
+ Parse a file or file-like object with the objectify parser.
+ + +
+ +
+   + + + + + + +
pyannotate(element_or_tree, + ignore_old=False, + ignore_xsi=False, + empty_pytype=None)
+ Recursively annotates the elements of an XML tree with 'pytype' +attributes.
+ + +
+ +
+   + + + + + + +
pytypename(obj)
+ Find the name of the corresponding PyType for a Python object.
+ + +
+ +
+   + + + + + + +
set_default_parser(new_parser= None)
+ Replace the default parser used by objectify's Element() and +fromstring() functions.
+ + +
+ +
+   + + + + + + +
set_pytype_attribute_tag(attribute_tag=None)
+ Change name and namespace of the XML attribute that holds Python type +information.
+ + +
+ +
+   + + + + + + +
xsiannotate(element_or_tree, + ignore_old=False, + ignore_pytype=False, + empty_type=None)
+ Recursively annotates the elements of an XML tree with 'xsi:type' +attributes.
+ + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + E = <lxml.objectify.ElementMaker object at 0x8f71d4c> +
+   + + PYTYPE_ATTRIBUTE = '{http://codespeak.net/lxml/objectify/pytyp... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

DataElement(_value, + attrib=None, + nsmap=None, + _pytype=None, + _xsi=None, + **_attributes) +

+
  +
+ +

Create a new element from a Python value and XML attributes taken from +keyword arguments or a dictionary passed as second argument.

+

Automatically adds a 'pytype' attribute for the Python type of the value, +if the type can be identified. If '_pytype' or '_xsi' are among the +keyword arguments, they will be used instead.

+

If the _value argument is an ObjectifiedDataElement instance, its py:pytype, +xsi:type and other attributes and nsmap are reused unless they are redefined +in attrib and/or keyword arguments.

+
+
+
+
+ +
+ +
+ + +
+

Element(_tag, + attrib=None, + nsmap=None, + _pytype=None, + **_attributes) +

+
  +
+ +

Objectify specific version of the lxml.etree Element() factory that +always creates a structural (tree) element.

+

NOTE: requires parser based element class lookup activated in lxml.etree!

+
+
+
+
+ +
+ +
+ + +
+

XML(xml, + parser=None, + base_url=None) +

+
  +
+ +

Objectify specific version of the lxml.etree XML() literal factory +that uses the objectify parser.

+

You can pass a different parser as second argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+ +
+ +
+ + +
+

annotate(element_or_tree, + ignore_old=True, + ignore_xsi=False, + empty_pytype=None, + empty_type=None, + annotate_xsi=0, + annotate_pytype=1) +

+
  +
+ +

Recursively annotates the elements of an XML tree with 'xsi:type' +and/or 'py:pytype' attributes.

+

If the 'ignore_old' keyword argument is True (the default), current +'py:pytype' attributes will be ignored for the type annotation. Set to False +if you want reuse existing 'py:pytype' information (iff appropriate for the +element text value).

+

If the 'ignore_xsi' keyword argument is False (the default), existing +'xsi:type' attributes will be used for the type annotation, if they fit the +element text values.

+

Note that the mapping from Python types to XSI types is usually ambiguous. +Currently, only the first XSI type name in the corresponding PyType +definition will be used for annotation. Thus, you should consider naming +the widest type first if you define additional types.

+

The default 'py:pytype' annotation of empty elements can be set with the +empty_pytype keyword argument. Pass 'str', for example, to make +string values the default.

+

The default 'xsi:type' annotation of empty elements can be set with the +empty_type keyword argument. The default is not to annotate empty +elements. Pass 'string', for example, to make string values the default.

+

The keyword arguments 'annotate_xsi' (default: 0) and 'annotate_pytype' +(default: 1) control which kind(s) of annotation to use.

+
+
+
+
+ +
+ +
+ + +
+

deannotate(element_or_tree, + pytype=True, + xsi=True, + xsi_nil=False) +

+
  +
+ +

Recursively de-annotate the elements of an XML tree by removing 'py:pytype' +and/or 'xsi:type' attributes and/or 'xsi:nil' attributes.

+

If the 'pytype' keyword argument is True (the default), 'py:pytype' +attributes will be removed. If the 'xsi' keyword argument is True (the +default), 'xsi:type' attributes will be removed. +If the 'xsi_nil' keyword argument is True (default: False), 'xsi:nil' +attributes will be removed.

+

Note that this does not touch the namespace declarations. If you +want to remove unused namespace declarations from the tree, use +lxml.etree.cleanup_namespaces().

+
+
+
+
+ +
+ +
+ + +
+

dump(...) +

+
  +
+ +

dump(_Element element not None)

+

Return a recursively generated string representation of an element.

+
+
+
+
+ +
+ +
+ + +
+

fromstring(xml, + parser=None, + base_url=None) +

+
  +
+ +

Objectify specific version of the lxml.etree fromstring() function +that uses the objectify parser.

+

You can pass a different parser as second argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+ +
+ +
+ + +
+

getRegisteredTypes() +

+
  +
+ +

Returns a list of the currently registered PyType objects.

+

To add a new type, retrieve this list and call unregister() for all +entries. Then add the new type at a suitable position (possibly replacing +an existing one) and call register() for all entries.

+

This is necessary if the new type interferes with the type check functions +of existing ones (normally only int/float/bool) and must the tried before +other types. To add a type that is not yet parsable by the current type +check functions, you can simply register() it, which will append it to the +end of the type list.

+
+
+
+
+ +
+ +
+ + +
+

makeparser(remove_blank_text=True, + **kw) +

+
  +
+ +

Create a new XML parser for objectify trees.

+

You can pass all keyword arguments that are supported by +etree.XMLParser(). Note that this parser defaults to removing +blank text. You can disable this by passing the +remove_blank_text boolean keyword option yourself.

+
+
+
+
+ +
+ +
+ + +
+

parse(f, + parser=None, + base_url=None) +

+
  +
+ +

Parse a file or file-like object with the objectify parser.

+

You can pass a different parser as second argument.

+

The base_url keyword allows setting a URL for the document +when parsing from a file-like object. This is needed when looking +up external entities (DTD, XInclude, ...) with relative paths.

+
+
+
+
+ +
+ +
+ + +
+

pyannotate(element_or_tree, + ignore_old=False, + ignore_xsi=False, + empty_pytype=None) +

+
  +
+ +

Recursively annotates the elements of an XML tree with 'pytype' +attributes.

+

If the 'ignore_old' keyword argument is True (the default), current 'pytype' +attributes will be ignored and replaced. Otherwise, they will be checked +and only replaced if they no longer fit the current text value.

+

Setting the keyword argument ignore_xsi to True makes the function +additionally ignore existing xsi:type annotations. The default is to +use them as a type hint.

+

The default annotation of empty elements can be set with the +empty_pytype keyword argument. The default is not to annotate empty +elements. Pass 'str', for example, to make string values the default.

+
+
+
+
+ +
+ +
+ + +
+

set_default_parser(new_parser= None) +

+
  +
+ +

Replace the default parser used by objectify's Element() and +fromstring() functions.

+

The new parser must be an etree.XMLParser.

+

Call without arguments to reset to the original parser.

+
+
+
+
+ +
+ +
+ + +
+

set_pytype_attribute_tag(attribute_tag=None) +

+
  +
+ +

Change name and namespace of the XML attribute that holds Python type +information.

+

Do not use this unless you know what you are doing.

+

Reset by calling without argument.

+

Default: "{http://codespeak.net/lxml/objectify/pytype}pytype"

+
+
+
+
+ +
+ +
+ + +
+

xsiannotate(element_or_tree, + ignore_old=False, + ignore_pytype=False, + empty_type=None) +

+
  +
+ +

Recursively annotates the elements of an XML tree with 'xsi:type' +attributes.

+

If the 'ignore_old' keyword argument is True (the default), current +'xsi:type' attributes will be ignored and replaced. Otherwise, they will be +checked and only replaced if they no longer fit the current text value.

+

Note that the mapping from Python types to XSI types is usually ambiguous. +Currently, only the first XSI type name in the corresponding PyType +definition will be used for annotation. Thus, you should consider naming +the widest type first if you define additional types.

+

Setting the keyword argument ignore_pytype to True makes the function +additionally ignore existing pytype annotations. The default is to +use them as a type hint.

+

The default annotation of empty elements can be set with the +empty_type keyword argument. The default is not to annotate empty +elements. Pass 'string', for example, to make string values the default.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

PYTYPE_ATTRIBUTE

+ +
+
+
+
Value:
+
+'{http://codespeak.net/lxml/objectify/pytype}pytype'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.BoolElement-class.html b/doc/html/api/lxml.objectify.BoolElement-class.html new file mode 100644 index 0000000..b349a46 --- /dev/null +++ b/doc/html/api/lxml.objectify.BoolElement-class.html @@ -0,0 +1,782 @@ + + + + + lxml.objectify.BoolElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class BoolElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class BoolElement

+
+    object --+                        
+             |                        
+etree._Element --+                    
+                 |                    
+ etree.ElementBase --+                
+                     |                
+    ObjectifiedElement --+            
+                         |            
+    ObjectifiedDataElement --+        
+                             |        
+                 NumberElement --+    
+                                 |    
+                        IntElement --+
+                                     |
+                                    BoolElement
+
+ +
+

Boolean type base on string values: 'true' or 'false'.

+

Note that this inherits from IntElement to mimic the behaviour of +Python's bool type.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+   + + + + + + +
_init(self)
+ Called after object initialisation.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __float__, + __hex__, + __int__, + __invert__, + __long__, + __lshift__, + __mod__, + __mul__, + __neg__, + __oct__, + __or__, + __pos__, + __pow__, + __radd__, + __rand__, + __rdiv__, + __rlshift__, + __rmod__, + __rmul__, + __ror__, + __rpow__, + __rrshift__, + __rshift__, + __rsub__, + __rtruediv__, + __rxor__, + __sub__, + __truediv__, + __xor__ +

+

Inherited from NumberElement (private): + _setValueParser +

+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + pyval +
+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__eq__(x, + y) +
(Equality operator) +

+
  +
+ + x==y +
+
Overrides: + NumberElement.__eq__ +
+
+
+
+ +
+ +
+ + +
+

__ge__(x, + y) +
(Greater-than-or-equals operator) +

+
  +
+ + x>=y +
+
Overrides: + NumberElement.__ge__ +
+
+
+
+ +
+ +
+ + +
+

__gt__(x, + y) +
(Greater-than operator) +

+
  +
+ + x>y +
+
Overrides: + NumberElement.__gt__ +
+
+
+
+ +
+ +
+ + +
+

__le__(x, + y) +
(Less-than-or-equals operator) +

+
  +
+ + x<=y +
+
Overrides: + NumberElement.__le__ +
+
+
+
+ +
+ +
+ + +
+

__lt__(x, + y) +
(Less-than operator) +

+
  +
+ + x<y +
+
Overrides: + NumberElement.__lt__ +
+
+
+
+ +
+ +
+ + +
+

__ne__(x, + y) +

+
  +
+ + x!=y +
+
Overrides: + NumberElement.__ne__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

_init(self) +

+
  +
+ + Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses. +
+
Overrides: + etree._Element._init +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.ElementMaker-class.html b/doc/html/api/lxml.objectify.ElementMaker-class.html new file mode 100644 index 0000000..0409daf --- /dev/null +++ b/doc/html/api/lxml.objectify.ElementMaker-class.html @@ -0,0 +1,356 @@ + + + + + lxml.objectify.ElementMaker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class ElementMaker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementMaker

+
+object --+
+         |
+        ElementMaker
+
+ +
+

ElementMaker(self, namespace=None, nsmap=None, annotate=True, makeelement=None)

+

An ElementMaker that can be used for constructing trees.

+

Example:

+
+>>> M = ElementMaker(annotate=False)
+>>> html = M.html( M.body( M.p('hello', M.br, 'objectify') ) )
+
+>>> from lxml.etree import tostring
+>>> print(tostring(html, method='html').decode('ASCII'))
+<html><body><p>hello<br>objectify</p></body></html>
+
+

Note that this module has a predefined ElementMaker instance called E.

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__getattr__(...) + + +
+ +
+   + + + + + + +
__getattribute__(...)
+ x.__getattribute__('name') <==> x.name
+ + +
+ +
+   + + + + + + +
__init__(self, + namespace=None, + nsmap=None, + annotate=True, + makeelement=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__getattribute__(...) +

+
  +
+ + x.__getattribute__('name') <==> x.name +
+
Overrides: + object.__getattribute__ +
+
+
+
+ +
+ +
+ + +
+

__init__(self, + namespace=None, + nsmap=None, + annotate=True, + makeelement=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.FloatElement-class.html b/doc/html/api/lxml.objectify.FloatElement-class.html new file mode 100644 index 0000000..fa6681b --- /dev/null +++ b/doc/html/api/lxml.objectify.FloatElement-class.html @@ -0,0 +1,408 @@ + + + + + lxml.objectify.FloatElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class FloatElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class FloatElement

+
+    object --+                    
+             |                    
+etree._Element --+                
+                 |                
+ etree.ElementBase --+            
+                     |            
+    ObjectifiedElement --+        
+                         |        
+    ObjectifiedDataElement --+    
+                             |    
+                 NumberElement --+
+                                 |
+                                FloatElement
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_init(self)
+ Called after object initialisation.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __eq__, + __float__, + __ge__, + __gt__, + __hex__, + __int__, + __invert__, + __le__, + __long__, + __lshift__, + __lt__, + __mod__, + __mul__, + __ne__, + __neg__, + __nonzero__, + __oct__, + __or__, + __pos__, + __pow__, + __radd__, + __rand__, + __rdiv__, + __repr__, + __rlshift__, + __rmod__, + __rmul__, + __ror__, + __rpow__, + __rrshift__, + __rshift__, + __rsub__, + __rtruediv__, + __rxor__, + __str__, + __sub__, + __truediv__, + __xor__ +

+

Inherited from NumberElement (private): + _setValueParser +

+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from NumberElement: + pyval +

+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

_init(self) +

+
  +
+ + Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses. +
+
Overrides: + etree._Element._init +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.IntElement-class.html b/doc/html/api/lxml.objectify.IntElement-class.html new file mode 100644 index 0000000..8814142 --- /dev/null +++ b/doc/html/api/lxml.objectify.IntElement-class.html @@ -0,0 +1,414 @@ + + + + + lxml.objectify.IntElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class IntElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class IntElement

+
+    object --+                    
+             |                    
+etree._Element --+                
+                 |                
+ etree.ElementBase --+            
+                     |            
+    ObjectifiedElement --+        
+                         |        
+    ObjectifiedDataElement --+    
+                             |    
+                 NumberElement --+
+                                 |
+                                IntElement
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_init(self)
+ Called after object initialisation.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __eq__, + __float__, + __ge__, + __gt__, + __hex__, + __int__, + __invert__, + __le__, + __long__, + __lshift__, + __lt__, + __mod__, + __mul__, + __ne__, + __neg__, + __nonzero__, + __oct__, + __or__, + __pos__, + __pow__, + __radd__, + __rand__, + __rdiv__, + __repr__, + __rlshift__, + __rmod__, + __rmul__, + __ror__, + __rpow__, + __rrshift__, + __rshift__, + __rsub__, + __rtruediv__, + __rxor__, + __str__, + __sub__, + __truediv__, + __xor__ +

+

Inherited from NumberElement (private): + _setValueParser +

+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from NumberElement: + pyval +

+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

_init(self) +

+
  +
+ + Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses. +
+
Overrides: + etree._Element._init +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.LongElement-class.html b/doc/html/api/lxml.objectify.LongElement-class.html new file mode 100644 index 0000000..3b6f865 --- /dev/null +++ b/doc/html/api/lxml.objectify.LongElement-class.html @@ -0,0 +1,408 @@ + + + + + lxml.objectify.LongElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class LongElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LongElement

+
+    object --+                    
+             |                    
+etree._Element --+                
+                 |                
+ etree.ElementBase --+            
+                     |            
+    ObjectifiedElement --+        
+                         |        
+    ObjectifiedDataElement --+    
+                             |    
+                 NumberElement --+
+                                 |
+                                LongElement
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
_init(self)
+ Called after object initialisation.
+ + +
+ +
+

Inherited from NumberElement: + __abs__, + __add__, + __and__, + __complex__, + __div__, + __eq__, + __float__, + __ge__, + __gt__, + __hex__, + __int__, + __invert__, + __le__, + __long__, + __lshift__, + __lt__, + __mod__, + __mul__, + __ne__, + __neg__, + __nonzero__, + __oct__, + __or__, + __pos__, + __pow__, + __radd__, + __rand__, + __rdiv__, + __repr__, + __rlshift__, + __rmod__, + __rmul__, + __ror__, + __rpow__, + __rrshift__, + __rshift__, + __rsub__, + __rtruediv__, + __rxor__, + __str__, + __sub__, + __truediv__, + __xor__ +

+

Inherited from NumberElement (private): + _setValueParser +

+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from NumberElement: + pyval +

+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

_init(self) +

+
  +
+ + Called after object initialisation. Custom subclasses may override +this if they recursively call _init() in the superclasses. +
+
Overrides: + etree._Element._init +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.NoneElement-class.html b/doc/html/api/lxml.objectify.NoneElement-class.html new file mode 100644 index 0000000..9000d19 --- /dev/null +++ b/doc/html/api/lxml.objectify.NoneElement-class.html @@ -0,0 +1,554 @@ + + + + + lxml.objectify.NoneElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class NoneElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class NoneElement

+
+    object --+                
+             |                
+etree._Element --+            
+                 |            
+ etree.ElementBase --+        
+                     |        
+    ObjectifiedElement --+    
+                         |    
+    ObjectifiedDataElement --+
+                             |
+                            NoneElement
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + pyval +
+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.NumberElement-class.html b/doc/html/api/lxml.objectify.NumberElement-class.html new file mode 100644 index 0000000..7e0a29e --- /dev/null +++ b/doc/html/api/lxml.objectify.NumberElement-class.html @@ -0,0 +1,1169 @@ + + + + + lxml.objectify.NumberElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class NumberElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class NumberElement

+
+    object --+                
+             |                
+etree._Element --+            
+                 |            
+ etree.ElementBase --+        
+                     |        
+    ObjectifiedElement --+    
+                         |    
+    ObjectifiedDataElement --+
+                             |
+                            NumberElement
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__abs__(...) + + +
+ +
+   + + + + + + +
__add__(...) + + +
+ +
+   + + + + + + +
__and__(...) + + +
+ +
+   + + + + + + +
__complex__(...) + + +
+ +
+   + + + + + + +
__div__(...) + + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__float__(...) + + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__hex__(...) + + +
+ +
+   + + + + + + +
__int__(...) + + +
+ +
+   + + + + + + +
__invert__(...) + + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__long__(...) + + +
+ +
+   + + + + + + +
__lshift__(...) + + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__mod__(...) + + +
+ +
+   + + + + + + +
__mul__(...) + + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+   + + + + + + +
__neg__(...) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__oct__(...) + + +
+ +
+   + + + + + + +
__or__(...) + + +
+ +
+   + + + + + + +
__pos__(...) + + +
+ +
+   + + + + + + +
__pow__(x, + y, + z=...)
+ pow(x, y[, z])
+ + +
+ +
+   + + + + + + +
__radd__(x, + y)
+ y+x
+ + +
+ +
+   + + + + + + +
__rand__(x, + y)
+ y&x
+ + +
+ +
+   + + + + + + +
__rdiv__(x, + y)
+ y/x
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__rlshift__(x, + y)
+ y<<x
+ + +
+ +
+   + + + + + + +
__rmod__(x, + y)
+ y%x
+ + +
+ +
+   + + + + + + +
__rmul__(x, + y)
+ y*x
+ + +
+ +
+   + + + + + + +
__ror__(x, + y)
+ y|x
+ + +
+ +
+   + + + + + + +
__rpow__(y, + x, + z=...)
+ pow(x, y[, z])
+ + +
+ +
+   + + + + + + +
__rrshift__(x, + y)
+ y>>x
+ + +
+ +
+   + + + + + + +
__rshift__(...) + + +
+ +
+   + + + + + + +
__rsub__(x, + y)
+ y-x
+ + +
+ +
+   + + + + + + +
__rtruediv__(x, + y)
+ y/x
+ + +
+ +
+   + + + + + + +
__rxor__(x, + y)
+ y^x
+ + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+   + + + + + + +
__sub__(...) + + +
+ +
+   + + + + + + +
__truediv__(...) + + +
+ +
+   + + + + + + +
__xor__(...) + + +
+ +
+   + + + + + + +
_setValueParser(...)
+ Set the function that parses the Python value from a string.
+ + +
+ +
+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + pyval +
+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

_setValueParser(...) +

+
  +
+ +

Set the function that parses the Python value from a string.

+

Do not use this unless you know what you are doing.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.ObjectPath-class.html b/doc/html/api/lxml.objectify.ObjectPath-class.html new file mode 100644 index 0000000..7d57200 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectPath-class.html @@ -0,0 +1,472 @@ + + + + + lxml.objectify.ObjectPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class ObjectPath + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ObjectPath

+
+object --+
+         |
+        ObjectPath
+
+ +
+

ObjectPath(path) +Immutable object that represents a compiled object path.

+

Example for a path: 'root.child[1].{other}child[25]'

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(...)
+ Follow the attribute path in the object structure and return the +target attribute value.
+ + +
+ +
+   + + + + + + +
__init__(path)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+   + + + + + + +
addattr(self, + root, + value)
+ Append a value to the target element in a subtree.
+ + +
+ +
+   + + + + + + +
hasattr(self, + root) + + +
+ +
+   + + + + + + +
setattr(self, + root, + value)
+ Set the value of the target element in a subtree.
+ + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + find +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__call__(...) +
(Call operator) +

+
  +
+ +

Follow the attribute path in the object structure and return the +target attribute value.

+

If it it not found, either returns a default value (if one was passed +as second argument) or raises AttributeError.

+
+
+
+
+ +
+ +
+ + +
+

__init__(path) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

addattr(self, + root, + value) +

+
  +
+ +

Append a value to the target element in a subtree.

+

If any of the children on the path does not exist, it is created.

+
+
+
+
+ +
+ +
+ + +
+

setattr(self, + root, + value) +

+
  +
+ +

Set the value of the target element in a subtree.

+

If any of the children on the path does not exist, it is created.

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.ObjectifiedDataElement-class.html b/doc/html/api/lxml.objectify.ObjectifiedDataElement-class.html new file mode 100644 index 0000000..33a35e0 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectifiedDataElement-class.html @@ -0,0 +1,448 @@ + + + + + lxml.objectify.ObjectifiedDataElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class ObjectifiedDataElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ObjectifiedDataElement

+
+    object --+            
+             |            
+etree._Element --+        
+                 |        
+ etree.ElementBase --+    
+                     |    
+    ObjectifiedElement --+
+                         |
+                        ObjectifiedDataElement
+
+ +
Known Subclasses:
+
+ +
+ +
+This is the base class for all data type Elements. Subclasses should +override the 'pyval' property and possibly the __str__ method. + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+   + + + + + + +
_setText(...)
+ For use in subclasses only.
+ + +
+ +
+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __nonzero__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + pyval +
+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

_setText(...) +

+
  +
+ + For use in subclasses only. Don't use unless you know what you are +doing. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.ObjectifiedElement-class.html b/doc/html/api/lxml.objectify.ObjectifiedElement-class.html new file mode 100644 index 0000000..be57be4 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectifiedElement-class.html @@ -0,0 +1,1008 @@ + + + + + lxml.objectify.ObjectifiedElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class ObjectifiedElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ObjectifiedElement

+
+    object --+        
+             |        
+etree._Element --+    
+                 |    
+ etree.ElementBase --+
+                     |
+                    ObjectifiedElement
+
+ +
Known Subclasses:
+
+ +
+ +
+

Main XML Element class.

+

Element children are accessed as object attributes. Multiple children +with the same name are available through a list index. Example:

+
+>>> root = XML("<root><c1><c2>0</c2><c2>1</c2></c1></root>")
+>>> second_c2 = root.c1.c2[1]
+>>> print(second_c2.text)
+1
+
+

Note that you cannot (and must not) instantiate this class or its +subclasses.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__delattr__(...)
+ x.__delattr__('name') <==> del x.name
+ + +
+ +
+   + + + + + + +
__delitem__(x, + y)
+ del x[y]
+ + +
+ +
+   + + + + + + +
__getattr__(...)
+ Return the (first) child with the given tag name.
+ + +
+ +
+   + + + + + + +
__getattribute__(...)
+ x.__getattribute__('name') <==> x.name
+ + +
+ +
+   + + + + + + +
__getitem__(...)
+ Return a sibling, counting from the first child of the parent.
+ + +
+ +
+   + + + + + + +
__iter__(self)
+ Iterate over self and all siblings with the same tag.
+ + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__setattr__(...)
+ x.__setattr__('name', value) <==> x.name = value
+ + +
+ +
+   + + + + + + +
__setitem__(x, + i, + y)
+ x[i]=y
+ + +
+ +
+   + + + + + + +
__str__(...)
+ str(x)
+ + +
+ +
+   + + + + + + +
addattr(self, + tag, + value)
+ Add a child value to the element.
+ + +
+ +
+   + + + + + + +
countchildren(self)
+ Return the number of children of this element, regardless of their +name.
+ + +
+ +
+   + + + + + + +
descendantpaths(self, + prefix=None)
+ Returns a list of object path expressions for all descendants.
+ + +
+ +
+   + + + + + + +
find(self, + path)
+ Finds the first matching subelement, by tag name or path.
+ + +
+ +
+   + + + + + + +
findall(self, + path)
+ Finds all matching subelements, by tag name or path.
+ + +
+ +
+   + + + + + + +
findtext(self, + path, + default=None)
+ Finds text for the first matching subelement, by tag name or path.
+ + +
+ +
+   + + + + + + +
getchildren(self)
+ Returns a sequence of all direct children.
+ + +
+ +
+   + + + + + + +
iterfind(self, + path)
+ Iterates over all matching subelements, by tag name or path.
+ + +
+ +
+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __nonzero__, + __repr__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + text
+ Text before the first subelement. +
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__delattr__(...) +

+
  +
+ + x.__delattr__('name') <==> del x.name +
+
Overrides: + object.__delattr__ +
+
+
+
+ +
+ +
+ + +
+

__delitem__(x, + y) +
(Index deletion operator) +

+
  +
+ + del x[y] +
+
Overrides: + etree._Element.__delitem__ +
+
+
+
+ +
+ +
+ + +
+

__getattr__(...) +
(Qualification operator) +

+
  +
+ + Return the (first) child with the given tag name. If no namespace +is provided, the child will be looked up in the same one as self. +
+
+
+
+ +
+ +
+ + +
+

__getattribute__(...) +

+
  +
+ + x.__getattribute__('name') <==> x.name +
+
Overrides: + object.__getattribute__ +
+
+
+
+ +
+ +
+ + +
+

__getitem__(...) +
(Indexing operator) +

+
  +
+ +

Return a sibling, counting from the first child of the parent. The +method behaves like both a dict and a sequence.

+
    +
  • If argument is an integer, returns the sibling at that position.
  • +
  • If argument is a string, does the same as getattr(). This can be +used to provide namespaces for element lookup, or to look up +children with special names (text etc.).
  • +
  • If argument is a slice object, returns the matching slice.
  • +
+
+
Overrides: + etree._Element.__getitem__ +
+
+
+
+ +
+ +
+ + +
+

__iter__(self) +

+
  +
+ + Iterate over self and all siblings with the same tag. +
+
Overrides: + etree._Element.__iter__ +
+
+
+
+ +
+ +
+ + +
+

__len__(x) +
(Length operator) +

+
  +
+ + len(x) +
+
Overrides: + etree._Element.__len__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__setattr__(...) +

+
  +
+ + x.__setattr__('name', value) <==> x.name = value +
+
Overrides: + object.__setattr__ +
+
+
+
+ +
+ +
+ + +
+

__setitem__(x, + i, + y) +
(Index assignment operator) +

+
  +
+ + x[i]=y +
+
Overrides: + etree._Element.__setitem__ +
+
+
+
+ +
+ +
+ + +
+

__str__(...) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

addattr(self, + tag, + value) +

+
  +
+ +

Add a child value to the element.

+

As opposed to append(), it sets a data value, not an element.

+
+
+
+
+ +
+ +
+ + +
+

find(self, + path) +

+
  +
+ + Finds the first matching subelement, by tag name or path. +
+
Overrides: + etree._Element.find +
+
+
+
+ +
+ +
+ + +
+

findall(self, + path) +

+
  +
+ + Finds all matching subelements, by tag name or path. +
+
Overrides: + etree._Element.findall +
+
+
+
+ +
+ +
+ + +
+

findtext(self, + path, + default=None) +

+
  +
+ + Finds text for the first matching subelement, by tag name or path. +
+
Overrides: + etree._Element.findtext +
+
+
+
+ +
+ +
+ + +
+

getchildren(self) +

+
  +
+ + Returns a sequence of all direct children. The elements are +returned in document order. +
+
Overrides: + etree._Element.getchildren +
+
+
+
+ +
+ +
+ + +
+

iterfind(self, + path) +

+
  +
+ + Iterates over all matching subelements, by tag name or path. +
+
Overrides: + etree._Element.iterfind +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.ObjectifyElementClassLookup-class.html b/doc/html/api/lxml.objectify.ObjectifyElementClassLookup-class.html new file mode 100644 index 0000000..ba19c49 --- /dev/null +++ b/doc/html/api/lxml.objectify.ObjectifyElementClassLookup-class.html @@ -0,0 +1,290 @@ + + + + + lxml.objectify.ObjectifyElementClassLookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class ObjectifyElementClassLookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ObjectifyElementClassLookup

+
+              object --+    
+                       |    
+etree.ElementClassLookup --+
+                           |
+                          ObjectifyElementClassLookup
+
+ +
+ObjectifyElementClassLookup(self, tree_class=None, empty_data_class=None) +Element class lookup method that uses the objectify classes. + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + tree_class=None, + empty_data_class=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + tree_class=None, + empty_data_class=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.PyType-class.html b/doc/html/api/lxml.objectify.PyType-class.html new file mode 100644 index 0000000..0a80475 --- /dev/null +++ b/doc/html/api/lxml.objectify.PyType-class.html @@ -0,0 +1,463 @@ + + + + + lxml.objectify.PyType + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class PyType + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class PyType

+
+object --+
+         |
+        PyType
+
+ +
+

PyType(self, name, type_check, type_class, stringify=None) +User defined type.

+

Named type that contains a type check function and a type class that +inherits from ObjectifiedDataElement. The type check must take a string +as argument and raise ValueError or TypeError if it cannot handle the +string value. It may be None in which case it is not considered for type +guessing.

+

Example:

+
+PyType('int', int, MyIntClass).register()
+
+

Note that the order in which types are registered matters. The first +matching type will be used.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + name, + type_check, + type_class, + stringify=None)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(...)
+ repr(x)
+ + +
+ +
+   + + + + + + +
register(self, + before=None, + after=None)
+ Register the type.
+ + +
+ +
+   + + + + + + +
unregister(self) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + name +
+   + + stringify +
+   + + type_check +
+   + + xmlSchemaTypes
+ The list of XML Schema datatypes this Python type maps to. +
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + name, + type_check, + type_class, + stringify=None) +
(Constructor) +

+
  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(...) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

register(self, + before=None, + after=None) +

+
  +
+ +

Register the type.

+

The additional keyword arguments 'before' and 'after' accept a +sequence of type names that must appear before/after the new type in +the type list. If any of them is not currently known, it is simply +ignored. Raises ValueError if the dependencies cannot be fulfilled.

+
+
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

xmlSchemaTypes

+

The list of XML Schema datatypes this Python type maps to.

+

Note that this must be set before registering the type!

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify.StringElement-class.html b/doc/html/api/lxml.objectify.StringElement-class.html new file mode 100644 index 0000000..ee823ab --- /dev/null +++ b/doc/html/api/lxml.objectify.StringElement-class.html @@ -0,0 +1,703 @@ + + + + + lxml.objectify.StringElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class StringElement + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class StringElement

+
+    object --+                
+             |                
+etree._Element --+            
+                 |            
+ etree.ElementBase --+        
+                     |        
+    ObjectifiedElement --+    
+                         |    
+    ObjectifiedDataElement --+
+                             |
+                            StringElement
+
+ +
+

String data class.

+

Note that this class does not support the sequence protocol of strings: +len(), iter(), str_attr[0], str_attr[0:1], etc. are not supported. +Instead, use the .text attribute to get a 'real' string.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__add__(...) + + +
+ +
+   + + + + + + +
__complex__(...) + + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__float__(...) + + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__int__(...) + + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__long__(...) + + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__mod__(...) + + +
+ +
+   + + + + + + +
__mul__(...) + + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__nonzero__(x)
+ x != 0
+ + +
+ +
+   + + + + + + +
__radd__(x, + y)
+ y+x
+ + +
+ +
+   + + + + + + +
__repr__(self)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__rmod__(x, + y)
+ y%x
+ + +
+ +
+   + + + + + + +
__rmul__(x, + y)
+ y*x
+ + +
+ +
+   + + + + + + +
strlen(...) + + +
+ +
+

Inherited from ObjectifiedDataElement: + __str__ +

+

Inherited from ObjectifiedDataElement (private): + _setText +

+

Inherited from ObjectifiedElement: + __delattr__, + __delitem__, + __getattr__, + __getattribute__, + __getitem__, + __iter__, + __len__, + __setattr__, + __setitem__, + addattr, + countchildren, + descendantpaths, + find, + findall, + findtext, + getchildren, + iterfind +

+

Inherited from etree.ElementBase: + __init__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __reversed__, + addnext, + addprevious, + append, + clear, + extend, + get, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __hash__, + __reduce__, + __reduce_ex__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + pyval +
+

Inherited from ObjectifiedElement: + text +

+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail +

+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__nonzero__(x) +
(Boolean test operator) +

+
  +
+ + x != 0 +
+
Overrides: + etree._Element.__nonzero__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(self) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.objectify._ObjectifyElementMakerCaller-class.html b/doc/html/api/lxml.objectify._ObjectifyElementMakerCaller-class.html new file mode 100644 index 0000000..73d3826 --- /dev/null +++ b/doc/html/api/lxml.objectify._ObjectifyElementMakerCaller-class.html @@ -0,0 +1,260 @@ + + + + + lxml.objectify._ObjectifyElementMakerCaller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module objectify :: + Class _ObjectifyElementMakerCaller + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class _ObjectifyElementMakerCaller

+
+object --+
+         |
+        _ObjectifyElementMakerCaller
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__call__(self, + *children, + **attrib) + + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __init__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.pyclasslookup-module.html b/doc/html/api/lxml.pyclasslookup-module.html new file mode 100644 index 0000000..a216939 --- /dev/null +++ b/doc/html/api/lxml.pyclasslookup-module.html @@ -0,0 +1,114 @@ + + + + + lxml.pyclasslookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module pyclasslookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module pyclasslookup

source code

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.pyclasslookup-pysrc.html b/doc/html/api/lxml.pyclasslookup-pysrc.html new file mode 100644 index 0000000..28d3633 --- /dev/null +++ b/doc/html/api/lxml.pyclasslookup-pysrc.html @@ -0,0 +1,128 @@ + + + + + lxml.pyclasslookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module pyclasslookup + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.pyclasslookup

+
+1  # dummy module for backwards compatibility 
+2   
+3  from etree import PythonElementClassLookup 
+4   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.sax-module.html b/doc/html/api/lxml.sax-module.html new file mode 100644 index 0000000..04cf7bd --- /dev/null +++ b/doc/html/api/lxml.sax-module.html @@ -0,0 +1,216 @@ + + + + + lxml.sax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module sax + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module sax

source code

+

SAX-based adapter to copy trees from/to the Python standard library.

+

Use the ElementTreeContentHandler class to build an ElementTree from +SAX events.

+

Use the ElementTreeProducer class or the saxify() function to fire +the SAX events of an ElementTree against a SAX ContentHandler.

+

See http://codespeak.net/lxml/sax.html

+ + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + SaxError
+ General SAX error. +
+   + + ElementTreeContentHandler
+ Build an lxml ElementTree from SAX events. +
+   + + ElementTreeProducer
+ Produces SAX events for an element and children. +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
_getNsTag(tag) + source code + +
+ +
+   + + + + + + +
saxify(element_or_tree, + content_handler)
+ One-shot helper to generate SAX events from an XML tree and fire +them against a SAX ContentHandler.
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.sax-pysrc.html b/doc/html/api/lxml.sax-pysrc.html new file mode 100644 index 0000000..72d8d3f --- /dev/null +++ b/doc/html/api/lxml.sax-pysrc.html @@ -0,0 +1,583 @@ + + + + + lxml.sax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module sax + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.sax

+
+  1  """ 
+  2  SAX-based adapter to copy trees from/to the Python standard library. 
+  3   
+  4  Use the `ElementTreeContentHandler` class to build an ElementTree from 
+  5  SAX events. 
+  6   
+  7  Use the `ElementTreeProducer` class or the `saxify()` function to fire 
+  8  the SAX events of an ElementTree against a SAX ContentHandler. 
+  9   
+ 10  See http://codespeak.net/lxml/sax.html 
+ 11  """ 
+ 12   
+ 13  from xml.sax.handler import ContentHandler 
+ 14  from lxml import etree 
+ 15  from lxml.etree import ElementTree, SubElement 
+ 16  from lxml.etree import Comment, ProcessingInstruction 
+ 17   
+
18 -class SaxError(etree.LxmlError): +
19 """General SAX error. + 20 """ + 21 pass +
22 +
23 -def _getNsTag(tag): +
24 if tag[0] == '{': + 25 return tuple(tag[1:].split('}', 1)) + 26 else: + 27 return (None, tag) +
28 +
29 -class ElementTreeContentHandler(ContentHandler): +
30 """Build an lxml ElementTree from SAX events. + 31 """ +
32 - def __init__(self, makeelement=None): +
33 self._root = None + 34 self._root_siblings = [] + 35 self._element_stack = [] + 36 self._default_ns = None + 37 self._ns_mapping = { None : [None] } + 38 self._new_mappings = {} + 39 if makeelement is None: + 40 makeelement = etree.Element + 41 self._makeelement = makeelement +
42 +
43 - def _get_etree(self): +
44 "Contains the generated ElementTree after parsing is finished." + 45 return ElementTree(self._root) +
46 + 47 etree = property(_get_etree, doc=_get_etree.__doc__) + 48 +
49 - def setDocumentLocator(self, locator): +
50 pass +
51 +
52 - def startDocument(self): +
53 pass +
54 +
55 - def endDocument(self): +
56 pass +
57 +
58 - def startPrefixMapping(self, prefix, uri): +
59 self._new_mappings[prefix] = uri + 60 try: + 61 self._ns_mapping[prefix].append(uri) + 62 except KeyError: + 63 self._ns_mapping[prefix] = [uri] + 64 if prefix is None: + 65 self._default_ns = uri +
66 +
67 - def endPrefixMapping(self, prefix): +
68 ns_uri_list = self._ns_mapping[prefix] + 69 ns_uri_list.pop() + 70 if prefix is None: + 71 self._default_ns = ns_uri_list[-1] +
72 +
73 - def startElementNS(self, ns_name, qname, attributes=None): +
74 ns_uri, local_name = ns_name + 75 if ns_uri: + 76 el_name = "{%s}%s" % ns_name + 77 elif self._default_ns: + 78 el_name = "{%s}%s" % (self._default_ns, local_name) + 79 else: + 80 el_name = local_name + 81 + 82 if attributes: + 83 attrs = {} + 84 try: + 85 iter_attributes = attributes.iteritems() + 86 except AttributeError: + 87 iter_attributes = attributes.items() + 88 + 89 for name_tuple, value in iter_attributes: + 90 if name_tuple[0]: + 91 attr_name = "{%s}%s" % name_tuple + 92 else: + 93 attr_name = name_tuple[1] + 94 attrs[attr_name] = value + 95 else: + 96 attrs = None + 97 + 98 element_stack = self._element_stack + 99 if self._root is None: +100 element = self._root = \ +101 self._makeelement(el_name, attrs, self._new_mappings) +102 if self._root_siblings and hasattr(element, 'addprevious'): +103 for sibling in self._root_siblings: +104 element.addprevious(sibling) +105 del self._root_siblings[:] +106 else: +107 element = SubElement(element_stack[-1], el_name, +108 attrs, self._new_mappings) +109 element_stack.append(element) +110 +111 self._new_mappings.clear() +
112 +
113 - def processingInstruction(self, target, data): +
114 pi = ProcessingInstruction(target, data) +115 if self._root is None: +116 self._root_siblings.append(pi) +117 else: +118 self._element_stack[-1].append(pi) +
119 +
120 - def endElementNS(self, ns_name, qname): +
121 element = self._element_stack.pop() +122 if ns_name != _getNsTag(element.tag): +123 raise SaxError("Unexpected element closed: {%s}%s" % ns_name) +
124 +
125 - def startElement(self, name, attributes=None): +
126 self.startElementNS((None, name), name, attributes) +
127 +
128 - def endElement(self, name): +
129 self.endElementNS((None, name), name) +
130 +
131 - def characters(self, data): +
132 last_element = self._element_stack[-1] +133 try: +134 # if there already is a child element, we must append to its tail +135 last_element = last_element[-1] +136 last_element.tail = (last_element.tail or '') + data +137 except IndexError: +138 # otherwise: append to the text +139 last_element.text = (last_element.text or '') + data +
140 +141 ignorableWhitespace = characters +
142 +143 +
144 -class ElementTreeProducer(object): +
145 """Produces SAX events for an element and children. +146 """ +
147 - def __init__(self, element_or_tree, content_handler): +
148 try: +149 element = element_or_tree.getroot() +150 except AttributeError: +151 element = element_or_tree +152 self._element = element +153 self._content_handler = content_handler +154 from xml.sax.xmlreader import AttributesNSImpl as attr_class +155 self._attr_class = attr_class +156 self._empty_attributes = attr_class({}, {}) +
157 +
158 - def saxify(self): +
159 self._content_handler.startDocument() +160 +161 element = self._element +162 if hasattr(element, 'getprevious'): +163 siblings = [] +164 sibling = element.getprevious() +165 while getattr(sibling, 'tag', None) is ProcessingInstruction: +166 siblings.append(sibling) +167 sibling = sibling.getprevious() +168 for sibling in siblings[::-1]: +169 self._recursive_saxify(sibling, {}) +170 +171 self._recursive_saxify(element, {}) +172 +173 if hasattr(element, 'getnext'): +174 sibling = element.getnext() +175 while getattr(sibling, 'tag', None) is ProcessingInstruction: +176 self._recursive_saxify(sibling, {}) +177 sibling = sibling.getnext() +178 +179 self._content_handler.endDocument() +
180 +
181 - def _recursive_saxify(self, element, prefixes): +
182 content_handler = self._content_handler +183 tag = element.tag +184 if tag is Comment or tag is ProcessingInstruction: +185 if tag is ProcessingInstruction: +186 content_handler.processingInstruction( +187 element.target, element.text) +188 if element.tail: +189 content_handler.characters(element.tail) +190 return +191 +192 new_prefixes = [] +193 build_qname = self._build_qname +194 attribs = element.items() +195 if attribs: +196 attr_values = {} +197 attr_qnames = {} +198 for attr_ns_name, value in attribs: +199 attr_ns_tuple = _getNsTag(attr_ns_name) +200 attr_values[attr_ns_tuple] = value +201 attr_qnames[attr_ns_tuple] = build_qname( +202 attr_ns_tuple[0], attr_ns_tuple[1], prefixes, new_prefixes) +203 sax_attributes = self._attr_class(attr_values, attr_qnames) +204 else: +205 sax_attributes = self._empty_attributes +206 +207 ns_uri, local_name = _getNsTag(tag) +208 qname = build_qname(ns_uri, local_name, prefixes, new_prefixes) +209 +210 for prefix, uri in new_prefixes: +211 content_handler.startPrefixMapping(prefix, uri) +212 content_handler.startElementNS((ns_uri, local_name), +213 qname, sax_attributes) +214 if element.text: +215 content_handler.characters(element.text) +216 for child in element: +217 self._recursive_saxify(child, prefixes) +218 content_handler.endElementNS((ns_uri, local_name), qname) +219 for prefix, uri in new_prefixes: +220 content_handler.endPrefixMapping(prefix) +221 if element.tail: +222 content_handler.characters(element.tail) +
223 +
224 - def _build_qname(self, ns_uri, local_name, prefixes, new_prefixes): +
225 if ns_uri is None: +226 return local_name +227 try: +228 prefix = prefixes[ns_uri] +229 except KeyError: +230 prefix = prefixes[ns_uri] = 'ns%02d' % len(prefixes) +231 new_prefixes.append( (prefix, ns_uri) ) +232 return prefix + ':' + local_name +
233 +
234 -def saxify(element_or_tree, content_handler): +
235 """One-shot helper to generate SAX events from an XML tree and fire +236 them against a SAX ContentHandler. +237 """ +238 return ElementTreeProducer(element_or_tree, content_handler).saxify() +
239 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.sax.ElementTreeContentHandler-class.html b/doc/html/api/lxml.sax.ElementTreeContentHandler-class.html new file mode 100644 index 0000000..8f29e4e --- /dev/null +++ b/doc/html/api/lxml.sax.ElementTreeContentHandler-class.html @@ -0,0 +1,876 @@ + + + + + lxml.sax.ElementTreeContentHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module sax :: + Class ElementTreeContentHandler + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTreeContentHandler

source code

+
+xml.sax.handler.ContentHandler --+
+                                 |
+                                ElementTreeContentHandler
+
+ +
+Build an lxml ElementTree from SAX events. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + makeelement=None) + source code + +
+ +
+   + + + + + + +
_get_etree(self)
+ Contains the generated ElementTree after parsing is finished.
+ source code + +
+ +
+   + + + + + + +
setDocumentLocator(self, + locator)
+ Called by the parser to give the application a locator for +locating the origin of document events.
+ source code + +
+ +
+   + + + + + + +
startDocument(self)
+ Receive notification of the beginning of a document.
+ source code + +
+ +
+   + + + + + + +
endDocument(self)
+ Receive notification of the end of a document.
+ source code + +
+ +
+   + + + + + + +
startPrefixMapping(self, + prefix, + uri)
+ Begin the scope of a prefix-URI Namespace mapping.
+ source code + +
+ +
+   + + + + + + +
endPrefixMapping(self, + prefix)
+ End the scope of a prefix-URI mapping.
+ source code + +
+ +
+   + + + + + + +
startElementNS(self, + ns_name, + qname, + attributes=None)
+ Signals the start of an element in namespace mode.
+ source code + +
+ +
+   + + + + + + +
processingInstruction(self, + target, + data)
+ Receive notification of a processing instruction.
+ source code + +
+ +
+   + + + + + + +
endElementNS(self, + ns_name, + qname)
+ Signals the end of an element in namespace mode.
+ source code + +
+ +
+   + + + + + + +
startElement(self, + name, + attributes=None)
+ Signals the start of an element in non-namespace mode.
+ source code + +
+ +
+   + + + + + + +
endElement(self, + name)
+ Signals the end of an element in non-namespace mode.
+ source code + +
+ +
+   + + + + + + +
characters(self, + data)
+ Receive notification of character data.
+ source code + +
+ +
+   + + + + + + +
ignorableWhitespace(self, + data)
+ Receive notification of character data.
+ source code + +
+ +
+

Inherited from xml.sax.handler.ContentHandler: + skippedEntity +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+   + + etree
+ Contains the generated ElementTree after parsing is finished. +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + makeelement=None) +
(Constructor) +

+
source code  +
+ + +
+
Overrides: + xml.sax.handler.ContentHandler.__init__ +
+
+
+
+ +
+ +
+ + +
+

setDocumentLocator(self, + locator) +

+
source code  +
+ +

Called by the parser to give the application a locator for +locating the origin of document events.

+

SAX parsers are strongly encouraged (though not absolutely +required) to supply a locator: if it does so, it must supply +the locator to the application by invoking this method before +invoking any of the other methods in the DocumentHandler +interface.

+

The locator allows the application to determine the end +position of any document-related event, even if the parser is +not reporting an error. Typically, the application will use +this information for reporting its own errors (such as +character content that does not match an application's +business rules). The information returned by the locator is +probably not sufficient for use with a search engine.

+

Note that the locator will return correct information only +during the invocation of the events in this interface. The +application should not attempt to use it at any other time.

+
+
Overrides: + xml.sax.handler.ContentHandler.setDocumentLocator +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

startDocument(self) +

+
source code  +
+ +

Receive notification of the beginning of a document.

+

The SAX parser will invoke this method only once, before any +other methods in this interface or in DTDHandler (except for +setDocumentLocator).

+
+
Overrides: + xml.sax.handler.ContentHandler.startDocument +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

endDocument(self) +

+
source code  +
+ +

Receive notification of the end of a document.

+

The SAX parser will invoke this method only once, and it will +be the last method invoked during the parse. The parser shall +not invoke this method until it has either abandoned parsing +(because of an unrecoverable error) or reached the end of +input.

+
+
Overrides: + xml.sax.handler.ContentHandler.endDocument +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

startPrefixMapping(self, + prefix, + uri) +

+
source code  +
+ +

Begin the scope of a prefix-URI Namespace mapping.

+

The information from this event is not necessary for normal +Namespace processing: the SAX XML reader will automatically +replace prefixes for element and attribute names when the +http://xml.org/sax/features/namespaces feature is true (the +default).

+

There are cases, however, when applications need to use +prefixes in character data or in attribute values, where they +cannot safely be expanded automatically; the +start/endPrefixMapping event supplies the information to the +application to expand prefixes in those contexts itself, if +necessary.

+

Note that start/endPrefixMapping events are not guaranteed to +be properly nested relative to each-other: all +startPrefixMapping events will occur before the corresponding +startElement event, and all endPrefixMapping events will occur +after the corresponding endElement event, but their order is +not guaranteed.

+
+
Overrides: + xml.sax.handler.ContentHandler.startPrefixMapping +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

endPrefixMapping(self, + prefix) +

+
source code  +
+ +

End the scope of a prefix-URI mapping.

+

See startPrefixMapping for details. This event will always +occur after the corresponding endElement event, but the order +of endPrefixMapping events is not otherwise guaranteed.

+
+
Overrides: + xml.sax.handler.ContentHandler.endPrefixMapping +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

startElementNS(self, + ns_name, + qname, + attributes=None) +

+
source code  +
+ +

Signals the start of an element in namespace mode.

+

The name parameter contains the name of the element type as a +(uri, localname) tuple, the qname parameter the raw XML 1.0 +name used in the source document, and the attrs parameter +holds an instance of the Attributes class containing the +attributes of the element.

+

The uri part of the name tuple is None for elements which have +no namespace.

+
+
Overrides: + xml.sax.handler.ContentHandler.startElementNS +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

processingInstruction(self, + target, + data) +

+
source code  +
+ +

Receive notification of a processing instruction.

+

The Parser will invoke this method once for each processing +instruction found: note that processing instructions may occur +before or after the main document element.

+

A SAX parser should never report an XML declaration (XML 1.0, +section 2.8) or a text declaration (XML 1.0, section 4.3.1) +using this method.

+
+
Overrides: + xml.sax.handler.ContentHandler.processingInstruction +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

endElementNS(self, + ns_name, + qname) +

+
source code  +
+ +

Signals the end of an element in namespace mode.

+

The name parameter contains the name of the element type, just +as with the startElementNS event.

+
+
Overrides: + xml.sax.handler.ContentHandler.endElementNS +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

startElement(self, + name, + attributes=None) +

+
source code  +
+ +

Signals the start of an element in non-namespace mode.

+

The name parameter contains the raw XML 1.0 name of the +element type as a string and the attrs parameter holds an +instance of the Attributes class containing the attributes of +the element.

+
+
Overrides: + xml.sax.handler.ContentHandler.startElement +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

endElement(self, + name) +

+
source code  +
+ +

Signals the end of an element in non-namespace mode.

+

The name parameter contains the name of the element type, just +as with the startElement event.

+
+
Overrides: + xml.sax.handler.ContentHandler.endElement +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

characters(self, + data) +

+
source code  +
+ +

Receive notification of character data.

+

The Parser will call this method to report each chunk of +character data. SAX parsers may return all contiguous +character data in a single chunk, or they may split it into +several chunks; however, all of the characters in any single +event must come from the same external entity so that the +Locator provides useful information.

+
+
Overrides: + xml.sax.handler.ContentHandler.characters +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

ignorableWhitespace(self, + data) +

+
source code  +
+ +

Receive notification of character data.

+

The Parser will call this method to report each chunk of +character data. SAX parsers may return all contiguous +character data in a single chunk, or they may split it into +several chunks; however, all of the characters in any single +event must come from the same external entity so that the +Locator provides useful information.

+
+
Overrides: + xml.sax.handler.ContentHandler.ignorableWhitespace +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Property Details[hide private]
+
+ +
+ +
+

etree

+ Contains the generated ElementTree after parsing is finished. +
+
Get Method:
+
_get_etree(self) + - Contains the generated ElementTree after parsing is finished. +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.sax.ElementTreeProducer-class.html b/doc/html/api/lxml.sax.ElementTreeProducer-class.html new file mode 100644 index 0000000..4f53903 --- /dev/null +++ b/doc/html/api/lxml.sax.ElementTreeProducer-class.html @@ -0,0 +1,300 @@ + + + + + lxml.sax.ElementTreeProducer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module sax :: + Class ElementTreeProducer + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTreeProducer

source code

+
+object --+
+         |
+        ElementTreeProducer
+
+ +
+Produces SAX events for an element and children. + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + element_or_tree, + content_handler)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
saxify(self) + source code + +
+ +
+   + + + + + + +
_recursive_saxify(self, + element, + prefixes) + source code + +
+ +
+   + + + + + + +
_build_qname(self, + ns_uri, + local_name, + prefixes, + new_prefixes) + source code + +
+ +
+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + element_or_tree, + content_handler) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.sax.SaxError-class.html b/doc/html/api/lxml.sax.SaxError-class.html new file mode 100644 index 0000000..71fe19f --- /dev/null +++ b/doc/html/api/lxml.sax.SaxError-class.html @@ -0,0 +1,204 @@ + + + + + lxml.sax.SaxError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module sax :: + Class SaxError + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SaxError

source code

+
+              object --+                
+                       |                
+exceptions.BaseException --+            
+                           |            
+        exceptions.Exception --+        
+                               |        
+                     etree.Error --+    
+                                   |    
+                     etree.LxmlError --+
+                                       |
+                                      SaxError
+
+ +
+General SAX error. + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.LxmlError: + __init__ +

+

Inherited from exceptions.Exception: + __new__ +

+

Inherited from exceptions.BaseException: + __delattr__, + __getattribute__, + __getitem__, + __getslice__, + __reduce__, + __repr__, + __setattr__, + __setstate__, + __str__ +

+

Inherited from object: + __hash__, + __reduce_ex__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from exceptions.BaseException: + args, + message +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests-module.html b/doc/html/api/lxml.tests-module.html new file mode 100644 index 0000000..033a933 --- /dev/null +++ b/doc/html/api/lxml.tests-module.html @@ -0,0 +1,160 @@ + + + + + lxml.tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package tests

source code

+The lxml test suite for lxml, ElementTree and cElementTree. + + + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests-pysrc.html b/doc/html/api/lxml.tests-pysrc.html new file mode 100644 index 0000000..c70d5c2 --- /dev/null +++ b/doc/html/api/lxml.tests-pysrc.html @@ -0,0 +1,124 @@ + + + + + lxml.tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package lxml.tests

+
+1  """ 
+2  The lxml test suite for lxml, ElementTree and cElementTree. 
+3  """ 
+4   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.common_imports-module.html b/doc/html/api/lxml.tests.common_imports-module.html new file mode 100644 index 0000000..ae21a82 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports-module.html @@ -0,0 +1,414 @@ + + + + + lxml.tests.common_imports + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module common_imports

source code

+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + unicode
+ str(object) -> string +
+   + + HelperTestCase +
+   + + SillyFileLike +
+   + + LargeFileLike +
+   + + LargeFileLikeUnicode +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
make_version_tuple(version_string) + source code + +
+ +
+   + + + + + + +
_get_caller_relative_path(filename, + frame_depth=2) + source code + +
+ +
+   + + + + + + +
_str(s, + encoding='UTF-8') + source code + +
+ +
+   + + + + + + +
_bytes(s, + encoding='UTF-8') + source code + +
+ +
+   + + + + + + +
_fix_traceback(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
_fix_exceptions(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
_fix_bytes(...)
+ sub(repl, string[, count = 0]) --> newstring +Return the string obtained by replacing the leftmost non-overlapping +occurrences of pattern in string by the replacement repl.
+ source code + +
+ +
+   + + + + + + +
make_doctest(filename) + source code + +
+ +
+   + + + + + + +
fileInTestDir(name) + source code + +
+ +
+   + + + + + + +
canonicalize(xml) + source code + +
+ +
+   + + + + + + +
unentitify(xml) + source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + cElementTree = None +
+   + + _fix_unicode = re.compile(r'(\s+)u(["\'])').sub +
+   + + doctest_parser = doctest.DocTestParser() +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.common_imports-pysrc.html b/doc/html/api/lxml.tests.common_imports-pysrc.html new file mode 100644 index 0000000..cc703d9 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports-pysrc.html @@ -0,0 +1,539 @@ + + + + + lxml.tests.common_imports + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.common_imports

+
+  1  import unittest 
+  2  import os.path 
+  3  import re, gc, sys 
+  4   
+  5  from lxml import etree 
+  6   
+
7 -def make_version_tuple(version_string): +
8 l = [] + 9 for part in re.findall('([0-9]+|[^0-9.]+)', version_string): + 10 try: + 11 l.append(int(part)) + 12 except ValueError: + 13 l.append(part) + 14 return tuple(l) +
15 + 16 try: + 17 from elementtree import ElementTree # standard ET + 18 except ImportError: + 19 try: + 20 from xml.etree import ElementTree # Python 2.5+ + 21 except ImportError: + 22 ElementTree = None + 23 + 24 if hasattr(ElementTree, 'VERSION'): + 25 if make_version_tuple(ElementTree.VERSION)[:2] < (1,3): + 26 # compatibility tests require ET 1.3+ + 27 ElementTree = None + 28 + 29 try: + 30 import cElementTree # standard ET + 31 except ImportError: + 32 try: + 33 from xml.etree import cElementTree # Python 2.5+ + 34 except ImportError: + 35 cElementTree = None + 36 + 37 if hasattr(cElementTree, 'VERSION'): + 38 if make_version_tuple(cElementTree.VERSION)[:2] <= (1,0): + 39 # compatibility tests do not run with cET 1.0.7 + 40 cElementTree = None + 41 + 42 try: + 43 import doctest + 44 # check if the system version has everything we need + 45 doctest.DocFileSuite + 46 doctest.DocTestParser + 47 doctest.NORMALIZE_WHITESPACE + 48 doctest.ELLIPSIS + 49 except (ImportError, AttributeError): + 50 # we need our own version to make it work (Python 2.3?) + 51 import local_doctest as doctest + 52 + 53 try: + 54 sorted + 55 except NameError: +
56 - def sorted(seq, **kwargs): +
57 seq = list(seq) + 58 seq.sort(**kwargs) + 59 return seq +
60 else: + 61 locals()['sorted'] = sorted + 62 +
63 -def _get_caller_relative_path(filename, frame_depth=2): +
64 module = sys.modules[sys._getframe(frame_depth).f_globals['__name__']] + 65 return os.path.normpath(os.path.join( + 66 os.path.dirname(getattr(module, '__file__', '')), filename)) +
67 + 68 if sys.version_info[0] >= 3: + 69 # Python 3 + 70 unicode = str +
71 - def _str(s, encoding="UTF-8"): +
72 return s +
73 - def _bytes(s, encoding="UTF-8"): +
74 return s.encode(encoding) +
75 from io import StringIO, BytesIO as _BytesIO +
76 - def BytesIO(*args): +
77 if args and isinstance(args[0], str): + 78 args = (args[0].encode("UTF-8"),) + 79 return _BytesIO(*args) +
80 + 81 doctest_parser = doctest.DocTestParser() + 82 _fix_unicode = re.compile(r'(\s+)u(["\'])').sub + 83 _fix_exceptions = re.compile(r'(.*except [^(]*),\s*(.*:)').sub +
84 - def make_doctest(filename): +
85 filename = _get_caller_relative_path(filename) + 86 doctests = open(filename).read() + 87 doctests = _fix_unicode(r'\1\2', doctests) + 88 doctests = _fix_exceptions(r'\1 as \2', doctests) + 89 return doctest.DocTestCase( + 90 doctest_parser.get_doctest( + 91 doctests, {}, os.path.basename(filename), filename, 0)) +
92 else: + 93 # Python 2 +
94 - def _str(s, encoding="UTF-8"): +
95 return unicode(s, encoding=encoding) +
96 - def _bytes(s, encoding="UTF-8"): +
97 return s +
98 from StringIO import StringIO + 99 BytesIO = StringIO +100 +101 doctest_parser = doctest.DocTestParser() +102 _fix_traceback = re.compile(r'^(\s*)(?:\w+\.)+(\w*(?:Error|Exception|Invalid):)', re.M).sub +103 _fix_exceptions = re.compile(r'(.*except [^(]*)\s+as\s+(.*:)').sub +104 _fix_bytes = re.compile(r'(\s+)b(["\'])').sub +
105 - def make_doctest(filename): +
106 filename = _get_caller_relative_path(filename) +107 doctests = open(filename).read() +108 doctests = _fix_traceback(r'\1\2', doctests) +109 doctests = _fix_exceptions(r'\1, \2', doctests) +110 doctests = _fix_bytes(r'\1\2', doctests) +111 return doctest.DocTestCase( +112 doctest_parser.get_doctest( +113 doctests, {}, os.path.basename(filename), filename, 0)) +
114 +
115 -class HelperTestCase(unittest.TestCase): +
116 - def tearDown(self): +
117 gc.collect() +
118 +
119 - def parse(self, text, parser=None): +
120 f = BytesIO(text) +121 return etree.parse(f, parser=parser) +
122 +
123 - def _rootstring(self, tree): +
124 return etree.tostring(tree.getroot()).replace( +125 _bytes(' '), _bytes('')).replace(_bytes('\n'), _bytes('')) +
126 +127 # assertFalse doesn't exist in Python 2.3 +128 try: +129 unittest.TestCase.assertFalse +130 except AttributeError: +131 assertFalse = unittest.TestCase.failIf +
132 +
133 -class SillyFileLike: +
134 - def __init__(self, xml_data=_bytes('<foo><bar/></foo>')): +
135 self.xml_data = xml_data +
136 +
137 - def read(self, amount=None): +
138 if self.xml_data: +139 if amount: +140 data = self.xml_data[:amount] +141 self.xml_data = self.xml_data[amount:] +142 else: +143 data = self.xml_data +144 self.xml_data = _bytes('') +145 return data +146 return _bytes('') +
147 +
148 -class LargeFileLike: +
149 - def __init__(self, charlen=100, depth=4, children=5): +
150 self.data = BytesIO() +151 self.chars = _bytes('a') * charlen +152 self.children = range(children) +153 self.more = self.iterelements(depth) +
154 +
155 - def iterelements(self, depth): +
156 yield _bytes('<root>') +157 depth -= 1 +158 if depth > 0: +159 for child in self.children: +160 for element in self.iterelements(depth): +161 yield element +162 yield self.chars +163 else: +164 yield self.chars +165 yield _bytes('</root>') +
166 +
167 - def read(self, amount=None): +
168 data = self.data +169 append = data.write +170 if amount: +171 for element in self.more: +172 append(element) +173 if data.tell() >= amount: +174 break +175 else: +176 for element in self.more: +177 append(element) +178 result = data.getvalue() +179 data.seek(0) +180 data.truncate() +181 if amount: +182 append(result[amount:]) +183 result = result[:amount] +184 return result +
185 +
186 -class LargeFileLikeUnicode(LargeFileLike): +
187 - def __init__(self, charlen=100, depth=4, children=5): +
188 LargeFileLike.__init__(self, charlen, depth, children) +189 self.data = StringIO() +190 self.chars = _str('a') * charlen +191 self.more = self.iterelements(depth) +
192 +
193 - def iterelements(self, depth): +
194 yield _str('<root>') +195 depth -= 1 +196 if depth > 0: +197 for child in self.children: +198 for element in self.iterelements(depth): +199 yield element +200 yield self.chars +201 else: +202 yield self.chars +203 yield _str('</root>') +
204 +
205 -def fileInTestDir(name): +
206 _testdir = os.path.dirname(__file__) +207 return os.path.join(_testdir, name) +
208 +
209 -def canonicalize(xml): +
210 f = BytesIO(xml) +211 tree = etree.parse(f) +212 f = BytesIO() +213 tree.write_c14n(f) +214 return f.getvalue() +
215 +
216 -def unentitify(xml): +
217 for entity_name, value in re.findall("(&#([0-9]+);)", xml): +218 xml = xml.replace(entity_name, unichr(int(value))) +219 return xml +
220 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.common_imports.HelperTestCase-class.html b/doc/html/api/lxml.tests.common_imports.HelperTestCase-class.html new file mode 100644 index 0000000..419a97d --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.HelperTestCase-class.html @@ -0,0 +1,367 @@ + + + + + lxml.tests.common_imports.HelperTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports :: + Class HelperTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HelperTestCase

source code

+
+       object --+    
+                |    
+unittest.TestCase --+
+                    |
+                   HelperTestCase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
parse(self, + text, + parser=None) + source code + +
+ +
+   + + + + + + +
_rootstring(self, + tree) + source code + +
+ +
+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + assertFalse = unittest.TestCase.failIf
+ Fail the test if the expression is true. +
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.common_imports.LargeFileLike-class.html b/doc/html/api/lxml.tests.common_imports.LargeFileLike-class.html new file mode 100644 index 0000000..34cfb30 --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.LargeFileLike-class.html @@ -0,0 +1,194 @@ + + + + + lxml.tests.common_imports.LargeFileLike + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports :: + Class LargeFileLike + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LargeFileLike

source code

+
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + charlen=100, + depth=4, + children=5) + source code + +
+ +
+   + + + + + + +
iterelements(self, + depth) + source code + +
+ +
+   + + + + + + +
read(self, + amount=None) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.common_imports.LargeFileLikeUnicode-class.html b/doc/html/api/lxml.tests.common_imports.LargeFileLikeUnicode-class.html new file mode 100644 index 0000000..347227a --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.LargeFileLikeUnicode-class.html @@ -0,0 +1,252 @@ + + + + + lxml.tests.common_imports.LargeFileLikeUnicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports :: + Class LargeFileLikeUnicode + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class LargeFileLikeUnicode

source code

+
+LargeFileLike --+
+                |
+               LargeFileLikeUnicode
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + charlen=100, + depth=4, + children=5) + source code + +
+ +
+   + + + + + + +
iterelements(self, + depth) + source code + +
+ +
+

Inherited from LargeFileLike: + read +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + charlen=100, + depth=4, + children=5) +
(Constructor) +

+
source code  +
+ + +
+
Overrides: + LargeFileLike.__init__ +
+
+
+
+ +
+ +
+ + +
+

iterelements(self, + depth) +

+
source code  +
+ + +
+
Overrides: + LargeFileLike.iterelements +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.common_imports.SillyFileLike-class.html b/doc/html/api/lxml.tests.common_imports.SillyFileLike-class.html new file mode 100644 index 0000000..a1cf0bf --- /dev/null +++ b/doc/html/api/lxml.tests.common_imports.SillyFileLike-class.html @@ -0,0 +1,168 @@ + + + + + lxml.tests.common_imports.SillyFileLike + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module common_imports :: + Class SillyFileLike + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SillyFileLike

source code

+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + xml_data='<foo><bar/></foo>') + source code + +
+ +
+   + + + + + + +
read(self, + amount=None) + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_classlookup-module.html b/doc/html/api/lxml.tests.test_classlookup-module.html new file mode 100644 index 0000000..e8038e0 --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup-module.html @@ -0,0 +1,276 @@ + + + + + lxml.tests.test_classlookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_classlookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_classlookup

source code

+Tests for different Element class lookup mechanisms. + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ClassLookupTestCase
+ Test cases for different Element class lookup mechanisms. +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + xml_str = '<root xmlns="myNS" xmlns:other="otherNS">\n <c1 a1... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+ +
+ +
+

xml_str

+ +
+
+
+
Value:
+
+'''<root xmlns="myNS" xmlns:other="otherNS">
+  <c1 a1="A1" a2="A2" other:a3="A3">
+    <c2 a1="C2">0</c2>
+    <c2>1</c2>
+    <other:c2>2</other:c2>
+  </c1>
+</root>'''
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_classlookup-pysrc.html b/doc/html/api/lxml.tests.test_classlookup-pysrc.html new file mode 100644 index 0000000..1014f6e --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup-pysrc.html @@ -0,0 +1,641 @@ + + + + + lxml.tests.test_classlookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_classlookup + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_classlookup

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Tests for different Element class lookup mechanisms. 
+  5  """ 
+  6   
+  7   
+  8  import unittest, doctest, operator, os.path, sys 
+  9   
+ 10  this_dir = os.path.dirname(__file__) 
+ 11  if this_dir not in sys.path: 
+ 12      sys.path.insert(0, this_dir) # needed for Py3 
+ 13   
+ 14  from common_imports import etree, HelperTestCase, SillyFileLike, fileInTestDir 
+ 15  from common_imports import canonicalize, _bytes, _str, BytesIO, StringIO 
+ 16   
+ 17  xml_str = _bytes('''\ 
+ 18  <root xmlns="myNS" xmlns:other="otherNS"> 
+ 19    <c1 a1="A1" a2="A2" other:a3="A3"> 
+ 20      <c2 a1="C2">0</c2> 
+ 21      <c2>1</c2> 
+ 22      <other:c2>2</other:c2> 
+ 23    </c1> 
+ 24  </root>''') 
+ 25   
+
26 -class ClassLookupTestCase(HelperTestCase): +
27 """Test cases for different Element class lookup mechanisms. + 28 """ + 29 etree = etree + 30 +
31 - def tearDown(self): +
34 +
35 - def test_namespace_lookup(self): +
36 class TestElement(etree.ElementBase): + 37 FIND_ME = "namespace class" +
38 + 39 lookup = etree.ElementNamespaceClassLookup() + 40 etree.set_element_class_lookup(lookup) + 41 + 42 ns = lookup.get_namespace("myNS") + 43 ns[None] = TestElement + 44 + 45 root = etree.XML(xml_str) + 46 self.assertEquals(root.FIND_ME, + 47 TestElement.FIND_ME) + 48 self.assertEquals(root[0].FIND_ME, + 49 TestElement.FIND_ME) + 50 self.assertFalse(hasattr(root[0][-1], 'FIND_ME')) +
51 +
52 - def test_default_class_lookup(self): +
53 class TestElement(etree.ElementBase): + 54 FIND_ME = "default element" +
55 class TestComment(etree.CommentBase): + 56 FIND_ME = "default comment" + 57 class TestPI(etree.PIBase): + 58 FIND_ME = "default pi" + 59 + 60 parser = etree.XMLParser() + 61 + 62 lookup = etree.ElementDefaultClassLookup( + 63 element=TestElement, comment=TestComment, pi=TestPI) + 64 parser.set_element_class_lookup(lookup) + 65 + 66 root = etree.XML(_bytes("""<?xml version='1.0'?> + 67 <root> + 68 <?myPI?> + 69 <!-- hi --> + 70 </root> + 71 """), parser) + 72 + 73 self.assertEquals("default element", root.FIND_ME) + 74 self.assertEquals("default pi", root[0].FIND_ME) + 75 self.assertEquals("default comment", root[1].FIND_ME) + 76 +
78 class TestElement(etree.ElementBase): + 79 FIND_ME = "attribute_based" +
80 + 81 class_dict = {"A1" : TestElement} + 82 + 83 lookup = etree.AttributeBasedElementClassLookup( + 84 "a1", class_dict) + 85 etree.set_element_class_lookup(lookup) + 86 + 87 root = etree.XML(xml_str) + 88 self.assertFalse(hasattr(root, 'FIND_ME')) + 89 self.assertEquals(root[0].FIND_ME, + 90 TestElement.FIND_ME) + 91 self.assertFalse(hasattr(root[0][0], 'FIND_ME')) + 92 +
93 - def test_custom_lookup(self): +
94 class TestElement(etree.ElementBase): + 95 FIND_ME = "custom" +
96 + 97 class MyLookup(etree.CustomElementClassLookup): + 98 def lookup(self, t, d, ns, name): + 99 if name == 'c1': +100 return TestElement +101 +102 etree.set_element_class_lookup( MyLookup() ) +103 +104 root = etree.XML(xml_str) +105 self.assertFalse(hasattr(root, 'FIND_ME')) +106 self.assertEquals(root[0].FIND_ME, +107 TestElement.FIND_ME) +108 self.assertFalse(hasattr(root[0][1], 'FIND_ME')) +109 +
111 class TestElement1(etree.ElementBase): +112 FIND_ME = "custom" +
113 +114 class TestElement2(etree.ElementBase): +115 FIND_ME = "nsclasses" +116 +117 class MyLookup(etree.CustomElementClassLookup): +118 def lookup(self, t, d, ns, name): +119 if name == 'c1': +120 return TestElement1 +121 +122 lookup = etree.ElementNamespaceClassLookup( MyLookup() ) +123 etree.set_element_class_lookup(lookup) +124 +125 ns = lookup.get_namespace("otherNS") +126 ns[None] = TestElement2 +127 +128 root = etree.XML(xml_str) +129 self.assertFalse(hasattr(root, 'FIND_ME')) +130 self.assertEquals(root[0].FIND_ME, +131 TestElement1.FIND_ME) +132 self.assertFalse(hasattr(root[0][1], 'FIND_ME')) +133 self.assertEquals(root[0][-1].FIND_ME, +134 TestElement2.FIND_ME) +135 +
136 - def test_parser_based_lookup(self): +
137 class TestElement(etree.ElementBase): +138 FIND_ME = "parser_based" +
139 +140 lookup = etree.ParserBasedElementClassLookup() +141 etree.set_element_class_lookup(lookup) +142 +143 class MyLookup(etree.CustomElementClassLookup): +144 def lookup(self, t, d, ns, name): +145 return TestElement +146 +147 parser = etree.XMLParser() +148 parser.set_element_class_lookup( MyLookup() ) +149 +150 root = etree.parse(BytesIO(xml_str), parser).getroot() +151 self.assertEquals(root.FIND_ME, +152 TestElement.FIND_ME) +153 self.assertEquals(root[0].FIND_ME, +154 TestElement.FIND_ME) +155 +156 root = etree.parse(BytesIO(xml_str)).getroot() +157 self.assertFalse(hasattr(root, 'FIND_ME')) +158 self.assertFalse(hasattr(root[0], 'FIND_ME')) +159 +
160 - def test_class_lookup_reentry(self): +
161 XML = self.etree.XML +162 +163 class TestElement(etree.ElementBase): +164 FIND_ME = "here" +
165 +166 root = None +167 class MyLookup(etree.CustomElementClassLookup): +168 el = None +169 def lookup(self, t, d, ns, name): +170 if root is not None: # not in the parser +171 if self.el is None and name == "a": +172 self.el = [] +173 self.el.append(root.find(name)) +174 return TestElement +175 +176 parser = self.etree.XMLParser() +177 parser.set_element_class_lookup(MyLookup()) +178 +179 root = XML(_bytes('<root><a>A</a><b xmlns="test">B</b></root>'), +180 parser) +181 +182 a = root[0] +183 self.assertEquals(a.tag, "a") +184 self.assertEquals(root[0].tag, "a") +185 del a +186 self.assertEquals(root[0].tag, "a") +187 +
189 class Lookup(etree.CustomElementClassLookup): +190 def __init__(self): +191 # no super call here, so no fallback is set +192 pass +
193 +194 def lookup(self, node_type, document, namespace, name): +195 return Foo +196 +197 class Foo(etree.ElementBase): +198 def custom(self): +199 return "test" +200 +201 parser = self.etree.XMLParser() +202 parser.set_element_class_lookup( Lookup() ) +203 +204 root = etree.XML('<foo/>', parser) +205 +206 self.assertEquals("test", root.custom()) +207 +208 +
209 -def test_suite(): +
210 suite = unittest.TestSuite() +211 suite.addTests([unittest.makeSuite(ClassLookupTestCase)]) +212 return suite +
213 +214 if __name__ == '__main__': +215 print('to test use test.py %s' % __file__) +216 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_classlookup.ClassLookupTestCase-class.html b/doc/html/api/lxml.tests.test_classlookup.ClassLookupTestCase-class.html new file mode 100644 index 0000000..6aa7bd9 --- /dev/null +++ b/doc/html/api/lxml.tests.test_classlookup.ClassLookupTestCase-class.html @@ -0,0 +1,507 @@ + + + + + lxml.tests.test_classlookup.ClassLookupTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_classlookup :: + Class ClassLookupTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ClassLookupTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ClassLookupTestCase
+
+ +
+Test cases for different Element class lookup mechanisms. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
test_namespace_lookup(self) + source code + +
+ +
+   + + + + + + +
test_default_class_lookup(self) + source code + +
+ +
+   + + + + + + +
test_attribute_based_lookup(self) + source code + +
+ +
+   + + + + + + +
test_custom_lookup(self) + source code + +
+ +
+   + + + + + + +
test_custom_lookup_ns_fallback(self) + source code + +
+ +
+   + + + + + + +
test_parser_based_lookup(self) + source code + +
+ +
+   + + + + + + +
test_class_lookup_reentry(self) + source code + +
+ +
+   + + + + + + +
test_lookup_without_fallback(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_css-module.html b/doc/html/api/lxml.tests.test_css-module.html new file mode 100644 index 0000000..22816dc --- /dev/null +++ b/doc/html/api/lxml.tests.test_css-module.html @@ -0,0 +1,254 @@ + + + + + lxml.tests.test_css + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_css + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_css

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + CSSTestCase +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
unique(s) + source code + +
+ +
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + doc_fn = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/t... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

doc_fn

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests/css_shakespe\
+ar.html'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_css-pysrc.html b/doc/html/api/lxml.tests.test_css-pysrc.html new file mode 100644 index 0000000..190f3dd --- /dev/null +++ b/doc/html/api/lxml.tests.test_css-pysrc.html @@ -0,0 +1,441 @@ + + + + + lxml.tests.test_css + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_css + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_css

+
+  1  import unittest, sys 
+  2  from lxml.tests.common_imports import doctest, make_doctest, HelperTestCase 
+  3  from lxml import html 
+  4  from lxml import cssselect 
+  5  import os 
+  6   
+  7  doc_fn = os.path.join(os.path.dirname(__file__), 
+  8                        'css_shakespear.html') 
+  9   
+ 10  try: 
+ 11      basestring = __builtins__['basestring'] 
+ 12  except (NameError, KeyError): 
+ 13      basestring = (str, bytes) 
+ 14   
+ 15  # Data borrowed from http://mootools.net/slickspeed/ 
+ 16   
+
17 -class CSSTestCase(HelperTestCase): +
18 + 19 selectors = [ + 20 ## Changed from original; probably because I'm only searching the body + 21 #('*', 252), + 22 ('*', 246), + 23 ('div:only-child', 22), # ? + 24 ## Changed from original, because the original doesn't make sense. + 25 ## There really aren't that many occurrances of 'celia' + 26 #('div:contains(CELIA)', 243), + 27 ('div:contains(CELIA)', 30), + 28 ('div:nth-child(even)', 106), + 29 ('div:nth-child(2n)', 106), + 30 ('div:nth-child(odd)', 137), + 31 ('div:nth-child(2n+1)', 137), + 32 ('div:nth-child(n)', 243), + 33 ('div:last-child', 53), + 34 ('div:first-child', 51), + 35 ('div > div', 242), + 36 ('div + div', 190), + 37 ('div ~ div', 190), + 38 ('body', 1), + 39 ('body div', 243), + 40 ('div', 243), + 41 ('div div', 242), + 42 ('div div div', 241), + 43 ('div, div, div', 243), + 44 ('div, a, span', 243), + 45 ('.dialog', 51), + 46 ('div.dialog', 51), + 47 ('div .dialog', 51), + 48 ('div.character, div.dialog', 99), + 49 ('div.direction.dialog', 0), + 50 ('div.dialog.direction', 0), + 51 ('div.dialog.scene', 1), + 52 ('div.scene.scene', 1), + 53 ('div.scene .scene', 0), + 54 ('div.direction .dialog ', 0), + 55 ('div .dialog .direction', 4), + 56 ('div.dialog .dialog .direction', 4), + 57 ('#speech5', 1), + 58 ('div#speech5', 1), + 59 ('div #speech5', 1), + 60 ('div.scene div.dialog', 49), + 61 ('div#scene1 div.dialog div', 142), + 62 ('#scene1 #speech1', 1), + 63 ('div[class]', 103), + 64 ('div[class=dialog]', 50), + 65 ('div[class^=dia]', 51), + 66 ('div[class$=log]', 50), + 67 ('div[class*=sce]', 1), + 68 ('div[class|=dialog]', 50), # ? Seems right + 69 ('div[class!=madeup]', 243), # ? Seems right + 70 ('div[class~=dialog]', 51), # ? Seems right + 71 ] + 72 +
73 - def __init__(self, index): +
74 self.index = index + 75 super(HelperTestCase, self).__init__() +
76 +
77 - def all(cls): +
78 for i in range(len(cls.selectors)): + 79 yield cls(i) +
80 all = classmethod(all) + 81 +
82 - def runTest(self): +
83 f = open(doc_fn, 'rb') + 84 c = f.read() + 85 f.close() + 86 doc = html.document_fromstring(c) + 87 body = doc.xpath('//body')[0] + 88 bad = [] + 89 selector, count = self.selectors[self.index] + 90 xpath = cssselect.css_to_xpath(cssselect.parse(selector)) + 91 try: + 92 results = body.xpath(xpath) + 93 except Exception: + 94 e = sys.exc_info()[1] + 95 e.args = ("%s for xpath %r" % (e, xpath)) + 96 raise + 97 found = {} + 98 for item in results: + 99 if item in found: +100 assert 0, ( +101 "Element shows up multiple times: %r" % item) +102 found[item] = None +103 if isinstance(results, basestring): +104 assert 0, ( +105 "Got string result (%r), not element, for xpath %r" +106 % (results[:20], str(xpath))) +107 if len(results) != count: +108 #if self.shortDescription() == 'div.character, div.dialog': +109 # import pdb; pdb.set_trace() +110 assert 0, ( +111 "Did not get expected results (%s) instead %s for xpath %r" +112 % (count, len(results), str(xpath))) +
113 +
114 - def shortDescription(self): +
115 return self.selectors[self.index][0] +
116 +
117 -def unique(s): +
118 found = {} +119 result = [] +120 for item in s: +121 if item in found: +122 continue +123 found[item] = None +124 result.append(s) +125 return result +
126 +
127 -def test_suite(): +
128 suite = unittest.TestSuite() +129 if sys.version_info >= (2,4): +130 suite.addTests([make_doctest('test_css_select.txt')]) +131 suite.addTests([make_doctest('test_css.txt')]) +132 suite.addTests(list(CSSTestCase.all())) +133 return suite +
134 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_css.CSSTestCase-class.html b/doc/html/api/lxml.tests.test_css.CSSTestCase-class.html new file mode 100644 index 0000000..66fef2f --- /dev/null +++ b/doc/html/api/lxml.tests.test_css.CSSTestCase-class.html @@ -0,0 +1,492 @@ + + + + + lxml.tests.test_css.CSSTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_css :: + Class CSSTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CSSTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               CSSTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + index)
+ Create an instance of the class that will use the named test +method when executed.
+ source code + +
+ +
+   + + + + + + +
runTest(self) + source code + +
+ +
+   + + + + + + +
shortDescription(self)
+ Returns a one-line description of the test, or None if no +description has been provided.
+ source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Methods[hide private]
+
+   + + + + + + +
all(cls) + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + selectors = [('*', 246), ('div:only-child', 22), ('div:contain... +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + index) +
(Constructor) +

+
source code  +
+ + Create an instance of the class that will use the named test +method when executed. Raises a ValueError if the instance does +not have a method with the specified name. +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

shortDescription(self) +

+
source code  +
+ +

Returns a one-line description of the test, or None if no +description has been provided.

+

The default implementation of this method returns the first line of +the specified test method's docstring.

+
+
Overrides: + unittest.TestCase.shortDescription +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

selectors

+ +
+
+
+
Value:
+
+[('*', 246),
+ ('div:only-child', 22),
+ ('div:contains(CELIA)', 30),
+ ('div:nth-child(even)', 106),
+ ('div:nth-child(2n)', 106),
+ ('div:nth-child(odd)', 137),
+ ('div:nth-child(2n+1)', 137),
+ ('div:nth-child(n)', 243),
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_dtd-module.html b/doc/html/api/lxml.tests.test_dtd-module.html new file mode 100644 index 0000000..a6f40a5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_dtd-module.html @@ -0,0 +1,238 @@ + + + + + lxml.tests.test_dtd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_dtd + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_dtd

source code

+Test cases related to DTD parsing and validation + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeDtdTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_dtd-pysrc.html b/doc/html/api/lxml.tests.test_dtd-pysrc.html new file mode 100644 index 0000000..3f7d2da --- /dev/null +++ b/doc/html/api/lxml.tests.test_dtd-pysrc.html @@ -0,0 +1,565 @@ + + + + + lxml.tests.test_dtd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_dtd + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_dtd

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to DTD parsing and validation 
+  5  """ 
+  6   
+  7  import unittest, sys, os.path 
+  8   
+  9  this_dir = os.path.dirname(__file__) 
+ 10  if this_dir not in sys.path: 
+ 11      sys.path.insert(0, this_dir) # needed for Py3 
+ 12   
+ 13  from common_imports import etree, StringIO, BytesIO, _bytes, doctest 
+ 14  from common_imports import HelperTestCase, fileInTestDir, make_doctest 
+ 15   
+
16 -class ETreeDtdTestCase(HelperTestCase): +
17 - def test_dtd(self): +
18 pass +
19 +
20 - def test_dtd_file(self): +
21 parse = etree.parse + 22 tree = parse(fileInTestDir("test.xml")) + 23 root = tree.getroot() + 24 + 25 dtd = etree.DTD(fileInTestDir("test.dtd")) + 26 self.assert_(dtd.validate(root)) +
27 +
28 - def test_dtd_stringio(self): +
29 root = etree.XML(_bytes("<b/>")) + 30 dtd = etree.DTD(BytesIO("<!ELEMENT b EMPTY>")) + 31 self.assert_(dtd.validate(root)) +
32 +
33 - def test_dtd_parse_invalid(self): +
34 fromstring = etree.fromstring + 35 parser = etree.XMLParser(dtd_validation=True) + 36 xml = _bytes('<!DOCTYPE b SYSTEM "%s"><b><a/></b>' % fileInTestDir("test.dtd")) + 37 self.assertRaises(etree.XMLSyntaxError, + 38 fromstring, xml, parser=parser) +
39 +
41 fromstring = etree.fromstring + 42 dtd_filename = fileInTestDir("__nosuch.dtd") + 43 parser = etree.XMLParser(dtd_validation=True) + 44 xml = _bytes('<!DOCTYPE b SYSTEM "%s"><b><a/></b>' % dtd_filename) + 45 self.assertRaises(etree.XMLSyntaxError, + 46 fromstring, xml, parser=parser) + 47 errors = None + 48 try: + 49 fromstring(xml, parser=parser) + 50 except etree.XMLSyntaxError: + 51 e = sys.exc_info()[1] + 52 errors = [ entry.message for entry in e.error_log + 53 if dtd_filename in entry.message ] + 54 self.assert_(errors) +
55 +
56 - def test_dtd_parse_valid(self): +
57 parser = etree.XMLParser(dtd_validation=True) + 58 xml = '<!DOCTYPE a SYSTEM "%s"><a><b/></a>' % fileInTestDir("test.dtd") + 59 root = etree.fromstring(xml, parser=parser) +
60 +
62 parser = etree.XMLParser(dtd_validation=True) + 63 xml = '<!DOCTYPE a SYSTEM "test.dtd"><a><b/></a>' + 64 root = etree.fromstring(xml, parser=parser, + 65 base_url=fileInTestDir("test.xml")) +
66 +
67 - def test_dtd_invalid(self): +
68 root = etree.XML("<b><a/></b>") + 69 dtd = etree.DTD(BytesIO("<!ELEMENT b EMPTY>")) + 70 self.assertRaises(etree.DocumentInvalid, dtd.assertValid, root) +
71 +
72 - def test_dtd_assertValid(self): +
73 root = etree.XML("<b><a/></b>") + 74 dtd = etree.DTD(BytesIO("<!ELEMENT b (a)><!ELEMENT a EMPTY>")) + 75 dtd.assertValid(root) +
76 +
77 - def test_dtd_internal(self): +
78 root = etree.XML(_bytes(''' + 79 <!DOCTYPE b SYSTEM "none" [ + 80 <!ELEMENT b (a)> + 81 <!ELEMENT a EMPTY> + 82 ]> + 83 <b><a/></b> + 84 ''')) + 85 dtd = etree.ElementTree(root).docinfo.internalDTD + 86 self.assert_(dtd) + 87 dtd.assertValid(root) +
88 +
89 - def test_dtd_internal_invalid(self): +
90 root = etree.XML(_bytes(''' + 91 <!DOCTYPE b SYSTEM "none" [ + 92 <!ELEMENT b (a)> + 93 <!ELEMENT a (c)> + 94 <!ELEMENT c EMPTY> + 95 ]> + 96 <b><a/></b> + 97 ''')) + 98 dtd = etree.ElementTree(root).docinfo.internalDTD + 99 self.assert_(dtd) +100 self.assertFalse(dtd.validate(root)) +
101 +
102 - def test_dtd_broken(self): +
103 self.assertRaises(etree.DTDParseError, etree.DTD, +104 BytesIO("<!ELEMENT b HONKEY>")) +
105 +
106 - def test_parse_file_dtd(self): +
107 parser = etree.XMLParser(attribute_defaults=True) +108 +109 tree = etree.parse(fileInTestDir('test.xml'), parser) +110 root = tree.getroot() +111 +112 self.assertEquals( +113 "valueA", +114 root.get("default")) +115 self.assertEquals( +116 "valueB", +117 root[0].get("default")) +
118 +
119 - def test_iterparse_file_dtd(self): +
120 iterparse = etree.iterparse +121 iterator = iterparse(fileInTestDir("test.xml"), events=("start",), +122 attribute_defaults=True) +123 attributes = [ element.get("default") +124 for event, element in iterator ] +125 self.assertEquals( +126 ["valueA", "valueB"], +127 attributes) +
128 +129 +
130 -def test_suite(): +
131 suite = unittest.TestSuite() +132 suite.addTests([unittest.makeSuite(ETreeDtdTestCase)]) +133 suite.addTests( +134 [make_doctest('../../../doc/validation.txt')]) +135 return suite +
136 +137 if __name__ == '__main__': +138 print('to test use test.py %s' % __file__) +139 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_dtd.ETreeDtdTestCase-class.html b/doc/html/api/lxml.tests.test_dtd.ETreeDtdTestCase-class.html new file mode 100644 index 0000000..fa1c98c --- /dev/null +++ b/doc/html/api/lxml.tests.test_dtd.ETreeDtdTestCase-class.html @@ -0,0 +1,499 @@ + + + + + lxml.tests.test_dtd.ETreeDtdTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_dtd :: + Class ETreeDtdTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeDtdTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeDtdTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_dtd(self) + source code + +
+ +
+   + + + + + + +
test_dtd_file(self) + source code + +
+ +
+   + + + + + + +
test_dtd_stringio(self) + source code + +
+ +
+   + + + + + + +
test_dtd_parse_invalid(self) + source code + +
+ +
+   + + + + + + +
test_dtd_parse_file_not_found(self) + source code + +
+ +
+   + + + + + + +
test_dtd_parse_valid(self) + source code + +
+ +
+   + + + + + + +
test_dtd_parse_valid_relative(self) + source code + +
+ +
+   + + + + + + +
test_dtd_invalid(self) + source code + +
+ +
+   + + + + + + +
test_dtd_assertValid(self) + source code + +
+ +
+   + + + + + + +
test_dtd_internal(self) + source code + +
+ +
+   + + + + + + +
test_dtd_internal_invalid(self) + source code + +
+ +
+   + + + + + + +
test_dtd_broken(self) + source code + +
+ +
+   + + + + + + +
test_parse_file_dtd(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_file_dtd(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree-module.html b/doc/html/api/lxml.tests.test_elementtree-module.html new file mode 100644 index 0000000..8201234 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree-module.html @@ -0,0 +1,285 @@ + + + + + lxml.tests.test_elementtree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_elementtree

source code

+

Tests for the ElementTree API

+

Only test cases that apply equally well to etree and ElementTree +belong here. Note that there is a second test module called test_io.py +for IO related test cases.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeTestCaseBase +
+   + + ETreeTestCase +
+   + + ElementTreeTestCase +
+   + + CElementTreeTestCase +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
reversed(seq) + source code + +
+ +
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + cElementTree = None +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree-pysrc.html b/doc/html/api/lxml.tests.test_elementtree-pysrc.html new file mode 100644 index 0000000..941e10b --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree-pysrc.html @@ -0,0 +1,12246 @@ + + + + + lxml.tests.test_elementtree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_elementtree

+
+   1  # -*- coding: utf-8 -*- 
+   2   
+   3  """ 
+   4  Tests for the ElementTree API 
+   5   
+   6  Only test cases that apply equally well to etree and ElementTree 
+   7  belong here. Note that there is a second test module called test_io.py 
+   8  for IO related test cases. 
+   9  """ 
+  10   
+  11  import unittest 
+  12  import os, re, tempfile, copy, operator, gc, sys 
+  13   
+  14  this_dir = os.path.dirname(__file__) 
+  15  if this_dir not in sys.path: 
+  16      sys.path.insert(0, this_dir) # needed for Py3 
+  17   
+  18  from common_imports import StringIO, BytesIO, etree, ElementTree, cElementTree 
+  19  from common_imports import fileInTestDir, canonicalize, HelperTestCase 
+  20  from common_imports import _str, _bytes 
+  21   
+  22  if cElementTree is not None: 
+  23      if tuple([int(n) for n in 
+  24                getattr(cElementTree, "VERSION", "0.0").split(".")]) <= (1,0,7): 
+  25          cElementTree = None 
+  26   
+  27  try: 
+  28      reversed 
+  29  except NameError: 
+  30      # Python 2.3 
+
31 - def reversed(seq): +
32 seq = list(seq)[::-1] + 33 return seq +
34 +
35 -class ETreeTestCaseBase(HelperTestCase): +
36 etree = None + 37 +
38 - def test_element(self): +
39 for i in range(10): + 40 e = self.etree.Element('foo') + 41 self.assertEquals(e.tag, 'foo') + 42 self.assertEquals(e.text, None) + 43 self.assertEquals(e.tail, None) +
44 +
45 - def test_simple(self): +
46 Element = self.etree.Element + 47 + 48 root = Element('root') + 49 root.append(Element('one')) + 50 root.append(Element('two')) + 51 root.append(Element('three')) + 52 self.assertEquals(3, len(root)) + 53 self.assertEquals('one', root[0].tag) + 54 self.assertEquals('two', root[1].tag) + 55 self.assertEquals('three', root[2].tag) + 56 self.assertRaises(IndexError, operator.getitem, root, 3) +
57 + 58 # test weird dictionary interaction leading to segfault previously +
60 root = self.etree.Element('root') + 61 self.assertEquals(root.tag, "root") + 62 add = self.etree.ElementTree(file=BytesIO('<foo>Foo</foo>')) + 63 self.assertEquals(add.getroot().tag, "foo") + 64 self.assertEquals(add.getroot().text, "Foo") + 65 root.append(self.etree.Element('baz')) + 66 self.assertEquals(root.tag, "root") + 67 self.assertEquals(root[0].tag, "baz") +
68 +
69 - def test_subelement(self): +
70 Element = self.etree.Element + 71 SubElement = self.etree.SubElement + 72 + 73 root = Element('root') + 74 SubElement(root, 'one') + 75 SubElement(root, 'two') + 76 SubElement(root, 'three') + 77 self.assertEquals(3, len(root)) + 78 self.assertEquals('one', root[0].tag) + 79 self.assertEquals('two', root[1].tag) + 80 self.assertEquals('three', root[2].tag) +
81 +
82 - def test_element_contains(self): +
83 Element = self.etree.Element + 84 SubElement = self.etree.SubElement + 85 + 86 root1 = Element('root') + 87 SubElement(root1, 'one') + 88 self.assert_(root1[0] in root1) + 89 + 90 root2 = Element('root') + 91 SubElement(root2, 'two') + 92 SubElement(root2, 'three') + 93 self.assert_(root2[0] in root2) + 94 self.assert_(root2[1] in root2) + 95 + 96 self.assertFalse(root1[0] in root2) + 97 self.assertFalse(root2[0] in root1) + 98 self.assertFalse(None in root2) +
99 +
101 ElementTree = self.etree.ElementTree + 102 + 103 f = BytesIO('<doc>Test<one>One</one></doc>') + 104 doc = ElementTree(file=f) + 105 root = doc.getroot() + 106 self.assertEquals(1, len(root)) + 107 self.assertEquals('one', root[0].tag) + 108 self.assertRaises(IndexError, operator.getitem, root, 1) +
109 +
111 ElementTree = self.etree.ElementTree + 112 + 113 f = BytesIO('<doc><one>One</one><two>Two</two>hm<three>Three</three></doc>') + 114 doc = ElementTree(file=f) + 115 root = doc.getroot() + 116 self.assertEquals(3, len(root)) + 117 self.assertEquals('one', root[0].tag) + 118 self.assertEquals('two', root[1].tag) + 119 self.assertEquals('three', root[2].tag) +
120 +
122 ElementTree = self.etree.ElementTree + 123 + 124 f = BytesIO('<doc>Test</doc>') + 125 doc = ElementTree(file=f) + 126 root = doc.getroot() + 127 self.assertEquals(0, len(root)) +
128 +
130 Element = self.etree.Element + 131 SubElement = self.etree.SubElement + 132 a = Element('a') + 133 b = SubElement(a, 'b') + 134 c = SubElement(a, 'c') + 135 d = SubElement(a, 'd') + 136 self.assertEquals(d, a[-1]) + 137 self.assertEquals(c, a[-2]) + 138 self.assertEquals(b, a[-3]) + 139 self.assertRaises(IndexError, operator.getitem, a, -4) + 140 a[-1] = e = Element('e') + 141 self.assertEquals(e, a[-1]) + 142 del a[-1] + 143 self.assertEquals(2, len(a)) +
144 +
145 - def test_elementtree(self): +
146 ElementTree = self.etree.ElementTree + 147 + 148 f = BytesIO('<doc><one>One</one><two>Two</two></doc>') + 149 doc = ElementTree(file=f) + 150 root = doc.getroot() + 151 self.assertEquals(2, len(root)) + 152 self.assertEquals('one', root[0].tag) + 153 self.assertEquals('two', root[1].tag) +
154 +
155 - def test_text(self): +
156 ElementTree = self.etree.ElementTree + 157 + 158 f = BytesIO('<doc>This is a text</doc>') + 159 doc = ElementTree(file=f) + 160 root = doc.getroot() + 161 self.assertEquals('This is a text', root.text) +
162 +
163 - def test_text_empty(self): +
164 ElementTree = self.etree.ElementTree + 165 + 166 f = BytesIO('<doc></doc>') + 167 doc = ElementTree(file=f) + 168 root = doc.getroot() + 169 self.assertEquals(None, root.text) +
170 +
171 - def test_text_other(self): +
172 ElementTree = self.etree.ElementTree + 173 + 174 f = BytesIO('<doc><one>One</one></doc>') + 175 doc = ElementTree(file=f) + 176 root = doc.getroot() + 177 self.assertEquals(None, root.text) + 178 self.assertEquals('One', root[0].text) +
179 +
180 - def test_text_escape_in(self): +
181 ElementTree = self.etree.ElementTree + 182 + 183 f = BytesIO('<doc>This is &gt; than a text</doc>') + 184 doc = ElementTree(file=f) + 185 root = doc.getroot() + 186 self.assertEquals('This is > than a text', root.text) +
187 +
188 - def test_text_escape_out(self): +
189 Element = self.etree.Element + 190 + 191 a = Element("a") + 192 a.text = "<>&" + 193 self.assertXML(_bytes('<a>&lt;&gt;&amp;</a>'), + 194 a) +
195 +
196 - def test_text_escape_tostring(self): +
197 tostring = self.etree.tostring + 198 Element = self.etree.Element + 199 + 200 a = Element("a") + 201 a.text = "<>&" + 202 self.assertEquals(_bytes('<a>&lt;&gt;&amp;</a>'), + 203 tostring(a)) +
204 +
205 - def test_text_str_subclass(self): +
206 Element = self.etree.Element + 207 + 208 class strTest(str): + 209 pass +
210 + 211 a = Element("a") + 212 a.text = strTest("text") + 213 self.assertXML(_bytes('<a>text</a>'), + 214 a) +
215 +
216 - def test_tail(self): +
217 ElementTree = self.etree.ElementTree + 218 + 219 f = BytesIO('<doc>This is <i>mixed</i> content.</doc>') + 220 doc = ElementTree(file=f) + 221 root = doc.getroot() + 222 self.assertEquals(1, len(root)) + 223 self.assertEquals('This is ', root.text) + 224 self.assertEquals(None, root.tail) + 225 self.assertEquals('mixed', root[0].text) + 226 self.assertEquals(' content.', root[0].tail) +
227 +
228 - def test_tail_str_subclass(self): +
229 Element = self.etree.Element + 230 SubElement = self.etree.SubElement + 231 + 232 class strTest(str): + 233 pass +
234 + 235 a = Element("a") + 236 SubElement(a, "t").tail = strTest("tail") + 237 self.assertXML(_bytes('<a><t></t>tail</a>'), + 238 a) + 239 +
240 - def _test_del_tail(self): +
241 # this is discouraged for ET compat, should not be tested... + 242 XML = self.etree.XML + 243 + 244 root = XML(_bytes('<doc>This is <i>mixed</i> content.</doc>')) + 245 self.assertEquals(1, len(root)) + 246 self.assertEquals('This is ', root.text) + 247 self.assertEquals(None, root.tail) + 248 self.assertEquals('mixed', root[0].text) + 249 self.assertEquals(' content.', root[0].tail) + 250 + 251 del root[0].tail + 252 + 253 self.assertEquals(1, len(root)) + 254 self.assertEquals('This is ', root.text) + 255 self.assertEquals(None, root.tail) + 256 self.assertEquals('mixed', root[0].text) + 257 self.assertEquals(None, root[0].tail) + 258 + 259 root[0].tail = "TAIL" + 260 + 261 self.assertEquals(1, len(root)) + 262 self.assertEquals('This is ', root.text) + 263 self.assertEquals(None, root.tail) + 264 self.assertEquals('mixed', root[0].text) + 265 self.assertEquals('TAIL', root[0].tail) +
266 +
267 - def test_ElementTree(self): +
268 Element = self.etree.Element + 269 ElementTree = self.etree.ElementTree + 270 + 271 el = Element('hoi') + 272 doc = ElementTree(el) + 273 root = doc.getroot() + 274 self.assertEquals(None, root.text) + 275 self.assertEquals('hoi', root.tag) +
276 +
277 - def test_attributes(self): +
278 ElementTree = self.etree.ElementTree + 279 + 280 f = BytesIO('<doc one="One" two="Two"/>') + 281 doc = ElementTree(file=f) + 282 root = doc.getroot() + 283 self.assertEquals('One', root.attrib['one']) + 284 self.assertEquals('Two', root.attrib['two']) + 285 self.assertRaises(KeyError, operator.getitem, root.attrib, 'three') +
286 +
287 - def test_attributes2(self): +
288 ElementTree = self.etree.ElementTree + 289 + 290 f = BytesIO('<doc one="One" two="Two"/>') + 291 doc = ElementTree(file=f) + 292 root = doc.getroot() + 293 self.assertEquals('One', root.attrib.get('one')) + 294 self.assertEquals('Two', root.attrib.get('two')) + 295 self.assertEquals(None, root.attrib.get('three')) + 296 self.assertEquals('foo', root.attrib.get('three', 'foo')) +
297 +
298 - def test_attributes3(self): +
299 ElementTree = self.etree.ElementTree + 300 + 301 f = BytesIO('<doc one="One" two="Two"/>') + 302 doc = ElementTree(file=f) + 303 root = doc.getroot() + 304 self.assertEquals('One', root.get('one')) + 305 self.assertEquals('Two', root.get('two')) + 306 self.assertEquals(None, root.get('three')) + 307 self.assertEquals('foo', root.get('three', 'foo')) +
308 +
309 - def test_attrib_clear(self): +
310 XML = self.etree.XML + 311 + 312 root = XML(_bytes('<doc one="One" two="Two"/>')) + 313 self.assertEquals('One', root.get('one')) + 314 self.assertEquals('Two', root.get('two')) + 315 root.attrib.clear() + 316 self.assertEquals(None, root.get('one')) + 317 self.assertEquals(None, root.get('two')) +
318 +
319 - def test_attrib_set_clear(self): +
320 Element = self.etree.Element + 321 + 322 root = Element("root", one="One") + 323 root.set("two", "Two") + 324 self.assertEquals('One', root.get('one')) + 325 self.assertEquals('Two', root.get('two')) + 326 root.attrib.clear() + 327 self.assertEquals(None, root.get('one')) + 328 self.assertEquals(None, root.get('two')) +
329 +
330 - def test_attrib_ns_clear(self): +
331 Element = self.etree.Element + 332 SubElement = self.etree.SubElement + 333 + 334 attribNS = '{http://foo/bar}x' + 335 + 336 parent = Element('parent') + 337 parent.set(attribNS, 'a') + 338 child = SubElement(parent, 'child') + 339 child.set(attribNS, 'b') + 340 + 341 self.assertEquals('a', parent.get(attribNS)) + 342 self.assertEquals('b', child.get(attribNS)) + 343 + 344 parent.clear() + 345 self.assertEquals(None, parent.get(attribNS)) + 346 self.assertEquals('b', child.get(attribNS)) +
347 +
348 - def test_attrib_pop(self): +
349 ElementTree = self.etree.ElementTree + 350 + 351 f = BytesIO('<doc one="One" two="Two"/>') + 352 doc = ElementTree(file=f) + 353 root = doc.getroot() + 354 self.assertEquals('One', root.attrib['one']) + 355 self.assertEquals('Two', root.attrib['two']) + 356 + 357 self.assertEquals('One', root.attrib.pop('one')) + 358 + 359 self.assertEquals(None, root.attrib.get('one')) + 360 self.assertEquals('Two', root.attrib['two']) +
361 +
362 - def test_attrib_pop_unknown(self): +
363 root = self.etree.XML(_bytes('<doc one="One" two="Two"/>')) + 364 self.assertRaises(KeyError, root.attrib.pop, 'NONE') + 365 + 366 self.assertEquals('One', root.attrib['one']) + 367 self.assertEquals('Two', root.attrib['two']) +
368 +
369 - def test_attrib_pop_default(self): +
370 root = self.etree.XML(_bytes('<doc one="One" two="Two"/>')) + 371 self.assertEquals('Three', root.attrib.pop('three', 'Three')) +
372 +
374 root = self.etree.XML(_bytes('<doc/>')) + 375 self.assertEquals('Three', root.attrib.pop('three', 'Three')) +
376 +
378 root = self.etree.XML(_bytes('<doc one="One" two="Two"/>')) + 379 self.assertRaises(TypeError, root.attrib.pop, 'One', None, None) +
380 +
381 - def test_attribute_update_dict(self): +
382 XML = self.etree.XML + 383 + 384 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 385 items = list(root.attrib.items()) + 386 items.sort() + 387 self.assertEquals( + 388 [('alpha', 'Alpha'), ('beta', 'Beta')], + 389 items) + 390 + 391 root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}) + 392 + 393 items = list(root.attrib.items()) + 394 items.sort() + 395 self.assertEquals( + 396 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 397 items) +
398 +
400 XML = self.etree.XML + 401 + 402 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 403 items = list(root.attrib.items()) + 404 items.sort() + 405 self.assertEquals( + 406 [('alpha', 'Alpha'), ('beta', 'Beta')], + 407 items) + 408 + 409 root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}.items()) + 410 + 411 items = list(root.attrib.items()) + 412 items.sort() + 413 self.assertEquals( + 414 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 415 items) +
416 +
417 - def test_attribute_update_iter(self): +
418 XML = self.etree.XML + 419 + 420 root = XML(_bytes('<doc alpha="Alpha" beta="Beta"/>')) + 421 items = list(root.attrib.items()) + 422 items.sort() + 423 self.assertEquals( + 424 [('alpha', 'Alpha'), ('beta', 'Beta')], + 425 items) + 426 + 427 root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}.items()) + 428 + 429 items = list(root.attrib.items()) + 430 items.sort() + 431 self.assertEquals( + 432 [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + 433 items) +
434 +
435 - def test_attribute_keys(self): +
436 XML = self.etree.XML + 437 + 438 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 439 keys = root.attrib.keys() + 440 keys.sort() + 441 self.assertEquals(['alpha', 'beta', 'gamma'], keys) +
442 +
443 - def test_attribute_keys2(self): +
444 XML = self.etree.XML + 445 + 446 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 447 keys = root.keys() + 448 keys.sort() + 449 self.assertEquals(['alpha', 'beta', 'gamma'], keys) +
450 +
451 - def test_attribute_items2(self): +
452 XML = self.etree.XML + 453 + 454 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 455 items = list(root.items()) + 456 items.sort() + 457 self.assertEquals( + 458 [('alpha','Alpha'), ('beta','Beta'), ('gamma','Gamma')], + 459 items) +
460 +
461 - def test_attribute_keys_ns(self): +
462 XML = self.etree.XML + 463 + 464 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 465 keys = root.keys() + 466 keys.sort() + 467 self.assertEquals(['bar', '{http://ns.codespeak.net/test}baz'], + 468 keys) +
469 +
470 - def test_attribute_values(self): +
471 XML = self.etree.XML + 472 + 473 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 474 values = root.attrib.values() + 475 values.sort() + 476 self.assertEquals(['Alpha', 'Beta', 'Gamma'], values) +
477 +
478 - def test_attribute_values_ns(self): +
479 XML = self.etree.XML + 480 + 481 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 482 values = root.attrib.values() + 483 values.sort() + 484 self.assertEquals( + 485 ['Bar', 'Baz'], values) +
486 +
487 - def test_attribute_items(self): +
488 XML = self.etree.XML + 489 + 490 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) + 491 items = list(root.attrib.items()) + 492 items.sort() + 493 self.assertEquals([ + 494 ('alpha', 'Alpha'), + 495 ('beta', 'Beta'), + 496 ('gamma', 'Gamma'), + 497 ], + 498 items) +
499 +
500 - def test_attribute_items_ns(self): +
501 XML = self.etree.XML + 502 + 503 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 504 items = list(root.attrib.items()) + 505 items.sort() + 506 self.assertEquals( + 507 [('bar', 'Bar'), ('{http://ns.codespeak.net/test}baz', 'Baz')], + 508 items) +
509 +
510 - def test_attribute_str(self): +
511 XML = self.etree.XML + 512 + 513 expected = "{'{http://ns.codespeak.net/test}baz': 'Baz', 'bar': 'Bar'}" + 514 alternative = "{'bar': 'Bar', '{http://ns.codespeak.net/test}baz': 'Baz'}" + 515 + 516 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 517 try: + 518 self.assertEquals(expected, str(root.attrib)) + 519 except AssertionError: + 520 self.assertEquals(alternative, str(root.attrib)) +
521 +
522 - def test_attribute_has_key(self): +
523 XML = self.etree.XML + 524 + 525 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 526 self.assertEquals( + 527 True, root.attrib.has_key('bar')) + 528 self.assertEquals( + 529 False, root.attrib.has_key('baz')) + 530 self.assertEquals( + 531 False, root.attrib.has_key('hah')) + 532 self.assertEquals( + 533 True, + 534 root.attrib.has_key('{http://ns.codespeak.net/test}baz')) +
535 +
536 - def test_attribute_contains(self): +
537 XML = self.etree.XML + 538 + 539 root = XML(_bytes('<foo bar="Bar" xmlns:ns="http://ns.codespeak.net/test" ns:baz="Baz" />')) + 540 self.assertEquals( + 541 True, 'bar' in root.attrib) + 542 self.assertEquals( + 543 False, 'baz' in root.attrib) + 544 self.assertEquals( + 545 False, 'hah' in root.attrib) + 546 self.assertEquals( + 547 True, + 548 '{http://ns.codespeak.net/test}baz' in root.attrib) +
549 +
550 - def test_attribute_set(self): +
551 Element = self.etree.Element + 552 + 553 root = Element("root") + 554 root.set("attr", "TEST") + 555 self.assertEquals("TEST", root.get("attr")) +
556 +
557 - def test_del_attribute_ns(self): +
558 Element = self.etree.Element + 559 + 560 a = Element('a') + 561 a.attrib['{http://a/}foo'] = 'Foo' + 562 a.attrib['{http://a/}bar'] = 'Bar' + 563 self.assertEquals(None, a.get('foo')) + 564 self.assertEquals('Foo', a.get('{http://a/}foo')) + 565 self.assertEquals('Foo', a.attrib['{http://a/}foo']) + 566 + 567 self.assertRaises(KeyError, operator.delitem, a.attrib, 'foo') + 568 self.assertEquals('Foo', a.attrib['{http://a/}foo']) + 569 + 570 del a.attrib['{http://a/}foo'] + 571 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') +
572 +
574 XML = self.etree.XML + 575 + 576 a = XML(_bytes('<a xmlns:nsa="http://a/" nsa:foo="FooNS" foo="Foo" />')) + 577 + 578 self.assertEquals('Foo', a.attrib['foo']) + 579 self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + 580 + 581 del a.attrib['foo'] + 582 self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + 583 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + 584 self.assertRaises(KeyError, operator.delitem, a.attrib, 'foo') + 585 + 586 del a.attrib['{http://a/}foo'] + 587 self.assertRaises(KeyError, operator.getitem, a.attrib, '{http://a/}foo') + 588 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + 589 + 590 a = XML(_bytes('<a xmlns:nsa="http://a/" foo="Foo" nsa:foo="FooNS" />')) + 591 + 592 self.assertEquals('Foo', a.attrib['foo']) + 593 self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + 594 + 595 del a.attrib['foo'] + 596 self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + 597 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + 598 + 599 del a.attrib['{http://a/}foo'] + 600 self.assertRaises(KeyError, operator.getitem, a.attrib, '{http://a/}foo') + 601 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') +
602 +
603 - def test_XML(self): +
604 XML = self.etree.XML + 605 + 606 root = XML(_bytes('<doc>This is a text.</doc>')) + 607 self.assertEquals(0, len(root)) + 608 self.assertEquals('This is a text.', root.text) +
609 +
610 - def test_XMLID(self): +
611 XMLID = self.etree.XMLID + 612 XML = self.etree.XML + 613 xml_text = _bytes(''' + 614 <document> + 615 <h1 id="chapter1">...</h1> + 616 <p id="note1" class="note">...</p> + 617 <p>Regular paragraph.</p> + 618 <p xml:id="xmlid">XML:ID paragraph.</p> + 619 <p id="warn1" class="warning">...</p> + 620 </document> + 621 ''') + 622 + 623 root, dic = XMLID(xml_text) + 624 root2 = XML(xml_text) + 625 self.assertEquals(self._writeElement(root), + 626 self._writeElement(root2)) + 627 expected = { + 628 "chapter1" : root[0], + 629 "note1" : root[1], + 630 "warn1" : root[4] + 631 } + 632 self.assertEquals(dic, expected) +
633 +
634 - def test_fromstring(self): +
635 fromstring = self.etree.fromstring + 636 + 637 root = fromstring('<doc>This is a text.</doc>') + 638 self.assertEquals(0, len(root)) + 639 self.assertEquals('This is a text.', root.text) +
640 +
641 - def test_fromstringlist(self): +
642 fromstringlist = self.etree.fromstringlist + 643 + 644 root = fromstringlist(["<do", "c>T", "hi", "s is", + 645 " a text.<", "/doc", ">"]) + 646 self.assertEquals(0, len(root)) + 647 self.assertEquals('This is a text.', root.text) +
648 +
650 fromstringlist = self.etree.fromstringlist + 651 + 652 root = fromstringlist(list('<doc>This is a text.</doc>')) + 653 self.assertEquals(0, len(root)) + 654 self.assertEquals('This is a text.', root.text) +
655 +
656 - def test_fromstringlist_single(self): +
657 fromstringlist = self.etree.fromstringlist + 658 + 659 root = fromstringlist(['<doc>This is a text.</doc>']) + 660 self.assertEquals(0, len(root)) + 661 self.assertEquals('This is a text.', root.text) +
662 +
663 - def test_iselement(self): +
664 iselement = self.etree.iselement + 665 Element = self.etree.Element + 666 ElementTree = self.etree.ElementTree + 667 XML = self.etree.XML + 668 Comment = self.etree.Comment + 669 ProcessingInstruction = self.etree.ProcessingInstruction + 670 + 671 el = Element('hoi') + 672 self.assert_(iselement(el)) + 673 + 674 el2 = XML(_bytes('<foo/>')) + 675 self.assert_(iselement(el2)) + 676 + 677 tree = ElementTree(element=Element('dag')) + 678 self.assert_(not iselement(tree)) + 679 self.assert_(iselement(tree.getroot())) + 680 + 681 c = Comment('test') + 682 self.assert_(iselement(c)) + 683 + 684 p = ProcessingInstruction("test", "some text") + 685 self.assert_(iselement(p)) +
686 +
687 - def test_iteration(self): +
688 XML = self.etree.XML + 689 + 690 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 691 result = [] + 692 for el in root: + 693 result.append(el.tag) + 694 self.assertEquals(['one', 'two', 'three'], result) +
695 +
696 - def test_iteration_empty(self): +
697 XML = self.etree.XML + 698 + 699 root = XML(_bytes('<doc></doc>')) + 700 result = [] + 701 for el in root: + 702 result.append(el.tag) + 703 self.assertEquals([], result) +
704 +
705 - def test_iteration_text_only(self): +
706 XML = self.etree.XML + 707 + 708 root = XML(_bytes('<doc>Text</doc>')) + 709 result = [] + 710 for el in root: + 711 result.append(el.tag) + 712 self.assertEquals([], result) +
713 +
714 - def test_iteration_crash(self): +
715 # this would cause a crash in the past + 716 fromstring = self.etree.fromstring + 717 root = etree.fromstring('<html><p></p>x</html>') + 718 for elem in root: + 719 elem.tail = '' +
720 +
721 - def test_iteration_reversed(self): +
722 XML = self.etree.XML + 723 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 724 result = [] + 725 for el in reversed(root): + 726 result.append(el.tag) + 727 self.assertEquals(['three', 'two', 'one'], result) +
728 +
729 - def test_iteration_subelement(self): +
730 XML = self.etree.XML + 731 + 732 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 733 result = [] + 734 add = True + 735 for el in root: + 736 result.append(el.tag) + 737 if add: + 738 self.etree.SubElement(root, 'four') + 739 add = False + 740 self.assertEquals(['one', 'two', 'three', 'four'], result) +
741 +
742 - def test_iteration_del_child(self): +
743 XML = self.etree.XML + 744 + 745 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) + 746 result = [] + 747 for el in root: + 748 result.append(el.tag) + 749 del root[-1] + 750 self.assertEquals(['one', 'two'], result) +
751 +
752 - def test_iteration_double(self): +
753 XML = self.etree.XML + 754 + 755 root = XML(_bytes('<doc><one/><two/></doc>')) + 756 result = [] + 757 for el0 in root: + 758 result.append(el0.tag) + 759 for el1 in root: + 760 result.append(el1.tag) + 761 self.assertEquals(['one','one', 'two', 'two', 'one', 'two'], result) +
762 +
763 - def test_attribute_iterator(self): +
764 XML = self.etree.XML + 765 + 766 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma" />')) + 767 result = [] + 768 for key in root.attrib: + 769 result.append(key) + 770 result.sort() + 771 self.assertEquals(['alpha', 'beta', 'gamma'], result) +
772 +
773 - def test_itertext(self): +
774 # ET 1.3+ + 775 XML = self.etree.XML + 776 root = XML(_bytes("<root>RTEXT<a></a>ATAIL<b/><c>CTEXT</c>CTAIL</root>")) + 777 + 778 text = list(root.itertext()) + 779 self.assertEquals(["RTEXT", "ATAIL", "CTEXT", "CTAIL"], + 780 text) +
781 +
782 - def test_itertext_child(self): +
783 # ET 1.3+ + 784 XML = self.etree.XML + 785 root = XML(_bytes("<root>RTEXT<a></a>ATAIL<b/><c>CTEXT</c>CTAIL</root>")) + 786 + 787 text = list(root[2].itertext()) + 788 self.assertEquals(["CTEXT"], + 789 text) +
790 +
791 - def test_findall(self): +
792 XML = self.etree.XML + 793 root = XML(_bytes('<a><b><c/></b><b/><c><b/></c></a>')) + 794 self.assertEquals(len(list(root.findall("c"))), 1) + 795 self.assertEquals(len(list(root.findall(".//c"))), 2) + 796 self.assertEquals(len(list(root.findall(".//b"))), 3) + 797 self.assertEquals(len(list(root.findall(".//b"))[0]), 1) + 798 self.assertEquals(len(list(root.findall(".//b"))[1]), 0) + 799 self.assertEquals(len(list(root.findall(".//b"))[2]), 0) +
800 +
801 - def test_findall_ns(self): +
802 XML = self.etree.XML + 803 root = XML(_bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>')) + 804 self.assertEquals(len(list(root.findall(".//{X}b"))), 2) + 805 self.assertEquals(len(list(root.findall(".//b"))), 3) + 806 self.assertEquals(len(list(root.findall("b"))), 2) +
807 +
809 Element = self.etree.Element + 810 + 811 el = Element('tag', foo='Foo', bar='Bar') + 812 self.assertEquals('Foo', el.attrib['foo']) + 813 self.assertEquals('Bar', el.attrib['bar']) +
814 +
816 Element = self.etree.Element + 817 + 818 el = Element('tag', {'foo':'Foo', 'bar':'Bar'}) + 819 self.assertEquals('Foo', el.attrib['foo']) + 820 self.assertEquals('Bar', el.attrib['bar']) +
821 +
823 Element = self.etree.Element + 824 + 825 el = Element('tag', {'{ns1}foo':'Foo', '{ns2}bar':'Bar'}) + 826 self.assertEquals('Foo', el.attrib['{ns1}foo']) + 827 self.assertEquals('Bar', el.attrib['{ns2}bar']) +
828 +
830 Element = self.etree.Element + 831 SubElement = self.etree.SubElement + 832 + 833 el = Element('tag') + 834 SubElement(el, 'foo', {'foo':'Foo'}, baz="Baz") + 835 self.assertEquals("Baz", el[0].attrib['baz']) + 836 self.assertEquals('Foo', el[0].attrib['foo']) +
837 +
839 Element = self.etree.Element + 840 SubElement = self.etree.SubElement + 841 + 842 el = Element('tag') + 843 SubElement(el, 'foo', {'{ns1}foo':'Foo', '{ns2}bar':'Bar'}) + 844 self.assertEquals('Foo', el[0].attrib['{ns1}foo']) + 845 self.assertEquals('Bar', el[0].attrib['{ns2}bar']) +
846 +
847 - def test_write(self): +
848 ElementTree = self.etree.ElementTree + 849 XML = self.etree.XML + 850 + 851 for i in range(10): + 852 f = BytesIO() + 853 root = XML(_bytes('<doc%s>This is a test.</doc%s>' % (i, i))) + 854 tree = ElementTree(element=root) + 855 tree.write(f) + 856 data = f.getvalue() + 857 self.assertEquals( + 858 _bytes('<doc%s>This is a test.</doc%s>' % (i, i)), + 859 canonicalize(data)) +
860 +
861 - def test_write_method_html(self): +
862 ElementTree = self.etree.ElementTree + 863 Element = self.etree.Element + 864 SubElement = self.etree.SubElement + 865 + 866 html = Element('html') + 867 body = SubElement(html, 'body') + 868 p = SubElement(body, 'p') + 869 p.text = "html" + 870 SubElement(p, 'br').tail = "test" + 871 + 872 tree = ElementTree(element=html) + 873 f = BytesIO() + 874 tree.write(f, method="html") + 875 data = f.getvalue().replace(_bytes('\n'),_bytes('')) + 876 + 877 self.assertEquals(_bytes('<html><body><p>html<br>test</p></body></html>'), + 878 data) +
879 +
880 - def test_write_method_text(self): +
881 ElementTree = self.etree.ElementTree + 882 Element = self.etree.Element + 883 SubElement = self.etree.SubElement + 884 + 885 a = Element('a') + 886 a.text = "A" + 887 a.tail = "tail" + 888 b = SubElement(a, 'b') + 889 b.text = "B" + 890 b.tail = "TAIL" + 891 c = SubElement(a, 'c') + 892 c.text = "C" + 893 + 894 tree = ElementTree(element=a) + 895 f = BytesIO() + 896 tree.write(f, method="text") + 897 data = f.getvalue() + 898 + 899 self.assertEquals(_bytes('ABTAILCtail'), + 900 data) +
901 +
902 - def test_write_fail(self): +
903 ElementTree = self.etree.ElementTree + 904 XML = self.etree.XML + 905 + 906 tree = ElementTree( XML(_bytes('<doc>This is a test.</doc>')) ) + 907 self.assertRaises(IOError, tree.write, + 908 "definitely////\\-\\nonexisting\\-\\////FILE") +
909 + 910 # this could trigger a crash, apparently because the document + 911 # reference was prematurely garbage collected +
912 - def test_crash(self): +
913 Element = self.etree.Element + 914 + 915 element = Element('tag') + 916 for i in range(10): + 917 element.attrib['key'] = 'value' + 918 value = element.attrib['key'] + 919 self.assertEquals(value, 'value') +
920 + 921 # from doctest; for some reason this caused crashes too +
923 Element = self.etree.Element + 924 ElementTree = self.etree.ElementTree + 925 + 926 f = BytesIO() + 927 for i in range(10): + 928 element = Element('tag%s' % i) + 929 self._check_element(element) + 930 tree = ElementTree(element) + 931 tree.write(f) + 932 self._check_element_tree(tree) +
933 +
934 - def test_subelement_reference(self): +
935 Element = self.etree.Element + 936 SubElement = self.etree.SubElement + 937 + 938 el = Element('foo') + 939 el2 = SubElement(el, 'bar') + 940 el3 = SubElement(el2, 'baz') + 941 + 942 al = Element('foo2') + 943 al2 = SubElement(al, 'bar2') + 944 al3 = SubElement(al2, 'baz2') + 945 + 946 # now move al2 into el + 947 el.append(al2) + 948 + 949 # now change al3 directly + 950 al3.text = 'baz2-modified' + 951 + 952 # it should have changed through this route too + 953 self.assertEquals( + 954 'baz2-modified', + 955 el[1][0].text) +
956 +
957 - def test_set_text(self): +
958 Element = self.etree.Element + 959 SubElement = self.etree.SubElement + 960 + 961 a = Element('a') + 962 b = SubElement(a, 'b') + 963 a.text = 'hoi' + 964 self.assertEquals( + 965 'hoi', + 966 a.text) + 967 self.assertEquals( + 968 'b', + 969 a[0].tag) +
970 +
971 - def test_set_text2(self): +
972 Element = self.etree.Element + 973 SubElement = self.etree.SubElement + 974 + 975 a = Element('a') + 976 a.text = 'hoi' + 977 b = SubElement(a ,'b') + 978 self.assertEquals( + 979 'hoi', + 980 a.text) + 981 self.assertEquals( + 982 'b', + 983 a[0].tag) +
984 +
985 - def test_set_text_none(self): +
986 Element = self.etree.Element + 987 + 988 a = Element('a') + 989 + 990 a.text = 'foo' + 991 a.text = None + 992 + 993 self.assertEquals( + 994 None, + 995 a.text) + 996 self.assertXML(_bytes('<a></a>'), a) +
997 +
998 - def test_set_text_empty(self): +
999 Element = self.etree.Element +1000 +1001 a = Element('a') +1002 self.assertEquals(None, a.text) +1003 +1004 a.text = '' +1005 self.assertEquals('', a.text) +1006 self.assertXML(_bytes('<a></a>'), a) +
1007 +
1008 - def test_tail1(self): +
1009 Element = self.etree.Element +1010 SubElement = self.etree.SubElement +1011 +1012 a = Element('a') +1013 a.tail = 'dag' +1014 self.assertEquals('dag', +1015 a.tail) +1016 b = SubElement(a, 'b') +1017 b.tail = 'hoi' +1018 self.assertEquals('hoi', +1019 b.tail) +1020 self.assertEquals('dag', +1021 a.tail) +
1022 +
1023 - def test_tail_append(self): +
1024 Element = self.etree.Element +1025 +1026 a = Element('a') +1027 b = Element('b') +1028 b.tail = 'b_tail' +1029 a.append(b) +1030 self.assertEquals('b_tail', +1031 b.tail) +
1032 +
1033 - def test_tail_set_twice(self): +
1034 Element = self.etree.Element +1035 SubElement = self.etree.SubElement +1036 +1037 a = Element('a') +1038 b = SubElement(a, 'b') +1039 b.tail = 'foo' +1040 b.tail = 'bar' +1041 self.assertEquals('bar', +1042 b.tail) +1043 self.assertXML(_bytes('<a><b></b>bar</a>'), a) +
1044 +
1045 - def test_tail_set_none(self): +
1046 Element = self.etree.Element +1047 a = Element('a') +1048 a.tail = 'foo' +1049 a.tail = None +1050 self.assertEquals( +1051 None, +1052 a.tail) +1053 self.assertXML(_bytes('<a></a>'), a) +
1054 +
1055 - def test_extend(self): +
1056 root = self.etree.Element('foo') +1057 for i in range(3): +1058 element = self.etree.SubElement(root, 'a%s' % i) +1059 element.text = "text%d" % i +1060 element.tail = "tail%d" % i +1061 +1062 elements = [] +1063 for i in range(3): +1064 new_element = self.etree.Element("test%s" % i) +1065 new_element.text = "TEXT%s" % i +1066 new_element.tail = "TAIL%s" % i +1067 elements.append(new_element) +1068 +1069 root.extend(elements) +1070 +1071 self.assertEquals( +1072 ["a0", "a1", "a2", "test0", "test1", "test2"], +1073 [ el.tag for el in root ]) +1074 self.assertEquals( +1075 ["text0", "text1", "text2", "TEXT0", "TEXT1", "TEXT2"], +1076 [ el.text for el in root ]) +1077 self.assertEquals( +1078 ["tail0", "tail1", "tail2", "TAIL0", "TAIL1", "TAIL2"], +1079 [ el.tail for el in root ]) +
1080 +
1081 - def test_comment(self): +
1082 Element = self.etree.Element +1083 SubElement = self.etree.SubElement +1084 Comment = self.etree.Comment +1085 +1086 a = Element('a') +1087 a.append(Comment('foo')) +1088 self.assertEquals(a[0].tag, Comment) +1089 self.assertEquals(a[0].text, 'foo') +
1090 +1091 # ElementTree < 1.3 adds whitespace around comments +
1092 - def test_comment_text(self): +
1093 Element = self.etree.Element +1094 SubElement = self.etree.SubElement +1095 Comment = self.etree.Comment +1096 tostring = self.etree.tostring +1097 +1098 a = Element('a') +1099 a.append(Comment('foo')) +1100 self.assertEquals(a[0].text, 'foo') +1101 +1102 self.assertEquals( +1103 _bytes('<a><!--foo--></a>'), +1104 tostring(a)) +1105 +1106 a[0].text = "TEST" +1107 self.assertEquals(a[0].text, 'TEST') +1108 +1109 self.assertEquals( +1110 _bytes('<a><!--TEST--></a>'), +1111 tostring(a)) +
1112 +1113 # ElementTree < 1.3 adds whitespace around comments +
1114 - def test_comment_whitespace(self): +
1115 Element = self.etree.Element +1116 SubElement = self.etree.SubElement +1117 Comment = self.etree.Comment +1118 tostring = self.etree.tostring +1119 +1120 a = Element('a') +1121 a.append(Comment(' foo ')) +1122 self.assertEquals(a[0].text, ' foo ') +1123 self.assertEquals( +1124 _bytes('<a><!-- foo --></a>'), +1125 tostring(a)) +
1126 +
1127 - def test_comment_nonsense(self): +
1128 Comment = self.etree.Comment +1129 c = Comment('foo') +1130 self.assertEquals({}, c.attrib) +1131 self.assertEquals([], list(c.keys())) +1132 self.assertEquals([], list(c.items())) +1133 self.assertEquals(None, c.get('hoi')) +1134 self.assertEquals(0, len(c)) +1135 # should not iterate +1136 for i in c: +1137 pass +
1138 +
1139 - def test_pi(self): +
1140 # lxml.etree separates target and text +1141 Element = self.etree.Element +1142 SubElement = self.etree.SubElement +1143 ProcessingInstruction = self.etree.ProcessingInstruction +1144 +1145 a = Element('a') +1146 a.append(ProcessingInstruction('foo', 'some more text')) +1147 self.assertEquals(a[0].tag, ProcessingInstruction) +1148 self.assertXML(_bytes("<a><?foo some more text?></a>"), +1149 a) +
1150 +
1151 - def test_processinginstruction(self): +
1152 # lxml.etree separates target and text +1153 Element = self.etree.Element +1154 SubElement = self.etree.SubElement +1155 ProcessingInstruction = self.etree.PI +1156 +1157 a = Element('a') +1158 a.append(ProcessingInstruction('foo', 'some more text')) +1159 self.assertEquals(a[0].tag, ProcessingInstruction) +1160 self.assertXML(_bytes("<a><?foo some more text?></a>"), +1161 a) +
1162 +
1163 - def test_pi_nonsense(self): +
1164 ProcessingInstruction = self.etree.ProcessingInstruction +1165 pi = ProcessingInstruction('foo') +1166 self.assertEquals({}, pi.attrib) +1167 self.assertEquals([], list(pi.keys())) +1168 self.assertEquals([], list(pi.items())) +1169 self.assertEquals(None, pi.get('hoi')) +1170 self.assertEquals(0, len(pi)) +1171 # should not iterate +1172 for i in pi: +1173 pass +
1174 +
1175 - def test_setitem(self): +
1176 Element = self.etree.Element +1177 SubElement = self.etree.SubElement +1178 +1179 a = Element('a') +1180 b = SubElement(a, 'b') +1181 c = Element('c') +1182 a[0] = c +1183 self.assertEquals( +1184 c, +1185 a[0]) +1186 self.assertXML(_bytes('<a><c></c></a>'), +1187 a) +1188 self.assertXML(_bytes('<b></b>'), +1189 b) +
1190 +
1191 - def test_setitem2(self): +
1192 Element = self.etree.Element +1193 SubElement = self.etree.SubElement +1194 +1195 a = Element('a') +1196 for i in range(5): +1197 b = SubElement(a, 'b%s' % i) +1198 c = SubElement(b, 'c') +1199 for i in range(5): +1200 d = Element('d') +1201 e = SubElement(d, 'e') +1202 a[i] = d +1203 self.assertXML( +1204 _bytes('<a><d><e></e></d><d><e></e></d><d><e></e></d><d><e></e></d><d><e></e></d></a>'), +1205 a) +1206 self.assertXML(_bytes('<c></c>'), +1207 c) +
1208 +
1209 - def test_setitem_replace(self): +
1210 Element = self.etree.Element +1211 SubElement = self.etree.SubElement +1212 +1213 a = Element('a') +1214 SubElement(a, 'b') +1215 d = Element('d') +1216 a[0] = d +1217 self.assertXML(_bytes('<a><d></d></a>'), a) +
1218 +
1219 - def test_setitem_indexerror(self): +
1220 Element = self.etree.Element +1221 SubElement = self.etree.SubElement +1222 +1223 a = Element('a') +1224 b = SubElement(a, 'b') +1225 +1226 self.assertRaises(IndexError, operator.setitem, a, 1, Element('c')) +
1227 +
1228 - def test_setitem_tail(self): +
1229 Element = self.etree.Element +1230 SubElement = self.etree.SubElement +1231 +1232 a = Element('a') +1233 b = SubElement(a, 'b') +1234 b.tail = 'B2' +1235 c = Element('c') +1236 c.tail = 'C2' +1237 +1238 a[0] = c +1239 self.assertXML( +1240 _bytes('<a><c></c>C2</a>'), +1241 a) +
1242 +
1243 - def test_tag_write(self): +
1244 Element = self.etree.Element +1245 SubElement = self.etree.SubElement +1246 +1247 a = Element('a') +1248 b = SubElement(a, 'b') +1249 +1250 a.tag = 'c' +1251 +1252 self.assertEquals( +1253 'c', +1254 a.tag) +1255 +1256 self.assertXML( +1257 _bytes('<c><b></b></c>'), +1258 a) +
1259 +
1260 - def test_tag_reset_ns(self): +
1261 Element = self.etree.Element +1262 SubElement = self.etree.SubElement +1263 tostring = self.etree.tostring +1264 +1265 a = Element('{a}a') +1266 b1 = SubElement(a, '{a}b') +1267 b2 = SubElement(a, '{b}b') +1268 +1269 self.assertEquals('{a}b', b1.tag) +1270 +1271 b1.tag = 'c' +1272 +1273 # can't use C14N here! +1274 self.assertEquals('c', b1.tag) +1275 self.assertEquals(_bytes('<c'), tostring(b1)[:2]) +1276 self.assert_(_bytes('<c') in tostring(a)) +
1277 +
1278 - def test_tag_reset_root_ns(self): +
1279 Element = self.etree.Element +1280 SubElement = self.etree.SubElement +1281 tostring = self.etree.tostring +1282 +1283 a = Element('{a}a') +1284 b1 = SubElement(a, '{a}b') +1285 b2 = SubElement(a, '{b}b') +1286 +1287 a.tag = 'c' +1288 +1289 self.assertEquals( +1290 'c', +1291 a.tag) +1292 +1293 # can't use C14N here! +1294 self.assertEquals('c', a.tag) +1295 self.assertEquals(_bytes('<c'), tostring(a)[:2]) +
1296 +
1297 - def test_tag_str_subclass(self): +
1298 Element = self.etree.Element +1299 +1300 class strTest(str): +1301 pass +
1302 +1303 a = Element("a") +1304 a.tag = strTest("TAG") +1305 self.assertXML(_bytes('<TAG></TAG>'), +1306 a) +1307 +
1308 - def test_delitem(self): +
1309 Element = self.etree.Element +1310 SubElement = self.etree.SubElement +1311 +1312 a = Element('a') +1313 b = SubElement(a, 'b') +1314 c = SubElement(a, 'c') +1315 d = SubElement(a, 'd') +1316 +1317 del a[1] +1318 self.assertXML( +1319 _bytes('<a><b></b><d></d></a>'), +1320 a) +1321 +1322 del a[0] +1323 self.assertXML( +1324 _bytes('<a><d></d></a>'), +1325 a) +1326 +1327 del a[0] +1328 self.assertXML( +1329 _bytes('<a></a>'), +1330 a) +1331 # move deleted element into other tree afterwards +1332 other = Element('other') +1333 other.append(c) +1334 self.assertXML( +1335 _bytes('<other><c></c></other>'), +1336 other) +
1337 +
1338 - def test_del_insert(self): +
1339 Element = self.etree.Element +1340 SubElement = self.etree.SubElement +1341 +1342 a = Element('a') +1343 b = SubElement(a, 'b') +1344 bs = SubElement(b, 'bs') +1345 c = SubElement(a, 'c') +1346 cs = SubElement(c, 'cs') +1347 +1348 el = a[0] +1349 self.assertXML( +1350 _bytes('<a><b><bs></bs></b><c><cs></cs></c></a>'), +1351 a) +1352 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1353 self.assertXML(_bytes('<c><cs></cs></c>'), c) +1354 +1355 del a[0] +1356 self.assertXML( +1357 _bytes('<a><c><cs></cs></c></a>'), +1358 a) +1359 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1360 self.assertXML(_bytes('<c><cs></cs></c>'), c) +1361 +1362 a.insert(0, el) +1363 self.assertXML( +1364 _bytes('<a><b><bs></bs></b><c><cs></cs></c></a>'), +1365 a) +1366 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1367 self.assertXML(_bytes('<c><cs></cs></c>'), c) +
1368 +
1369 - def test_del_setitem(self): +
1370 Element = self.etree.Element +1371 SubElement = self.etree.SubElement +1372 +1373 a = Element('a') +1374 b = SubElement(a, 'b') +1375 bs = SubElement(b, 'bs') +1376 c = SubElement(a, 'c') +1377 cs = SubElement(c, 'cs') +1378 +1379 el = a[0] +1380 del a[0] +1381 a[0] = el +1382 self.assertXML( +1383 _bytes('<a><b><bs></bs></b></a>'), +1384 a) +1385 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1386 self.assertXML(_bytes('<c><cs></cs></c>'), c) +
1387 +
1388 - def test_del_setslice(self): +
1389 Element = self.etree.Element +1390 SubElement = self.etree.SubElement +1391 +1392 a = Element('a') +1393 b = SubElement(a, 'b') +1394 bs = SubElement(b, 'bs') +1395 c = SubElement(a, 'c') +1396 cs = SubElement(c, 'cs') +1397 +1398 el = a[0] +1399 del a[0] +1400 a[0:0] = [el] +1401 self.assertXML( +1402 _bytes('<a><b><bs></bs></b><c><cs></cs></c></a>'), +1403 a) +1404 self.assertXML(_bytes('<b><bs></bs></b>'), b) +1405 self.assertXML(_bytes('<c><cs></cs></c>'), c) +
1406 +
1407 - def test_replace_slice_tail(self): +
1408 XML = self.etree.XML +1409 a = XML(_bytes('<a><b></b>B2<c></c>C2</a>')) +1410 b, c = a +1411 +1412 a[:] = [] +1413 +1414 self.assertEquals("B2", b.tail) +1415 self.assertEquals("C2", c.tail) +
1416 +
1418 XML = self.etree.XML +1419 root = XML(_bytes( +1420 '<foo><bar xmlns:baz="http://huhu"><puh><baz:bump1 /><baz:bump2 /></puh></bar></foo>')) +1421 root[:] = root.findall('.//puh') # delete bar from hierarchy +1422 +1423 # previously, this lost a namespace declaration on bump2 +1424 result = self.etree.tostring(root) +1425 foo = self.etree.fromstring(result) +1426 +1427 self.assertEquals('puh', foo[0].tag) +1428 self.assertEquals('{http://huhu}bump1', foo[0][0].tag) +1429 self.assertEquals('{http://huhu}bump2', foo[0][1].tag) +
1430 +
1431 - def test_delitem_tail(self): +
1432 ElementTree = self.etree.ElementTree +1433 f = BytesIO('<a><b></b>B2<c></c>C2</a>') +1434 doc = ElementTree(file=f) +1435 a = doc.getroot() +1436 del a[0] +1437 self.assertXML( +1438 _bytes('<a><c></c>C2</a>'), +1439 a) +
1440 +
1441 - def test_clear(self): +
1442 Element = self.etree.Element +1443 +1444 a = Element('a') +1445 a.text = 'foo' +1446 a.tail = 'bar' +1447 a.set('hoi', 'dag') +1448 a.clear() +1449 self.assertEquals(None, a.text) +1450 self.assertEquals(None, a.tail) +1451 self.assertEquals(None, a.get('hoi')) +1452 self.assertEquals('a', a.tag) +
1453 +
1454 - def test_clear_sub(self): +
1455 Element = self.etree.Element +1456 SubElement = self.etree.SubElement +1457 +1458 a = Element('a') +1459 a.text = 'foo' +1460 a.tail = 'bar' +1461 a.set('hoi', 'dag') +1462 b = SubElement(a, 'b') +1463 c = SubElement(b, 'c') +1464 a.clear() +1465 self.assertEquals(None, a.text) +1466 self.assertEquals(None, a.tail) +1467 self.assertEquals(None, a.get('hoi')) +1468 self.assertEquals('a', a.tag) +1469 self.assertEquals(0, len(a)) +1470 self.assertXML(_bytes('<a></a>'), +1471 a) +1472 self.assertXML(_bytes('<b><c></c></b>'), +1473 b) +
1474 +
1475 - def test_clear_tail(self): +
1476 ElementTree = self.etree.ElementTree +1477 f = BytesIO('<a><b></b>B2<c></c>C2</a>') +1478 doc = ElementTree(file=f) +1479 a = doc.getroot() +1480 a.clear() +1481 self.assertXML( +1482 _bytes('<a></a>'), +1483 a) +
1484 +
1485 - def test_insert(self): +
1486 Element = self.etree.Element +1487 SubElement = self.etree.SubElement +1488 +1489 a = Element('a') +1490 b = SubElement(a, 'b') +1491 c = SubElement(a, 'c') +1492 d = Element('d') +1493 a.insert(0, d) +1494 +1495 self.assertEquals( +1496 d, +1497 a[0]) +1498 +1499 self.assertXML( +1500 _bytes('<a><d></d><b></b><c></c></a>'), +1501 a) +1502 +1503 e = Element('e') +1504 a.insert(2, e) +1505 self.assertEquals( +1506 e, +1507 a[2]) +1508 self.assertXML( +1509 _bytes('<a><d></d><b></b><e></e><c></c></a>'), +1510 a) +
1511 +
1512 - def test_insert_beyond_index(self): +
1513 Element = self.etree.Element +1514 SubElement = self.etree.SubElement +1515 +1516 a = Element('a') +1517 b = SubElement(a, 'b') +1518 c = Element('c') +1519 +1520 a.insert(2, c) +1521 self.assertEquals( +1522 c, +1523 a[1]) +1524 self.assertXML( +1525 _bytes('<a><b></b><c></c></a>'), +1526 a) +
1527 +
1528 - def test_insert_negative(self): +
1529 Element = self.etree.Element +1530 SubElement = self.etree.SubElement +1531 +1532 a = Element('a') +1533 b = SubElement(a, 'b') +1534 c = SubElement(a, 'c') +1535 +1536 d = Element('d') +1537 a.insert(-1, d) +1538 self.assertEquals( +1539 d, +1540 a[-2]) +1541 self.assertXML( +1542 _bytes('<a><b></b><d></d><c></c></a>'), +1543 a) +
1544 +
1545 - def test_insert_tail(self): +
1546 Element = self.etree.Element +1547 SubElement = self.etree.SubElement +1548 +1549 a = Element('a') +1550 b = SubElement(a, 'b') +1551 +1552 c = Element('c') +1553 c.tail = 'C2' +1554 +1555 a.insert(0, c) +1556 self.assertXML( +1557 _bytes('<a><c></c>C2<b></b></a>'), +1558 a) +
1559 +
1560 - def test_remove(self): +
1561 Element = self.etree.Element +1562 SubElement = self.etree.SubElement +1563 +1564 a = Element('a') +1565 b = SubElement(a, 'b') +1566 c = SubElement(a, 'c') +1567 +1568 a.remove(b) +1569 self.assertEquals( +1570 c, +1571 a[0]) +1572 self.assertXML( +1573 _bytes('<a><c></c></a>'), +1574 a) +
1575 +
1576 - def test_remove_ns(self): +
1577 Element = self.etree.Element +1578 SubElement = self.etree.SubElement +1579 +1580 a = Element('{http://test}a') +1581 b = SubElement(a, '{http://test}b') +1582 c = SubElement(a, '{http://test}c') +1583 +1584 a.remove(b) +1585 self.assertXML( +1586 _bytes('<ns0:a xmlns:ns0="http://test"><ns0:c></ns0:c></ns0:a>'), +1587 a) +1588 self.assertXML( +1589 _bytes('<ns0:b xmlns:ns0="http://test"></ns0:b>'), +1590 b) +
1591 +
1592 - def test_remove_nonexisting(self): +
1593 Element = self.etree.Element +1594 SubElement = self.etree.SubElement +1595 +1596 a = Element('a') +1597 b = SubElement(a, 'b') +1598 c = SubElement(a, 'c') +1599 d = Element('d') +1600 self.assertRaises( +1601 ValueError, a.remove, d) +
1602 +
1603 - def test_remove_tail(self): +
1604 Element = self.etree.Element +1605 SubElement = self.etree.SubElement +1606 +1607 a = Element('a') +1608 b = SubElement(a, 'b') +1609 b.tail = 'b2' +1610 a.remove(b) +1611 self.assertXML( +1612 _bytes('<a></a>'), +1613 a) +1614 self.assertEquals('b2', b.tail) +
1615 +
1616 - def _test_getchildren(self): +
1617 Element = self.etree.Element +1618 SubElement = self.etree.SubElement +1619 +1620 a = Element('a') +1621 b = SubElement(a, 'b') +1622 c = SubElement(a, 'c') +1623 d = SubElement(b, 'd') +1624 e = SubElement(c, 'e') +1625 self.assertXML( +1626 _bytes('<a><b><d></d></b><c><e></e></c></a>'), +1627 a) +1628 self.assertEquals( +1629 [b, c], +1630 a.getchildren()) +1631 self.assertEquals( +1632 [d], +1633 b.getchildren()) +1634 self.assertEquals( +1635 [], +1636 d.getchildren()) +
1637 +
1638 - def test_makeelement(self): +
1639 Element = self.etree.Element +1640 +1641 a = Element('a') +1642 b = a.makeelement('c', {'hoi':'dag'}) +1643 self.assertXML( +1644 _bytes('<c hoi="dag"></c>'), +1645 b) +
1646 +
1647 - def test_iter(self): +
1648 Element = self.etree.Element +1649 SubElement = self.etree.SubElement +1650 +1651 a = Element('a') +1652 b = SubElement(a, 'b') +1653 c = SubElement(a, 'c') +1654 d = SubElement(b, 'd') +1655 e = SubElement(c, 'e') +1656 +1657 self.assertEquals( +1658 [a, b, d, c, e], +1659 list(a.iter())) +1660 self.assertEquals( +1661 [d], +1662 list(d.iter())) +
1663 +
1664 - def test_getiterator(self): +
1665 Element = self.etree.Element +1666 SubElement = self.etree.SubElement +1667 +1668 a = Element('a') +1669 b = SubElement(a, 'b') +1670 c = SubElement(a, 'c') +1671 d = SubElement(b, 'd') +1672 e = SubElement(c, 'e') +1673 +1674 self.assertEquals( +1675 [a, b, d, c, e], +1676 list(a.getiterator())) +1677 self.assertEquals( +1678 [d], +1679 list(d.getiterator())) +
1680 +
1681 - def test_getiterator_empty(self): +
1682 Element = self.etree.Element +1683 SubElement = self.etree.SubElement +1684 +1685 a = Element('a') +1686 b = SubElement(a, 'b') +1687 c = SubElement(a, 'c') +1688 d = SubElement(b, 'd') +1689 e = SubElement(c, 'e') +1690 +1691 self.assertEquals( +1692 [], +1693 list(a.getiterator('none'))) +1694 self.assertEquals( +1695 [], +1696 list(e.getiterator('none'))) +1697 self.assertEquals( +1698 [e], +1699 list(e.getiterator())) +
1700 +
1701 - def test_getiterator_filter(self): +
1702 Element = self.etree.Element +1703 SubElement = self.etree.SubElement +1704 +1705 a = Element('a') +1706 b = SubElement(a, 'b') +1707 c = SubElement(a, 'c') +1708 d = SubElement(b, 'd') +1709 e = SubElement(c, 'e') +1710 +1711 self.assertEquals( +1712 [a], +1713 list(a.getiterator('a'))) +1714 a2 = SubElement(e, 'a') +1715 self.assertEquals( +1716 [a, a2], +1717 list(a.getiterator('a'))) +1718 self.assertEquals( +1719 [a2], +1720 list(c.getiterator('a'))) +
1721 +
1722 - def test_getiterator_filter_all(self): +
1723 Element = self.etree.Element +1724 SubElement = self.etree.SubElement +1725 +1726 a = Element('a') +1727 b = SubElement(a, 'b') +1728 c = SubElement(a, 'c') +1729 d = SubElement(b, 'd') +1730 e = SubElement(c, 'e') +1731 +1732 self.assertEquals( +1733 [a, b, d, c, e], +1734 list(a.getiterator('*'))) +
1735 +
1737 Element = self.etree.Element +1738 Comment = self.etree.Comment +1739 SubElement = self.etree.SubElement +1740 +1741 a = Element('a') +1742 b = SubElement(a, 'b') +1743 comment_b = Comment("TEST-b") +1744 b.append(comment_b) +1745 +1746 self.assertEquals( +1747 [comment_b], +1748 list(a.getiterator(Comment))) +1749 +1750 comment_a = Comment("TEST-a") +1751 a.append(comment_a) +1752 +1753 self.assertEquals( +1754 [comment_b, comment_a], +1755 list(a.getiterator(Comment))) +1756 +1757 self.assertEquals( +1758 [comment_b], +1759 list(b.getiterator(Comment))) +
1760 +
1761 - def test_getiterator_filter_pi(self): +
1762 Element = self.etree.Element +1763 PI = self.etree.ProcessingInstruction +1764 SubElement = self.etree.SubElement +1765 +1766 a = Element('a') +1767 b = SubElement(a, 'b') +1768 pi_b = PI("TEST-b") +1769 b.append(pi_b) +1770 +1771 self.assertEquals( +1772 [pi_b], +1773 list(a.getiterator(PI))) +1774 +1775 pi_a = PI("TEST-a") +1776 a.append(pi_a) +1777 +1778 self.assertEquals( +1779 [pi_b, pi_a], +1780 list(a.getiterator(PI))) +1781 +1782 self.assertEquals( +1783 [pi_b], +1784 list(b.getiterator(PI))) +
1785 +
1786 - def test_getiterator_with_text(self): +
1787 Element = self.etree.Element +1788 SubElement = self.etree.SubElement +1789 +1790 a = Element('a') +1791 a.text = 'a' +1792 b = SubElement(a, 'b') +1793 b.text = 'b' +1794 b.tail = 'b1' +1795 c = SubElement(a, 'c') +1796 c.text = 'c' +1797 c.tail = 'c1' +1798 d = SubElement(b, 'd') +1799 c.text = 'd' +1800 c.tail = 'd1' +1801 e = SubElement(c, 'e') +1802 e.text = 'e' +1803 e.tail = 'e1' +1804 +1805 self.assertEquals( +1806 [a, b, d, c, e], +1807 list(a.getiterator())) +
1808 #self.assertEquals( +1809 # [d], +1810 # list(d.getiterator())) +1811 +
1813 Element = self.etree.Element +1814 SubElement = self.etree.SubElement +1815 +1816 a = Element('a') +1817 a.text = 'a' +1818 b = SubElement(a, 'b') +1819 b.text = 'b' +1820 b.tail = 'b1' +1821 c = SubElement(a, 'c') +1822 c.text = 'c' +1823 c.tail = 'c1' +1824 d = SubElement(b, 'd') +1825 c.text = 'd' +1826 c.tail = 'd1' +1827 e = SubElement(c, 'e') +1828 e.text = 'e' +1829 e.tail = 'e1' +1830 +1831 self.assertEquals( +1832 [a], +1833 list(a.getiterator('a'))) +1834 a2 = SubElement(e, 'a') +1835 self.assertEquals( +1836 [a, a2], +1837 list(a.getiterator('a'))) +1838 self.assertEquals( +1839 [a2], +1840 list(e.getiterator('a'))) +
1841 +
1842 - def test_attribute_manipulation(self): +
1843 Element = self.etree.Element +1844 +1845 a = Element('a') +1846 a.attrib['foo'] = 'Foo' +1847 a.attrib['bar'] = 'Bar' +1848 self.assertEquals('Foo', a.attrib['foo']) +1849 del a.attrib['foo'] +1850 self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') +
1851 +
1852 - def test_getslice(self): +
1853 Element = self.etree.Element +1854 SubElement = self.etree.SubElement +1855 +1856 a = Element('a') +1857 b = SubElement(a, 'b') +1858 c = SubElement(a, 'c') +1859 d = SubElement(a, 'd') +1860 +1861 self.assertEquals( +1862 [b, c], +1863 a[0:2]) +1864 self.assertEquals( +1865 [b, c, d], +1866 a[:]) +1867 self.assertEquals( +1868 [b, c, d], +1869 a[:10]) +1870 self.assertEquals( +1871 [b], +1872 a[0:1]) +1873 self.assertEquals( +1874 [], +1875 a[10:12]) +
1876 +
1877 - def test_getslice_negative(self): +
1878 Element = self.etree.Element +1879 SubElement = self.etree.SubElement +1880 +1881 a = Element('a') +1882 b = SubElement(a, 'b') +1883 c = SubElement(a, 'c') +1884 d = SubElement(a, 'd') +1885 +1886 self.assertEquals( +1887 [d], +1888 a[-1:]) +1889 self.assertEquals( +1890 [c, d], +1891 a[-2:]) +1892 self.assertEquals( +1893 [c], +1894 a[-2:-1]) +1895 self.assertEquals( +1896 [b, c], +1897 a[-3:-1]) +1898 self.assertEquals( +1899 [b, c], +1900 a[-3:2]) +
1901 +
1902 - def test_getslice_step(self): +
1903 Element = self.etree.Element +1904 SubElement = self.etree.SubElement +1905 +1906 a = Element('a') +1907 b = SubElement(a, 'b') +1908 c = SubElement(a, 'c') +1909 d = SubElement(a, 'd') +1910 e = SubElement(a, 'e') +1911 +1912 self.assertEquals( +1913 [e,d,c,b], +1914 a[::-1]) +1915 self.assertEquals( +1916 [b,d], +1917 a[::2]) +1918 self.assertEquals( +1919 [e,c], +1920 a[::-2]) +1921 self.assertEquals( +1922 [d,c], +1923 a[-2:0:-1]) +1924 self.assertEquals( +1925 [e], +1926 a[:1:-2]) +
1927 +
1928 - def test_getslice_text(self): +
1929 ElementTree = self.etree.ElementTree +1930 +1931 f = BytesIO('<a><b>B</b>B1<c>C</c>C1</a>') +1932 doc = ElementTree(file=f) +1933 a = doc.getroot() +1934 b = a[0] +1935 c = a[1] +1936 self.assertEquals( +1937 [b, c], +1938 a[:]) +1939 self.assertEquals( +1940 [b], +1941 a[0:1]) +1942 self.assertEquals( +1943 [c], +1944 a[1:]) +
1945 +
1947 Element = self.etree.Element +1948 Comment = self.etree.Comment +1949 SubElement = self.etree.SubElement +1950 +1951 a = Element('a') +1952 b = SubElement(a, 'b') +1953 foo = Comment('foo') +1954 a.append(foo) +1955 c = SubElement(a, 'c') +1956 self.assertEquals( +1957 [b, foo, c], +1958 a[:]) +1959 self.assertEquals( +1960 foo, +1961 a[1]) +1962 a[1] = new = Element('new') +1963 self.assertEquals( +1964 new, +1965 a[1]) +1966 self.assertXML( +1967 _bytes('<a><b></b><new></new><c></c></a>'), +1968 a) +
1969 +
1970 - def test_delslice(self): +
1971 Element = self.etree.Element +1972 SubElement = self.etree.SubElement +1973 +1974 a = Element('a') +1975 b = SubElement(a, 'b') +1976 c = SubElement(a, 'c') +1977 d = SubElement(a, 'd') +1978 e = SubElement(a, 'e') +1979 +1980 del a[1:3] +1981 self.assertEquals( +1982 [b, e], +1983 list(a)) +
1984 +
1985 - def test_delslice_negative1(self): +
1986 Element = self.etree.Element +1987 SubElement = self.etree.SubElement +1988 +1989 a = Element('a') +1990 b = SubElement(a, 'b') +1991 c = SubElement(a, 'c') +1992 d = SubElement(a, 'd') +1993 e = SubElement(a, 'e') +1994 +1995 del a[1:-1] +1996 self.assertEquals( +1997 [b, e], +1998 list(a)) +
1999 +
2000 - def test_delslice_negative2(self): +
2001 Element = self.etree.Element +2002 SubElement = self.etree.SubElement +2003 +2004 a = Element('a') +2005 b = SubElement(a, 'b') +2006 c = SubElement(a, 'c') +2007 d = SubElement(a, 'd') +2008 e = SubElement(a, 'e') +2009 +2010 del a[-3:-1] +2011 self.assertEquals( +2012 [b, e], +2013 list(a)) +
2014 +
2015 - def test_delslice_step(self): +
2016 Element = self.etree.Element +2017 SubElement = self.etree.SubElement +2018 +2019 a = Element('a') +2020 b = SubElement(a, 'b') +2021 c = SubElement(a, 'c') +2022 d = SubElement(a, 'd') +2023 e = SubElement(a, 'e') +2024 +2025 del a[1::2] +2026 self.assertEquals( +2027 [b, d], +2028 list(a)) +
2029 +
2030 - def test_delslice_step_negative(self): +
2031 Element = self.etree.Element +2032 SubElement = self.etree.SubElement +2033 +2034 a = Element('a') +2035 b = SubElement(a, 'b') +2036 c = SubElement(a, 'c') +2037 d = SubElement(a, 'd') +2038 e = SubElement(a, 'e') +2039 +2040 del a[::-1] +2041 self.assertEquals( +2042 [], +2043 list(a)) +
2044 +
2046 Element = self.etree.Element +2047 SubElement = self.etree.SubElement +2048 +2049 a = Element('a') +2050 b = SubElement(a, 'b') +2051 c = SubElement(a, 'c') +2052 d = SubElement(a, 'd') +2053 e = SubElement(a, 'e') +2054 +2055 del a[::-2] +2056 self.assertEquals( +2057 [b, d], +2058 list(a)) +
2059 +
2060 - def test_delslice_child_tail(self): +
2061 ElementTree = self.etree.ElementTree +2062 f = BytesIO('<a><b></b>B2<c></c>C2<d></d>D2<e></e>E2</a>') +2063 doc = ElementTree(file=f) +2064 a = doc.getroot() +2065 del a[1:3] +2066 self.assertXML( +2067 _bytes('<a><b></b>B2<e></e>E2</a>'), +2068 a) +
2069 +
2070 - def test_delslice_tail(self): +
2071 XML = self.etree.XML +2072 a = XML(_bytes('<a><b></b>B2<c></c>C2</a>')) +2073 b, c = a +2074 +2075 del a[:] +2076 +2077 self.assertEquals("B2", b.tail) +2078 self.assertEquals("C2", c.tail) +
2079 +
2080 - def test_delslice_memory(self): +
2081 # this could trigger a crash +2082 Element = self.etree.Element +2083 SubElement = self.etree.SubElement +2084 a = Element('a') +2085 b = SubElement(a, 'b') +2086 c = SubElement(b, 'c') +2087 del b # no more reference to b +2088 del a[:] +2089 self.assertEquals('c', c.tag) +
2090 +
2091 - def test_setslice(self): +
2092 Element = self.etree.Element +2093 SubElement = self.etree.SubElement +2094 +2095 a = Element('a') +2096 b = SubElement(a, 'b') +2097 c = SubElement(a, 'c') +2098 d = SubElement(a, 'd') +2099 +2100 e = Element('e') +2101 f = Element('f') +2102 g = Element('g') +2103 +2104 s = [e, f, g] +2105 a[1:2] = s +2106 self.assertEquals( +2107 [b, e, f, g, d], +2108 list(a)) +
2109 +
2110 - def test_setslice_all(self): +
2111 Element = self.etree.Element +2112 SubElement = self.etree.SubElement +2113 +2114 a = Element('a') +2115 b = SubElement(a, 'b') +2116 c = SubElement(a, 'c') +2117 +2118 e = Element('e') +2119 f = Element('f') +2120 g = Element('g') +2121 +2122 s = [e, f, g] +2123 a[:] = s +2124 self.assertEquals( +2125 [e, f, g], +2126 list(a)) +
2127 +
2128 - def test_setslice_all_empty(self): +
2129 Element = self.etree.Element +2130 SubElement = self.etree.SubElement +2131 +2132 a = Element('a') +2133 +2134 e = Element('e') +2135 f = Element('f') +2136 g = Element('g') +2137 +2138 s = [e, f, g] +2139 a[:] = s +2140 self.assertEquals( +2141 [e, f, g], +2142 list(a)) +
2143 +
2144 - def test_setslice_all_replace(self): +
2145 Element = self.etree.Element +2146 SubElement = self.etree.SubElement +2147 +2148 a = Element('a') +2149 b = SubElement(a, 'b') +2150 c = SubElement(a, 'c') +2151 d = SubElement(a, 'd') +2152 +2153 s = [b, c, d] +2154 a[:] = s +2155 self.assertEquals( +2156 [b, c, d], +2157 list(a)) +
2158 +
2160 Element = self.etree.Element +2161 SubElement = self.etree.SubElement +2162 +2163 a = Element('a') +2164 b = SubElement(a, 'b') +2165 c = SubElement(a, 'c') +2166 d = SubElement(a, 'd') +2167 +2168 s = [d, c, b] +2169 a[:] = s +2170 self.assertEquals( +2171 [d, c, b], +2172 list(a)) +
2173 +
2175 Element = self.etree.Element +2176 SubElement = self.etree.SubElement +2177 +2178 a = Element('{ns}a') +2179 b = SubElement(a, '{ns}b', {'{ns1}a1': 'test'}) +2180 c = SubElement(a, '{ns}c', {'{ns2}a2': 'test'}) +2181 d = SubElement(a, '{ns}d', {'{ns3}a3': 'test'}) +2182 +2183 s = [d, c, b] +2184 a[:] = s +2185 self.assertEquals( +2186 [d, c, b], +2187 list(a)) +2188 self.assertEquals( +2189 ['{ns}d', '{ns}c', '{ns}b'], +2190 [ child.tag for child in a ]) +2191 +2192 self.assertEquals( +2193 [['{ns3}a3'], ['{ns2}a2'], ['{ns1}a1']], +2194 [ child.attrib.keys() for child in a ]) +
2195 +
2197 Element = self.etree.Element +2198 SubElement = self.etree.SubElement +2199 +2200 a = Element('{ns}a') +2201 b = SubElement(a, '{ns1}b', {'{ns}a1': 'test'}) +2202 c = SubElement(a, '{ns2}c', {'{ns}a2': 'test'}) +2203 d = SubElement(a, '{ns3}d', {'{ns}a3': 'test'}) +2204 +2205 s = [d, c, b] +2206 a[:] = s +2207 self.assertEquals( +2208 [d, c, b], +2209 list(a)) +2210 self.assertEquals( +2211 ['{ns3}d', '{ns2}c', '{ns1}b'], +2212 [ child.tag for child in a ]) +2213 +2214 self.assertEquals( +2215 [['{ns}a3'], ['{ns}a2'], ['{ns}a1']], +2216 [ child.attrib.keys() for child in a ]) +
2217 +
2218 - def test_setslice_end(self): +
2219 Element = self.etree.Element +2220 SubElement = self.etree.SubElement +2221 +2222 a = Element('a') +2223 b = SubElement(a, 'b') +2224 c = SubElement(a, 'c') +2225 +2226 e = Element('e') +2227 f = Element('f') +2228 g = Element('g') +2229 h = Element('h') +2230 +2231 s = [e, f] +2232 a[99:] = s +2233 self.assertEquals( +2234 [a, b, e, f], +2235 list(a)) +2236 +2237 s = [g, h] +2238 a[:0] = s +2239 self.assertEquals( +2240 [g, h, a, b, e, f], +2241 list(a)) +
2242 +
2243 - def test_setslice_single(self): +
2244 Element = self.etree.Element +2245 SubElement = self.etree.SubElement +2246 +2247 a = Element('a') +2248 b = SubElement(a, 'b') +2249 c = SubElement(a, 'c') +2250 +2251 e = Element('e') +2252 f = Element('f') +2253 +2254 s = [e] +2255 a[0:1] = s +2256 self.assertEquals( +2257 [e, c], +2258 list(a)) +2259 +2260 s = [f] +2261 a[1:2] = s +2262 self.assertEquals( +2263 [e, f], +2264 list(a)) +
2265 +
2266 - def test_setslice_tail(self): +
2267 ElementTree = self.etree.ElementTree +2268 Element = self.etree.Element +2269 f = BytesIO('<a><b></b>B2<c></c>C2<d></d>D2<e></e>E2</a>') +2270 doc = ElementTree(file=f) +2271 a = doc.getroot() +2272 x = Element('x') +2273 y = Element('y') +2274 z = Element('z') +2275 x.tail = 'X2' +2276 y.tail = 'Y2' +2277 z.tail = 'Z2' +2278 a[1:3] = [x, y, z] +2279 self.assertXML( +2280 _bytes('<a><b></b>B2<x></x>X2<y></y>Y2<z></z>Z2<e></e>E2</a>'), +2281 a) +
2282 +
2283 - def test_setslice_negative(self): +
2284 Element = self.etree.Element +2285 SubElement = self.etree.SubElement +2286 +2287 a = Element('a') +2288 b = SubElement(a, 'b') +2289 c = SubElement(a, 'c') +2290 d = SubElement(a, 'd') +2291 +2292 x = Element('x') +2293 y = Element('y') +2294 +2295 a[1:-1] = [x, y] +2296 self.assertEquals( +2297 [b, x, y, d], +2298 list(a)) +
2299 +
2300 - def test_setslice_negative2(self): +
2301 Element = self.etree.Element +2302 SubElement = self.etree.SubElement +2303 +2304 a = Element('a') +2305 b = SubElement(a, 'b') +2306 c = SubElement(a, 'c') +2307 d = SubElement(a, 'd') +2308 +2309 x = Element('x') +2310 y = Element('y') +2311 +2312 a[1:-2] = [x, y] +2313 self.assertEquals( +2314 [b, x, y, c, d], +2315 list(a)) +
2316 +
2317 - def test_setslice_end(self): +
2318 Element = self.etree.Element +2319 SubElement = self.etree.SubElement +2320 +2321 a = Element('a') +2322 b = SubElement(a, 'b') +2323 c = SubElement(a, 'c') +2324 d = SubElement(a, 'd') +2325 +2326 e = Element('e') +2327 f = Element('f') +2328 g = Element('g') +2329 +2330 s = [e, f, g] +2331 a[3:] = s +2332 self.assertEquals( +2333 [b, c, d, e, f, g], +2334 list(a)) +
2335 +
2336 - def test_setslice_empty(self): +
2337 Element = self.etree.Element +2338 +2339 a = Element('a') +2340 +2341 b = Element('b') +2342 c = Element('c') +2343 +2344 a[:] = [b, c] +2345 self.assertEquals( +2346 [b, c], +2347 list(a)) +
2348 +
2349 - def test_tail_elementtree_root(self): +
2350 Element = self.etree.Element +2351 ElementTree = self.etree.ElementTree +2352 +2353 a = Element('a') +2354 a.tail = 'A2' +2355 t = ElementTree(element=a) +2356 self.assertEquals('A2', +2357 a.tail) +
2358 +
2360 Element = self.etree.Element +2361 SubElement = self.etree.SubElement +2362 ElementTree = self.etree.ElementTree +2363 +2364 a = Element('a') +2365 b = SubElement(a, 'b') +2366 c = SubElement(a, 'c') +2367 d = SubElement(b, 'd') +2368 e = SubElement(c, 'e') +2369 t = ElementTree(element=a) +2370 +2371 self.assertEquals( +2372 [a, b, d, c, e], +2373 list(t.getiterator())) +
2374 +
2376 Element = self.etree.Element +2377 SubElement = self.etree.SubElement +2378 ElementTree = self.etree.ElementTree +2379 a = Element('a') +2380 b = SubElement(a, 'b') +2381 c = SubElement(a, 'c') +2382 d = SubElement(b, 'd') +2383 e = SubElement(c, 'e') +2384 t = ElementTree(element=a) +2385 +2386 self.assertEquals( +2387 [a], +2388 list(t.getiterator('a'))) +2389 a2 = SubElement(e, 'a') +2390 self.assertEquals( +2391 [a, a2], +2392 list(t.getiterator('a'))) +
2393 +
2394 - def test_ns_access(self): +
2395 ElementTree = self.etree.ElementTree +2396 ns = 'http://xml.infrae.com/1' +2397 f = BytesIO('<x:a xmlns:x="%s"><x:b></x:b></x:a>' % ns) +2398 t = ElementTree(file=f) +2399 a = t.getroot() +2400 self.assertEquals('{%s}a' % ns, +2401 a.tag) +2402 self.assertEquals('{%s}b' % ns, +2403 a[0].tag) +
2404 +
2405 - def test_ns_access2(self): +
2406 ElementTree = self.etree.ElementTree +2407 ns = 'http://xml.infrae.com/1' +2408 ns2 = 'http://xml.infrae.com/2' +2409 f = BytesIO('<x:a xmlns:x="%s" xmlns:y="%s"><x:b></x:b><y:b></y:b></x:a>' % (ns, ns2)) +2410 t = ElementTree(file=f) +2411 a = t.getroot() +2412 self.assertEquals('{%s}a' % ns, +2413 a.tag) +2414 self.assertEquals('{%s}b' % ns, +2415 a[0].tag) +2416 self.assertEquals('{%s}b' % ns2, +2417 a[1].tag) +
2418 +
2419 - def test_ns_setting(self): +
2420 Element = self.etree.Element +2421 SubElement = self.etree.SubElement +2422 ns = 'http://xml.infrae.com/1' +2423 ns2 = 'http://xml.infrae.com/2' +2424 a = Element('{%s}a' % ns) +2425 b = SubElement(a, '{%s}b' % ns2) +2426 c = SubElement(a, '{%s}c' % ns) +2427 self.assertEquals('{%s}a' % ns, +2428 a.tag) +2429 self.assertEquals('{%s}b' % ns2, +2430 b.tag) +2431 self.assertEquals('{%s}c' % ns, +2432 c.tag) +2433 self.assertEquals('{%s}a' % ns, +2434 a.tag) +2435 self.assertEquals('{%s}b' % ns2, +2436 b.tag) +2437 self.assertEquals('{%s}c' % ns, +2438 c.tag) +
2439 +
2440 - def test_ns_tag_parse(self): +
2441 Element = self.etree.Element +2442 SubElement = self.etree.SubElement +2443 ElementTree = self.etree.ElementTree +2444 +2445 ns = 'http://xml.infrae.com/1' +2446 ns2 = 'http://xml.infrae.com/2' +2447 f = BytesIO('<a xmlns="%s" xmlns:x="%s"><x:b></x:b><b></b></a>' % (ns, ns2)) +2448 t = ElementTree(file=f) +2449 +2450 a = t.getroot() +2451 self.assertEquals('{%s}a' % ns, +2452 a.tag) +2453 self.assertEquals('{%s}b' % ns2, +2454 a[0].tag) +2455 self.assertEquals('{%s}b' % ns, +2456 a[1].tag) +
2457 +
2458 - def test_ns_attr(self): +
2459 Element = self.etree.Element +2460 ns = 'http://xml.infrae.com/1' +2461 ns2 = 'http://xml.infrae.com/2' +2462 a = Element('a') +2463 a.set('{%s}foo' % ns, 'Foo') +2464 a.set('{%s}bar' % ns2, 'Bar') +2465 self.assertEquals( +2466 'Foo', +2467 a.get('{%s}foo' % ns)) +2468 self.assertEquals( +2469 'Bar', +2470 a.get('{%s}bar' % ns2)) +2471 try: +2472 self.assertXML( +2473 _bytes('<a xmlns:ns0="%s" xmlns:ns1="%s" ns0:foo="Foo" ns1:bar="Bar"></a>' % (ns, ns2)), +2474 a) +2475 except AssertionError: +2476 self.assertXML( +2477 _bytes('<a xmlns:ns0="%s" xmlns:ns1="%s" ns1:foo="Foo" ns0:bar="Bar"></a>' % (ns2, ns)), +2478 a) +
2479 +
2480 - def test_ns_move(self): +
2481 Element = self.etree.Element +2482 one = self.etree.fromstring( +2483 _bytes('<foo><bar xmlns:ns="http://a.b.c"><ns:baz/></bar></foo>')) +2484 baz = one[0][0] +2485 +2486 two = Element('root') +2487 two.append(baz) +2488 # removing the originating document could cause a crash/error before +2489 # as namespace is not moved along with it +2490 del one, baz +2491 self.assertEquals('{http://a.b.c}baz', two[0].tag) +
2492 +
2493 - def test_ns_decl_tostring(self): +
2494 tostring = self.etree.tostring +2495 root = self.etree.XML( +2496 _bytes('<foo><bar xmlns:ns="http://a.b.c"><ns:baz/></bar></foo>')) +2497 baz = root[0][0] +2498 +2499 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2500 tostring(baz)) +2501 self.assertEquals([_bytes("http://a.b.c")], nsdecl) +
2502 +
2504 tostring = self.etree.tostring +2505 root = self.etree.XML( +2506 _bytes('<foo><bar xmlns="http://a.b.c"><baz/></bar></foo>')) +2507 baz = root[0][0] +2508 +2509 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2510 tostring(baz)) +2511 self.assertEquals([_bytes("http://a.b.c")], nsdecl) +
2512 +
2513 - def test_ns_decl_tostring_root(self): +
2514 tostring = self.etree.tostring +2515 root = self.etree.XML( +2516 _bytes('<foo xmlns:ns="http://a.b.c"><bar><ns:baz/></bar></foo>')) +2517 baz = root[0][0] +2518 +2519 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2520 tostring(baz)) +2521 +2522 self.assertEquals([_bytes("http://a.b.c")], nsdecl) +
2523 +
2525 Element = self.etree.Element +2526 SubElement = self.etree.SubElement +2527 +2528 root = Element("foo") +2529 bar = SubElement(root, "{http://a.b.c}bar") +2530 baz = SubElement(bar, "{http://a.b.c}baz") +2531 +2532 nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), +2533 self.etree.tostring(baz)) +2534 +2535 self.assertEquals([_bytes("http://a.b.c")], nsdecl) +
2536 +
2537 - def test_attribute_xmlns_move(self): +
2538 Element = self.etree.Element +2539 +2540 root = Element('element') +2541 +2542 subelement = Element('subelement', +2543 {"{http://www.w3.org/XML/1998/namespace}id": "foo"}) +2544 self.assertEquals(1, len(subelement.attrib)) +2545 self.assertEquals( +2546 "foo", +2547 subelement.get("{http://www.w3.org/XML/1998/namespace}id")) +2548 +2549 root.append(subelement) +2550 self.assertEquals(1, len(subelement.attrib)) +2551 self.assertEquals( +2552 list({"{http://www.w3.org/XML/1998/namespace}id" : "foo"}.items()), +2553 list(subelement.attrib.items())) +2554 self.assertEquals( +2555 "foo", +2556 subelement.get("{http://www.w3.org/XML/1998/namespace}id")) +
2557 +
2559 parse = self.etree.parse +2560 tostring = self.etree.tostring +2561 +2562 ns_href = "http://a.b.c" +2563 one = parse( +2564 BytesIO('<foo><bar xmlns:ns="%s"><ns:baz/></bar></foo>' % ns_href)) +2565 baz = one.getroot()[0][0] +2566 +2567 parsed = parse(BytesIO( tostring(baz) )).getroot() +2568 self.assertEquals('{%s}baz' % ns_href, parsed.tag) +
2569 +
2570 - def test_tostring(self): +
2571 tostring = self.etree.tostring +2572 Element = self.etree.Element +2573 SubElement = self.etree.SubElement +2574 +2575 a = Element('a') +2576 b = SubElement(a, 'b') +2577 c = SubElement(a, 'c') +2578 +2579 self.assertEquals(_bytes('<a><b></b><c></c></a>'), +2580 canonicalize(tostring(a))) +
2581 +
2582 - def test_tostring_element(self): +
2583 tostring = self.etree.tostring +2584 Element = self.etree.Element +2585 SubElement = self.etree.SubElement +2586 +2587 a = Element('a') +2588 b = SubElement(a, 'b') +2589 c = SubElement(a, 'c') +2590 d = SubElement(c, 'd') +2591 self.assertEquals(_bytes('<b></b>'), +2592 canonicalize(tostring(b))) +2593 self.assertEquals(_bytes('<c><d></d></c>'), +2594 canonicalize(tostring(c))) +
2595 +
2596 - def test_tostring_element_tail(self): +
2597 tostring = self.etree.tostring +2598 Element = self.etree.Element +2599 SubElement = self.etree.SubElement +2600 +2601 a = Element('a') +2602 b = SubElement(a, 'b') +2603 c = SubElement(a, 'c') +2604 d = SubElement(c, 'd') +2605 b.tail = 'Foo' +2606 +2607 self.assert_(tostring(b) == _bytes('<b/>Foo') or +2608 tostring(b) == _bytes('<b />Foo')) +
2609 +
2610 - def test_tostring_method_html(self): +
2611 tostring = self.etree.tostring +2612 Element = self.etree.Element +2613 SubElement = self.etree.SubElement +2614 +2615 html = Element('html') +2616 body = SubElement(html, 'body') +2617 p = SubElement(body, 'p') +2618 p.text = "html" +2619 SubElement(p, 'br').tail = "test" +2620 +2621 self.assertEquals(_bytes('<html><body><p>html<br>test</p></body></html>'), +2622 tostring(html, method="html")) +
2623 +
2624 - def test_tostring_method_text(self): +
2625 tostring = self.etree.tostring +2626 Element = self.etree.Element +2627 SubElement = self.etree.SubElement +2628 +2629 a = Element('a') +2630 a.text = "A" +2631 a.tail = "tail" +2632 b = SubElement(a, 'b') +2633 b.text = "B" +2634 b.tail = "TAIL" +2635 c = SubElement(a, 'c') +2636 c.text = "C" +2637 +2638 self.assertEquals(_bytes('ABTAILCtail'), +2639 tostring(a, method="text")) +
2640 +
2641 - def test_iterparse(self): +
2642 iterparse = self.etree.iterparse +2643 f = BytesIO('<a><b></b><c/></a>') +2644 +2645 iterator = iterparse(f) +2646 self.assertEquals(None, +2647 iterator.root) +2648 events = list(iterator) +2649 root = iterator.root +2650 self.assertEquals( +2651 [('end', root[0]), ('end', root[1]), ('end', root)], +2652 events) +
2653 +
2654 - def test_iterparse_file(self): +
2655 iterparse = self.etree.iterparse +2656 iterator = iterparse(fileInTestDir("test.xml")) +2657 self.assertEquals(None, +2658 iterator.root) +2659 events = list(iterator) +2660 root = iterator.root +2661 self.assertEquals( +2662 [('end', root[0]), ('end', root)], +2663 events) +
2664 +
2665 - def test_iterparse_start(self): +
2666 iterparse = self.etree.iterparse +2667 f = BytesIO('<a><b></b><c/></a>') +2668 +2669 iterator = iterparse(f, events=('start',)) +2670 events = list(iterator) +2671 root = iterator.root +2672 self.assertEquals( +2673 [('start', root), ('start', root[0]), ('start', root[1])], +2674 events) +
2675 +
2676 - def test_iterparse_start_end(self): +
2677 iterparse = self.etree.iterparse +2678 f = BytesIO('<a><b></b><c/></a>') +2679 +2680 iterator = iterparse(f, events=('start','end')) +2681 events = list(iterator) +2682 root = iterator.root +2683 self.assertEquals( +2684 [('start', root), ('start', root[0]), ('end', root[0]), +2685 ('start', root[1]), ('end', root[1]), ('end', root)], +2686 events) +
2687 +
2688 - def test_iterparse_clear(self): +
2689 iterparse = self.etree.iterparse +2690 f = BytesIO('<a><b></b><c/></a>') +2691 +2692 iterator = iterparse(f) +2693 for event, elem in iterator: +2694 elem.clear() +2695 +2696 root = iterator.root +2697 self.assertEquals(0, +2698 len(root)) +
2699 +
2700 - def test_iterparse_large(self): +
2701 iterparse = self.etree.iterparse +2702 CHILD_COUNT = 12345 +2703 f = BytesIO('<a>%s</a>' % ('<b>test</b>'*CHILD_COUNT)) +2704 +2705 i = 0 +2706 for key in iterparse(f): +2707 event, element = key +2708 i += 1 +2709 self.assertEquals(i, CHILD_COUNT + 1) +
2710 +
2711 - def test_iterparse_attrib_ns(self): +
2712 iterparse = self.etree.iterparse +2713 f = BytesIO('<a xmlns="http://ns1/"><b><c xmlns="http://ns2/"/></b></a>') +2714 +2715 attr_name = '{http://testns/}bla' +2716 events = [] +2717 iterator = iterparse(f, events=('start','end','start-ns','end-ns')) +2718 for event, elem in iterator: +2719 events.append(event) +2720 if event == 'start': +2721 if elem.tag != '{http://ns1/}a': +2722 elem.set(attr_name, 'value') +2723 +2724 self.assertEquals( +2725 ['start-ns', 'start', 'start', 'start-ns', 'start', +2726 'end', 'end-ns', 'end', 'end', 'end-ns'], +2727 events) +2728 +2729 root = iterator.root +2730 self.assertEquals( +2731 None, +2732 root.get(attr_name)) +2733 self.assertEquals( +2734 'value', +2735 root[0].get(attr_name)) +
2736 +
2737 - def test_iterparse_getiterator(self): +
2738 iterparse = self.etree.iterparse +2739 f = BytesIO('<a><b><d/></b><c/></a>') +2740 +2741 counts = [] +2742 for event, elem in iterparse(f): +2743 counts.append(len(list(elem.getiterator()))) +2744 self.assertEquals( +2745 [1,2,1,4], +2746 counts) +
2747 +
2749 iterparse = self.etree.iterparse +2750 f = BytesIO('<a><b><d/></b><c/></a>') +2751 +2752 for event, node in etree.iterparse(f): pass +2753 +2754 root = etree.Element('new_root', {}) +2755 root[:] = node[:] +2756 +2757 self.assertEquals( +2758 ['b', 'c'], +2759 [ el.tag for el in root ]) +
2760 +
2761 - def test_iterparse_cdata(self): +
2762 tostring = self.etree.tostring +2763 f = BytesIO('<root><![CDATA[test]]></root>') +2764 context = self.etree.iterparse(f) +2765 content = [ el.text for event,el in context ] +2766 +2767 self.assertEquals(['test'], content) +2768 self.assertEquals(_bytes('<root>test</root>'), +2769 tostring(context.root)) +
2770 +
2771 - def test_parse_file(self): +
2772 parse = self.etree.parse +2773 # from file +2774 tree = parse(fileInTestDir('test.xml')) +2775 self.assertXML( +2776 _bytes('<a><b></b></a>'), +2777 tree.getroot()) +
2778 +
2779 - def test_parse_file_nonexistent(self): +
2780 parse = self.etree.parse +2781 self.assertRaises(IOError, parse, fileInTestDir('notthere.xml')) +
2782 +
2783 - def test_parse_error_none(self): +
2784 parse = self.etree.parse +2785 self.assertRaises(TypeError, parse, None) +
2786 +
2787 - def test_parse_error(self): +
2788 # ET < 1.3 raises ExpatError +2789 parse = self.etree.parse +2790 f = BytesIO('<a><b></c></b></a>') +2791 self.assertRaises(SyntaxError, parse, f) +2792 f.close() +
2793 +
2794 - def test_parse_error_from_file(self): +
2795 parse = self.etree.parse +2796 # from file +2797 f = open(fileInTestDir('test_broken.xml'), 'rb') +2798 self.assertRaises(SyntaxError, parse, f) +2799 f.close() +
2800 +
2801 - def test_parse_file_object(self): +
2802 parse = self.etree.parse +2803 # from file object +2804 f = open(fileInTestDir('test.xml'), 'rb') +2805 tree = parse(f) +2806 f.close() +2807 self.assertXML( +2808 _bytes('<a><b></b></a>'), +2809 tree.getroot()) +
2810 +
2811 - def test_parse_stringio(self): +
2812 parse = self.etree.parse +2813 f = BytesIO('<a><b></b></a>') +2814 tree = parse(f) +2815 f.close() +2816 self.assertXML( +2817 _bytes('<a><b></b></a>'), +2818 tree.getroot() +2819 ) +
2820 +
2821 - def test_parse_cdata(self): +
2822 tostring = self.etree.tostring +2823 root = self.etree.XML(_bytes('<root><![CDATA[test]]></root>')) +2824 +2825 self.assertEquals('test', root.text) +2826 self.assertEquals(_bytes('<root>test</root>'), +2827 tostring(root)) +
2828 +
2829 - def test_parse_with_encoding(self): +
2830 # this can fail in libxml2 <= 2.6.22 +2831 parse = self.etree.parse +2832 tree = parse(BytesIO('<?xml version="1.0" encoding="ascii"?><html/>')) +2833 self.assertXML(_bytes('<html></html>'), +2834 tree.getroot()) +
2835 +
2836 - def test_encoding(self): +
2837 Element = self.etree.Element +2838 +2839 a = Element('a') +2840 a.text = _str('Søk på nettet') +2841 self.assertXML( +2842 _str('<a>Søk på nettet</a>').encode('UTF-8'), +2843 a, 'utf-8') +
2844 +
2845 - def test_encoding_exact(self): +
2846 ElementTree = self.etree.ElementTree +2847 Element = self.etree.Element +2848 +2849 a = Element('a') +2850 a.text = _str('Søk på nettet') +2851 +2852 f = BytesIO() +2853 tree = ElementTree(element=a) +2854 tree.write(f, encoding='utf-8') +2855 self.assertEquals(_str('<a>Søk på nettet</a>').encode('UTF-8'), +2856 f.getvalue().replace(_bytes('\n'),_bytes(''))) +
2857 +
2858 - def test_parse_file_encoding(self): +
2859 parse = self.etree.parse +2860 # from file +2861 tree = parse(fileInTestDir('test-string.xml')) +2862 self.assertXML( +2863 _str('<a>Søk på nettet</a>').encode('UTF-8'), +2864 tree.getroot(), 'UTF-8') +
2865 +
2867 parse = self.etree.parse +2868 # from file object +2869 f = open(fileInTestDir('test-string.xml'), 'rb') +2870 tree = parse(f) +2871 f.close() +2872 self.assertXML( +2873 _str('<a>Søk på nettet</a>').encode('UTF-8'), +2874 tree.getroot(), 'UTF-8') +
2875 +
2876 - def test_encoding_8bit_latin1(self): +
2877 ElementTree = self.etree.ElementTree +2878 Element = self.etree.Element +2879 +2880 a = Element('a') +2881 a.text = _str('Søk på nettet') +2882 +2883 f = BytesIO() +2884 tree = ElementTree(element=a) +2885 tree.write(f, encoding='iso-8859-1') +2886 result = f.getvalue() +2887 declaration = _bytes("<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>") +2888 self.assertEncodingDeclaration(result, _bytes('iso-8859-1')) +2889 result = result.split(_bytes('?>'), 1)[-1].replace(_bytes('\n'),_bytes('')) +2890 self.assertEquals(_str('<a>Søk på nettet</a>').encode('iso-8859-1'), +2891 result) +
2892 +
2894 XMLParser = self.etree.XMLParser +2895 +2896 text = _str('Søk på nettet') +2897 xml_latin1 = (_str('<a>%s</a>') % text).encode('iso-8859-1') +2898 +2899 self.assertRaises(self.etree.ParseError, +2900 self.etree.parse, +2901 BytesIO(xml_latin1)) +2902 +2903 tree = self.etree.parse(BytesIO(xml_latin1), +2904 XMLParser(encoding="iso-8859-1")) +2905 a = tree.getroot() +2906 self.assertEquals(a.text, text) +
2907 +
2909 XMLParser = self.etree.XMLParser +2910 +2911 text = _str('Søk på nettet') +2912 wrong_declaration = _str("<?xml version='1.0' encoding='UTF-8'?>") +2913 xml_latin1 = (_str('%s<a>%s</a>') % (wrong_declaration, text) +2914 ).encode('iso-8859-1') +2915 +2916 self.assertRaises(self.etree.ParseError, +2917 self.etree.parse, +2918 BytesIO(xml_latin1)) +2919 +2920 tree = self.etree.parse(BytesIO(xml_latin1), +2921 XMLParser(encoding="iso-8859-1")) +2922 a = tree.getroot() +2923 self.assertEquals(a.text, text) +
2924 +
2926 # raise error on wrong encoding declaration in unicode strings +2927 XML = self.etree.XML +2928 test_utf = (_str('<?xml version="1.0" encoding="iso-8859-1"?>') + +2929 _str('<a>Søk på nettet</a>')) +2930 self.assertRaises(SyntaxError, XML, test_utf) +
2931 +
2933 ElementTree = self.etree.ElementTree +2934 Element = self.etree.Element +2935 +2936 a = Element('a') +2937 a.text = _str('Søk på nettet') +2938 +2939 f = BytesIO() +2940 tree = ElementTree(element=a) +2941 tree.write(f) +2942 data = f.getvalue().replace(_bytes('\n'),_bytes('')) +2943 self.assertEquals( +2944 _str('<a>Søk på nettet</a>').encode('ASCII', 'xmlcharrefreplace'), +2945 data) +
2946 +
2947 - def test_encoding_tostring(self): +
2948 Element = self.etree.Element +2949 tostring = self.etree.tostring +2950 +2951 a = Element('a') +2952 a.text = _str('Søk på nettet') +2953 self.assertEquals(_str('<a>Søk på nettet</a>').encode('UTF-8'), +2954 tostring(a, encoding='utf-8')) +
2955 +
2957 Element = self.etree.Element +2958 tostring = self.etree.tostring +2959 +2960 a = Element('a') +2961 a.text = _str('Søk på nettet') +2962 self.assertRaises(LookupError, tostring, a, +2963 encoding='Invalid Encoding') +
2964 +
2965 - def test_encoding_tostring_sub(self): +
2966 Element = self.etree.Element +2967 SubElement = self.etree.SubElement +2968 tostring = self.etree.tostring +2969 +2970 a = Element('a') +2971 b = SubElement(a, 'b') +2972 b.text = _str('Søk på nettet') +2973 self.assertEquals(_str('<b>Søk på nettet</b>').encode('UTF-8'), +2974 tostring(b, encoding='utf-8')) +
2975 +
2977 Element = self.etree.Element +2978 SubElement = self.etree.SubElement +2979 tostring = self.etree.tostring +2980 +2981 a = Element('a') +2982 b = SubElement(a, 'b') +2983 b.text = _str('Søk på nettet') +2984 b.tail = _str('Søk') +2985 self.assertEquals(_str('<b>Søk på nettet</b>Søk').encode('UTF-8'), +2986 tostring(b, encoding='utf-8')) +
2987 +
2989 Element = self.etree.Element +2990 SubElement = self.etree.SubElement +2991 tostring = self.etree.tostring +2992 +2993 a = Element('a') +2994 a.text = _str('Søk på nettet') +2995 +2996 expected = _bytes('<a>S&#248;k p&#229; nettet</a>') +2997 self.assertEquals( +2998 expected, +2999 tostring(a)) +
3000 +
3002 Element = self.etree.Element +3003 SubElement = self.etree.SubElement +3004 tostring = self.etree.tostring +3005 +3006 a = Element('a') +3007 b = SubElement(a, 'b') +3008 b.text = _str('Søk på nettet') +3009 +3010 expected = _bytes('<b>S&#248;k p&#229; nettet</b>') +3011 self.assertEquals( +3012 expected, +3013 tostring(b)) +
3014 +
3015 - def test_encoding_8bit_xml(self): +
3016 utext = _str('Søk på nettet') +3017 uxml = _str('<p>%s</p>') % utext +3018 prologue = _bytes('<?xml version="1.0" encoding="iso-8859-1" ?>') +3019 isoxml = prologue + uxml.encode('iso-8859-1') +3020 tree = self.etree.XML(isoxml) +3021 self.assertEquals(utext, tree.text) +
3022 +
3023 - def test_encoding_utf8_bom(self): +
3024 utext = _str('Søk på nettet') +3025 uxml = (_str('<?xml version="1.0" encoding="UTF-8"?>') + +3026 _str('<p>%s</p>') % utext) +3027 bom = _bytes('\\xEF\\xBB\\xBF').decode("unicode_escape").encode("latin1") +3028 xml = bom + uxml.encode("utf-8") +3029 tree = etree.XML(xml) +3030 self.assertEquals(utext, tree.text) +
3031 +
3033 utext = _str('Søk på nettet') +3034 uxml = _str('<p>%s</p>') % utext +3035 prologue = _bytes('<?xml version="1.0" encoding="iso-8859-1" ?>') +3036 isoxml = prologue + uxml.encode('iso-8859-1') +3037 el = self.etree.parse(BytesIO(isoxml)).getroot() +3038 self.assertEquals(utext, el.text) +
3039 +
3040 - def test_deepcopy_elementtree(self): +
3041 Element = self.etree.Element +3042 ElementTree = self.etree.ElementTree +3043 +3044 a = Element('a') +3045 a.text = "Foo" +3046 atree = ElementTree(a) +3047 +3048 btree = copy.deepcopy(atree) +3049 self.assertEqual("Foo", atree.getroot().text) +3050 self.assertEqual("Foo", btree.getroot().text) +3051 self.assertFalse(btree is atree) +3052 self.assertFalse(btree.getroot() is atree.getroot()) +
3053 +
3054 - def test_deepcopy(self): +
3055 Element = self.etree.Element +3056 +3057 a = Element('a') +3058 a.text = 'Foo' +3059 +3060 b = copy.deepcopy(a) +3061 self.assertEquals('Foo', b.text) +3062 +3063 b.text = 'Bar' +3064 self.assertEquals('Bar', b.text) +3065 self.assertEquals('Foo', a.text) +3066 +3067 del a +3068 self.assertEquals('Bar', b.text) +
3069 +
3070 - def test_deepcopy_tail(self): +
3071 Element = self.etree.Element +3072 +3073 a = Element('a') +3074 a.tail = 'Foo' +3075 +3076 b = copy.deepcopy(a) +3077 self.assertEquals('Foo', b.tail) +3078 +3079 b.tail = 'Bar' +3080 self.assertEquals('Bar', b.tail) +3081 self.assertEquals('Foo', a.tail) +3082 +3083 del a +3084 self.assertEquals('Bar', b.tail) +
3085 +
3086 - def test_deepcopy_subelement(self): +
3087 Element = self.etree.Element +3088 SubElement = self.etree.SubElement +3089 +3090 root = Element('root') +3091 a = SubElement(root, 'a') +3092 a.text = 'FooText' +3093 a.tail = 'FooTail' +3094 +3095 b = copy.deepcopy(a) +3096 self.assertEquals('FooText', b.text) +3097 self.assertEquals('FooTail', b.tail) +3098 +3099 b.text = 'BarText' +3100 b.tail = 'BarTail' +3101 self.assertEquals('BarTail', b.tail) +3102 self.assertEquals('FooTail', a.tail) +3103 self.assertEquals('BarText', b.text) +3104 self.assertEquals('FooText', a.text) +3105 +3106 del a +3107 self.assertEquals('BarTail', b.tail) +3108 self.assertEquals('BarText', b.text) +
3109 +
3110 - def test_deepcopy_namespaces(self): +
3111 root = self.etree.XML(_bytes('''<doc xmlns="dns" xmlns:t="tns"> +3112 <parent><node t:foo="bar" /></parent> +3113 </doc>''')) +3114 self.assertEquals( +3115 root[0][0].get('{tns}foo'), +3116 copy.deepcopy(root[0])[0].get('{tns}foo') ) +3117 self.assertEquals( +3118 root[0][0].get('{tns}foo'), +3119 copy.deepcopy(root[0][0]).get('{tns}foo') ) +
3120 +
3121 - def test_deepcopy_append(self): +
3122 # previously caused a crash +3123 Element = self.etree.Element +3124 tostring = self.etree.tostring +3125 +3126 a = Element('a') +3127 b = copy.deepcopy(a) +3128 a.append( Element('C') ) +3129 b.append( Element('X') ) +3130 +3131 self.assertEquals(_bytes('<a><C/></a>'), +3132 tostring(a).replace(_bytes(' '), _bytes(''))) +3133 self.assertEquals(_bytes('<a><X/></a>'), +3134 tostring(b).replace(_bytes(' '), _bytes(''))) +
3135 +
3136 - def test_deepcopy_comment(self): +
3137 # previously caused a crash +3138 # not supported by ET < 1.3! +3139 Comment = self.etree.Comment +3140 +3141 a = Comment("ONE") +3142 b = copy.deepcopy(a) +3143 b.text = "ANOTHER" +3144 +3145 self.assertEquals('ONE', a.text) +3146 self.assertEquals('ANOTHER', b.text) +
3147 +
3148 - def test_shallowcopy(self): +
3149 Element = self.etree.Element +3150 +3151 a = Element('a') +3152 a.text = 'Foo' +3153 +3154 b = copy.copy(a) +3155 self.assertEquals('Foo', b.text) +3156 +3157 b.text = 'Bar' +3158 self.assertEquals('Bar', b.text) +3159 self.assertEquals('Foo', a.text) +
3160 # XXX ElementTree will share nodes, but lxml.etree won't.. +3161 +
3163 Element = self.etree.Element +3164 ElementTree = self.etree.ElementTree +3165 +3166 a = Element('a') +3167 a.text = 'Foo' +3168 atree = ElementTree(a) +3169 +3170 btree = copy.copy(atree) +3171 self.assertFalse(btree is atree) +3172 self.assert_(btree.getroot() is atree.getroot()) +3173 self.assertEquals('Foo', atree.getroot().text) +
3174 +
3175 - def _test_element_boolean(self): +
3176 # deprecated as of ET 1.3/lxml 2.0 +3177 etree = self.etree +3178 e = etree.Element('foo') +3179 self.assertEquals(False, bool(e)) +3180 etree.SubElement(e, 'bar') +3181 self.assertEquals(True, bool(e)) +3182 e = etree.Element('foo') +3183 e.text = 'hey' +3184 self.assertEquals(False, bool(e)) +3185 e = etree.Element('foo') +3186 e.tail = 'bar' +3187 self.assertEquals(False, bool(e)) +3188 e = etree.Element('foo') +3189 e.set('bar', 'Bar') +3190 self.assertEquals(False, bool(e)) +
3191 +
3192 - def test_multiple_elementrees(self): +
3193 etree = self.etree +3194 +3195 a = etree.Element('a') +3196 b = etree.SubElement(a, 'b') +3197 +3198 t = etree.ElementTree(a) +3199 self.assertEquals(self._rootstring(t), _bytes('<a><b/></a>')) +3200 +3201 t1 = etree.ElementTree(a) +3202 self.assertEquals(self._rootstring(t1), _bytes('<a><b/></a>')) +3203 self.assertEquals(self._rootstring(t), _bytes('<a><b/></a>')) +3204 +3205 t2 = etree.ElementTree(b) +3206 self.assertEquals(self._rootstring(t2), _bytes('<b/>')) +3207 self.assertEquals(self._rootstring(t1), _bytes('<a><b/></a>')) +3208 self.assertEquals(self._rootstring(t), _bytes('<a><b/></a>')) +
3209 +
3210 - def test_qname(self): +
3211 etree = self.etree +3212 qname = etree.QName('myns', 'a') +3213 a1 = etree.Element(qname) +3214 a2 = etree.SubElement(a1, qname) +3215 self.assertEquals(a1.tag, "{myns}a") +3216 self.assertEquals(a2.tag, "{myns}a") +
3217 +
3218 - def test_qname_cmp(self): +
3219 etree = self.etree +3220 qname1 = etree.QName('myns', 'a') +3221 qname2 = etree.QName('myns', 'a') +3222 self.assertEquals(qname1, "{myns}a") +3223 self.assertEquals("{myns}a", qname2) +3224 self.assertEquals(qname1, qname1) +3225 self.assertEquals(qname1, qname2) +
3226 +
3227 - def test_qname_attribute_getset(self): +
3228 etree = self.etree +3229 qname = etree.QName('myns', 'a') +3230 +3231 a = etree.Element(qname) +3232 a.set(qname, "value") +3233 +3234 self.assertEquals(a.get(qname), "value") +3235 self.assertEquals(a.get("{myns}a"), "value") +
3236 +
3237 - def test_qname_attrib(self): +
3238 etree = self.etree +3239 qname = etree.QName('myns', 'a') +3240 +3241 a = etree.Element(qname) +3242 a.attrib[qname] = "value" +3243 +3244 self.assertEquals(a.attrib[qname], "value") +3245 self.assertEquals(a.attrib.get(qname), "value") +3246 +3247 self.assertEquals(a.attrib["{myns}a"], "value") +3248 self.assertEquals(a.attrib.get("{myns}a"), "value") +
3249 +
3251 etree = self.etree +3252 qname = etree.QName('http://myns', 'a') +3253 a = etree.Element(qname) +3254 a.set(qname, qname) +3255 +3256 self.assertXML( +3257 _bytes('<ns0:a xmlns:ns0="http://myns" ns0:a="ns0:a"></ns0:a>'), +3258 a) +
3259 +
3261 etree = self.etree +3262 qname = etree.QName('http://myns', 'a') +3263 a = etree.Element('a') +3264 a.set('a', qname) +3265 +3266 self.assertXML( +3267 _bytes('<a xmlns:ns0="http://myns" a="ns0:a"></a>'), +3268 a) +
3269 +
3270 - def test_qname_attrib_resolve(self): +
3271 etree = self.etree +3272 qname = etree.QName('http://myns', 'a') +3273 a = etree.Element(qname) +3274 a.attrib[qname] = qname +3275 +3276 self.assertXML( +3277 _bytes('<ns0:a xmlns:ns0="http://myns" ns0:a="ns0:a"></ns0:a>'), +3278 a) +
3279 +
3280 - def test_parser_version(self): +
3281 etree = self.etree +3282 parser = etree.XMLParser() +3283 if hasattr(parser, "version"): +3284 # ElementTree 1.3+, cET +3285 self.assert_(re.match("[^ ]+ [0-9.]+", parser.version)) +
3286 +3287 # feed parser interface +3288 +
3289 - def test_feed_parser(self): +
3290 parser = self.etree.XMLParser() +3291 +3292 parser.feed('<?xml version=') +3293 parser.feed('"1.0"?><ro') +3294 parser.feed('ot><') +3295 parser.feed('a test="works"/') +3296 parser.feed('></root') +3297 parser.feed('>') +3298 +3299 root = parser.close() +3300 +3301 self.assertEquals(root.tag, "root") +3302 self.assertEquals(root[0].tag, "a") +3303 self.assertEquals(root[0].get("test"), "works") +
3304 +
3306 ParseError = self.etree.ParseError +3307 parser = self.etree.XMLParser() +3308 self.assertRaises(ParseError, parser.close) +
3309 +
3311 ParseError = self.etree.ParseError +3312 parser = self.etree.XMLParser() +3313 +3314 parser.feed('<?xml version=') +3315 parser.feed('"1.0"?><ro') +3316 +3317 self.assertRaises(ParseError, parser.close) +
3318 +
3320 ParseError = self.etree.ParseError +3321 parser = self.etree.XMLParser() +3322 +3323 parser.feed('<?xml version=') +3324 parser.feed('"1.0"?><ro') +3325 try: +3326 parser.feed('<><><><><><><') +3327 except ParseError: +3328 # can raise, but not required before close() +3329 pass +3330 +3331 self.assertRaises(ParseError, parser.close) +
3332 +
3334 ParseError = self.etree.ParseError +3335 parser = self.etree.XMLParser() +3336 try: +3337 parser.close() +3338 except ParseError: +3339 e = sys.exc_info()[1] +3340 self.assertNotEquals(None, e.code) +3341 self.assertNotEquals(0, e.code) +3342 self.assert_(isinstance(e.position, tuple)) +3343 self.assert_(e.position >= (0, 0)) +
3344 +3345 # parser target interface +3346 +
3347 - def test_parser_target_tag(self): +
3348 assertEquals = self.assertEquals +3349 assertFalse = self.assertFalse +3350 +3351 events = [] +3352 class Target(object): +3353 def start(self, tag, attrib): +3354 events.append("start") +3355 assertFalse(attrib) +3356 assertEquals("TAG", tag) +
3357 def end(self, tag): +3358 events.append("end") +3359 assertEquals("TAG", tag) +3360 def close(self): +3361 return "DONE" +3362 +3363 parser = self.etree.XMLParser(target=Target()) +3364 +3365 parser.feed("<TAG/>") +3366 done = parser.close() +3367 +3368 self.assertEquals("DONE", done) +3369 self.assertEquals(["start", "end"], events) +3370 +
3372 assertEquals = self.assertEquals +3373 assertFalse = self.assertFalse +3374 Element = self.etree.Element +3375 +3376 events = [] +3377 class Target(object): +3378 def start(self, tag, attrib): +3379 events.append("start") +3380 assertFalse(attrib) +3381 assertEquals("TAG", tag) +
3382 def end(self, tag): +3383 events.append("end") +3384 assertEquals("TAG", tag) +3385 def close(self): +3386 return Element("DONE") +3387 +3388 parser = self.etree.XMLParser(target=Target()) +3389 tree = self.etree.ElementTree() +3390 tree.parse(BytesIO("<TAG/>"), parser=parser) +3391 +3392 self.assertEquals("DONE", tree.getroot().tag) +3393 self.assertEquals(["start", "end"], events) +3394 +
3395 - def test_parser_target_attrib(self): +
3396 assertEquals = self.assertEquals +3397 +3398 events = [] +3399 class Target(object): +3400 def start(self, tag, attrib): +3401 events.append("start-" + tag) +3402 for name, value in attrib.items(): +3403 assertEquals(tag + name, value) +
3404 def end(self, tag): +3405 events.append("end-" + tag) +3406 def close(self): +3407 return "DONE" +3408 +3409 parser = self.etree.XMLParser(target=Target()) +3410 +3411 parser.feed('<root a="roota" b="rootb"><sub c="subc"/></root>') +3412 done = parser.close() +3413 +3414 self.assertEquals("DONE", done) +3415 self.assertEquals(["start-root", "start-sub", "end-sub", "end-root"], +3416 events) +3417 +
3418 - def test_parser_target_data(self): +
3419 events = [] +3420 class Target(object): +3421 def start(self, tag, attrib): +3422 events.append("start-" + tag) +
3423 def end(self, tag): +3424 events.append("end-" + tag) +3425 def data(self, data): +3426 events.append("data-" + data) +3427 def close(self): +3428 return "DONE" +3429 +3430 parser = self.etree.XMLParser(target=Target()) +3431 +3432 parser.feed('<root>A<sub/>B</root>') +3433 done = parser.close() +3434 +3435 self.assertEquals("DONE", done) +3436 self.assertEquals(["start-root", "data-A", "start-sub", +3437 "end-sub", "data-B", "end-root"], +3438 events) +3439 +
3440 - def test_parser_target_entity(self): +
3441 events = [] +3442 class Target(object): +3443 def __init__(self): +3444 self._data = [] +
3445 def _flush_data(self): +3446 if self._data: +3447 events.append("data-" + ''.join(self._data)) +3448 del self._data[:] +3449 def start(self, tag, attrib): +3450 self._flush_data() +3451 events.append("start-" + tag) +3452 def end(self, tag): +3453 self._flush_data() +3454 events.append("end-" + tag) +3455 def data(self, data): +3456 self._data.append(data) +3457 def close(self): +3458 self._flush_data() +3459 return "DONE" +3460 +3461 parser = self.etree.XMLParser(target=Target()) +3462 +3463 dtd = ''' +3464 <!DOCTYPE root [ +3465 <!ELEMENT root (sub*)> +3466 <!ELEMENT sub (#PCDATA)> +3467 <!ENTITY ent "an entity"> +3468 ]> +3469 ''' +3470 parser.feed(dtd+'<root><sub/><sub>this is &ent;</sub><sub/></root>') +3471 done = parser.close() +3472 +3473 self.assertEquals("DONE", done) +3474 self.assertEquals(["start-root", "start-sub", "end-sub", "start-sub", +3475 "data-this is an entity", +3476 "end-sub", "start-sub", "end-sub", "end-root"], +3477 events) +3478 +
3480 events = [] +3481 class Target(object): +3482 def __init__(self): +3483 self._data = [] +
3484 def _flush_data(self): +3485 if self._data: +3486 events.append("data-" + ''.join(self._data)) +3487 del self._data[:] +3488 def start(self, tag, attrib): +3489 self._flush_data() +3490 events.append("start-" + tag) +3491 def end(self, tag): +3492 self._flush_data() +3493 events.append("end-" + tag) +3494 def data(self, data): +3495 self._data.append(data) +3496 def close(self): +3497 self._flush_data() +3498 return "DONE" +3499 +3500 parser = self.etree.XMLParser(target=Target()) +3501 +3502 def feed(): +3503 parser.feed('<root><sub/><sub>some &ent;</sub><sub/></root>') +3504 parser.close() +3505 +3506 self.assertRaises(self.etree.ParseError, feed) +3507 +
3509 events = [] +3510 class Target(object): +3511 def start(self, tag, attrib): +3512 events.append("start-" + tag) +
3513 def end(self, tag): +3514 events.append("end-" + tag) +3515 if tag == 'a': +3516 raise ValueError("dead and gone") +3517 def data(self, data): +3518 events.append("data-" + data) +3519 def close(self): +3520 events.append("close") +3521 return "DONE" +3522 +3523 parser = self.etree.XMLParser(target=Target()) +3524 +3525 try: +3526 parser.feed(_bytes('<root>A<a>ca</a>B</root>')) +3527 done = parser.close() +3528 self.fail("error expected, but parsing succeeded") +3529 except ValueError: +3530 done = 'value error received as expected' +3531 +3532 self.assertEquals(["start-root", "data-A", "start-a", +3533 "data-ca", "end-a"], +3534 events) +3535 +
3537 events = [] +3538 class Target(object): +3539 def start(self, tag, attrib): +3540 events.append("start-" + tag) +
3541 def end(self, tag): +3542 events.append("end-" + tag) +3543 if tag == 'a': +3544 raise ValueError("dead and gone") +3545 def data(self, data): +3546 events.append("data-" + data) +3547 def close(self): +3548 events.append("close") +3549 return "DONE" +3550 +3551 parser = self.etree.XMLParser(target=Target()) +3552 +3553 try: +3554 done = self.etree.fromstring(_bytes('<root>A<a>ca</a>B</root>'), +3555 parser=parser) +3556 self.fail("error expected, but parsing succeeded") +3557 except ValueError: +3558 done = 'value error received as expected' +3559 +3560 self.assertEquals(["start-root", "data-A", "start-a", +3561 "data-ca", "end-a"], +3562 events) +3563 +
3564 - def test_treebuilder(self): +
3565 builder = self.etree.TreeBuilder() +3566 el = builder.start("root", {'a':'A', 'b':'B'}) +3567 self.assertEquals("root", el.tag) +3568 self.assertEquals({'a':'A', 'b':'B'}, el.attrib) +3569 builder.data("ROOTTEXT") +3570 el = builder.start("child", {'x':'X', 'y':'Y'}) +3571 self.assertEquals("child", el.tag) +3572 self.assertEquals({'x':'X', 'y':'Y'}, el.attrib) +3573 builder.data("CHILDTEXT") +3574 el = builder.end("child") +3575 self.assertEquals("child", el.tag) +3576 self.assertEquals({'x':'X', 'y':'Y'}, el.attrib) +3577 self.assertEquals("CHILDTEXT", el.text) +3578 self.assertEquals(None, el.tail) +3579 builder.data("CHILDTAIL") +3580 root = builder.end("root") +3581 +3582 self.assertEquals("root", root.tag) +3583 self.assertEquals("ROOTTEXT", root.text) +3584 self.assertEquals("CHILDTEXT", root[0].text) +3585 self.assertEquals("CHILDTAIL", root[0].tail) +
3586 +
3587 - def test_treebuilder_target(self): +
3588 parser = self.etree.XMLParser(target=self.etree.TreeBuilder()) +3589 parser.feed('<root>ROOTTEXT<child>CHILDTEXT</child>CHILDTAIL</root>') +3590 root = parser.close() +3591 +3592 self.assertEquals("root", root.tag) +3593 self.assertEquals("ROOTTEXT", root.text) +3594 self.assertEquals("CHILDTEXT", root[0].text) +3595 self.assertEquals("CHILDTAIL", root[0].tail) +
3596 +3597 # helper methods +3598 +
3599 - def _writeElement(self, element, encoding='us-ascii'): +
3600 """Write out element for comparison. +3601 """ +3602 data = self.etree.tostring(element, encoding=encoding) +3603 if encoding != 'us-ascii': +3604 data = data.decode(encoding) +3605 return canonicalize(data) +
3606 +
3607 - def _writeElementFile(self, element, encoding='us-ascii'): +
3608 """Write out element for comparison, using real file. +3609 """ +3610 ElementTree = self.etree.ElementTree +3611 handle, filename = tempfile.mkstemp() +3612 try: +3613 f = open(filename, 'wb') +3614 tree = ElementTree(element=element) +3615 tree.write(f, encoding=encoding) +3616 f.close() +3617 f = open(filename, 'rb') +3618 data = f.read() +3619 f.close() +3620 finally: +3621 os.close(handle) +3622 os.remove(filename) +3623 if encoding != 'us-ascii': +3624 data = data.decode(encoding) +3625 return canonicalize(data) +
3626 +
3627 - def assertXML(self, expected, element, encoding='us-ascii'): +
3628 """Writes element out and checks whether it is expected. +3629 +3630 Does this two ways; once using BytesIO, once using a real file. +3631 """ +3632 self.assertEquals(expected, self._writeElement(element, encoding)) +3633 self.assertEquals(expected, self._writeElementFile(element, encoding)) +
3634 +
3635 - def assertEncodingDeclaration(self, result, encoding): +
3636 "Checks if the result XML byte string specifies the encoding." +3637 enc_re = r"<\?xml[^>]+ encoding=[\"']([^\"']+)[\"']" +3638 if isinstance(result, str): +3639 has_encoding = re.compile(enc_re).match +3640 else: +3641 has_encoding = re.compile(_bytes(enc_re)).match +3642 self.assert_(has_encoding(result)) +3643 result_encoding = has_encoding(result).group(1) +3644 self.assertEquals(result_encoding.upper(), encoding.upper()) +
3645 +
3646 - def _rootstring(self, tree): +
3647 return self.etree.tostring(tree.getroot()).replace( +3648 _bytes(' '), _bytes('')).replace(_bytes('\n'), _bytes('')) +
3649 +
3650 - def _check_element_tree(self, tree): +
3651 self._check_element(tree.getroot()) +
3652 +
3653 - def _check_element(self, element): +
3654 self.assert_(hasattr(element, 'tag')) +3655 self.assert_(hasattr(element, 'attrib')) +3656 self.assert_(hasattr(element, 'text')) +3657 self.assert_(hasattr(element, 'tail')) +3658 self._check_string(element.tag) +3659 self._check_mapping(element.attrib) +3660 if element.text != None: +3661 self._check_string(element.text) +3662 if element.tail != None: +3663 self._check_string(element.tail) +
3664 +
3665 - def _check_string(self, string): +
3666 len(string) +3667 for char in string: +3668 self.assertEquals(1, len(char)) +3669 new_string = string + "" +3670 new_string = string + " " +3671 string[:0] +
3672 +
3673 - def _check_mapping(self, mapping): +
3674 len(mapping) +3675 keys = mapping.keys() +3676 values = mapping.values() +3677 items = mapping.items() +3678 for key in keys: +3679 item = mapping[key] +3680 mapping["key"] = "value" +3681 self.assertEquals("value", mapping["key"]) +
3682 +3683 +3684 if etree: +
3685 - class ETreeTestCase(ETreeTestCaseBase): +
3686 etree = etree +
3687 +3688 if ElementTree: +
3689 - class ElementTreeTestCase(ETreeTestCaseBase): +
3691 +3692 if cElementTree: +
3693 - class CElementTreeTestCase(ETreeTestCaseBase): +
3695 +
3696 -def test_suite(): +
3697 suite = unittest.TestSuite() +3698 if etree: +3699 suite.addTests([unittest.makeSuite(ETreeTestCase)]) +3700 if ElementTree: +3701 suite.addTests([unittest.makeSuite(ElementTreeTestCase)]) +3702 if cElementTree: +3703 suite.addTests([unittest.makeSuite(CElementTreeTestCase)]) +3704 return suite +
3705 +3706 if __name__ == '__main__': +3707 print('to test use test.py %s' % __file__) +3708 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.CElementTreeTestCase-class.html b/doc/html/api/lxml.tests.test_elementtree.CElementTreeTestCase-class.html new file mode 100644 index 0000000..39edd73 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.CElementTreeTestCase-class.html @@ -0,0 +1,548 @@ + + + + + lxml.tests.test_elementtree.CElementTreeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class CElementTreeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class CElementTreeTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                ETreeTestCaseBase --+
+                                    |
+                                   CElementTreeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from ETreeTestCaseBase: + assertEncodingDeclaration, + assertXML, + test_ElementTree, + test_XML, + test_XMLID, + test_attrib_clear, + test_attrib_ns_clear, + test_attrib_pop, + test_attrib_pop_default, + test_attrib_pop_empty_default, + test_attrib_pop_invalid_args, + test_attrib_pop_unknown, + test_attrib_set_clear, + test_attribute_contains, + test_attribute_has_key, + test_attribute_items, + test_attribute_items2, + test_attribute_items_ns, + test_attribute_iterator, + test_attribute_keys, + test_attribute_keys2, + test_attribute_keys_ns, + test_attribute_manipulation, + test_attribute_set, + test_attribute_str, + test_attribute_update_dict, + test_attribute_update_iter, + test_attribute_update_sequence, + test_attribute_values, + test_attribute_values_ns, + test_attribute_xmlns_move, + test_attributes, + test_attributes2, + test_attributes3, + test_clear, + test_clear_sub, + test_clear_tail, + test_comment, + test_comment_getitem_getslice, + test_comment_nonsense, + test_comment_text, + test_comment_whitespace, + test_crash, + test_deepcopy, + test_deepcopy_append, + test_deepcopy_comment, + test_deepcopy_elementtree, + test_deepcopy_namespaces, + test_deepcopy_subelement, + test_deepcopy_tail, + test_del_attribute_ns, + test_del_attribute_ns_parsed, + test_del_insert, + test_del_setitem, + test_del_setslice, + test_delitem, + test_delitem_tail, + test_delslice, + test_delslice_child_tail, + test_delslice_memory, + test_delslice_negative1, + test_delslice_negative2, + test_delslice_step, + test_delslice_step_negative, + test_delslice_step_negative2, + test_delslice_tail, + test_element, + test_element_contains, + test_element_indexing_negative, + test_element_indexing_only_text, + test_element_indexing_with_text, + test_element_indexing_with_text2, + test_element_with_attributes, + test_element_with_attributes_keywords, + test_element_with_attributes_ns, + test_elementtree, + test_elementtree_getiterator, + test_elementtree_getiterator_filter, + test_elementtree_parser_target, + test_encoding, + test_encoding_8bit_latin1, + test_encoding_8bit_parse_stringio, + test_encoding_8bit_xml, + test_encoding_exact, + test_encoding_sub_tostring_default_encoding, + test_encoding_tostring, + test_encoding_tostring_default_encoding, + test_encoding_tostring_sub, + test_encoding_tostring_sub_tail, + test_encoding_tostring_unknown, + test_encoding_utf8_bom, + test_encoding_write_default_encoding, + test_extend, + test_feed_parser, + test_feed_parser_error_broken, + test_feed_parser_error_close_empty, + test_feed_parser_error_close_incomplete, + test_feed_parser_error_position, + test_findall, + test_findall_ns, + test_fromstring, + test_fromstringlist, + test_fromstringlist_characters, + test_fromstringlist_single, + test_getiterator, + test_getiterator_empty, + test_getiterator_filter, + test_getiterator_filter_all, + test_getiterator_filter_comment, + test_getiterator_filter_pi, + test_getiterator_filter_with_text, + test_getiterator_with_text, + test_getslice, + test_getslice_negative, + test_getslice_step, + test_getslice_text, + test_insert, + test_insert_beyond_index, + test_insert_negative, + test_insert_tail, + test_iselement, + test_iter, + test_iteration, + test_iteration_crash, + test_iteration_del_child, + test_iteration_double, + test_iteration_empty, + test_iteration_reversed, + test_iteration_subelement, + test_iteration_text_only, + test_iterparse, + test_iterparse_attrib_ns, + test_iterparse_cdata, + test_iterparse_clear, + test_iterparse_file, + test_iterparse_getiterator, + test_iterparse_large, + test_iterparse_move_elements, + test_iterparse_start, + test_iterparse_start_end, + test_itertext, + test_itertext_child, + test_makeelement, + test_merge_namespaced_subtree_as_slice, + test_multiple_elementrees, + test_namespaces_after_serialize, + test_ns_access, + test_ns_access2, + test_ns_attr, + test_ns_decl_tostring, + test_ns_decl_tostring_default, + test_ns_decl_tostring_element, + test_ns_decl_tostring_root, + test_ns_move, + test_ns_setting, + test_ns_tag_parse, + test_parse_cdata, + test_parse_encoding_8bit_explicit, + test_parse_encoding_8bit_override, + test_parse_error, + test_parse_error_from_file, + test_parse_error_none, + test_parse_file, + test_parse_file_encoding, + test_parse_file_nonexistent, + test_parse_file_object, + test_parse_file_object_encoding, + test_parse_stringio, + test_parse_with_encoding, + test_parser_target_attrib, + test_parser_target_data, + test_parser_target_entity, + test_parser_target_entity_unknown, + test_parser_target_feed_exception, + test_parser_target_fromstring_exception, + test_parser_target_tag, + test_parser_version, + test_pi, + test_pi_nonsense, + test_processinginstruction, + test_qname, + test_qname_attrib, + test_qname_attrib_resolve, + test_qname_attribute_getset, + test_qname_attribute_resolve, + test_qname_attribute_resolve_new, + test_qname_cmp, + test_remove, + test_remove_nonexisting, + test_remove_ns, + test_remove_tail, + test_replace_slice_tail, + test_set_text, + test_set_text2, + test_set_text_empty, + test_set_text_none, + test_setitem, + test_setitem2, + test_setitem_indexerror, + test_setitem_replace, + test_setitem_tail, + test_setslice, + test_setslice_all, + test_setslice_all_empty, + test_setslice_all_replace, + test_setslice_all_replace_reversed, + test_setslice_all_replace_reversed_ns1, + test_setslice_all_replace_reversed_ns2, + test_setslice_empty, + test_setslice_end, + test_setslice_negative, + test_setslice_negative2, + test_setslice_single, + test_setslice_tail, + test_shallowcopy, + test_shallowcopy_elementtree, + test_simple, + test_subelement, + test_subelement_reference, + test_subelement_with_attributes, + test_subelement_with_attributes_ns, + test_tag_reset_ns, + test_tag_reset_root_ns, + test_tag_str_subclass, + test_tag_write, + test_tail, + test_tail1, + test_tail_append, + test_tail_elementtree_root, + test_tail_set_none, + test_tail_set_twice, + test_tail_str_subclass, + test_text, + test_text_empty, + test_text_escape_in, + test_text_escape_out, + test_text_escape_tostring, + test_text_other, + test_text_str_subclass, + test_tostring, + test_tostring_element, + test_tostring_element_tail, + test_tostring_method_html, + test_tostring_method_text, + test_treebuilder, + test_treebuilder_target, + test_weird_dict_interaction, + test_write, + test_write_ElementTreeDoctest, + test_write_fail, + test_write_method_html, + test_write_method_text +

+ +

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.ETreeTestCase-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeTestCase-class.html new file mode 100644 index 0000000..be2f684 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeTestCase-class.html @@ -0,0 +1,585 @@ + + + + + lxml.tests.test_elementtree.ETreeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                ETreeTestCaseBase --+
+                                    |
+                                   ETreeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from ETreeTestCaseBase: + assertEncodingDeclaration, + assertXML, + test_ElementTree, + test_XML, + test_XMLID, + test_attrib_clear, + test_attrib_ns_clear, + test_attrib_pop, + test_attrib_pop_default, + test_attrib_pop_empty_default, + test_attrib_pop_invalid_args, + test_attrib_pop_unknown, + test_attrib_set_clear, + test_attribute_contains, + test_attribute_has_key, + test_attribute_items, + test_attribute_items2, + test_attribute_items_ns, + test_attribute_iterator, + test_attribute_keys, + test_attribute_keys2, + test_attribute_keys_ns, + test_attribute_manipulation, + test_attribute_set, + test_attribute_str, + test_attribute_update_dict, + test_attribute_update_iter, + test_attribute_update_sequence, + test_attribute_values, + test_attribute_values_ns, + test_attribute_xmlns_move, + test_attributes, + test_attributes2, + test_attributes3, + test_clear, + test_clear_sub, + test_clear_tail, + test_comment, + test_comment_getitem_getslice, + test_comment_nonsense, + test_comment_text, + test_comment_whitespace, + test_crash, + test_deepcopy, + test_deepcopy_append, + test_deepcopy_comment, + test_deepcopy_elementtree, + test_deepcopy_namespaces, + test_deepcopy_subelement, + test_deepcopy_tail, + test_del_attribute_ns, + test_del_attribute_ns_parsed, + test_del_insert, + test_del_setitem, + test_del_setslice, + test_delitem, + test_delitem_tail, + test_delslice, + test_delslice_child_tail, + test_delslice_memory, + test_delslice_negative1, + test_delslice_negative2, + test_delslice_step, + test_delslice_step_negative, + test_delslice_step_negative2, + test_delslice_tail, + test_element, + test_element_contains, + test_element_indexing_negative, + test_element_indexing_only_text, + test_element_indexing_with_text, + test_element_indexing_with_text2, + test_element_with_attributes, + test_element_with_attributes_keywords, + test_element_with_attributes_ns, + test_elementtree, + test_elementtree_getiterator, + test_elementtree_getiterator_filter, + test_elementtree_parser_target, + test_encoding, + test_encoding_8bit_latin1, + test_encoding_8bit_parse_stringio, + test_encoding_8bit_xml, + test_encoding_exact, + test_encoding_sub_tostring_default_encoding, + test_encoding_tostring, + test_encoding_tostring_default_encoding, + test_encoding_tostring_sub, + test_encoding_tostring_sub_tail, + test_encoding_tostring_unknown, + test_encoding_utf8_bom, + test_encoding_write_default_encoding, + test_extend, + test_feed_parser, + test_feed_parser_error_broken, + test_feed_parser_error_close_empty, + test_feed_parser_error_close_incomplete, + test_feed_parser_error_position, + test_findall, + test_findall_ns, + test_fromstring, + test_fromstringlist, + test_fromstringlist_characters, + test_fromstringlist_single, + test_getiterator, + test_getiterator_empty, + test_getiterator_filter, + test_getiterator_filter_all, + test_getiterator_filter_comment, + test_getiterator_filter_pi, + test_getiterator_filter_with_text, + test_getiterator_with_text, + test_getslice, + test_getslice_negative, + test_getslice_step, + test_getslice_text, + test_insert, + test_insert_beyond_index, + test_insert_negative, + test_insert_tail, + test_iselement, + test_iter, + test_iteration, + test_iteration_crash, + test_iteration_del_child, + test_iteration_double, + test_iteration_empty, + test_iteration_reversed, + test_iteration_subelement, + test_iteration_text_only, + test_iterparse, + test_iterparse_attrib_ns, + test_iterparse_cdata, + test_iterparse_clear, + test_iterparse_file, + test_iterparse_getiterator, + test_iterparse_large, + test_iterparse_move_elements, + test_iterparse_start, + test_iterparse_start_end, + test_itertext, + test_itertext_child, + test_makeelement, + test_merge_namespaced_subtree_as_slice, + test_multiple_elementrees, + test_namespaces_after_serialize, + test_ns_access, + test_ns_access2, + test_ns_attr, + test_ns_decl_tostring, + test_ns_decl_tostring_default, + test_ns_decl_tostring_element, + test_ns_decl_tostring_root, + test_ns_move, + test_ns_setting, + test_ns_tag_parse, + test_parse_cdata, + test_parse_encoding_8bit_explicit, + test_parse_encoding_8bit_override, + test_parse_error, + test_parse_error_from_file, + test_parse_error_none, + test_parse_file, + test_parse_file_encoding, + test_parse_file_nonexistent, + test_parse_file_object, + test_parse_file_object_encoding, + test_parse_stringio, + test_parse_with_encoding, + test_parser_target_attrib, + test_parser_target_data, + test_parser_target_entity, + test_parser_target_entity_unknown, + test_parser_target_feed_exception, + test_parser_target_fromstring_exception, + test_parser_target_tag, + test_parser_version, + test_pi, + test_pi_nonsense, + test_processinginstruction, + test_qname, + test_qname_attrib, + test_qname_attrib_resolve, + test_qname_attribute_getset, + test_qname_attribute_resolve, + test_qname_attribute_resolve_new, + test_qname_cmp, + test_remove, + test_remove_nonexisting, + test_remove_ns, + test_remove_tail, + test_replace_slice_tail, + test_set_text, + test_set_text2, + test_set_text_empty, + test_set_text_none, + test_setitem, + test_setitem2, + test_setitem_indexerror, + test_setitem_replace, + test_setitem_tail, + test_setslice, + test_setslice_all, + test_setslice_all_empty, + test_setslice_all_replace, + test_setslice_all_replace_reversed, + test_setslice_all_replace_reversed_ns1, + test_setslice_all_replace_reversed_ns2, + test_setslice_empty, + test_setslice_end, + test_setslice_negative, + test_setslice_negative2, + test_setslice_single, + test_setslice_tail, + test_shallowcopy, + test_shallowcopy_elementtree, + test_simple, + test_subelement, + test_subelement_reference, + test_subelement_with_attributes, + test_subelement_with_attributes_ns, + test_tag_reset_ns, + test_tag_reset_root_ns, + test_tag_str_subclass, + test_tag_write, + test_tail, + test_tail1, + test_tail_append, + test_tail_elementtree_root, + test_tail_set_none, + test_tail_set_twice, + test_tail_str_subclass, + test_text, + test_text_empty, + test_text_escape_in, + test_text_escape_out, + test_text_escape_tostring, + test_text_other, + test_text_str_subclass, + test_tostring, + test_tostring_element, + test_tostring_element_tail, + test_tostring_method_html, + test_tostring_method_text, + test_treebuilder, + test_treebuilder_target, + test_weird_dict_interaction, + test_write, + test_write_ElementTreeDoctest, + test_write_fail, + test_write_method_html, + test_write_method_text +

+ +

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.ETreeTestCaseBase-class.html b/doc/html/api/lxml.tests.test_elementtree.ETreeTestCaseBase-class.html new file mode 100644 index 0000000..33a1725 --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ETreeTestCaseBase-class.html @@ -0,0 +1,4576 @@ + + + + + lxml.tests.test_elementtree.ETreeTestCaseBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ETreeTestCaseBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeTestCaseBase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeTestCaseBase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_element(self) + source code + +
+ +
+   + + + + + + +
test_simple(self) + source code + +
+ +
+   + + + + + + +
test_weird_dict_interaction(self) + source code + +
+ +
+   + + + + + + +
test_subelement(self) + source code + +
+ +
+   + + + + + + +
test_element_contains(self) + source code + +
+ +
+   + + + + + + +
test_element_indexing_with_text(self) + source code + +
+ +
+   + + + + + + +
test_element_indexing_with_text2(self) + source code + +
+ +
+   + + + + + + +
test_element_indexing_only_text(self) + source code + +
+ +
+   + + + + + + +
test_element_indexing_negative(self) + source code + +
+ +
+   + + + + + + +
test_elementtree(self) + source code + +
+ +
+   + + + + + + +
test_text(self) + source code + +
+ +
+   + + + + + + +
test_text_empty(self) + source code + +
+ +
+   + + + + + + +
test_text_other(self) + source code + +
+ +
+   + + + + + + +
test_text_escape_in(self) + source code + +
+ +
+   + + + + + + +
test_text_escape_out(self) + source code + +
+ +
+   + + + + + + +
test_text_escape_tostring(self) + source code + +
+ +
+   + + + + + + +
test_text_str_subclass(self) + source code + +
+ +
+   + + + + + + +
test_tail(self) + source code + +
+ +
+   + + + + + + +
test_tail_str_subclass(self) + source code + +
+ +
+   + + + + + + +
_test_del_tail(self) + source code + +
+ +
+   + + + + + + +
test_ElementTree(self) + source code + +
+ +
+   + + + + + + +
test_attributes(self) + source code + +
+ +
+   + + + + + + +
test_attributes2(self) + source code + +
+ +
+   + + + + + + +
test_attributes3(self) + source code + +
+ +
+   + + + + + + +
test_attrib_clear(self) + source code + +
+ +
+   + + + + + + +
test_attrib_set_clear(self) + source code + +
+ +
+   + + + + + + +
test_attrib_ns_clear(self) + source code + +
+ +
+   + + + + + + +
test_attrib_pop(self) + source code + +
+ +
+   + + + + + + +
test_attrib_pop_unknown(self) + source code + +
+ +
+   + + + + + + +
test_attrib_pop_default(self) + source code + +
+ +
+   + + + + + + +
test_attrib_pop_empty_default(self) + source code + +
+ +
+   + + + + + + +
test_attrib_pop_invalid_args(self) + source code + +
+ +
+   + + + + + + +
test_attribute_update_dict(self) + source code + +
+ +
+   + + + + + + +
test_attribute_update_sequence(self) + source code + +
+ +
+   + + + + + + +
test_attribute_update_iter(self) + source code + +
+ +
+   + + + + + + +
test_attribute_keys(self) + source code + +
+ +
+   + + + + + + +
test_attribute_keys2(self) + source code + +
+ +
+   + + + + + + +
test_attribute_items2(self) + source code + +
+ +
+   + + + + + + +
test_attribute_keys_ns(self) + source code + +
+ +
+   + + + + + + +
test_attribute_values(self) + source code + +
+ +
+   + + + + + + +
test_attribute_values_ns(self) + source code + +
+ +
+   + + + + + + +
test_attribute_items(self) + source code + +
+ +
+   + + + + + + +
test_attribute_items_ns(self) + source code + +
+ +
+   + + + + + + +
test_attribute_str(self) + source code + +
+ +
+   + + + + + + +
test_attribute_has_key(self) + source code + +
+ +
+   + + + + + + +
test_attribute_contains(self) + source code + +
+ +
+   + + + + + + +
test_attribute_set(self) + source code + +
+ +
+   + + + + + + +
test_del_attribute_ns(self) + source code + +
+ +
+   + + + + + + +
test_del_attribute_ns_parsed(self) + source code + +
+ +
+   + + + + + + +
test_XML(self) + source code + +
+ +
+   + + + + + + +
test_XMLID(self) + source code + +
+ +
+   + + + + + + +
test_fromstring(self) + source code + +
+ +
+   + + + + + + +
test_fromstringlist(self) + source code + +
+ +
+   + + + + + + +
test_fromstringlist_characters(self) + source code + +
+ +
+   + + + + + + +
test_fromstringlist_single(self) + source code + +
+ +
+   + + + + + + +
test_iselement(self) + source code + +
+ +
+   + + + + + + +
test_iteration(self) + source code + +
+ +
+   + + + + + + +
test_iteration_empty(self) + source code + +
+ +
+   + + + + + + +
test_iteration_text_only(self) + source code + +
+ +
+   + + + + + + +
test_iteration_crash(self) + source code + +
+ +
+   + + + + + + +
test_iteration_reversed(self) + source code + +
+ +
+   + + + + + + +
test_iteration_subelement(self) + source code + +
+ +
+   + + + + + + +
test_iteration_del_child(self) + source code + +
+ +
+   + + + + + + +
test_iteration_double(self) + source code + +
+ +
+   + + + + + + +
test_attribute_iterator(self) + source code + +
+ +
+   + + + + + + +
test_itertext(self) + source code + +
+ +
+   + + + + + + +
test_itertext_child(self) + source code + +
+ +
+   + + + + + + +
test_findall(self) + source code + +
+ +
+   + + + + + + +
test_findall_ns(self) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes_keywords(self) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes(self) + source code + +
+ +
+   + + + + + + +
test_element_with_attributes_ns(self) + source code + +
+ +
+   + + + + + + +
test_subelement_with_attributes(self) + source code + +
+ +
+   + + + + + + +
test_subelement_with_attributes_ns(self) + source code + +
+ +
+   + + + + + + +
test_write(self) + source code + +
+ +
+   + + + + + + +
test_write_method_html(self) + source code + +
+ +
+   + + + + + + +
test_write_method_text(self) + source code + +
+ +
+   + + + + + + +
test_write_fail(self) + source code + +
+ +
+   + + + + + + +
test_crash(self) + source code + +
+ +
+   + + + + + + +
test_write_ElementTreeDoctest(self) + source code + +
+ +
+   + + + + + + +
test_subelement_reference(self) + source code + +
+ +
+   + + + + + + +
test_set_text(self) + source code + +
+ +
+   + + + + + + +
test_set_text2(self) + source code + +
+ +
+   + + + + + + +
test_set_text_none(self) + source code + +
+ +
+   + + + + + + +
test_set_text_empty(self) + source code + +
+ +
+   + + + + + + +
test_tail1(self) + source code + +
+ +
+   + + + + + + +
test_tail_append(self) + source code + +
+ +
+   + + + + + + +
test_tail_set_twice(self) + source code + +
+ +
+   + + + + + + +
test_tail_set_none(self) + source code + +
+ +
+   + + + + + + +
test_extend(self) + source code + +
+ +
+   + + + + + + +
test_comment(self) + source code + +
+ +
+   + + + + + + +
test_comment_text(self) + source code + +
+ +
+   + + + + + + +
test_comment_whitespace(self) + source code + +
+ +
+   + + + + + + +
test_comment_nonsense(self) + source code + +
+ +
+   + + + + + + +
test_pi(self) + source code + +
+ +
+   + + + + + + +
test_processinginstruction(self) + source code + +
+ +
+   + + + + + + +
test_pi_nonsense(self) + source code + +
+ +
+   + + + + + + +
test_setitem(self) + source code + +
+ +
+   + + + + + + +
test_setitem2(self) + source code + +
+ +
+   + + + + + + +
test_setitem_replace(self) + source code + +
+ +
+   + + + + + + +
test_setitem_indexerror(self) + source code + +
+ +
+   + + + + + + +
test_setitem_tail(self) + source code + +
+ +
+   + + + + + + +
test_tag_write(self) + source code + +
+ +
+   + + + + + + +
test_tag_reset_ns(self) + source code + +
+ +
+   + + + + + + +
test_tag_reset_root_ns(self) + source code + +
+ +
+   + + + + + + +
test_tag_str_subclass(self) + source code + +
+ +
+   + + + + + + +
test_delitem(self) + source code + +
+ +
+   + + + + + + +
test_del_insert(self) + source code + +
+ +
+   + + + + + + +
test_del_setitem(self) + source code + +
+ +
+   + + + + + + +
test_del_setslice(self) + source code + +
+ +
+   + + + + + + +
test_replace_slice_tail(self) + source code + +
+ +
+   + + + + + + +
test_merge_namespaced_subtree_as_slice(self) + source code + +
+ +
+   + + + + + + +
test_delitem_tail(self) + source code + +
+ +
+   + + + + + + +
test_clear(self) + source code + +
+ +
+   + + + + + + +
test_clear_sub(self) + source code + +
+ +
+   + + + + + + +
test_clear_tail(self) + source code + +
+ +
+   + + + + + + +
test_insert(self) + source code + +
+ +
+   + + + + + + +
test_insert_beyond_index(self) + source code + +
+ +
+   + + + + + + +
test_insert_negative(self) + source code + +
+ +
+   + + + + + + +
test_insert_tail(self) + source code + +
+ +
+   + + + + + + +
test_remove(self) + source code + +
+ +
+   + + + + + + +
test_remove_ns(self) + source code + +
+ +
+   + + + + + + +
test_remove_nonexisting(self) + source code + +
+ +
+   + + + + + + +
test_remove_tail(self) + source code + +
+ +
+   + + + + + + +
_test_getchildren(self) + source code + +
+ +
+   + + + + + + +
test_makeelement(self) + source code + +
+ +
+   + + + + + + +
test_iter(self) + source code + +
+ +
+   + + + + + + +
test_getiterator(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_empty(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_all(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_comment(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_pi(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_with_text(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_with_text(self) + source code + +
+ +
+   + + + + + + +
test_attribute_manipulation(self) + source code + +
+ +
+   + + + + + + +
test_getslice(self) + source code + +
+ +
+   + + + + + + +
test_getslice_negative(self) + source code + +
+ +
+   + + + + + + +
test_getslice_step(self) + source code + +
+ +
+   + + + + + + +
test_getslice_text(self) + source code + +
+ +
+   + + + + + + +
test_comment_getitem_getslice(self) + source code + +
+ +
+   + + + + + + +
test_delslice(self) + source code + +
+ +
+   + + + + + + +
test_delslice_negative1(self) + source code + +
+ +
+   + + + + + + +
test_delslice_negative2(self) + source code + +
+ +
+   + + + + + + +
test_delslice_step(self) + source code + +
+ +
+   + + + + + + +
test_delslice_step_negative(self) + source code + +
+ +
+   + + + + + + +
test_delslice_step_negative2(self) + source code + +
+ +
+   + + + + + + +
test_delslice_child_tail(self) + source code + +
+ +
+   + + + + + + +
test_delslice_tail(self) + source code + +
+ +
+   + + + + + + +
test_delslice_memory(self) + source code + +
+ +
+   + + + + + + +
test_setslice(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_empty(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_replace(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_replace_reversed(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_replace_reversed_ns1(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_replace_reversed_ns2(self) + source code + +
+ +
+   + + + + + + +
test_setslice_single(self) + source code + +
+ +
+   + + + + + + +
test_setslice_tail(self) + source code + +
+ +
+   + + + + + + +
test_setslice_negative(self) + source code + +
+ +
+   + + + + + + +
test_setslice_negative2(self) + source code + +
+ +
+   + + + + + + +
test_setslice_end(self) + source code + +
+ +
+   + + + + + + +
test_setslice_empty(self) + source code + +
+ +
+   + + + + + + +
test_tail_elementtree_root(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_getiterator(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_getiterator_filter(self) + source code + +
+ +
+   + + + + + + +
test_ns_access(self) + source code + +
+ +
+   + + + + + + +
test_ns_access2(self) + source code + +
+ +
+   + + + + + + +
test_ns_setting(self) + source code + +
+ +
+   + + + + + + +
test_ns_tag_parse(self) + source code + +
+ +
+   + + + + + + +
test_ns_attr(self) + source code + +
+ +
+   + + + + + + +
test_ns_move(self) + source code + +
+ +
+   + + + + + + +
test_ns_decl_tostring(self) + source code + +
+ +
+   + + + + + + +
test_ns_decl_tostring_default(self) + source code + +
+ +
+   + + + + + + +
test_ns_decl_tostring_root(self) + source code + +
+ +
+   + + + + + + +
test_ns_decl_tostring_element(self) + source code + +
+ +
+   + + + + + + +
test_attribute_xmlns_move(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_after_serialize(self) + source code + +
+ +
+   + + + + + + +
test_tostring(self) + source code + +
+ +
+   + + + + + + +
test_tostring_element(self) + source code + +
+ +
+   + + + + + + +
test_tostring_element_tail(self) + source code + +
+ +
+   + + + + + + +
test_tostring_method_html(self) + source code + +
+ +
+   + + + + + + +
test_tostring_method_text(self) + source code + +
+ +
+   + + + + + + +
test_iterparse(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_file(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_start(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_start_end(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_clear(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_large(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_attrib_ns(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_getiterator(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_move_elements(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_cdata(self) + source code + +
+ +
+   + + + + + + +
test_parse_file(self) + source code + +
+ +
+   + + + + + + +
test_parse_file_nonexistent(self) + source code + +
+ +
+   + + + + + + +
test_parse_error_none(self) + source code + +
+ +
+   + + + + + + +
test_parse_error(self) + source code + +
+ +
+   + + + + + + +
test_parse_error_from_file(self) + source code + +
+ +
+   + + + + + + +
test_parse_file_object(self) + source code + +
+ +
+   + + + + + + +
test_parse_stringio(self) + source code + +
+ +
+   + + + + + + +
test_parse_cdata(self) + source code + +
+ +
+   + + + + + + +
test_parse_with_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding_exact(self) + source code + +
+ +
+   + + + + + + +
test_parse_file_encoding(self) + source code + +
+ +
+   + + + + + + +
test_parse_file_object_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding_8bit_latin1(self) + source code + +
+ +
+   + + + + + + +
test_parse_encoding_8bit_explicit(self) + source code + +
+ +
+   + + + + + + +
test_parse_encoding_8bit_override(self) + source code + +
+ +
+   + + + + + + +
_test_wrong_unicode_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding_write_default_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding_tostring(self) + source code + +
+ +
+   + + + + + + +
test_encoding_tostring_unknown(self) + source code + +
+ +
+   + + + + + + +
test_encoding_tostring_sub(self) + source code + +
+ +
+   + + + + + + +
test_encoding_tostring_sub_tail(self) + source code + +
+ +
+   + + + + + + +
test_encoding_tostring_default_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding_sub_tostring_default_encoding(self) + source code + +
+ +
+   + + + + + + +
test_encoding_8bit_xml(self) + source code + +
+ +
+   + + + + + + +
test_encoding_utf8_bom(self) + source code + +
+ +
+   + + + + + + +
test_encoding_8bit_parse_stringio(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_elementtree(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_tail(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_subelement(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_namespaces(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_append(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_comment(self) + source code + +
+ +
+   + + + + + + +
test_shallowcopy(self) + source code + +
+ +
+   + + + + + + +
test_shallowcopy_elementtree(self) + source code + +
+ +
+   + + + + + + +
_test_element_boolean(self) + source code + +
+ +
+   + + + + + + +
test_multiple_elementrees(self) + source code + +
+ +
+   + + + + + + +
test_qname(self) + source code + +
+ +
+   + + + + + + +
test_qname_cmp(self) + source code + +
+ +
+   + + + + + + +
test_qname_attribute_getset(self) + source code + +
+ +
+   + + + + + + +
test_qname_attrib(self) + source code + +
+ +
+   + + + + + + +
test_qname_attribute_resolve(self) + source code + +
+ +
+   + + + + + + +
test_qname_attribute_resolve_new(self) + source code + +
+ +
+   + + + + + + +
test_qname_attrib_resolve(self) + source code + +
+ +
+   + + + + + + +
test_parser_version(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser_error_close_empty(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser_error_close_incomplete(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser_error_broken(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser_error_position(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_tag(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_parser_target(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_attrib(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_data(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_entity(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_entity_unknown(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_feed_exception(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_fromstring_exception(self) + source code + +
+ +
+   + + + + + + +
test_treebuilder(self) + source code + +
+ +
+   + + + + + + +
test_treebuilder_target(self) + source code + +
+ +
+   + + + + + + +
_writeElement(self, + element, + encoding='us-ascii')
+ Write out element for comparison.
+ source code + +
+ +
+   + + + + + + +
_writeElementFile(self, + element, + encoding='us-ascii')
+ Write out element for comparison, using real file.
+ source code + +
+ +
+   + + + + + + +
assertXML(self, + expected, + element, + encoding='us-ascii')
+ Writes element out and checks whether it is expected.
+ source code + +
+ +
+   + + + + + + +
assertEncodingDeclaration(self, + result, + encoding)
+ Checks if the result XML byte string specifies the encoding.
+ source code + +
+ +
+   + + + + + + +
_rootstring(self, + tree) + source code + +
+ +
+   + + + + + + +
_check_element_tree(self, + tree) + source code + +
+ +
+   + + + + + + +
_check_element(self, + element) + source code + +
+ +
+   + + + + + + +
_check_string(self, + string) + source code + +
+ +
+   + + + + + + +
_check_mapping(self, + mapping) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

assertXML(self, + expected, + element, + encoding='us-ascii') +

+
source code  +
+ +

Writes element out and checks whether it is expected.

+

Does this two ways; once using BytesIO, once using a real file.

+
+
+
+
+ +
+ +
+ + +
+

_rootstring(self, + tree) +

+
source code  +
+ + +
+
Overrides: + common_imports.HelperTestCase._rootstring +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_elementtree.ElementTreeTestCase-class.html b/doc/html/api/lxml.tests.test_elementtree.ElementTreeTestCase-class.html new file mode 100644 index 0000000..3f5b5ec --- /dev/null +++ b/doc/html/api/lxml.tests.test_elementtree.ElementTreeTestCase-class.html @@ -0,0 +1,582 @@ + + + + + lxml.tests.test_elementtree.ElementTreeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_elementtree :: + Class ElementTreeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTreeTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                ETreeTestCaseBase --+
+                                    |
+                                   ElementTreeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from ETreeTestCaseBase: + assertEncodingDeclaration, + assertXML, + test_ElementTree, + test_XML, + test_XMLID, + test_attrib_clear, + test_attrib_ns_clear, + test_attrib_pop, + test_attrib_pop_default, + test_attrib_pop_empty_default, + test_attrib_pop_invalid_args, + test_attrib_pop_unknown, + test_attrib_set_clear, + test_attribute_contains, + test_attribute_has_key, + test_attribute_items, + test_attribute_items2, + test_attribute_items_ns, + test_attribute_iterator, + test_attribute_keys, + test_attribute_keys2, + test_attribute_keys_ns, + test_attribute_manipulation, + test_attribute_set, + test_attribute_str, + test_attribute_update_dict, + test_attribute_update_iter, + test_attribute_update_sequence, + test_attribute_values, + test_attribute_values_ns, + test_attribute_xmlns_move, + test_attributes, + test_attributes2, + test_attributes3, + test_clear, + test_clear_sub, + test_clear_tail, + test_comment, + test_comment_getitem_getslice, + test_comment_nonsense, + test_comment_text, + test_comment_whitespace, + test_crash, + test_deepcopy, + test_deepcopy_append, + test_deepcopy_comment, + test_deepcopy_elementtree, + test_deepcopy_namespaces, + test_deepcopy_subelement, + test_deepcopy_tail, + test_del_attribute_ns, + test_del_attribute_ns_parsed, + test_del_insert, + test_del_setitem, + test_del_setslice, + test_delitem, + test_delitem_tail, + test_delslice, + test_delslice_child_tail, + test_delslice_memory, + test_delslice_negative1, + test_delslice_negative2, + test_delslice_step, + test_delslice_step_negative, + test_delslice_step_negative2, + test_delslice_tail, + test_element, + test_element_contains, + test_element_indexing_negative, + test_element_indexing_only_text, + test_element_indexing_with_text, + test_element_indexing_with_text2, + test_element_with_attributes, + test_element_with_attributes_keywords, + test_element_with_attributes_ns, + test_elementtree, + test_elementtree_getiterator, + test_elementtree_getiterator_filter, + test_elementtree_parser_target, + test_encoding, + test_encoding_8bit_latin1, + test_encoding_8bit_parse_stringio, + test_encoding_8bit_xml, + test_encoding_exact, + test_encoding_sub_tostring_default_encoding, + test_encoding_tostring, + test_encoding_tostring_default_encoding, + test_encoding_tostring_sub, + test_encoding_tostring_sub_tail, + test_encoding_tostring_unknown, + test_encoding_utf8_bom, + test_encoding_write_default_encoding, + test_extend, + test_feed_parser, + test_feed_parser_error_broken, + test_feed_parser_error_close_empty, + test_feed_parser_error_close_incomplete, + test_feed_parser_error_position, + test_findall, + test_findall_ns, + test_fromstring, + test_fromstringlist, + test_fromstringlist_characters, + test_fromstringlist_single, + test_getiterator, + test_getiterator_empty, + test_getiterator_filter, + test_getiterator_filter_all, + test_getiterator_filter_comment, + test_getiterator_filter_pi, + test_getiterator_filter_with_text, + test_getiterator_with_text, + test_getslice, + test_getslice_negative, + test_getslice_step, + test_getslice_text, + test_insert, + test_insert_beyond_index, + test_insert_negative, + test_insert_tail, + test_iselement, + test_iter, + test_iteration, + test_iteration_crash, + test_iteration_del_child, + test_iteration_double, + test_iteration_empty, + test_iteration_reversed, + test_iteration_subelement, + test_iteration_text_only, + test_iterparse, + test_iterparse_attrib_ns, + test_iterparse_cdata, + test_iterparse_clear, + test_iterparse_file, + test_iterparse_getiterator, + test_iterparse_large, + test_iterparse_move_elements, + test_iterparse_start, + test_iterparse_start_end, + test_itertext, + test_itertext_child, + test_makeelement, + test_merge_namespaced_subtree_as_slice, + test_multiple_elementrees, + test_namespaces_after_serialize, + test_ns_access, + test_ns_access2, + test_ns_attr, + test_ns_decl_tostring, + test_ns_decl_tostring_default, + test_ns_decl_tostring_element, + test_ns_decl_tostring_root, + test_ns_move, + test_ns_setting, + test_ns_tag_parse, + test_parse_cdata, + test_parse_encoding_8bit_explicit, + test_parse_encoding_8bit_override, + test_parse_error, + test_parse_error_from_file, + test_parse_error_none, + test_parse_file, + test_parse_file_encoding, + test_parse_file_nonexistent, + test_parse_file_object, + test_parse_file_object_encoding, + test_parse_stringio, + test_parse_with_encoding, + test_parser_target_attrib, + test_parser_target_data, + test_parser_target_entity, + test_parser_target_entity_unknown, + test_parser_target_feed_exception, + test_parser_target_fromstring_exception, + test_parser_target_tag, + test_parser_version, + test_pi, + test_pi_nonsense, + test_processinginstruction, + test_qname, + test_qname_attrib, + test_qname_attrib_resolve, + test_qname_attribute_getset, + test_qname_attribute_resolve, + test_qname_attribute_resolve_new, + test_qname_cmp, + test_remove, + test_remove_nonexisting, + test_remove_ns, + test_remove_tail, + test_replace_slice_tail, + test_set_text, + test_set_text2, + test_set_text_empty, + test_set_text_none, + test_setitem, + test_setitem2, + test_setitem_indexerror, + test_setitem_replace, + test_setitem_tail, + test_setslice, + test_setslice_all, + test_setslice_all_empty, + test_setslice_all_replace, + test_setslice_all_replace_reversed, + test_setslice_all_replace_reversed_ns1, + test_setslice_all_replace_reversed_ns2, + test_setslice_empty, + test_setslice_end, + test_setslice_negative, + test_setslice_negative2, + test_setslice_single, + test_setslice_tail, + test_shallowcopy, + test_shallowcopy_elementtree, + test_simple, + test_subelement, + test_subelement_reference, + test_subelement_with_attributes, + test_subelement_with_attributes_ns, + test_tag_reset_ns, + test_tag_reset_root_ns, + test_tag_str_subclass, + test_tag_write, + test_tail, + test_tail1, + test_tail_append, + test_tail_elementtree_root, + test_tail_set_none, + test_tail_set_twice, + test_tail_str_subclass, + test_text, + test_text_empty, + test_text_escape_in, + test_text_escape_out, + test_text_escape_tostring, + test_text_other, + test_text_str_subclass, + test_tostring, + test_tostring_element, + test_tostring_element_tail, + test_tostring_method_html, + test_tostring_method_text, + test_treebuilder, + test_treebuilder_target, + test_weird_dict_interaction, + test_write, + test_write_ElementTreeDoctest, + test_write_fail, + test_write_method_html, + test_write_method_text +

+ +

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ +
+
+
+
Value:
+
elementtree.ElementTree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_errors-module.html b/doc/html/api/lxml.tests.test_errors-module.html new file mode 100644 index 0000000..84c5ed7 --- /dev/null +++ b/doc/html/api/lxml.tests.test_errors-module.html @@ -0,0 +1,236 @@ + + + + + lxml.tests.test_errors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_errors + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_errors

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ErrorTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_errors-pysrc.html b/doc/html/api/lxml.tests.test_errors-pysrc.html new file mode 100644 index 0000000..a2f26cc --- /dev/null +++ b/doc/html/api/lxml.tests.test_errors-pysrc.html @@ -0,0 +1,172 @@ + + + + + lxml.tests.test_errors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_errors + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_errors

+
+# -*- coding: utf-8 -*-
+import unittest, doctest
+
+# These tests check that error handling in the Pyrex code is
+# complete.
+# It is likely that if there are errors, instead of failing the code
+# will simply crash.
+
+import sys, gc, os.path
+from lxml import etree
+
+this_dir = os.path.dirname(__file__)
+if this_dir not in sys.path:
+    sys.path.insert(0, this_dir) # needed for Py3
+
+from common_imports import HelperTestCase
+
+class ErrorTestCase(HelperTestCase):
+    etree = etree
+
+    def test_bad_element(self):
+        # attrib argument of Element() should be a dictionary, so if
+        # we pass a string we should get an error.
+        self.assertRaises(TypeError, self.etree.Element, 'a', 'b')
+
+    def test_empty_parse(self):
+        self.assertRaises(etree.XMLSyntaxError, etree.fromstring, '')
+
+    def test_element_cyclic_gc_none(self):
+        # test if cyclic reference can crash etree
+        Element = self.etree.Element
+        gc.collect()
+
+        count = sys.getrefcount(None)
+
+        l = [Element('name'), Element('name')]
+        l.append(l)
+
+        del l
+        gc.collect()
+
+        self.assertEquals(sys.getrefcount(None), count)
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTests([unittest.makeSuite(ErrorTestCase)])
+    return suite
+
+if __name__ == '__main__':
+    print('to test use test.py %s' % __file__)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_errors.ErrorTestCase-class.html b/doc/html/api/lxml.tests.test_errors.ErrorTestCase-class.html new file mode 100644 index 0000000..cbf7fc4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_errors.ErrorTestCase-class.html @@ -0,0 +1,367 @@ + + + + + lxml.tests.test_errors.ErrorTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_errors :: + Class ErrorTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ErrorTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ErrorTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_bad_element(self) + source code + +
+ +
+   + + + + + + +
test_empty_parse(self) + source code + +
+ +
+   + + + + + + +
test_element_cyclic_gc_none(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree-module.html b/doc/html/api/lxml.tests.test_etree-module.html new file mode 100644 index 0000000..230ce0a --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree-module.html @@ -0,0 +1,283 @@ + + + + + lxml.tests.test_etree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_etree

source code

+

Tests specific to the extended etree API

+

Tests that apply to the general ElementTree API should go into +test_elementtree

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeOnlyTestCase
+ Tests only for etree, not ElementTree +
+   + + XIncludeTestCase +
+   + + ETreeXIncludeTestCase +
+   + + ElementIncludeTestCase +
+   + + ETreeC14NTestCase +
+   + + ETreeWriteTestCase +
+   + + ETreeErrorLogTest +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree-pysrc.html b/doc/html/api/lxml.tests.test_etree-pysrc.html new file mode 100644 index 0000000..4722df9 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree-pysrc.html @@ -0,0 +1,9084 @@ + + + + + lxml.tests.test_etree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_etree

+
+   1  # -*- coding: utf-8 -*- 
+   2   
+   3  """ 
+   4  Tests specific to the extended etree API 
+   5   
+   6  Tests that apply to the general ElementTree API should go into 
+   7  test_elementtree 
+   8  """ 
+   9   
+  10  import os.path, unittest, copy, sys, operator, tempfile, gzip 
+  11   
+  12  this_dir = os.path.dirname(__file__) 
+  13  if this_dir not in sys.path: 
+  14      sys.path.insert(0, this_dir) # needed for Py3 
+  15   
+  16  from common_imports import etree, StringIO, BytesIO, HelperTestCase, fileInTestDir 
+  17  from common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_doctest 
+  18  from common_imports import canonicalize, sorted, _str, _bytes 
+  19   
+  20  print("") 
+  21  print("TESTED VERSION: %s" % etree.__version__) 
+  22  print("    Python:           " + repr(sys.version_info)) 
+  23  print("    lxml.etree:       " + repr(etree.LXML_VERSION)) 
+  24  print("    libxml used:      " + repr(etree.LIBXML_VERSION)) 
+  25  print("    libxml compiled:  " + repr(etree.LIBXML_COMPILED_VERSION)) 
+  26  print("    libxslt used:     " + repr(etree.LIBXSLT_VERSION)) 
+  27  print("    libxslt compiled: " + repr(etree.LIBXSLT_COMPILED_VERSION)) 
+  28  print("") 
+  29   
+  30  try: 
+  31      _unicode = unicode 
+  32  except NameError: 
+  33      # Python 3 
+  34      _unicode = str 
+  35   
+
36 -class ETreeOnlyTestCase(HelperTestCase): +
37 """Tests only for etree, not ElementTree""" + 38 etree = etree + 39 +
40 - def test_version(self): +
41 self.assert_(isinstance(etree.__version__, _unicode)) + 42 self.assert_(isinstance(etree.LXML_VERSION, tuple)) + 43 self.assertEqual(len(etree.LXML_VERSION), 4) + 44 self.assert_(isinstance(etree.LXML_VERSION[0], int)) + 45 self.assert_(isinstance(etree.LXML_VERSION[1], int)) + 46 self.assert_(isinstance(etree.LXML_VERSION[2], int)) + 47 self.assert_(isinstance(etree.LXML_VERSION[3], int)) + 48 self.assert_(etree.__version__.startswith( + 49 str(etree.LXML_VERSION[0]))) +
50 +
51 - def test_c_api(self): +
52 if hasattr(self.etree, '__pyx_capi__'): + 53 # newer Pyrex compatible C-API + 54 self.assert_(isinstance(self.etree.__pyx_capi__, dict)) + 55 self.assert_(len(self.etree.__pyx_capi__) > 0) + 56 else: + 57 # older C-API mechanism + 58 self.assert_(hasattr(self.etree, '_import_c_api')) +
59 +
60 - def test_element_names(self): +
61 Element = self.etree.Element + 62 el = Element('name') + 63 self.assertEquals(el.tag, 'name') + 64 el = Element('{}name') + 65 self.assertEquals(el.tag, 'name') +
66 +
67 - def test_element_name_empty(self): +
68 Element = self.etree.Element + 69 el = Element('name') + 70 self.assertRaises(ValueError, Element, '{}') + 71 self.assertRaises(ValueError, setattr, el, 'tag', '{}') + 72 + 73 self.assertRaises(ValueError, Element, '{test}') + 74 self.assertRaises(ValueError, setattr, el, 'tag', '{test}') +
75 +
76 - def test_element_name_colon(self): +
77 Element = self.etree.Element + 78 self.assertRaises(ValueError, Element, 'p:name') + 79 self.assertRaises(ValueError, Element, '{test}p:name') + 80 + 81 el = Element('name') + 82 self.assertRaises(ValueError, setattr, el, 'tag', 'p:name') +
83 +
84 - def test_element_name_quote(self): +
85 Element = self.etree.Element + 86 self.assertRaises(ValueError, Element, "p'name") + 87 self.assertRaises(ValueError, Element, 'p"name') + 88 + 89 self.assertRaises(ValueError, Element, "{test}p'name") + 90 self.assertRaises(ValueError, Element, '{test}p"name') + 91 + 92 el = Element('name') + 93 self.assertRaises(ValueError, setattr, el, 'tag', "p'name") + 94 self.assertRaises(ValueError, setattr, el, 'tag', 'p"name') +
95 +
96 - def test_element_name_space(self): +
97 Element = self.etree.Element + 98 self.assertRaises(ValueError, Element, ' name ') + 99 self.assertRaises(ValueError, Element, 'na me') + 100 self.assertRaises(ValueError, Element, '{test} name') + 101 + 102 el = Element('name') + 103 self.assertRaises(ValueError, setattr, el, 'tag', ' name ') +
104 +
105 - def test_subelement_name_empty(self): +
106 Element = self.etree.Element + 107 SubElement = self.etree.SubElement + 108 + 109 el = Element('name') + 110 self.assertRaises(ValueError, SubElement, el, '{}') + 111 self.assertRaises(ValueError, SubElement, el, '{test}') +
112 +
113 - def test_subelement_name_colon(self): +
114 Element = self.etree.Element + 115 SubElement = self.etree.SubElement + 116 + 117 el = Element('name') + 118 self.assertRaises(ValueError, SubElement, el, 'p:name') + 119 self.assertRaises(ValueError, SubElement, el, '{test}p:name') +
120 +
121 - def test_subelement_name_quote(self): +
122 Element = self.etree.Element + 123 SubElement = self.etree.SubElement + 124 + 125 el = Element('name') + 126 self.assertRaises(ValueError, SubElement, el, "p'name") + 127 self.assertRaises(ValueError, SubElement, el, "{test}p'name") + 128 + 129 self.assertRaises(ValueError, SubElement, el, 'p"name') + 130 self.assertRaises(ValueError, SubElement, el, '{test}p"name') +
131 +
132 - def test_subelement_name_space(self): +
133 Element = self.etree.Element + 134 SubElement = self.etree.SubElement + 135 + 136 el = Element('name') + 137 self.assertRaises(ValueError, SubElement, el, ' name ') + 138 self.assertRaises(ValueError, SubElement, el, 'na me') + 139 self.assertRaises(ValueError, SubElement, el, '{test} name') +
140 +
142 Element = self.etree.Element + 143 SubElement = self.etree.SubElement + 144 + 145 el = Element('name') + 146 self.assertRaises(ValueError, SubElement, el, 'name', {'a b c' : 'abc'}) + 147 self.assertRaises(ValueError, SubElement, el, 'name', {'a' : 'a\0\n'}) + 148 self.assertEquals(0, len(el)) +
149 +
150 - def test_qname_empty(self): +
151 QName = self.etree.QName + 152 self.assertRaises(ValueError, QName, '') + 153 self.assertRaises(ValueError, QName, 'test', '') +
154 +
155 - def test_qname_colon(self): +
156 QName = self.etree.QName + 157 self.assertRaises(ValueError, QName, 'p:name') + 158 self.assertRaises(ValueError, QName, 'test', 'p:name') +
159 +
160 - def test_qname_space(self): +
161 QName = self.etree.QName + 162 self.assertRaises(ValueError, QName, ' name ') + 163 self.assertRaises(ValueError, QName, 'na me') + 164 self.assertRaises(ValueError, QName, 'test', ' name') +
165 +
167 # ET doesn't have namespace/localname properties on QNames + 168 QName = self.etree.QName + 169 namespace, localname = 'http://myns', 'a' + 170 qname = QName(namespace, localname) + 171 self.assertEquals(namespace, qname.namespace) + 172 self.assertEquals(localname, qname.localname) +
173 +
174 - def test_qname_element(self): +
175 # ET doesn't have namespace/localname properties on QNames + 176 QName = self.etree.QName + 177 qname1 = QName('http://myns', 'a') + 178 a = self.etree.Element(qname1, nsmap={'p' : 'http://myns'}) + 179 + 180 qname2 = QName(a) + 181 self.assertEquals(a.tag, qname1.text) + 182 self.assertEquals(qname1.text, qname2.text) + 183 self.assertEquals(qname1, qname2) +
184 +
185 - def test_qname_text_resolve(self): +
186 # ET doesn't resove QNames as text values + 187 etree = self.etree + 188 qname = etree.QName('http://myns', 'a') + 189 a = etree.Element(qname, nsmap={'p' : 'http://myns'}) + 190 a.text = qname + 191 + 192 self.assertEquals("p:a", a.text) +
193 +
194 - def test_nsmap_prefix_invalid(self): +
195 etree = self.etree + 196 self.assertRaises(ValueError, + 197 etree.Element, "root", nsmap={'"' : 'testns'}) + 198 self.assertRaises(ValueError, + 199 etree.Element, "root", nsmap={'&' : 'testns'}) + 200 self.assertRaises(ValueError, + 201 etree.Element, "root", nsmap={'a:b' : 'testns'}) +
202 +
203 - def test_attribute_set(self): +
204 Element = self.etree.Element + 205 root = Element("root") + 206 root.set("attr", "TEST") + 207 self.assertEquals("TEST", root.get("attr")) +
208 +
209 - def test_attribute_set_invalid(self): +
210 # ElementTree accepts arbitrary attribute values + 211 # lxml.etree allows only strings + 212 Element = self.etree.Element + 213 root = Element("root") + 214 self.assertRaises(TypeError, root.set, "newattr", 5) + 215 self.assertRaises(TypeError, root.set, "newattr", None) +
216 +
217 - def test_strip_attributes(self): +
218 XML = self.etree.XML + 219 xml = _bytes('<test a="5" b="10" c="20"><x a="4" b="2"/></test>') + 220 + 221 root = XML(xml) + 222 self.etree.strip_attributes(root, 'a') + 223 self.assertEquals(_bytes('<test b="10" c="20"><x b="2"></x></test>'), + 224 self._writeElement(root)) + 225 + 226 root = XML(xml) + 227 self.etree.strip_attributes(root, 'b', 'c') + 228 self.assertEquals(_bytes('<test a="5"><x a="4"></x></test>'), + 229 self._writeElement(root)) +
230 +
231 - def test_strip_attributes_ns(self): +
232 XML = self.etree.XML + 233 xml = _bytes('<test xmlns:n="http://test/ns" a="6" b="10" c="20" n:a="5"><x a="4" n:b="2"/></test>') + 234 + 235 root = XML(xml) + 236 self.etree.strip_attributes(root, 'a') + 237 self.assertEquals( + 238 _bytes('<test xmlns:n="http://test/ns" b="10" c="20" n:a="5"><x n:b="2"></x></test>'), + 239 self._writeElement(root)) + 240 + 241 root = XML(xml) + 242 self.etree.strip_attributes(root, '{http://test/ns}a', 'c') + 243 self.assertEquals( + 244 _bytes('<test xmlns:n="http://test/ns" a="6" b="10"><x a="4" n:b="2"></x></test>'), + 245 self._writeElement(root)) + 246 + 247 root = XML(xml) + 248 self.etree.strip_attributes(root, '{http://test/ns}*') + 249 self.assertEquals( + 250 _bytes('<test xmlns:n="http://test/ns" a="6" b="10" c="20"><x a="4"></x></test>'), + 251 self._writeElement(root)) +
252 +
253 - def test_strip_elements(self): +
254 XML = self.etree.XML + 255 xml = _bytes('<test><a><b><c/></b></a><x><a><b/><c/></a></x></test>') + 256 + 257 root = XML(xml) + 258 self.etree.strip_elements(root, 'a') + 259 self.assertEquals(_bytes('<test><x></x></test>'), + 260 self._writeElement(root)) + 261 + 262 root = XML(xml) + 263 self.etree.strip_elements(root, 'b', 'c', 'X', 'Y', 'Z') + 264 self.assertEquals(_bytes('<test><a></a><x><a></a></x></test>'), + 265 self._writeElement(root)) + 266 + 267 root = XML(xml) + 268 self.etree.strip_elements(root, 'c') + 269 self.assertEquals(_bytes('<test><a><b></b></a><x><a><b></b></a></x></test>'), + 270 self._writeElement(root)) +
271 +
272 - def test_strip_elements_ns(self): +
273 XML = self.etree.XML + 274 xml = _bytes('<test>TEST<n:a xmlns:n="urn:a">A<b>B<c xmlns="urn:c"/>C</b>BT</n:a>AT<x>X<a>A<b xmlns="urn:a"/>BT<c xmlns="urn:x"/>CT</a>AT</x>XT</test>') + 275 + 276 root = XML(xml) + 277 self.etree.strip_elements(root, 'a') + 278 self.assertEquals(_bytes('<test>TEST<n:a xmlns:n="urn:a">A<b>B<c xmlns="urn:c"></c>C</b>BT</n:a>AT<x>X</x>XT</test>'), + 279 self._writeElement(root)) + 280 + 281 root = XML(xml) + 282 self.etree.strip_elements(root, '{urn:a}b', 'c') + 283 self.assertEquals(_bytes('<test>TEST<n:a xmlns:n="urn:a">A<b>B<c xmlns="urn:c"></c>C</b>BT</n:a>AT<x>X<a>A<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 284 self._writeElement(root)) + 285 + 286 root = XML(xml) + 287 self.etree.strip_elements(root, '{urn:a}*', 'c') + 288 self.assertEquals(_bytes('<test>TEST<x>X<a>A<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 289 self._writeElement(root)) + 290 + 291 root = XML(xml) + 292 self.etree.strip_elements(root, '{urn:a}*', 'c', with_tail=False) + 293 self.assertEquals(_bytes('<test>TESTAT<x>X<a>ABT<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 294 self._writeElement(root)) +
295 +
296 - def test_strip_tags(self): +
297 XML = self.etree.XML + 298 xml = _bytes('<test>TEST<a>A<b>B<c/>CT</b>BT</a>AT<x>X<a>A<b/>BT<c/>CT</a>AT</x>XT</test>') + 299 + 300 root = XML(xml) + 301 self.etree.strip_tags(root, 'a') + 302 self.assertEquals(_bytes('<test>TESTA<b>B<c></c>CT</b>BTAT<x>XA<b></b>BT<c></c>CTAT</x>XT</test>'), + 303 self._writeElement(root)) + 304 + 305 root = XML(xml) + 306 self.etree.strip_tags(root, 'b', 'c', 'X', 'Y', 'Z') + 307 self.assertEquals(_bytes('<test>TEST<a>ABCTBT</a>AT<x>X<a>ABTCT</a>AT</x>XT</test>'), + 308 self._writeElement(root)) + 309 + 310 root = XML(xml) + 311 self.etree.strip_tags(root, 'c') + 312 self.assertEquals(_bytes('<test>TEST<a>A<b>BCT</b>BT</a>AT<x>X<a>A<b></b>BTCT</a>AT</x>XT</test>'), + 313 self._writeElement(root)) +
314 +
315 - def test_strip_tags_ns(self): +
316 XML = self.etree.XML + 317 xml = _bytes('<test>TEST<n:a xmlns:n="urn:a">A<b>B<c xmlns="urn:c"/>CT</b>BT</n:a>AT<x>X<a>A<b xmlns="urn:a"/>BT<c xmlns="urn:x"/>CT</a>AT</x>XT</test>') + 318 + 319 root = XML(xml) + 320 self.etree.strip_tags(root, 'a') + 321 self.assertEquals(_bytes('<test>TEST<n:a xmlns:n="urn:a">A<b>B<c xmlns="urn:c"></c>CT</b>BT</n:a>AT<x>XA<b xmlns="urn:a"></b>BT<c xmlns="urn:x"></c>CTAT</x>XT</test>'), + 322 self._writeElement(root)) + 323 + 324 root = XML(xml) + 325 self.etree.strip_tags(root, '{urn:a}b', 'c') + 326 self.assertEquals(_bytes('<test>TEST<n:a xmlns:n="urn:a">A<b>B<c xmlns="urn:c"></c>CT</b>BT</n:a>AT<x>X<a>ABT<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 327 self._writeElement(root)) + 328 + 329 root = XML(xml) + 330 self.etree.strip_tags(root, '{urn:a}*', 'c') + 331 self.assertEquals(_bytes('<test>TESTA<b>B<c xmlns="urn:c"></c>CT</b>BTAT<x>X<a>ABT<c xmlns="urn:x"></c>CT</a>AT</x>XT</test>'), + 332 self._writeElement(root)) +
333 +
334 - def test_pi(self): +
335 # lxml.etree separates target and text + 336 Element = self.etree.Element + 337 SubElement = self.etree.SubElement + 338 ProcessingInstruction = self.etree.ProcessingInstruction + 339 + 340 a = Element('a') + 341 a.append(ProcessingInstruction('foo', 'some more text')) + 342 self.assertEquals(a[0].target, 'foo') + 343 self.assertEquals(a[0].text, 'some more text') +
344 +
345 - def test_pi_parse(self): +
346 XML = self.etree.XML + 347 root = XML(_bytes("<test><?mypi my test ?></test>")) + 348 self.assertEquals(root[0].target, "mypi") + 349 self.assertEquals(root[0].text, "my test ") +
350 +
351 - def test_deepcopy_pi(self): +
352 # previously caused a crash + 353 ProcessingInstruction = self.etree.ProcessingInstruction + 354 + 355 a = ProcessingInstruction("PI", "ONE") + 356 b = copy.deepcopy(a) + 357 b.text = "ANOTHER" + 358 + 359 self.assertEquals('ONE', a.text) + 360 self.assertEquals('ANOTHER', b.text) +
361 +
363 XML = self.etree.XML + 364 tostring = self.etree.tostring + 365 root = XML(_bytes("<?mypi my test ?><test/><!--comment -->")) + 366 tree1 = self.etree.ElementTree(root) + 367 self.assertEquals(_bytes("<?mypi my test ?><test/><!--comment -->"), + 368 tostring(tree1)) + 369 + 370 tree2 = copy.deepcopy(tree1) + 371 self.assertEquals(_bytes("<?mypi my test ?><test/><!--comment -->"), + 372 tostring(tree2)) + 373 + 374 root2 = copy.deepcopy(tree1.getroot()) + 375 self.assertEquals(_bytes("<test/>"), + 376 tostring(root2)) +
377 +
379 XML = self.etree.XML + 380 tostring = self.etree.tostring + 381 xml = _bytes('<!DOCTYPE test [\n<!ENTITY entity "tasty">\n]>\n<test/>') + 382 root = XML(xml) + 383 tree1 = self.etree.ElementTree(root) + 384 self.assertEquals(xml, tostring(tree1)) + 385 + 386 tree2 = copy.deepcopy(tree1) + 387 self.assertEquals(xml, tostring(tree2)) + 388 + 389 root2 = copy.deepcopy(tree1.getroot()) + 390 self.assertEquals(_bytes("<test/>"), + 391 tostring(root2)) +
392 +
393 - def test_attribute_set(self): +
394 # ElementTree accepts arbitrary attribute values + 395 # lxml.etree allows only strings + 396 Element = self.etree.Element + 397 + 398 root = Element("root") + 399 root.set("attr", "TEST") + 400 self.assertEquals("TEST", root.get("attr")) + 401 self.assertRaises(TypeError, root.set, "newattr", 5) +
402 +
403 - def test_parse_remove_comments(self): +
404 fromstring = self.etree.fromstring + 405 tostring = self.etree.tostring + 406 XMLParser = self.etree.XMLParser + 407 + 408 xml = _bytes('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 409 parser = XMLParser(remove_comments=True) + 410 root = fromstring(xml, parser) + 411 self.assertEquals( + 412 _bytes('<a><b><c/></b></a>'), + 413 tostring(root)) +
414 +
415 - def test_parse_remove_pis(self): +
416 parse = self.etree.parse + 417 tostring = self.etree.tostring + 418 XMLParser = self.etree.XMLParser + 419 + 420 xml = _bytes('<?test?><a><?A?><b><?B?><c/></b><?C?></a><?tail?>') + 421 + 422 f = BytesIO(xml) + 423 tree = parse(f) + 424 self.assertEquals( + 425 xml, + 426 tostring(tree)) + 427 + 428 parser = XMLParser(remove_pis=True) + 429 tree = parse(f, parser) + 430 self.assertEquals( + 431 _bytes('<a><b><c/></b></a>'), + 432 tostring(tree)) +
433 +
435 # ET raises IOError only + 436 parse = self.etree.parse + 437 self.assertRaises(TypeError, parse, 'notthere.xml', object()) +
438 +
440 # ET removes comments + 441 iterparse = self.etree.iterparse + 442 tostring = self.etree.tostring + 443 + 444 f = BytesIO('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 445 events = list(iterparse(f)) + 446 root = events[-1][1] + 447 self.assertEquals(3, len(events)) + 448 self.assertEquals( + 449 _bytes('<a><!--A--><b><!-- B --><c/></b><!--C--></a>'), + 450 tostring(root)) +
451 +
452 - def test_iterparse_comments(self): +
453 # ET removes comments + 454 iterparse = self.etree.iterparse + 455 tostring = self.etree.tostring + 456 + 457 def name(event, el): + 458 if event == 'comment': + 459 return el.text + 460 else: + 461 return el.tag +
462 + 463 f = BytesIO('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 464 events = list(iterparse(f, events=('end', 'comment'))) + 465 root = events[-1][1] + 466 self.assertEquals(6, len(events)) + 467 self.assertEquals(['A', ' B ', 'c', 'b', 'C', 'a'], + 468 [ name(*item) for item in events ]) + 469 self.assertEquals( + 470 _bytes('<a><!--A--><b><!-- B --><c/></b><!--C--></a>'), + 471 tostring(root)) +
472 +
473 - def test_iterparse_pis(self): +
474 # ET removes pis + 475 iterparse = self.etree.iterparse + 476 tostring = self.etree.tostring + 477 ElementTree = self.etree.ElementTree + 478 + 479 def name(event, el): + 480 if event == 'pi': + 481 return (el.target, el.text) + 482 else: + 483 return el.tag +
484 + 485 f = BytesIO('<?pia a?><a><?pib b?><b><?pic c?><c/></b><?pid d?></a><?pie e?>') + 486 events = list(iterparse(f, events=('end', 'pi'))) + 487 root = events[-2][1] + 488 self.assertEquals(8, len(events)) + 489 self.assertEquals([('pia','a'), ('pib','b'), ('pic','c'), 'c', 'b', + 490 ('pid','d'), 'a', ('pie','e')], + 491 [ name(*item) for item in events ]) + 492 self.assertEquals( + 493 _bytes('<?pia a?><a><?pib b?><b><?pic c?><c/></b><?pid d?></a><?pie e?>'), + 494 tostring(ElementTree(root))) + 495 +
497 iterparse = self.etree.iterparse + 498 tostring = self.etree.tostring + 499 + 500 f = BytesIO('<a><!--A--><b><!-- B --><c/></b><!--C--></a>') + 501 events = list(iterparse(f, remove_comments=True, + 502 events=('end', 'comment'))) + 503 root = events[-1][1] + 504 self.assertEquals(3, len(events)) + 505 self.assertEquals(['c', 'b', 'a'], + 506 [ el.tag for (event, el) in events ]) + 507 self.assertEquals( + 508 _bytes('<a><b><c/></b></a>'), + 509 tostring(root)) +
510 +
511 - def test_iterparse_broken(self): +
512 iterparse = self.etree.iterparse + 513 f = BytesIO('<a><b><c/></a>') + 514 # ET raises ExpatError, lxml raises XMLSyntaxError + 515 self.assertRaises(self.etree.XMLSyntaxError, list, iterparse(f)) +
516 +
517 - def test_iterparse_strip(self): +
518 iterparse = self.etree.iterparse + 519 f = BytesIO(""" + 520 <a> \n \n <b> b test </b> \n + 521 + 522 \n\t <c> \n </c> </a> \n """) + 523 iterator = iterparse(f, remove_blank_text=True) + 524 text = [ (element.text, element.tail) + 525 for event, element in iterator ] + 526 self.assertEquals( + 527 [(" b test ", None), (" \n ", None), (None, None)], + 528 text) +
529 +
530 - def test_iterparse_tag(self): +
531 iterparse = self.etree.iterparse + 532 f = BytesIO('<a><b><d/></b><c/></a>') + 533 + 534 iterator = iterparse(f, tag="b", events=('start', 'end')) + 535 events = list(iterator) + 536 root = iterator.root + 537 self.assertEquals( + 538 [('start', root[0]), ('end', root[0])], + 539 events) +
540 +
541 - def test_iterparse_tag_all(self): +
542 iterparse = self.etree.iterparse + 543 f = BytesIO('<a><b><d/></b><c/></a>') + 544 + 545 iterator = iterparse(f, tag="*", events=('start', 'end')) + 546 events = list(iterator) + 547 self.assertEquals( + 548 8, + 549 len(events)) +
550 +
552 text = _str('Søk på nettet') + 553 wrong_declaration = "<?xml version='1.0' encoding='UTF-8'?>" + 554 xml_latin1 = (_str('%s<a>%s</a>') % (wrong_declaration, text) + 555 ).encode('iso-8859-1') + 556 + 557 self.assertRaises(self.etree.ParseError, + 558 list, self.etree.iterparse(BytesIO(xml_latin1))) +
559 +
561 text = _str('Søk på nettet', encoding="UTF-8") + 562 wrong_declaration = "<?xml version='1.0' encoding='UTF-8'?>" + 563 xml_latin1 = (_str('%s<a>%s</a>') % (wrong_declaration, text) + 564 ).encode('iso-8859-1') + 565 + 566 iterator = self.etree.iterparse(BytesIO(xml_latin1), + 567 encoding="iso-8859-1") + 568 self.assertEquals(1, len(list(iterator))) + 569 + 570 a = iterator.root + 571 self.assertEquals(a.text, text) +
572 +
573 - def test_iterparse_keep_cdata(self): +
574 tostring = self.etree.tostring + 575 f = BytesIO('<root><![CDATA[test]]></root>') + 576 context = self.etree.iterparse(f, strip_cdata=False) + 577 content = [ el.text for event,el in context ] + 578 + 579 self.assertEquals(['test'], content) + 580 self.assertEquals(_bytes('<root><![CDATA[test]]></root>'), + 581 tostring(context.root)) +
582 +
584 self.assertRaises( + 585 LookupError, self.etree.XMLParser, encoding="hopefully unknown") +
586 +
587 - def test_parser_encoding(self): +
588 self.etree.XMLParser(encoding="ascii") + 589 self.etree.XMLParser(encoding="utf-8") + 590 self.etree.XMLParser(encoding="iso-8859-1") +
591 +
592 - def test_feed_parser_recover(self): +
593 parser = self.etree.XMLParser(recover=True) + 594 + 595 parser.feed('<?xml version=') + 596 parser.feed('"1.0"?><ro') + 597 parser.feed('ot><') + 598 parser.feed('a test="works"') + 599 parser.feed('><othertag/></root') # <a> not closed! + 600 parser.feed('>') + 601 + 602 root = parser.close() + 603 + 604 self.assertEquals(root.tag, "root") + 605 self.assertEquals(len(root), 1) + 606 self.assertEquals(root[0].tag, "a") + 607 self.assertEquals(root[0].get("test"), "works") + 608 self.assertEquals(len(root[0]), 1) + 609 self.assertEquals(root[0][0].tag, "othertag") +
610 # FIXME: would be nice to get some errors logged ... + 611 #self.assert_(len(parser.error_log) > 0, "error log is empty") + 612 +
614 assertEquals = self.assertEquals + 615 assertFalse = self.assertFalse + 616 + 617 events = [] + 618 class Target(object): + 619 def start(self, tag, attrib): + 620 events.append("start") + 621 assertFalse(attrib) + 622 assertEquals("TAG", tag) +
623 def end(self, tag): + 624 events.append("end") + 625 assertEquals("TAG", tag) + 626 def close(self): + 627 return "DONE" # no Element! + 628 + 629 parser = self.etree.XMLParser(target=Target()) + 630 tree = self.etree.ElementTree() + 631 + 632 self.assertRaises(TypeError, + 633 tree.parse, BytesIO("<TAG/>"), parser=parser) + 634 self.assertEquals(["start", "end"], events) + 635 +
636 - def test_parser_target_comment(self): +
637 events = [] + 638 class Target(object): + 639 def start(self, tag, attrib): + 640 events.append("start-" + tag) +
641 def end(self, tag): + 642 events.append("end-" + tag) + 643 def data(self, data): + 644 events.append("data-" + data) + 645 def comment(self, text): + 646 events.append("comment-" + text) + 647 def close(self): + 648 return "DONE" + 649 + 650 parser = self.etree.XMLParser(target=Target()) + 651 + 652 parser.feed(_bytes('<!--a--><root>A<!--b--><sub/><!--c-->B</root><!--d-->')) + 653 done = parser.close() + 654 + 655 self.assertEquals("DONE", done) + 656 self.assertEquals(["comment-a", "start-root", "data-A", "comment-b", + 657 "start-sub", "end-sub", "comment-c", "data-B", + 658 "end-root", "comment-d"], + 659 events) + 660 +
661 - def test_parser_target_pi(self): +
662 events = [] + 663 class Target(object): + 664 def start(self, tag, attrib): + 665 events.append("start-" + tag) +
666 def end(self, tag): + 667 events.append("end-" + tag) + 668 def data(self, data): + 669 events.append("data-" + data) + 670 def pi(self, target, data): + 671 events.append("pi-" + target + "-" + data) + 672 def close(self): + 673 return "DONE" + 674 + 675 parser = self.etree.XMLParser(target=Target()) + 676 + 677 parser.feed(_bytes('<?test a?><root>A<?test b?>B</root><?test c?>')) + 678 done = parser.close() + 679 + 680 self.assertEquals("DONE", done) + 681 self.assertEquals(["pi-test-a", "start-root", "data-A", "pi-test-b", + 682 "data-B", "end-root", "pi-test-c"], + 683 events) + 684 +
685 - def test_parser_target_cdata(self): +
686 events = [] + 687 class Target(object): + 688 def start(self, tag, attrib): + 689 events.append("start-" + tag) +
690 def end(self, tag): + 691 events.append("end-" + tag) + 692 def data(self, data): + 693 events.append("data-" + data) + 694 def close(self): + 695 return "DONE" + 696 + 697 parser = self.etree.XMLParser(target=Target(), + 698 strip_cdata=False) + 699 + 700 parser.feed(_bytes('<root>A<a><![CDATA[ca]]></a>B</root>')) + 701 done = parser.close() + 702 + 703 self.assertEquals("DONE", done) + 704 self.assertEquals(["start-root", "data-A", "start-a", + 705 "data-ca", "end-a", "data-B", "end-root"], + 706 events) + 707 +
708 - def test_parser_target_recover(self): +
709 events = [] + 710 class Target(object): + 711 def start(self, tag, attrib): + 712 events.append("start-" + tag) +
713 def end(self, tag): + 714 events.append("end-" + tag) + 715 def data(self, data): + 716 events.append("data-" + data) + 717 def close(self): + 718 events.append("close") + 719 return "DONE" + 720 + 721 parser = self.etree.XMLParser(target=Target(), + 722 recover=True) + 723 + 724 parser.feed(_bytes('<root>A<a>ca</a>B</not-root>')) + 725 done = parser.close() + 726 + 727 self.assertEquals("DONE", done) + 728 self.assertEquals(["start-root", "data-A", "start-a", + 729 "data-ca", "end-a", "data-B", + 730 "end-root", "close"], + 731 events) + 732 +
733 - def test_iterwalk_tag(self): +
734 iterwalk = self.etree.iterwalk + 735 root = self.etree.XML(_bytes('<a><b><d/></b><c/></a>')) + 736 + 737 iterator = iterwalk(root, tag="b", events=('start', 'end')) + 738 events = list(iterator) + 739 self.assertEquals( + 740 [('start', root[0]), ('end', root[0])], + 741 events) +
742 +
743 - def test_iterwalk_tag_all(self): +
744 iterwalk = self.etree.iterwalk + 745 root = self.etree.XML(_bytes('<a><b><d/></b><c/></a>')) + 746 + 747 iterator = iterwalk(root, tag="*", events=('start', 'end')) + 748 events = list(iterator) + 749 self.assertEquals( + 750 8, + 751 len(events)) +
752 +
753 - def test_iterwalk(self): +
754 iterwalk = self.etree.iterwalk + 755 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) + 756 + 757 events = list(iterwalk(root)) + 758 self.assertEquals( + 759 [('end', root[0]), ('end', root[1]), ('end', root)], + 760 events) +
761 +
762 - def test_iterwalk_start(self): +
763 iterwalk = self.etree.iterwalk + 764 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) + 765 + 766 iterator = iterwalk(root, events=('start',)) + 767 events = list(iterator) + 768 self.assertEquals( + 769 [('start', root), ('start', root[0]), ('start', root[1])], + 770 events) +
771 +
772 - def test_iterwalk_start_end(self): +
773 iterwalk = self.etree.iterwalk + 774 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) + 775 + 776 iterator = iterwalk(root, events=('start','end')) + 777 events = list(iterator) + 778 self.assertEquals( + 779 [('start', root), ('start', root[0]), ('end', root[0]), + 780 ('start', root[1]), ('end', root[1]), ('end', root)], + 781 events) +
782 +
783 - def test_iterwalk_clear(self): +
784 iterwalk = self.etree.iterwalk + 785 root = self.etree.XML(_bytes('<a><b></b><c/></a>')) + 786 + 787 iterator = iterwalk(root) + 788 for event, elem in iterator: + 789 elem.clear() + 790 + 791 self.assertEquals(0, + 792 len(root)) +
793 +
794 - def test_iterwalk_attrib_ns(self): +
795 iterwalk = self.etree.iterwalk + 796 root = self.etree.XML(_bytes('<a xmlns="ns1"><b><c xmlns="ns2"/></b></a>')) + 797 + 798 attr_name = '{testns}bla' + 799 events = [] + 800 iterator = iterwalk(root, events=('start','end','start-ns','end-ns')) + 801 for event, elem in iterator: + 802 events.append(event) + 803 if event == 'start': + 804 if elem.tag != '{ns1}a': + 805 elem.set(attr_name, 'value') + 806 + 807 self.assertEquals( + 808 ['start-ns', 'start', 'start', 'start-ns', 'start', + 809 'end', 'end-ns', 'end', 'end', 'end-ns'], + 810 events) + 811 + 812 self.assertEquals( + 813 None, + 814 root.get(attr_name)) + 815 self.assertEquals( + 816 'value', + 817 root[0].get(attr_name)) +
818 +
819 - def test_iterwalk_getiterator(self): +
820 iterwalk = self.etree.iterwalk + 821 root = self.etree.XML(_bytes('<a><b><d/></b><c/></a>')) + 822 + 823 counts = [] + 824 for event, elem in iterwalk(root): + 825 counts.append(len(list(elem.getiterator()))) + 826 self.assertEquals( + 827 [1,2,1,4], + 828 counts) +
829 +
830 - def test_resolve_string_dtd(self): +
831 parse = self.etree.parse + 832 parser = self.etree.XMLParser(dtd_validation=True) + 833 assertEqual = self.assertEqual + 834 test_url = _str("__nosuch.dtd") + 835 + 836 class MyResolver(self.etree.Resolver): + 837 def resolve(self, url, id, context): + 838 assertEqual(url, test_url) + 839 return self.resolve_string( + 840 _str('''<!ENTITY myentity "%s"> + 841 <!ELEMENT doc ANY>''') % url, context) +
842 + 843 parser.resolvers.add(MyResolver()) + 844 + 845 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url + 846 tree = parse(StringIO(xml), parser) + 847 root = tree.getroot() + 848 self.assertEquals(root.text, test_url) + 849 +
850 - def test_resolve_bytes_dtd(self): +
851 parse = self.etree.parse + 852 parser = self.etree.XMLParser(dtd_validation=True) + 853 assertEqual = self.assertEqual + 854 test_url = _str("__nosuch.dtd") + 855 + 856 class MyResolver(self.etree.Resolver): + 857 def resolve(self, url, id, context): + 858 assertEqual(url, test_url) + 859 return self.resolve_string( + 860 (_str('''<!ENTITY myentity "%s"> + 861 <!ELEMENT doc ANY>''') % url).encode('utf-8'), + 862 context) +
863 + 864 parser.resolvers.add(MyResolver()) + 865 + 866 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url + 867 tree = parse(StringIO(xml), parser) + 868 root = tree.getroot() + 869 self.assertEquals(root.text, test_url) + 870 +
871 - def test_resolve_filelike_dtd(self): +
872 parse = self.etree.parse + 873 parser = self.etree.XMLParser(dtd_validation=True) + 874 assertEqual = self.assertEqual + 875 test_url = _str("__nosuch.dtd") + 876 + 877 class MyResolver(self.etree.Resolver): + 878 def resolve(self, url, id, context): + 879 assertEqual(url, test_url) + 880 return self.resolve_file( + 881 SillyFileLike( + 882 _str('''<!ENTITY myentity "%s"> + 883 <!ELEMENT doc ANY>''') % url), context) +
884 + 885 parser.resolvers.add(MyResolver()) + 886 + 887 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url + 888 tree = parse(StringIO(xml), parser) + 889 root = tree.getroot() + 890 self.assertEquals(root.text, test_url) + 891 +
892 - def test_resolve_filename_dtd(self): +
893 parse = self.etree.parse + 894 parser = self.etree.XMLParser(attribute_defaults=True) + 895 assertEqual = self.assertEqual + 896 test_url = _str("__nosuch.dtd") + 897 + 898 class MyResolver(self.etree.Resolver): + 899 def resolve(self, url, id, context): + 900 assertEqual(url, test_url) + 901 return self.resolve_filename( + 902 fileInTestDir('test.dtd'), context) +
903 + 904 parser.resolvers.add(MyResolver()) + 905 + 906 xml = _str('<!DOCTYPE a SYSTEM "%s"><a><b/></a>') % test_url + 907 tree = parse(StringIO(xml), parser) + 908 root = tree.getroot() + 909 self.assertEquals( + 910 root.attrib, {'default': 'valueA'}) + 911 self.assertEquals( + 912 root[0].attrib, {'default': 'valueB'}) + 913 +
915 parse = self.etree.parse + 916 parser = self.etree.XMLParser(attribute_defaults=True) + 917 assertEqual = self.assertEqual + 918 test_url = _str("__nosuch.dtd") + 919 + 920 class MyResolver(self.etree.Resolver): + 921 def resolve(self, url, id, context): + 922 assertEqual(url, fileInTestDir(test_url)) + 923 return self.resolve_filename( + 924 fileInTestDir('test.dtd'), context) +
925 + 926 parser.resolvers.add(MyResolver()) + 927 + 928 xml = _str('<!DOCTYPE a SYSTEM "%s"><a><b/></a>') % test_url + 929 tree = parse(StringIO(xml), parser, + 930 base_url=fileInTestDir('__test.xml')) + 931 root = tree.getroot() + 932 self.assertEquals( + 933 root.attrib, {'default': 'valueA'}) + 934 self.assertEquals( + 935 root[0].attrib, {'default': 'valueB'}) + 936 +
937 - def test_resolve_file_dtd(self): +
938 parse = self.etree.parse + 939 parser = self.etree.XMLParser(attribute_defaults=True) + 940 assertEqual = self.assertEqual + 941 test_url = _str("__nosuch.dtd") + 942 + 943 class MyResolver(self.etree.Resolver): + 944 def resolve(self, url, id, context): + 945 assertEqual(url, test_url) + 946 return self.resolve_file( + 947 open(fileInTestDir('test.dtd'), 'rb'), context) +
948 + 949 parser.resolvers.add(MyResolver()) + 950 + 951 xml = _str('<!DOCTYPE a SYSTEM "%s"><a><b/></a>') % test_url + 952 tree = parse(StringIO(xml), parser) + 953 root = tree.getroot() + 954 self.assertEquals( + 955 root.attrib, {'default': 'valueA'}) + 956 self.assertEquals( + 957 root[0].attrib, {'default': 'valueB'}) + 958 +
959 - def test_resolve_empty(self): +
960 parse = self.etree.parse + 961 parser = self.etree.XMLParser(load_dtd=True) + 962 assertEqual = self.assertEqual + 963 test_url = _str("__nosuch.dtd") + 964 + 965 class check(object): + 966 resolved = False +
967 + 968 class MyResolver(self.etree.Resolver): + 969 def resolve(self, url, id, context): + 970 assertEqual(url, test_url) + 971 check.resolved = True + 972 return self.resolve_empty(context) + 973 + 974 parser.resolvers.add(MyResolver()) + 975 + 976 xml = _str('<!DOCTYPE doc SYSTEM "%s"><doc>&myentity;</doc>') % test_url + 977 self.assertRaises(etree.XMLSyntaxError, parse, StringIO(xml), parser) + 978 self.assert_(check.resolved) + 979 +
980 - def test_resolve_error(self): +
981 parse = self.etree.parse + 982 parser = self.etree.XMLParser(dtd_validation=True) + 983 + 984 class _LocalException(Exception): + 985 pass +
986 + 987 class MyResolver(self.etree.Resolver): + 988 def resolve(self, url, id, context): + 989 raise _LocalException + 990 + 991 parser.resolvers.add(MyResolver()) + 992 + 993 xml = '<!DOCTYPE doc SYSTEM "test"><doc>&myentity;</doc>' + 994 self.assertRaises(_LocalException, parse, BytesIO(xml), parser) + 995 + 996 if etree.LIBXML_VERSION > (2,6,20): +
997 - def test_entity_parse(self): +
998 parse = self.etree.parse + 999 tostring = self.etree.tostring +1000 parser = self.etree.XMLParser(resolve_entities=False) +1001 Entity = self.etree.Entity +1002 +1003 xml = _bytes('<!DOCTYPE doc SYSTEM "test"><doc>&myentity;</doc>') +1004 tree = parse(BytesIO(xml), parser) +1005 root = tree.getroot() +1006 self.assertEquals(root[0].tag, Entity) +1007 self.assertEquals(root[0].text, "&myentity;") +1008 self.assertEquals(root[0].tail, None) +1009 self.assertEquals(root[0].name, "myentity") +1010 +1011 self.assertEquals(_bytes('<doc>&myentity;</doc>'), +1012 tostring(root)) +
1013 +
1014 - def test_entity_restructure(self): +
1015 xml = _bytes('''<!DOCTYPE root [ <!ENTITY nbsp "&#160;"> ]> +1016 <root> +1017 <child1/> +1018 <child2/> +1019 <child3>&nbsp;</child3> +1020 </root>''') +1021 +1022 parser = self.etree.XMLParser(resolve_entities=False) +1023 root = etree.fromstring(xml, parser) +1024 self.assertEquals([ el.tag for el in root ], +1025 ['child1', 'child2', 'child3']) +1026 +1027 root[0] = root[-1] +1028 self.assertEquals([ el.tag for el in root ], +1029 ['child3', 'child2']) +1030 self.assertEquals(root[0][0].text, '&nbsp;') +1031 self.assertEquals(root[0][0].name, 'nbsp') +
1032 +
1033 - def test_entity_append(self): +
1034 Entity = self.etree.Entity +1035 Element = self.etree.Element +1036 tostring = self.etree.tostring +1037 +1038 root = Element("root") +1039 root.append( Entity("test") ) +1040 +1041 self.assertEquals(root[0].tag, Entity) +1042 self.assertEquals(root[0].text, "&test;") +1043 self.assertEquals(root[0].tail, None) +1044 self.assertEquals(root[0].name, "test") +1045 +1046 self.assertEquals(_bytes('<root>&test;</root>'), +1047 tostring(root)) +
1048 +
1049 - def test_entity_values(self): +
1050 Entity = self.etree.Entity +1051 self.assertEquals(Entity("test").text, '&test;') +1052 self.assertEquals(Entity("#17683").text, '&#17683;') +1053 self.assertEquals(Entity("#x1768").text, '&#x1768;') +1054 self.assertEquals(Entity("#x98AF").text, '&#x98AF;') +
1055 +
1056 - def test_entity_error(self): +
1057 Entity = self.etree.Entity +1058 self.assertRaises(ValueError, Entity, 'a b c') +1059 self.assertRaises(ValueError, Entity, 'a,b') +1060 self.assertRaises(ValueError, Entity, 'a\0b') +1061 self.assertRaises(ValueError, Entity, '#abc') +1062 self.assertRaises(ValueError, Entity, '#xxyz') +
1063 +
1064 - def test_cdata(self): +
1065 CDATA = self.etree.CDATA +1066 Element = self.etree.Element +1067 tostring = self.etree.tostring +1068 +1069 root = Element("root") +1070 root.text = CDATA('test') +1071 +1072 self.assertEquals('test', +1073 root.text) +1074 self.assertEquals(_bytes('<root><![CDATA[test]]></root>'), +1075 tostring(root)) +
1076 +
1077 - def test_cdata_type(self): +
1078 CDATA = self.etree.CDATA +1079 Element = self.etree.Element +1080 root = Element("root") +1081 +1082 root.text = CDATA("test") +1083 self.assertEquals('test', root.text) +1084 +1085 root.text = CDATA(_str("test")) +1086 self.assertEquals('test', root.text) +1087 +1088 self.assertRaises(TypeError, CDATA, 1) +
1089 +
1090 - def test_cdata_errors(self): +
1091 CDATA = self.etree.CDATA +1092 Element = self.etree.Element +1093 +1094 root = Element("root") +1095 cdata = CDATA('test') +1096 +1097 self.assertRaises(TypeError, +1098 setattr, root, 'tail', cdata) +1099 self.assertRaises(TypeError, +1100 root.set, 'attr', cdata) +1101 self.assertRaises(TypeError, +1102 operator.setitem, root.attrib, 'attr', cdata) +
1103 +
1104 - def test_cdata_parser(self): +
1105 tostring = self.etree.tostring +1106 parser = self.etree.XMLParser(strip_cdata=False) +1107 root = self.etree.XML(_bytes('<root><![CDATA[test]]></root>'), parser) +1108 +1109 self.assertEquals('test', root.text) +1110 self.assertEquals(_bytes('<root><![CDATA[test]]></root>'), +1111 tostring(root)) +
1112 +
1113 - def test_cdata_xpath(self): +
1114 tostring = self.etree.tostring +1115 parser = self.etree.XMLParser(strip_cdata=False) +1116 root = self.etree.XML(_bytes('<root><![CDATA[test]]></root>'), parser) +1117 self.assertEquals(_bytes('<root><![CDATA[test]]></root>'), +1118 tostring(root)) +1119 +1120 self.assertEquals(['test'], root.xpath('//text()')) +
1121 +1122 # TypeError in etree, AssertionError in ElementTree; +
1123 - def test_setitem_assert(self): +
1124 Element = self.etree.Element +1125 SubElement = self.etree.SubElement +1126 +1127 a = Element('a') +1128 b = SubElement(a, 'b') +1129 +1130 self.assertRaises(TypeError, +1131 a.__setitem__, 0, 'foo') +
1132 +
1133 - def test_append_None(self): +
1134 # raises AssertionError in ElementTree +1135 Element = self.etree.Element +1136 self.assertRaises(TypeError, Element('a').append, None) +
1137 +
1138 - def test_addnext(self): +
1139 Element = self.etree.Element +1140 SubElement = self.etree.SubElement +1141 root = Element('root') +1142 SubElement(root, 'a') +1143 SubElement(root, 'b') +1144 +1145 self.assertEquals(['a', 'b'], +1146 [c.tag for c in root]) +1147 root[1].addnext(root[0]) +1148 self.assertEquals(['b', 'a'], +1149 [c.tag for c in root]) +
1150 +
1151 - def test_addprevious(self): +
1152 Element = self.etree.Element +1153 SubElement = self.etree.SubElement +1154 root = Element('root') +1155 SubElement(root, 'a') +1156 SubElement(root, 'b') +1157 +1158 self.assertEquals(['a', 'b'], +1159 [c.tag for c in root]) +1160 root[0].addprevious(root[1]) +1161 self.assertEquals(['b', 'a'], +1162 [c.tag for c in root]) +
1163 +
1164 - def test_addnext_root(self): +
1165 Element = self.etree.Element +1166 a = Element('a') +1167 b = Element('b') +1168 self.assertRaises(TypeError, a.addnext, b) +
1169 +
1170 - def test_addnext_root(self): +
1171 Element = self.etree.Element +1172 a = Element('a') +1173 b = Element('b') +1174 self.assertRaises(TypeError, a.addnext, b) +
1175 +
1176 - def test_addprevious_pi(self): +
1177 Element = self.etree.Element +1178 SubElement = self.etree.SubElement +1179 PI = self.etree.PI +1180 root = Element('root') +1181 SubElement(root, 'a') +1182 pi = PI('TARGET', 'TEXT') +1183 pi.tail = "TAIL" +1184 +1185 self.assertEquals(_bytes('<root><a></a></root>'), +1186 self._writeElement(root)) +1187 root[0].addprevious(pi) +1188 self.assertEquals(_bytes('<root><?TARGET TEXT?>TAIL<a></a></root>'), +1189 self._writeElement(root)) +
1190 +
1191 - def test_addprevious_root_pi(self): +
1192 Element = self.etree.Element +1193 PI = self.etree.PI +1194 root = Element('root') +1195 pi = PI('TARGET', 'TEXT') +1196 pi.tail = "TAIL" +1197 +1198 self.assertEquals(_bytes('<root></root>'), +1199 self._writeElement(root)) +1200 root.addprevious(pi) +1201 self.assertEquals(_bytes('<?TARGET TEXT?>\n<root></root>'), +1202 self._writeElement(root)) +
1203 +
1204 - def test_addnext_pi(self): +
1205 Element = self.etree.Element +1206 SubElement = self.etree.SubElement +1207 PI = self.etree.PI +1208 root = Element('root') +1209 SubElement(root, 'a') +1210 pi = PI('TARGET', 'TEXT') +1211 pi.tail = "TAIL" +1212 +1213 self.assertEquals(_bytes('<root><a></a></root>'), +1214 self._writeElement(root)) +1215 root[0].addnext(pi) +1216 self.assertEquals(_bytes('<root><a></a><?TARGET TEXT?>TAIL</root>'), +1217 self._writeElement(root)) +
1218 +
1219 - def test_addnext_root_pi(self): +
1220 Element = self.etree.Element +1221 PI = self.etree.PI +1222 root = Element('root') +1223 pi = PI('TARGET', 'TEXT') +1224 pi.tail = "TAIL" +1225 +1226 self.assertEquals(_bytes('<root></root>'), +1227 self._writeElement(root)) +1228 root.addnext(pi) +1229 self.assertEquals(_bytes('<root></root>\n<?TARGET TEXT?>'), +1230 self._writeElement(root)) +
1231 +
1232 - def test_addnext_comment(self): +
1233 Element = self.etree.Element +1234 SubElement = self.etree.SubElement +1235 Comment = self.etree.Comment +1236 root = Element('root') +1237 SubElement(root, 'a') +1238 comment = Comment('TEXT ') +1239 comment.tail = "TAIL" +1240 +1241 self.assertEquals(_bytes('<root><a></a></root>'), +1242 self._writeElement(root)) +1243 root[0].addnext(comment) +1244 self.assertEquals(_bytes('<root><a></a><!--TEXT -->TAIL</root>'), +1245 self._writeElement(root)) +
1246 +
1247 - def test_addnext_root_comment(self): +
1248 Element = self.etree.Element +1249 Comment = self.etree.Comment +1250 root = Element('root') +1251 comment = Comment('TEXT ') +1252 comment.tail = "TAIL" +1253 +1254 self.assertEquals(_bytes('<root></root>'), +1255 self._writeElement(root)) +1256 root.addnext(comment) +1257 self.assertEquals(_bytes('<root></root>\n<!--TEXT -->'), +1258 self._writeElement(root)) +
1259 +
1260 - def test_addprevious_comment(self): +
1261 Element = self.etree.Element +1262 SubElement = self.etree.SubElement +1263 Comment = self.etree.Comment +1264 root = Element('root') +1265 SubElement(root, 'a') +1266 comment = Comment('TEXT ') +1267 comment.tail = "TAIL" +1268 +1269 self.assertEquals(_bytes('<root><a></a></root>'), +1270 self._writeElement(root)) +1271 root[0].addprevious(comment) +1272 self.assertEquals(_bytes('<root><!--TEXT -->TAIL<a></a></root>'), +1273 self._writeElement(root)) +
1274 +
1276 Element = self.etree.Element +1277 Comment = self.etree.Comment +1278 root = Element('root') +1279 comment = Comment('TEXT ') +1280 comment.tail = "TAIL" +1281 +1282 self.assertEquals(_bytes('<root></root>'), +1283 self._writeElement(root)) +1284 root.addprevious(comment) +1285 self.assertEquals(_bytes('<!--TEXT -->\n<root></root>'), +1286 self._writeElement(root)) +
1287 +1288 # ET's Elements have items() and key(), but not values() +
1289 - def test_attribute_values(self): +
1290 XML = self.etree.XML +1291 +1292 root = XML(_bytes('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>')) +1293 values = root.values() +1294 values.sort() +1295 self.assertEquals(['Alpha', 'Beta', 'Gamma'], values) +
1296 +1297 # gives error in ElementTree +
1298 - def test_comment_empty(self): +
1299 Element = self.etree.Element +1300 Comment = self.etree.Comment +1301 +1302 a = Element('a') +1303 a.append(Comment()) +1304 self.assertEquals( +1305 _bytes('<a><!----></a>'), +1306 self._writeElement(a)) +
1307 +1308 # ElementTree ignores comments +
1309 - def test_comment_parse_empty(self): +
1310 ElementTree = self.etree.ElementTree +1311 tostring = self.etree.tostring +1312 +1313 xml = _bytes('<a><b/><!----><c/></a>') +1314 f = BytesIO(xml) +1315 doc = ElementTree(file=f) +1316 a = doc.getroot() +1317 self.assertEquals( +1318 '', +1319 a[1].text) +1320 self.assertEquals( +1321 xml, +1322 tostring(a)) +
1323 +1324 # ElementTree ignores comments +
1325 - def test_comment_no_proxy_yet(self): +
1326 ElementTree = self.etree.ElementTree +1327 +1328 f = BytesIO('<a><b></b><!-- hoi --><c></c></a>') +1329 doc = ElementTree(file=f) +1330 a = doc.getroot() +1331 self.assertEquals( +1332 ' hoi ', +1333 a[1].text) +
1334 +1335 # does not raise an exception in ElementTree +
1336 - def test_comment_immutable(self): +
1337 Element = self.etree.Element +1338 Comment = self.etree.Comment +1339 +1340 c = Comment() +1341 el = Element('myel') +1342 +1343 self.assertRaises(TypeError, c.append, el) +1344 self.assertRaises(TypeError, c.insert, 0, el) +1345 self.assertRaises(TypeError, c.set, "myattr", "test") +
1346 +1347 # test passing 'None' to dump +
1348 - def test_dump_none(self): +
1349 self.assertRaises(TypeError, self.etree.dump, None) +
1350 +
1351 - def test_prefix(self): +
1352 ElementTree = self.etree.ElementTree +1353 +1354 f = BytesIO('<a xmlns:foo="http://www.infrae.com/ns/1"><foo:b/></a>') +1355 doc = ElementTree(file=f) +1356 a = doc.getroot() +1357 self.assertEquals( +1358 None, +1359 a.prefix) +1360 self.assertEquals( +1361 'foo', +1362 a[0].prefix) +
1363 +
1364 - def test_prefix_default_ns(self): +
1365 ElementTree = self.etree.ElementTree +1366 +1367 f = BytesIO('<a xmlns="http://www.infrae.com/ns/1"><b/></a>') +1368 doc = ElementTree(file=f) +1369 a = doc.getroot() +1370 self.assertEquals( +1371 None, +1372 a.prefix) +1373 self.assertEquals( +1374 None, +1375 a[0].prefix) +
1376 +
1377 - def test_getparent(self): +
1378 Element = self.etree.Element +1379 SubElement = self.etree.SubElement +1380 +1381 a = Element('a') +1382 b = SubElement(a, 'b') +1383 c = SubElement(a, 'c') +1384 d = SubElement(b, 'd') +1385 self.assertEquals( +1386 None, +1387 a.getparent()) +1388 self.assertEquals( +1389 a, +1390 b.getparent()) +1391 self.assertEquals( +1392 b.getparent(), +1393 c.getparent()) +1394 self.assertEquals( +1395 b, +1396 d.getparent()) +
1397 +
1398 - def test_iterchildren(self): +
1399 XML = self.etree.XML +1400 +1401 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) +1402 result = [] +1403 for el in root.iterchildren(): +1404 result.append(el.tag) +1405 self.assertEquals(['one', 'two', 'three'], result) +
1406 +
1407 - def test_iterchildren_reversed(self): +
1408 XML = self.etree.XML +1409 +1410 root = XML(_bytes('<doc><one/><two>Two</two>Hm<three/></doc>')) +1411 result = [] +1412 for el in root.iterchildren(reversed=True): +1413 result.append(el.tag) +1414 self.assertEquals(['three', 'two', 'one'], result) +
1415 +
1416 - def test_iterchildren_tag(self): +
1417 XML = self.etree.XML +1418 +1419 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two></doc>')) +1420 result = [] +1421 for el in root.iterchildren(tag='two'): +1422 result.append(el.text) +1423 self.assertEquals(['Two', 'Bla'], result) +
1424 +
1426 XML = self.etree.XML +1427 +1428 root = XML(_bytes('<doc><one/><two>Two</two>Hm<two>Bla</two></doc>')) +1429 result = [] +1430 for el in root.iterchildren(reversed=True, tag='two'): +1431 result.append(el.text) +1432 self.assertEquals(['Bla', 'Two'], result) +
1433 +
1434 - def test_iterancestors(self): +
1435 Element = self.etree.Element +1436 SubElement = self.etree.SubElement +1437 +1438 a = Element('a') +1439 b = SubElement(a, 'b') +1440 c = SubElement(a, 'c') +1441 d = SubElement(b, 'd') +1442 self.assertEquals( +1443 [], +1444 list(a.iterancestors())) +1445 self.assertEquals( +1446 [a], +1447 list(b.iterancestors())) +1448 self.assertEquals( +1449 [a], +1450 list(c.iterancestors())) +1451 self.assertEquals( +1452 [b, a], +1453 list(d.iterancestors())) +
1454 +
1455 - def test_iterancestors_tag(self): +
1456 Element = self.etree.Element +1457 SubElement = self.etree.SubElement +1458 +1459 a = Element('a') +1460 b = SubElement(a, 'b') +1461 c = SubElement(a, 'c') +1462 d = SubElement(b, 'd') +1463 self.assertEquals( +1464 [a], +1465 list(d.iterancestors(tag='a'))) +
1466 +
1467 - def test_iterdescendants(self): +
1468 Element = self.etree.Element +1469 SubElement = self.etree.SubElement +1470 +1471 a = Element('a') +1472 b = SubElement(a, 'b') +1473 c = SubElement(a, 'c') +1474 d = SubElement(b, 'd') +1475 e = SubElement(c, 'e') +1476 +1477 self.assertEquals( +1478 [b, d, c, e], +1479 list(a.iterdescendants())) +1480 self.assertEquals( +1481 [], +1482 list(d.iterdescendants())) +
1483 +
1484 - def test_iterdescendants_tag(self): +
1485 Element = self.etree.Element +1486 SubElement = self.etree.SubElement +1487 +1488 a = Element('a') +1489 b = SubElement(a, 'b') +1490 c = SubElement(a, 'c') +1491 d = SubElement(b, 'd') +1492 e = SubElement(c, 'e') +1493 +1494 self.assertEquals( +1495 [], +1496 list(a.iterdescendants('a'))) +1497 a2 = SubElement(e, 'a') +1498 self.assertEquals( +1499 [a2], +1500 list(a.iterdescendants('a'))) +1501 self.assertEquals( +1502 [a2], +1503 list(c.iterdescendants('a'))) +
1504 +
1505 - def test_getroottree(self): +
1506 Element = self.etree.Element +1507 SubElement = self.etree.SubElement +1508 +1509 a = Element('a') +1510 b = SubElement(a, 'b') +1511 c = SubElement(a, 'c') +1512 d = SubElement(b, 'd') +1513 self.assertEquals( +1514 a, +1515 a.getroottree().getroot()) +1516 self.assertEquals( +1517 a, +1518 b.getroottree().getroot()) +1519 self.assertEquals( +1520 a, +1521 d.getroottree().getroot()) +
1522 +
1523 - def test_getnext(self): +
1524 Element = self.etree.Element +1525 SubElement = self.etree.SubElement +1526 +1527 a = Element('a') +1528 b = SubElement(a, 'b') +1529 c = SubElement(a, 'c') +1530 self.assertEquals( +1531 None, +1532 a.getnext()) +1533 self.assertEquals( +1534 c, +1535 b.getnext()) +1536 self.assertEquals( +1537 None, +1538 c.getnext()) +
1539 +
1540 - def test_getprevious(self): +
1541 Element = self.etree.Element +1542 SubElement = self.etree.SubElement +1543 +1544 a = Element('a') +1545 b = SubElement(a, 'b') +1546 c = SubElement(a, 'c') +1547 d = SubElement(b, 'd') +1548 self.assertEquals( +1549 None, +1550 a.getprevious()) +1551 self.assertEquals( +1552 b, +1553 c.getprevious()) +1554 self.assertEquals( +1555 None, +1556 b.getprevious()) +
1557 +
1558 - def test_itersiblings(self): +
1559 Element = self.etree.Element +1560 SubElement = self.etree.SubElement +1561 +1562 a = Element('a') +1563 b = SubElement(a, 'b') +1564 c = SubElement(a, 'c') +1565 d = SubElement(b, 'd') +1566 self.assertEquals( +1567 [], +1568 list(a.itersiblings())) +1569 self.assertEquals( +1570 [c], +1571 list(b.itersiblings())) +1572 self.assertEquals( +1573 [], +1574 list(c.itersiblings())) +1575 self.assertEquals( +1576 [b], +1577 list(c.itersiblings(preceding=True))) +1578 self.assertEquals( +1579 [], +1580 list(b.itersiblings(preceding=True))) +
1581 +
1582 - def test_itersiblings_tag(self): +
1583 Element = self.etree.Element +1584 SubElement = self.etree.SubElement +1585 +1586 a = Element('a') +1587 b = SubElement(a, 'b') +1588 c = SubElement(a, 'c') +1589 d = SubElement(b, 'd') +1590 self.assertEquals( +1591 [], +1592 list(a.itersiblings(tag='XXX'))) +1593 self.assertEquals( +1594 [c], +1595 list(b.itersiblings(tag='c'))) +1596 self.assertEquals( +1597 [b], +1598 list(c.itersiblings(preceding=True, tag='b'))) +1599 self.assertEquals( +1600 [], +1601 list(c.itersiblings(preceding=True, tag='c'))) +
1602 +
1603 - def test_parseid(self): +
1604 parseid = self.etree.parseid +1605 XML = self.etree.XML +1606 xml_text = _bytes(''' +1607 <!DOCTYPE document [ +1608 <!ELEMENT document (h1,p)*> +1609 <!ELEMENT h1 (#PCDATA)> +1610 <!ATTLIST h1 myid ID #REQUIRED> +1611 <!ELEMENT p (#PCDATA)> +1612 <!ATTLIST p someid ID #REQUIRED> +1613 ]> +1614 <document> +1615 <h1 myid="chapter1">...</h1> +1616 <p id="note1" class="note">...</p> +1617 <p>Regular paragraph.</p> +1618 <p xml:id="xmlid">XML:ID paragraph.</p> +1619 <p someid="warn1" class="warning">...</p> +1620 </document> +1621 ''') +1622 +1623 tree, dic = parseid(BytesIO(xml_text)) +1624 root = tree.getroot() +1625 root2 = XML(xml_text) +1626 self.assertEquals(self._writeElement(root), +1627 self._writeElement(root2)) +1628 expected = { +1629 "chapter1" : root[0], +1630 "xmlid" : root[3], +1631 "warn1" : root[4] +1632 } +1633 self.assert_("chapter1" in dic) +1634 self.assert_("warn1" in dic) +1635 self.assert_("xmlid" in dic) +1636 self._checkIDDict(dic, expected) +
1637 +
1638 - def test_XMLDTDID(self): +
1639 XMLDTDID = self.etree.XMLDTDID +1640 XML = self.etree.XML +1641 xml_text = _bytes(''' +1642 <!DOCTYPE document [ +1643 <!ELEMENT document (h1,p)*> +1644 <!ELEMENT h1 (#PCDATA)> +1645 <!ATTLIST h1 myid ID #REQUIRED> +1646 <!ELEMENT p (#PCDATA)> +1647 <!ATTLIST p someid ID #REQUIRED> +1648 ]> +1649 <document> +1650 <h1 myid="chapter1">...</h1> +1651 <p id="note1" class="note">...</p> +1652 <p>Regular paragraph.</p> +1653 <p xml:id="xmlid">XML:ID paragraph.</p> +1654 <p someid="warn1" class="warning">...</p> +1655 </document> +1656 ''') +1657 +1658 root, dic = XMLDTDID(xml_text) +1659 root2 = XML(xml_text) +1660 self.assertEquals(self._writeElement(root), +1661 self._writeElement(root2)) +1662 expected = { +1663 "chapter1" : root[0], +1664 "xmlid" : root[3], +1665 "warn1" : root[4] +1666 } +1667 self.assert_("chapter1" in dic) +1668 self.assert_("warn1" in dic) +1669 self.assert_("xmlid" in dic) +1670 self._checkIDDict(dic, expected) +
1671 +
1672 - def test_XMLDTDID_empty(self): +
1673 XMLDTDID = self.etree.XMLDTDID +1674 XML = self.etree.XML +1675 xml_text = _bytes(''' +1676 <document> +1677 <h1 myid="chapter1">...</h1> +1678 <p id="note1" class="note">...</p> +1679 <p>Regular paragraph.</p> +1680 <p someid="warn1" class="warning">...</p> +1681 </document> +1682 ''') +1683 +1684 root, dic = XMLDTDID(xml_text) +1685 root2 = XML(xml_text) +1686 self.assertEquals(self._writeElement(root), +1687 self._writeElement(root2)) +1688 expected = {} +1689 self._checkIDDict(dic, expected) +
1690 +
1691 - def _checkIDDict(self, dic, expected): +
1692 self.assertEquals(len(dic), +1693 len(expected)) +1694 self.assertEquals(sorted(dic.items()), +1695 sorted(expected.items())) +1696 if sys.version_info < (3,): +1697 self.assertEquals(sorted(dic.iteritems()), +1698 sorted(expected.iteritems())) +1699 self.assertEquals(sorted(dic.keys()), +1700 sorted(expected.keys())) +1701 if sys.version_info < (3,): +1702 self.assertEquals(sorted(dic.iterkeys()), +1703 sorted(expected.iterkeys())) +1704 if sys.version_info < (3,): +1705 self.assertEquals(sorted(dic.values()), +1706 sorted(expected.values())) +1707 self.assertEquals(sorted(dic.itervalues()), +1708 sorted(expected.itervalues())) +
1709 +
1710 - def test_namespaces(self): +
1711 etree = self.etree +1712 +1713 r = {'foo': 'http://ns.infrae.com/foo'} +1714 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1715 self.assertEquals( +1716 'foo', +1717 e.prefix) +1718 self.assertEquals( +1719 _bytes('<foo:bar xmlns:foo="http://ns.infrae.com/foo"></foo:bar>'), +1720 self._writeElement(e)) +
1721 +
1722 - def test_namespaces_default(self): +
1723 etree = self.etree +1724 +1725 r = {None: 'http://ns.infrae.com/foo'} +1726 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1727 self.assertEquals( +1728 None, +1729 e.prefix) +1730 self.assertEquals( +1731 '{http://ns.infrae.com/foo}bar', +1732 e.tag) +1733 self.assertEquals( +1734 _bytes('<bar xmlns="http://ns.infrae.com/foo"></bar>'), +1735 self._writeElement(e)) +
1736 +
1738 etree = self.etree +1739 +1740 r = {None: 'http://ns.infrae.com/foo', +1741 'hoi': 'http://ns.infrae.com/hoi'} +1742 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1743 e.set('{http://ns.infrae.com/hoi}test', 'value') +1744 self.assertEquals( +1745 _bytes('<bar xmlns="http://ns.infrae.com/foo" xmlns:hoi="http://ns.infrae.com/hoi" hoi:test="value"></bar>'), +1746 self._writeElement(e)) +
1747 +
1748 - def test_namespaces_elementtree(self): +
1749 etree = self.etree +1750 r = {None: 'http://ns.infrae.com/foo', +1751 'hoi': 'http://ns.infrae.com/hoi'} +1752 e = etree.Element('{http://ns.infrae.com/foo}z', nsmap=r) +1753 tree = etree.ElementTree(element=e) +1754 etree.SubElement(e, '{http://ns.infrae.com/hoi}x') +1755 self.assertEquals( +1756 _bytes('<z xmlns="http://ns.infrae.com/foo" xmlns:hoi="http://ns.infrae.com/hoi"><hoi:x></hoi:x></z>'), +1757 self._writeElement(e)) +
1758 +
1760 etree = self.etree +1761 +1762 r = {None: 'http://ns.infrae.com/foo'} +1763 e1 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1764 e2 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1765 +1766 e1.append(e2) +1767 +1768 self.assertEquals( +1769 None, +1770 e1.prefix) +1771 self.assertEquals( +1772 None, +1773 e1[0].prefix) +1774 self.assertEquals( +1775 '{http://ns.infrae.com/foo}bar', +1776 e1.tag) +1777 self.assertEquals( +1778 '{http://ns.infrae.com/foo}bar', +1779 e1[0].tag) +
1780 +
1782 etree = self.etree +1783 +1784 r = {None: 'http://ns.infrae.com/BAR'} +1785 e1 = etree.Element('{http://ns.infrae.com/BAR}bar', nsmap=r) +1786 e2 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1787 +1788 e1.append(e2) +1789 +1790 self.assertEquals( +1791 None, +1792 e1.prefix) +1793 self.assertNotEquals( +1794 None, +1795 e2.prefix) +1796 self.assertEquals( +1797 '{http://ns.infrae.com/BAR}bar', +1798 e1.tag) +1799 self.assertEquals( +1800 '{http://ns.infrae.com/foo}bar', +1801 e2.tag) +
1802 +
1804 ns_href = "http://a.b.c" +1805 one = self.etree.fromstring( +1806 _bytes('<foo><bar xmlns:ns="%s"><ns:baz/></bar></foo>' % ns_href)) +1807 baz = one[0][0] +1808 +1809 two = self.etree.fromstring( +1810 _bytes('<root xmlns:ns="%s"/>' % ns_href)) +1811 two.append(baz) +1812 del one # make sure the source document is deallocated +1813 +1814 self.assertEquals('{%s}baz' % ns_href, baz.tag) +1815 self.assertEquals( +1816 _bytes('<root xmlns:ns="%s"><ns:baz/></root>' % ns_href), +1817 self.etree.tostring(two)) +
1818 +
1819 - def test_namespace_cleanup(self): +
1820 xml = _bytes('<foo xmlns="F" xmlns:x="x"><bar xmlns:ns="NS" xmlns:b="b" xmlns="B"><ns:baz/></bar></foo>') +1821 root = self.etree.fromstring(xml) +1822 self.assertEquals(xml, +1823 self.etree.tostring(root)) +1824 self.etree.cleanup_namespaces(root) +1825 self.assertEquals( +1826 _bytes('<foo xmlns="F"><bar xmlns:ns="NS" xmlns="B"><ns:baz/></bar></foo>'), +1827 self.etree.tostring(root)) +
1828 +
1829 - def test_element_nsmap(self): +
1830 etree = self.etree +1831 +1832 r = {None: 'http://ns.infrae.com/foo', +1833 'hoi': 'http://ns.infrae.com/hoi'} +1834 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) +1835 self.assertEquals( +1836 r, +1837 e.nsmap) +
1838 +
1839 - def test_subelement_nsmap(self): +
1840 etree = self.etree +1841 +1842 re = {None: 'http://ns.infrae.com/foo', +1843 'hoi': 'http://ns.infrae.com/hoi'} +1844 e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=re) +1845 +1846 rs = {None: 'http://ns.infrae.com/honk', +1847 'top': 'http://ns.infrae.com/top'} +1848 s = etree.SubElement(e, '{http://ns.infrae.com/honk}bar', nsmap=rs) +1849 +1850 r = re.copy() +1851 r.update(rs) +1852 self.assertEquals( +1853 re, +1854 e.nsmap) +1855 self.assertEquals( +1856 r, +1857 s.nsmap) +
1858 +
1860 Element = self.etree.Element +1861 SubElement = self.etree.SubElement +1862 +1863 a = Element('{a}a') +1864 b = SubElement(a, '{a}b') +1865 c = SubElement(a, '{a}c') +1866 d = SubElement(b, '{b}d') +1867 e = SubElement(c, '{a}e') +1868 f = SubElement(c, '{b}f') +1869 +1870 self.assertEquals( +1871 [a], +1872 list(a.getiterator('{a}a'))) +1873 self.assertEquals( +1874 [], +1875 list(a.getiterator('{b}a'))) +1876 self.assertEquals( +1877 [], +1878 list(a.getiterator('a'))) +1879 self.assertEquals( +1880 [f], +1881 list(c.getiterator('{b}*'))) +1882 self.assertEquals( +1883 [d, f], +1884 list(a.getiterator('{b}*'))) +
1885 +
1887 Element = self.etree.Element +1888 Entity = self.etree.Entity +1889 SubElement = self.etree.SubElement +1890 +1891 a = Element('a') +1892 b = SubElement(a, 'b') +1893 entity_b = Entity("TEST-b") +1894 b.append(entity_b) +1895 +1896 self.assertEquals( +1897 [entity_b], +1898 list(a.getiterator(Entity))) +1899 +1900 entity_a = Entity("TEST-a") +1901 a.append(entity_a) +1902 +1903 self.assertEquals( +1904 [entity_b, entity_a], +1905 list(a.getiterator(Entity))) +1906 +1907 self.assertEquals( +1908 [entity_b], +1909 list(b.getiterator(Entity))) +
1910 +
1912 Element = self.etree.Element +1913 Comment = self.etree.Comment +1914 PI = self.etree.PI +1915 SubElement = self.etree.SubElement +1916 +1917 a = Element('a') +1918 b = SubElement(a, 'b') +1919 a.append(Comment("test")) +1920 a.append(PI("pi", "content")) +1921 c = SubElement(a, 'c') +1922 +1923 self.assertEquals( +1924 [a, b, c], +1925 list(a.getiterator(Element))) +
1926 +
1928 # ElementTree iterates over everything here +1929 Element = self.etree.Element +1930 Comment = self.etree.Comment +1931 PI = self.etree.PI +1932 SubElement = self.etree.SubElement +1933 +1934 a = Element('a') +1935 b = SubElement(a, 'b') +1936 a.append(Comment("test")) +1937 a.append(PI("pi", "content")) +1938 c = SubElement(a, 'c') +1939 +1940 self.assertEquals( +1941 [a, b, c], +1942 list(a.getiterator('*'))) +
1943 +
1944 - def test_elementtree_find_qname(self): +
1945 XML = self.etree.XML +1946 ElementTree = self.etree.ElementTree +1947 QName = self.etree.QName +1948 tree = ElementTree(XML(_bytes('<a><b><c/></b><b/><c><b/></c></a>'))) +1949 self.assertEquals(tree.find(QName("c")), tree.getroot()[2]) +
1950 +
1952 XML = self.etree.XML +1953 ElementTree = self.etree.ElementTree +1954 QName = self.etree.QName +1955 tree = ElementTree(XML(_bytes('<a><b><c/></b><b/><c><b/></c></a>'))) +1956 self.assertEquals(len(list(tree.findall(QName("c")))), 1) +
1957 +
1959 XML = self.etree.XML +1960 ElementTree = self.etree.ElementTree +1961 QName = self.etree.QName +1962 tree = ElementTree(XML( +1963 _bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>'))) +1964 self.assertEquals(len(list(tree.findall(QName("b")))), 2) +1965 self.assertEquals(len(list(tree.findall(QName("X", "b")))), 1) +
1966 +
1967 - def test_findall_ns(self): +
1968 XML = self.etree.XML +1969 root = XML(_bytes('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>')) +1970 self.assertEquals(len(root.findall(".//{X}b")), 2) +1971 self.assertEquals(len(root.findall(".//{X}*")), 2) +1972 self.assertEquals(len(root.findall(".//b")), 3) +
1973 +
1974 - def test_index(self): +
1975 etree = self.etree +1976 e = etree.Element('foo') +1977 for i in range(10): +1978 etree.SubElement(e, 'a%s' % i) +1979 for i in range(10): +1980 self.assertEquals( +1981 i, +1982 e.index(e[i])) +1983 self.assertEquals( +1984 3, e.index(e[3], 3)) +1985 self.assertRaises( +1986 ValueError, e.index, e[3], 4) +1987 self.assertRaises( +1988 ValueError, e.index, e[3], 0, 2) +1989 self.assertRaises( +1990 ValueError, e.index, e[8], 0, -3) +1991 self.assertRaises( +1992 ValueError, e.index, e[8], -5, -3) +1993 self.assertEquals( +1994 8, e.index(e[8], 0, -1)) +1995 self.assertEquals( +1996 8, e.index(e[8], -12, -1)) +1997 self.assertEquals( +1998 0, e.index(e[0], -12, -1)) +
1999 +
2000 - def test_replace(self): +
2001 etree = self.etree +2002 e = etree.Element('foo') +2003 for i in range(10): +2004 el = etree.SubElement(e, 'a%s' % i) +2005 el.text = "text%d" % i +2006 el.tail = "tail%d" % i +2007 +2008 child0 = e[0] +2009 child1 = e[1] +2010 child2 = e[2] +2011 +2012 e.replace(e[0], e[1]) +2013 self.assertEquals( +2014 9, len(e)) +2015 self.assertEquals( +2016 child1, e[0]) +2017 self.assertEquals( +2018 child1.text, "text1") +2019 self.assertEquals( +2020 child1.tail, "tail1") +2021 self.assertEquals( +2022 child0.tail, "tail0") +2023 self.assertEquals( +2024 child2, e[1]) +2025 +2026 e.replace(e[-1], e[0]) +2027 self.assertEquals( +2028 child1, e[-1]) +2029 self.assertEquals( +2030 child1.text, "text1") +2031 self.assertEquals( +2032 child1.tail, "tail1") +2033 self.assertEquals( +2034 child2, e[0]) +
2035 +
2036 - def test_replace_new(self): +
2037 etree = self.etree +2038 e = etree.Element('foo') +2039 for i in range(10): +2040 etree.SubElement(e, 'a%s' % i) +2041 +2042 new_element = etree.Element("test") +2043 new_element.text = "TESTTEXT" +2044 new_element.tail = "TESTTAIL" +2045 child1 = e[1] +2046 e.replace(e[0], new_element) +2047 self.assertEquals( +2048 new_element, e[0]) +2049 self.assertEquals( +2050 "TESTTEXT", +2051 e[0].text) +2052 self.assertEquals( +2053 "TESTTAIL", +2054 e[0].tail) +2055 self.assertEquals( +2056 child1, e[1]) +
2057 +
2059 Element = self.etree.Element +2060 SubElement = self.etree.SubElement +2061 +2062 a = Element('a') +2063 +2064 e = Element('e') +2065 f = Element('f') +2066 g = Element('g') +2067 +2068 s = [e, f, g] +2069 a[::-1] = s +2070 self.assertEquals( +2071 [g, f, e], +2072 list(a)) +
2073 +
2074 - def test_setslice_step(self): +
2075 Element = self.etree.Element +2076 SubElement = self.etree.SubElement +2077 +2078 a = Element('a') +2079 b = SubElement(a, 'b') +2080 c = SubElement(a, 'c') +2081 d = SubElement(a, 'd') +2082 e = SubElement(a, 'e') +2083 +2084 x = Element('x') +2085 y = Element('y') +2086 +2087 a[1::2] = [x, y] +2088 self.assertEquals( +2089 [b, x, d, y], +2090 list(a)) +
2091 +
2092 - def test_setslice_step_negative(self): +
2093 Element = self.etree.Element +2094 SubElement = self.etree.SubElement +2095 +2096 a = Element('a') +2097 b = SubElement(a, 'b') +2098 c = SubElement(a, 'c') +2099 d = SubElement(a, 'd') +2100 e = SubElement(a, 'e') +2101 +2102 x = Element('x') +2103 y = Element('y') +2104 +2105 a[1::-1] = [x, y] +2106 self.assertEquals( +2107 [y, x, d, e], +2108 list(a)) +
2109 +
2111 Element = self.etree.Element +2112 SubElement = self.etree.SubElement +2113 +2114 a = Element('a') +2115 b = SubElement(a, 'b') +2116 c = SubElement(a, 'c') +2117 d = SubElement(a, 'd') +2118 e = SubElement(a, 'e') +2119 +2120 x = Element('x') +2121 y = Element('y') +2122 +2123 a[::-2] = [x, y] +2124 self.assertEquals( +2125 [b, y, d, x], +2126 list(a)) +
2127 +
2128 - def test_setslice_step_overrun(self): +
2129 Element = self.etree.Element +2130 SubElement = self.etree.SubElement +2131 try: +2132 slice +2133 except NameError: +2134 print("slice() not found") +2135 return +2136 +2137 a = Element('a') +2138 b = SubElement(a, 'b') +2139 c = SubElement(a, 'c') +2140 d = SubElement(a, 'd') +2141 e = SubElement(a, 'e') +2142 +2143 x = Element('x') +2144 y = Element('y') +2145 z = Element('z') +2146 +2147 self.assertRaises( +2148 ValueError, +2149 operator.setitem, a, slice(1,None,2), [x, y, z]) +2150 +2151 self.assertEquals( +2152 [b, c, d, e], +2153 list(a)) +
2154 +
2155 - def test_sourceline_XML(self): +
2156 XML = self.etree.XML +2157 root = XML(_bytes('''<?xml version="1.0"?> +2158 <root><test> +2159 +2160 <bla/></test> +2161 </root> +2162 ''')) +2163 +2164 self.assertEquals( +2165 [2, 2, 4], +2166 [ el.sourceline for el in root.getiterator() ]) +
2167 +
2168 - def test_sourceline_parse(self): +
2169 parse = self.etree.parse +2170 tree = parse(fileInTestDir('include/test_xinclude.xml')) +2171 +2172 self.assertEquals( +2173 [1, 2, 3], +2174 [ el.sourceline for el in tree.getiterator() ]) +
2175 +
2177 iterparse = self.etree.iterparse +2178 lines = [ el.sourceline for (event, el) in +2179 iterparse(fileInTestDir('include/test_xinclude.xml')) ] +2180 +2181 self.assertEquals( +2182 [2, 3, 1], +2183 lines) +
2184 +
2186 iterparse = self.etree.iterparse +2187 lines = [ el.sourceline for (event, el) in +2188 iterparse(fileInTestDir('include/test_xinclude.xml'), +2189 events=("start",)) ] +2190 +2191 self.assertEquals( +2192 [1, 2, 3], +2193 lines) +
2194 +
2195 - def test_sourceline_element(self): +
2196 Element = self.etree.Element +2197 SubElement = self.etree.SubElement +2198 el = Element("test") +2199 self.assertEquals(None, el.sourceline) +2200 +2201 child = SubElement(el, "test") +2202 self.assertEquals(None, el.sourceline) +2203 self.assertEquals(None, child.sourceline) +
2204 +
2205 - def test_XML_base_url_docinfo(self): +
2206 etree = self.etree +2207 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +2208 docinfo = root.getroottree().docinfo +2209 self.assertEquals(docinfo.URL, "http://no/such/url") +
2210 +
2212 etree = self.etree +2213 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +2214 docinfo = root.getroottree().docinfo +2215 self.assertEquals(docinfo.URL, "http://no/such/url") +2216 docinfo.URL = "https://secret/url" +2217 self.assertEquals(docinfo.URL, "https://secret/url") +
2218 +
2220 etree = self.etree +2221 tree = etree.parse(BytesIO("<root/>"), base_url="http://no/such/url") +2222 docinfo = tree.docinfo +2223 self.assertEquals(docinfo.URL, "http://no/such/url") +
2224 +
2225 - def test_parse_base_url_docinfo(self): +
2226 etree = self.etree +2227 tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), +2228 base_url="http://no/such/url") +2229 docinfo = tree.docinfo +2230 self.assertEquals(docinfo.URL, "http://no/such/url") +
2231 +
2232 - def test_HTML_base_url_docinfo(self): +
2233 etree = self.etree +2234 root = etree.HTML(_bytes("<html/>"), base_url="http://no/such/url") +2235 docinfo = root.getroottree().docinfo +2236 self.assertEquals(docinfo.URL, "http://no/such/url") +
2237 +
2238 - def test_docinfo_public(self): +
2239 etree = self.etree +2240 xml_header = '<?xml version="1.0" encoding="ascii"?>' +2241 pub_id = "-//W3C//DTD XHTML 1.0 Transitional//EN" +2242 sys_id = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +2243 doctype_string = '<!DOCTYPE html PUBLIC "%s" "%s">' % (pub_id, sys_id) +2244 +2245 xml = _bytes(xml_header + doctype_string + '<html><body></body></html>') +2246 +2247 tree = etree.parse(BytesIO(xml)) +2248 docinfo = tree.docinfo +2249 self.assertEquals(docinfo.encoding, "ascii") +2250 self.assertEquals(docinfo.xml_version, "1.0") +2251 self.assertEquals(docinfo.public_id, pub_id) +2252 self.assertEquals(docinfo.system_url, sys_id) +2253 self.assertEquals(docinfo.root_name, 'html') +2254 self.assertEquals(docinfo.doctype, doctype_string) +
2255 +
2256 - def test_docinfo_system(self): +
2257 etree = self.etree +2258 xml_header = '<?xml version="1.0" encoding="UTF-8"?>' +2259 sys_id = "some.dtd" +2260 doctype_string = '<!DOCTYPE html SYSTEM "%s">' % sys_id +2261 xml = _bytes(xml_header + doctype_string + '<html><body></body></html>') +2262 +2263 tree = etree.parse(BytesIO(xml)) +2264 docinfo = tree.docinfo +2265 self.assertEquals(docinfo.encoding, "UTF-8") +2266 self.assertEquals(docinfo.xml_version, "1.0") +2267 self.assertEquals(docinfo.public_id, None) +2268 self.assertEquals(docinfo.system_url, sys_id) +2269 self.assertEquals(docinfo.root_name, 'html') +2270 self.assertEquals(docinfo.doctype, doctype_string) +
2271 +
2272 - def test_docinfo_empty(self): +
2273 etree = self.etree +2274 xml = _bytes('<html><body></body></html>') +2275 tree = etree.parse(BytesIO(xml)) +2276 docinfo = tree.docinfo +2277 self.assertEquals(docinfo.encoding, "UTF-8") +2278 self.assertEquals(docinfo.xml_version, "1.0") +2279 self.assertEquals(docinfo.public_id, None) +2280 self.assertEquals(docinfo.system_url, None) +2281 self.assertEquals(docinfo.root_name, 'html') +2282 self.assertEquals(docinfo.doctype, '') +
2283 +
2284 - def test_docinfo_name_only(self): +
2285 etree = self.etree +2286 xml = _bytes('<!DOCTYPE root><root></root>') +2287 tree = etree.parse(BytesIO(xml)) +2288 docinfo = tree.docinfo +2289 self.assertEquals(docinfo.encoding, "UTF-8") +2290 self.assertEquals(docinfo.xml_version, "1.0") +2291 self.assertEquals(docinfo.public_id, None) +2292 self.assertEquals(docinfo.system_url, None) +2293 self.assertEquals(docinfo.root_name, 'root') +2294 self.assertEquals(docinfo.doctype, '<!DOCTYPE root>') +
2295 +
2297 etree = self.etree +2298 xml = _bytes('<!DOCTYPE root>\n<root/>') +2299 tree = etree.parse(BytesIO(xml)) +2300 self.assertEquals(xml, etree.tostring(tree)) +
2301 +
2302 - def test_xml_base(self): +
2303 etree = self.etree +2304 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +2305 self.assertEquals(root.base, "http://no/such/url") +2306 self.assertEquals( +2307 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +2308 root.base = "https://secret/url" +2309 self.assertEquals(root.base, "https://secret/url") +2310 self.assertEquals( +2311 root.get('{http://www.w3.org/XML/1998/namespace}base'), +2312 "https://secret/url") +
2313 +
2314 - def test_xml_base_attribute(self): +
2315 etree = self.etree +2316 root = etree.XML(_bytes("<root/>"), base_url="http://no/such/url") +2317 self.assertEquals(root.base, "http://no/such/url") +2318 self.assertEquals( +2319 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +2320 root.set('{http://www.w3.org/XML/1998/namespace}base', +2321 "https://secret/url") +2322 self.assertEquals(root.base, "https://secret/url") +2323 self.assertEquals( +2324 root.get('{http://www.w3.org/XML/1998/namespace}base'), +2325 "https://secret/url") +
2326 +
2327 - def test_html_base(self): +
2328 etree = self.etree +2329 root = etree.HTML(_bytes("<html><body></body></html>"), +2330 base_url="http://no/such/url") +2331 self.assertEquals(root.base, "http://no/such/url") +
2332 +
2333 - def test_html_base_tag(self): +
2334 etree = self.etree +2335 root = etree.HTML(_bytes('<html><head><base href="http://no/such/url"></head></html>')) +2336 self.assertEquals(root.base, "http://no/such/url") +
2337 +
2339 # parse from a file object that returns unicode strings +2340 f = LargeFileLikeUnicode() +2341 tree = self.etree.parse(f) +2342 root = tree.getroot() +2343 self.assert_(root.tag.endswith('root')) +
2344 +
2345 - def test_dtd_io(self): +
2346 # check that DTDs that go in also go back out +2347 xml = _bytes('''\ +2348 <!DOCTYPE test SYSTEM "test.dtd" [ +2349 <!ENTITY entity "tasty"> +2350 <!ELEMENT test (a)> +2351 <!ELEMENT a (#PCDATA)> +2352 ]> +2353 <test><a>test-test</a></test>\ +2354 ''') +2355 tree = self.etree.parse(BytesIO(xml)) +2356 self.assertEqual(self.etree.tostring(tree).replace(_bytes(" "), _bytes("")), +2357 xml.replace(_bytes(" "), _bytes(""))) +
2358 +
2359 - def test_byte_zero(self): +
2360 Element = self.etree.Element +2361 +2362 a = Element('a') +2363 self.assertRaises(ValueError, setattr, a, "text", 'ha\0ho') +2364 self.assertRaises(ValueError, setattr, a, "tail", 'ha\0ho') +2365 +2366 self.assertRaises(ValueError, Element, 'ha\0ho') +
2367 +
2368 - def test_unicode_byte_zero(self): +
2369 Element = self.etree.Element +2370 +2371 a = Element('a') +2372 self.assertRaises(ValueError, setattr, a, "text", +2373 _str('ha\0ho')) +2374 self.assertRaises(ValueError, setattr, a, "tail", +2375 _str('ha\0ho')) +2376 +2377 self.assertRaises(ValueError, Element, +2378 _str('ha\0ho')) +
2379 +
2380 - def test_byte_invalid(self): +
2381 Element = self.etree.Element +2382 +2383 a = Element('a') +2384 self.assertRaises(ValueError, setattr, a, "text", 'ha\x07ho') +2385 self.assertRaises(ValueError, setattr, a, "text", 'ha\x02ho') +2386 +2387 self.assertRaises(ValueError, setattr, a, "tail", 'ha\x07ho') +2388 self.assertRaises(ValueError, setattr, a, "tail", 'ha\x02ho') +2389 +2390 self.assertRaises(ValueError, Element, 'ha\x07ho') +2391 self.assertRaises(ValueError, Element, 'ha\x02ho') +
2392 +
2393 - def test_unicode_byte_invalid(self): +
2394 Element = self.etree.Element +2395 +2396 a = Element('a') +2397 self.assertRaises(ValueError, setattr, a, "text", +2398 _str('ha\x07ho')) +2399 self.assertRaises(ValueError, setattr, a, "text", +2400 _str('ha\x02ho')) +2401 +2402 self.assertRaises(ValueError, setattr, a, "tail", +2403 _str('ha\x07ho')) +2404 self.assertRaises(ValueError, setattr, a, "tail", +2405 _str('ha\x02ho')) +2406 +2407 self.assertRaises(ValueError, Element, +2408 _str('ha\x07ho')) +2409 self.assertRaises(ValueError, Element, +2410 _str('ha\x02ho')) +
2411 +
2413 # ElementTree fails to serialize this +2414 tostring = self.etree.tostring +2415 Element = self.etree.Element +2416 SubElement = self.etree.SubElement +2417 +2418 a = Element('a') +2419 b = SubElement(a, 'b') +2420 c = SubElement(a, 'c') +2421 +2422 result = tostring(a, encoding='UTF-16') +2423 self.assertEquals(_bytes('<a><b></b><c></c></a>'), +2424 canonicalize(result)) +
2425 +
2426 - def test_tostring_none(self): +
2427 # ElementTree raises an AssertionError here +2428 tostring = self.etree.tostring +2429 self.assertRaises(TypeError, self.etree.tostring, None) +
2430 +
2431 - def test_tostring_pretty(self): +
2432 tostring = self.etree.tostring +2433 Element = self.etree.Element +2434 SubElement = self.etree.SubElement +2435 +2436 a = Element('a') +2437 b = SubElement(a, 'b') +2438 c = SubElement(a, 'c') +2439 +2440 result = tostring(a) +2441 self.assertEquals(result, _bytes("<a><b/><c/></a>")) +2442 +2443 result = tostring(a, pretty_print=False) +2444 self.assertEquals(result, _bytes("<a><b/><c/></a>")) +2445 +2446 result = tostring(a, pretty_print=True) +2447 self.assertEquals(result, _bytes("<a>\n <b/>\n <c/>\n</a>\n")) +
2448 +
2449 - def test_tostring_with_tail(self): +
2450 tostring = self.etree.tostring +2451 Element = self.etree.Element +2452 SubElement = self.etree.SubElement +2453 +2454 a = Element('a') +2455 a.tail = "aTAIL" +2456 b = SubElement(a, 'b') +2457 b.tail = "bTAIL" +2458 c = SubElement(a, 'c') +2459 +2460 result = tostring(a) +2461 self.assertEquals(result, _bytes("<a><b/>bTAIL<c/></a>aTAIL")) +2462 +2463 result = tostring(a, with_tail=False) +2464 self.assertEquals(result, _bytes("<a><b/>bTAIL<c/></a>")) +2465 +2466 result = tostring(a, with_tail=True) +2467 self.assertEquals(result, _bytes("<a><b/>bTAIL<c/></a>aTAIL")) +
2468 +
2469 - def test_standalone(self): +
2470 tostring = self.etree.tostring +2471 XML = self.etree.XML +2472 ElementTree = self.etree.ElementTree +2473 Element = self.etree.Element +2474 +2475 tree = Element("root").getroottree() +2476 self.assertEquals(None, tree.docinfo.standalone) +2477 +2478 tree = XML(_bytes("<root/>")).getroottree() +2479 self.assertEquals(None, tree.docinfo.standalone) +2480 +2481 tree = XML(_bytes( +2482 "<?xml version='1.0' encoding='ASCII' standalone='yes'?>\n<root/>" +2483 )).getroottree() +2484 self.assertEquals(True, tree.docinfo.standalone) +2485 +2486 tree = XML(_bytes( +2487 "<?xml version='1.0' encoding='ASCII' standalone='no'?>\n<root/>" +2488 )).getroottree() +2489 self.assertEquals(False, tree.docinfo.standalone) +
2490 +
2491 - def test_tostring_standalone(self): +
2492 tostring = self.etree.tostring +2493 XML = self.etree.XML +2494 ElementTree = self.etree.ElementTree +2495 +2496 root = XML(_bytes("<root/>")) +2497 +2498 tree = ElementTree(root) +2499 self.assertEquals(None, tree.docinfo.standalone) +2500 +2501 result = tostring(root, xml_declaration=True, encoding="ASCII") +2502 self.assertEquals(result, _bytes( +2503 "<?xml version='1.0' encoding='ASCII'?>\n<root/>")) +2504 +2505 result = tostring(root, xml_declaration=True, encoding="ASCII", +2506 standalone=True) +2507 self.assertEquals(result, _bytes( +2508 "<?xml version='1.0' encoding='ASCII' standalone='yes'?>\n<root/>")) +2509 +2510 tree = ElementTree(XML(result)) +2511 self.assertEquals(True, tree.docinfo.standalone) +2512 +2513 result = tostring(root, xml_declaration=True, encoding="ASCII", +2514 standalone=False) +2515 self.assertEquals(result, _bytes( +2516 "<?xml version='1.0' encoding='ASCII' standalone='no'?>\n<root/>")) +2517 +2518 tree = ElementTree(XML(result)) +2519 self.assertEquals(False, tree.docinfo.standalone) +
2520 +
2522 tostring = self.etree.tostring +2523 XML = self.etree.XML +2524 ElementTree = self.etree.ElementTree +2525 +2526 root = XML(_bytes( +2527 "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n<root/>")) +2528 +2529 tree = ElementTree(root) +2530 self.assertEquals(True, tree.docinfo.standalone) +2531 +2532 result = tostring(root, xml_declaration=True, encoding="ASCII") +2533 self.assertEquals(result, _bytes( +2534 "<?xml version='1.0' encoding='ASCII'?>\n<root/>")) +2535 +2536 result = tostring(root, xml_declaration=True, encoding="ASCII", +2537 standalone=True) +2538 self.assertEquals(result, _bytes( +2539 "<?xml version='1.0' encoding='ASCII' standalone='yes'?>\n<root/>")) +
2540 +
2542 tostring = self.etree.tostring +2543 Element = self.etree.Element +2544 SubElement = self.etree.SubElement +2545 +2546 a = Element('a') +2547 a.text = "A" +2548 a.tail = "tail" +2549 b = SubElement(a, 'b') +2550 b.text = "B" +2551 b.tail = _str("Søk på nettet") +2552 c = SubElement(a, 'c') +2553 c.text = "C" +2554 +2555 result = tostring(a, method="text", encoding="UTF-16") +2556 +2557 self.assertEquals(_str('ABSøk på nettetCtail').encode("UTF-16"), +2558 result) +
2559 +
2561 tostring = self.etree.tostring +2562 Element = self.etree.Element +2563 SubElement = self.etree.SubElement +2564 +2565 a = Element('a') +2566 a.text = _str('Søk på nettetA') +2567 a.tail = "tail" +2568 b = SubElement(a, 'b') +2569 b.text = "B" +2570 b.tail = _str('Søk på nettetB') +2571 c = SubElement(a, 'c') +2572 c.text = "C" +2573 +2574 self.assertRaises(UnicodeEncodeError, +2575 tostring, a, method="text") +2576 +2577 self.assertEquals( +2578 _str('Søk på nettetABSøk på nettetBCtail').encode('utf-8'), +2579 tostring(a, encoding="UTF-8", method="text")) +
2580 +
2581 - def test_tounicode(self): +
2582 tounicode = self.etree.tounicode +2583 Element = self.etree.Element +2584 SubElement = self.etree.SubElement +2585 +2586 a = Element('a') +2587 b = SubElement(a, 'b') +2588 c = SubElement(a, 'c') +2589 +2590 self.assert_(isinstance(tounicode(a), _unicode)) +2591 self.assertEquals(_bytes('<a><b></b><c></c></a>'), +2592 canonicalize(tounicode(a))) +
2593 +
2594 - def test_tounicode_element(self): +
2595 tounicode = self.etree.tounicode +2596 Element = self.etree.Element +2597 SubElement = self.etree.SubElement +2598 +2599 a = Element('a') +2600 b = SubElement(a, 'b') +2601 c = SubElement(a, 'c') +2602 d = SubElement(c, 'd') +2603 self.assert_(isinstance(tounicode(b), _unicode)) +2604 self.assert_(isinstance(tounicode(c), _unicode)) +2605 self.assertEquals(_bytes('<b></b>'), +2606 canonicalize(tounicode(b))) +2607 self.assertEquals(_bytes('<c><d></d></c>'), +2608 canonicalize(tounicode(c))) +
2609 +
2610 - def test_tounicode_none(self): +
2611 tounicode = self.etree.tounicode +2612 self.assertRaises(TypeError, self.etree.tounicode, None) +
2613 +
2614 - def test_tounicode_element_tail(self): +
2615 tounicode = self.etree.tounicode +2616 Element = self.etree.Element +2617 SubElement = self.etree.SubElement +2618 +2619 a = Element('a') +2620 b = SubElement(a, 'b') +2621 c = SubElement(a, 'c') +2622 d = SubElement(c, 'd') +2623 b.tail = 'Foo' +2624 +2625 self.assert_(isinstance(tounicode(b), _unicode)) +2626 self.assert_(tounicode(b) == '<b/>Foo' or +2627 tounicode(b) == '<b />Foo') +
2628 +
2629 - def test_tounicode_pretty(self): +
2630 tounicode = self.etree.tounicode +2631 Element = self.etree.Element +2632 SubElement = self.etree.SubElement +2633 +2634 a = Element('a') +2635 b = SubElement(a, 'b') +2636 c = SubElement(a, 'c') +2637 +2638 result = tounicode(a) +2639 self.assertEquals(result, "<a><b/><c/></a>") +2640 +2641 result = tounicode(a, pretty_print=False) +2642 self.assertEquals(result, "<a><b/><c/></a>") +2643 +2644 result = tounicode(a, pretty_print=True) +2645 self.assertEquals(result, "<a>\n <b/>\n <c/>\n</a>\n") +
2646 +
2647 - def test_tostring_unicode(self): +
2648 tostring = self.etree.tostring +2649 Element = self.etree.Element +2650 SubElement = self.etree.SubElement +2651 +2652 a = Element('a') +2653 b = SubElement(a, 'b') +2654 c = SubElement(a, 'c') +2655 +2656 self.assert_(isinstance(tostring(a, encoding=_unicode), _unicode)) +2657 self.assertEquals(_bytes('<a><b></b><c></c></a>'), +2658 canonicalize(tostring(a, encoding=_unicode))) +
2659 +
2661 tostring = self.etree.tostring +2662 Element = self.etree.Element +2663 SubElement = self.etree.SubElement +2664 +2665 a = Element('a') +2666 b = SubElement(a, 'b') +2667 c = SubElement(a, 'c') +2668 d = SubElement(c, 'd') +2669 self.assert_(isinstance(tostring(b, encoding=_unicode), _unicode)) +2670 self.assert_(isinstance(tostring(c, encoding=_unicode), _unicode)) +2671 self.assertEquals(_bytes('<b></b>'), +2672 canonicalize(tostring(b, encoding=_unicode))) +2673 self.assertEquals(_bytes('<c><d></d></c>'), +2674 canonicalize(tostring(c, encoding=_unicode))) +
2675 +
2676 - def test_tostring_unicode_none(self): +
2677 tostring = self.etree.tostring +2678 self.assertRaises(TypeError, self.etree.tostring, +2679 None, encoding=_unicode) +
2680 +
2682 tostring = self.etree.tostring +2683 Element = self.etree.Element +2684 SubElement = self.etree.SubElement +2685 +2686 a = Element('a') +2687 b = SubElement(a, 'b') +2688 c = SubElement(a, 'c') +2689 d = SubElement(c, 'd') +2690 b.tail = 'Foo' +2691 +2692 self.assert_(isinstance(tostring(b, encoding=_unicode), _unicode)) +2693 self.assert_(tostring(b, encoding=_unicode) == '<b/>Foo' or +2694 tostring(b, encoding=_unicode) == '<b />Foo') +
2695 +
2697 tostring = self.etree.tostring +2698 Element = self.etree.Element +2699 SubElement = self.etree.SubElement +2700 +2701 a = Element('a') +2702 b = SubElement(a, 'b') +2703 c = SubElement(a, 'c') +2704 +2705 result = tostring(a, encoding=_unicode) +2706 self.assertEquals(result, "<a><b/><c/></a>") +2707 +2708 result = tostring(a, encoding=_unicode, pretty_print=False) +2709 self.assertEquals(result, "<a><b/><c/></a>") +2710 +2711 result = tostring(a, encoding=_unicode, pretty_print=True) +2712 self.assertEquals(result, "<a>\n <b/>\n <c/>\n</a>\n") +
2713 +2714 # helper methods +2715 +
2716 - def _writeElement(self, element, encoding='us-ascii', compression=0): +
2717 """Write out element for comparison. +2718 """ +2719 ElementTree = self.etree.ElementTree +2720 f = BytesIO() +2721 tree = ElementTree(element=element) +2722 tree.write(f, encoding=encoding, compression=compression) +2723 data = f.getvalue() +2724 if compression: +2725 data = zlib.decompress(data) +2726 return canonicalize(data) +
2727 +2728 +
2729 -class XIncludeTestCase(HelperTestCase): +
2730 - def test_xinclude_text(self): +
2731 filename = fileInTestDir('test_broken.xml') +2732 root = etree.XML(_bytes('''\ +2733 <doc xmlns:xi="http://www.w3.org/2001/XInclude"> +2734 <xi:include href="%s" parse="text"/> +2735 </doc> +2736 ''' % filename)) +2737 old_text = root.text +2738 content = open(filename).read() +2739 old_tail = root[0].tail +2740 +2741 self.include( etree.ElementTree(root) ) +2742 self.assertEquals(old_text + content + old_tail, +2743 root.text) +
2744 +
2745 - def test_xinclude(self): +
2746 tree = etree.parse(fileInTestDir('include/test_xinclude.xml')) +2747 self.assertNotEquals( +2748 'a', +2749 tree.getroot()[1].tag) +2750 # process xincludes +2751 self.include( tree ) +2752 # check whether we find it replaced with included data +2753 self.assertEquals( +2754 'a', +2755 tree.getroot()[1].tag) +
2756 +
2757 - def test_xinclude_resolver(self): +
2758 class res(etree.Resolver): +2759 include_text = open(fileInTestDir('test.xml')).read() +2760 called = {} +2761 def resolve(self, url, id, context): +2762 if url.endswith(".dtd"): +2763 self.called["dtd"] = True +2764 return self.resolve_filename( +2765 fileInTestDir('test.dtd'), context) +2766 elif url.endswith("test_xinclude.xml"): +2767 self.called["input"] = True +2768 return None # delegate to default resolver +2769 else: +2770 self.called["include"] = True +2771 return self.resolve_string(self.include_text, context) +
2772 +2773 res_instance = res() +2774 parser = etree.XMLParser(load_dtd = True) +2775 parser.resolvers.add(res_instance) +2776 +2777 tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), +2778 parser = parser) +2779 +2780 self.include(tree) +2781 +2782 called = list(res_instance.called.items()) +2783 called.sort() +2784 self.assertEquals( +2785 [("dtd", True), ("include", True), ("input", True)], +2786 called) +2787 +
2788 -class ETreeXIncludeTestCase(XIncludeTestCase): +
2789 - def include(self, tree): +
2790 tree.xinclude() +
2791 +2792 +
2793 -class ElementIncludeTestCase(XIncludeTestCase): +
2794 from lxml import ElementInclude +
2795 - def include(self, tree): +
2796 self.ElementInclude.include(tree.getroot()) +
2797 +2798 +
2799 -class ETreeC14NTestCase(HelperTestCase): +
2800 - def test_c14n(self): +
2801 tree = self.parse(_bytes('<a><b/></a>')) +2802 f = BytesIO() +2803 tree.write_c14n(f) +2804 s = f.getvalue() +2805 self.assertEquals(_bytes('<a><b></b></a>'), +2806 s) +
2807 +
2808 - def test_c14n_gzip(self): +
2809 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2810 f = BytesIO() +2811 tree.write_c14n(f, compression=9) +2812 s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() +2813 self.assertEquals(_bytes('<a>'+'<b></b>'*200+'</a>'), +2814 s) +
2815 +
2816 - def test_c14n_file(self): +
2817 tree = self.parse(_bytes('<a><b/></a>')) +2818 handle, filename = tempfile.mkstemp() +2819 try: +2820 tree.write_c14n(filename) +2821 f = open(filename, 'rb') +2822 data = f.read() +2823 f.close() +2824 finally: +2825 os.close(handle) +2826 os.remove(filename) +2827 self.assertEquals(_bytes('<a><b></b></a>'), +2828 data) +
2829 +
2830 - def test_c14n_file_gzip(self): +
2831 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2832 handle, filename = tempfile.mkstemp() +2833 try: +2834 tree.write_c14n(filename, compression=9) +2835 f = gzip.open(filename, 'rb') +2836 data = f.read() +2837 f.close() +2838 finally: +2839 os.close(handle) +2840 os.remove(filename) +2841 self.assertEquals(_bytes('<a>'+'<b></b>'*200+'</a>'), +2842 data) +
2843 +
2844 - def test_c14n_with_comments(self): +
2845 tree = self.parse(_bytes('<!--hi--><a><!--ho--><b/></a><!--hu-->')) +2846 f = BytesIO() +2847 tree.write_c14n(f) +2848 s = f.getvalue() +2849 self.assertEquals(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +2850 s) +2851 f = BytesIO() +2852 tree.write_c14n(f, with_comments=True) +2853 s = f.getvalue() +2854 self.assertEquals(_bytes('<!--hi-->\n<a><!--ho--><b></b></a>\n<!--hu-->'), +2855 s) +2856 f = BytesIO() +2857 tree.write_c14n(f, with_comments=False) +2858 s = f.getvalue() +2859 self.assertEquals(_bytes('<a><b></b></a>'), +2860 s) +
2861 +
2862 - def test_c14n_exclusive(self): +
2863 tree = self.parse(_bytes( +2864 '<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b/></a>')) +2865 f = BytesIO() +2866 tree.write_c14n(f) +2867 s = f.getvalue() +2868 self.assertEquals(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +2869 s) +2870 f = BytesIO() +2871 tree.write_c14n(f, exclusive=False) +2872 s = f.getvalue() +2873 self.assertEquals(_bytes('<a xmlns="http://abc" xmlns:y="http://bcd" xmlns:z="http://cde"><z:b></z:b></a>'), +2874 s) +2875 f = BytesIO() +2876 tree.write_c14n(f, exclusive=True) +2877 s = f.getvalue() +2878 self.assertEquals(_bytes('<a xmlns="http://abc"><z:b xmlns:z="http://cde"></z:b></a>'), +2879 s) +
2880 +2881 +
2882 -class ETreeWriteTestCase(HelperTestCase): +
2883 - def test_write(self): +
2884 tree = self.parse(_bytes('<a><b/></a>')) +2885 f = BytesIO() +2886 tree.write(f) +2887 s = f.getvalue() +2888 self.assertEquals(_bytes('<a><b/></a>'), +2889 s) +
2890 +
2891 - def test_write_gzip(self): +
2892 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2893 f = BytesIO() +2894 tree.write(f, compression=9) +2895 s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() +2896 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2897 s) +
2898 +
2899 - def test_write_gzip_level(self): +
2900 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2901 f = BytesIO() +2902 tree.write(f, compression=0) +2903 s0 = f.getvalue() +2904 +2905 f = BytesIO() +2906 tree.write(f) +2907 self.assertEquals(f.getvalue(), s0) +2908 +2909 f = BytesIO() +2910 tree.write(f, compression=1) +2911 s = f.getvalue() +2912 self.assert_(len(s) <= len(s0)) +2913 s1 = gzip.GzipFile(fileobj=BytesIO(s)).read() +2914 +2915 f = BytesIO() +2916 tree.write(f, compression=9) +2917 s = f.getvalue() +2918 self.assert_(len(s) <= len(s0)) +2919 s9 = gzip.GzipFile(fileobj=BytesIO(s)).read() +2920 +2921 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2922 s0) +2923 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2924 s1) +2925 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2926 s9) +
2927 +
2928 - def test_write_file(self): +
2929 tree = self.parse(_bytes('<a><b/></a>')) +2930 handle, filename = tempfile.mkstemp() +2931 try: +2932 tree.write(filename) +2933 f = open(filename, 'rb') +2934 data = f.read() +2935 f.close() +2936 finally: +2937 os.close(handle) +2938 os.remove(filename) +2939 self.assertEquals(_bytes('<a><b/></a>'), +2940 data) +
2941 +
2942 - def test_write_file_gzip(self): +
2943 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2944 handle, filename = tempfile.mkstemp() +2945 try: +2946 tree.write(filename, compression=9) +2947 f = gzip.open(filename, 'rb') +2948 data = f.read() +2949 f.close() +2950 finally: +2951 os.close(handle) +2952 os.remove(filename) +2953 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2954 data) +
2955 +
2956 - def test_write_file_gzip_parse(self): +
2957 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2958 handle, filename = tempfile.mkstemp() +2959 try: +2960 tree.write(filename, compression=9) +2961 data = etree.tostring(etree.parse(filename)) +2962 finally: +2963 os.close(handle) +2964 os.remove(filename) +2965 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2966 data) +
2967 +
2969 tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) +2970 handle, filename = tempfile.mkstemp() +2971 try: +2972 tree.write(filename, compression=9) +2973 data = etree.tostring(etree.parse( +2974 gzip.GzipFile(filename))) +2975 finally: +2976 os.close(handle) +2977 os.remove(filename) +2978 self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), +2979 data) +
2980 +
2981 -class ETreeErrorLogTest(HelperTestCase): +
2982 etree = etree +2983 +
2984 - def test_parse_error_logging(self): +
2985 parse = self.etree.parse +2986 f = BytesIO('<a><b></c></b></a>') +2987 self.etree.clear_error_log() +2988 try: +2989 parse(f) +2990 logs = None +2991 except SyntaxError: +2992 e = sys.exc_info()[1] +2993 logs = e.error_log +2994 f.close() +2995 self.assert_([ log for log in logs +2996 if 'mismatch' in log.message ]) +2997 self.assert_([ log for log in logs +2998 if 'PARSER' in log.domain_name]) +2999 self.assert_([ log for log in logs +3000 if 'ERR_TAG_NAME_MISMATCH' in log.type_name ]) +3001 self.assert_([ log for log in logs +3002 if 1 == log.line ]) +3003 self.assert_([ log for log in logs +3004 if 15 == log.column ]) +
3005 +
3006 - def _test_python_error_logging(self): +
3007 """This can't really be tested as long as there isn't a way to +3008 reset the logging setup ... +3009 """ +3010 parse = self.etree.parse +3011 +3012 messages = [] +3013 class Logger(self.etree.PyErrorLog): +3014 def log(self, entry, message, *args): +3015 messages.append(message) +
3016 +3017 self.etree.use_global_python_log(Logger()) +3018 f = BytesIO('<a><b></c></b></a>') +3019 try: +3020 parse(f) +3021 except SyntaxError: +3022 pass +3023 f.close() +3024 +3025 self.assert_([ message for message in messages +3026 if 'mismatch' in message ]) +3027 self.assert_([ message for message in messages +3028 if ':PARSER:' in message]) +3029 self.assert_([ message for message in messages +3030 if ':ERR_TAG_NAME_MISMATCH:' in message ]) +3031 self.assert_([ message for message in messages +3032 if ':1:15:' in message ]) +3033 +
3034 -def test_suite(): +
3035 suite = unittest.TestSuite() +3036 suite.addTests([unittest.makeSuite(ETreeOnlyTestCase)]) +3037 suite.addTests([unittest.makeSuite(ETreeXIncludeTestCase)]) +3038 suite.addTests([unittest.makeSuite(ElementIncludeTestCase)]) +3039 suite.addTests([unittest.makeSuite(ETreeC14NTestCase)]) +3040 suite.addTests([unittest.makeSuite(ETreeWriteTestCase)]) +3041 suite.addTests([unittest.makeSuite(ETreeErrorLogTest)]) +3042 suite.addTests( +3043 [make_doctest('../../../doc/tutorial.txt')]) +3044 suite.addTests( +3045 [make_doctest('../../../doc/api.txt')]) +3046 suite.addTests( +3047 [make_doctest('../../../doc/FAQ.txt')]) +3048 suite.addTests( +3049 [make_doctest('../../../doc/parsing.txt')]) +3050 suite.addTests( +3051 [make_doctest('../../../doc/resolvers.txt')]) +3052 return suite +
3053 +3054 if __name__ == '__main__': +3055 print('to test use test.py %s' % __file__) +3056 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.ETreeC14NTestCase-class.html b/doc/html/api/lxml.tests.test_etree.ETreeC14NTestCase-class.html new file mode 100644 index 0000000..0b582dd --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeC14NTestCase-class.html @@ -0,0 +1,371 @@ + + + + + lxml.tests.test_etree.ETreeC14NTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class ETreeC14NTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeC14NTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeC14NTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_c14n(self) + source code + +
+ +
+   + + + + + + +
test_c14n_gzip(self) + source code + +
+ +
+   + + + + + + +
test_c14n_file(self) + source code + +
+ +
+   + + + + + + +
test_c14n_file_gzip(self) + source code + +
+ +
+   + + + + + + +
test_c14n_with_comments(self) + source code + +
+ +
+   + + + + + + +
test_c14n_exclusive(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.ETreeErrorLogTest-class.html b/doc/html/api/lxml.tests.test_etree.ETreeErrorLogTest-class.html new file mode 100644 index 0000000..f72f297 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeErrorLogTest-class.html @@ -0,0 +1,353 @@ + + + + + lxml.tests.test_etree.ETreeErrorLogTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class ETreeErrorLogTest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeErrorLogTest

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeErrorLogTest
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_parse_error_logging(self) + source code + +
+ +
+   + + + + + + +
_test_python_error_logging(self)
+ This can't really be tested as long as there isn't a way to +reset the logging setup ...
+ source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.ETreeOnlyTestCase-class.html b/doc/html/api/lxml.tests.test_etree.ETreeOnlyTestCase-class.html new file mode 100644 index 0000000..68064ac --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeOnlyTestCase-class.html @@ -0,0 +1,3367 @@ + + + + + lxml.tests.test_etree.ETreeOnlyTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class ETreeOnlyTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeOnlyTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeOnlyTestCase
+
+ +
+Tests only for etree, not ElementTree + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_version(self) + source code + +
+ +
+   + + + + + + +
test_c_api(self) + source code + +
+ +
+   + + + + + + +
test_element_names(self) + source code + +
+ +
+   + + + + + + +
test_element_name_empty(self) + source code + +
+ +
+   + + + + + + +
test_element_name_colon(self) + source code + +
+ +
+   + + + + + + +
test_element_name_quote(self) + source code + +
+ +
+   + + + + + + +
test_element_name_space(self) + source code + +
+ +
+   + + + + + + +
test_subelement_name_empty(self) + source code + +
+ +
+   + + + + + + +
test_subelement_name_colon(self) + source code + +
+ +
+   + + + + + + +
test_subelement_name_quote(self) + source code + +
+ +
+   + + + + + + +
test_subelement_name_space(self) + source code + +
+ +
+   + + + + + + +
test_subelement_attribute_invalid(self) + source code + +
+ +
+   + + + + + + +
test_qname_empty(self) + source code + +
+ +
+   + + + + + + +
test_qname_colon(self) + source code + +
+ +
+   + + + + + + +
test_qname_space(self) + source code + +
+ +
+   + + + + + + +
test_qname_namespace_localname(self) + source code + +
+ +
+   + + + + + + +
test_qname_element(self) + source code + +
+ +
+   + + + + + + +
test_qname_text_resolve(self) + source code + +
+ +
+   + + + + + + +
test_nsmap_prefix_invalid(self) + source code + +
+ +
+   + + + + + + +
test_attribute_set_invalid(self) + source code + +
+ +
+   + + + + + + +
test_strip_attributes(self) + source code + +
+ +
+   + + + + + + +
test_strip_attributes_ns(self) + source code + +
+ +
+   + + + + + + +
test_strip_elements(self) + source code + +
+ +
+   + + + + + + +
test_strip_elements_ns(self) + source code + +
+ +
+   + + + + + + +
test_strip_tags(self) + source code + +
+ +
+   + + + + + + +
test_strip_tags_ns(self) + source code + +
+ +
+   + + + + + + +
test_pi(self) + source code + +
+ +
+   + + + + + + +
test_pi_parse(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_pi(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_elementtree_pi(self) + source code + +
+ +
+   + + + + + + +
test_deepcopy_elementtree_dtd(self) + source code + +
+ +
+   + + + + + + +
test_attribute_set(self) + source code + +
+ +
+   + + + + + + +
test_parse_remove_comments(self) + source code + +
+ +
+   + + + + + + +
test_parse_remove_pis(self) + source code + +
+ +
+   + + + + + + +
test_parse_parser_type_error(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tree_comments(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_comments(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_pis(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_remove_comments(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_broken(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_strip(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_tag_all(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_encoding_error(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_encoding_8bit_override(self) + source code + +
+ +
+   + + + + + + +
test_iterparse_keep_cdata(self) + source code + +
+ +
+   + + + + + + +
test_parser_encoding_unknown(self) + source code + +
+ +
+   + + + + + + +
test_parser_encoding(self) + source code + +
+ +
+   + + + + + + +
test_feed_parser_recover(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_parser_target_type_error(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_comment(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_pi(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_cdata(self) + source code + +
+ +
+   + + + + + + +
test_parser_target_recover(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_tag_all(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_start_end(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_clear(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_attrib_ns(self) + source code + +
+ +
+   + + + + + + +
test_iterwalk_getiterator(self) + source code + +
+ +
+   + + + + + + +
test_resolve_string_dtd(self) + source code + +
+ +
+   + + + + + + +
test_resolve_bytes_dtd(self) + source code + +
+ +
+   + + + + + + +
test_resolve_filelike_dtd(self) + source code + +
+ +
+   + + + + + + +
test_resolve_filename_dtd(self) + source code + +
+ +
+   + + + + + + +
test_resolve_filename_dtd_relative(self) + source code + +
+ +
+   + + + + + + +
test_resolve_file_dtd(self) + source code + +
+ +
+   + + + + + + +
test_resolve_empty(self) + source code + +
+ +
+   + + + + + + +
test_resolve_error(self) + source code + +
+ +
+   + + + + + + +
test_entity_parse(self) + source code + +
+ +
+   + + + + + + +
test_entity_restructure(self) + source code + +
+ +
+   + + + + + + +
test_entity_append(self) + source code + +
+ +
+   + + + + + + +
test_entity_values(self) + source code + +
+ +
+   + + + + + + +
test_entity_error(self) + source code + +
+ +
+   + + + + + + +
test_cdata(self) + source code + +
+ +
+   + + + + + + +
test_cdata_type(self) + source code + +
+ +
+   + + + + + + +
test_cdata_errors(self) + source code + +
+ +
+   + + + + + + +
test_cdata_parser(self) + source code + +
+ +
+   + + + + + + +
test_cdata_xpath(self) + source code + +
+ +
+   + + + + + + +
test_setitem_assert(self) + source code + +
+ +
+   + + + + + + +
test_append_None(self) + source code + +
+ +
+   + + + + + + +
test_addnext(self) + source code + +
+ +
+   + + + + + + +
test_addprevious(self) + source code + +
+ +
+   + + + + + + +
test_addnext_root(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_pi(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_root_pi(self) + source code + +
+ +
+   + + + + + + +
test_addnext_pi(self) + source code + +
+ +
+   + + + + + + +
test_addnext_root_pi(self) + source code + +
+ +
+   + + + + + + +
test_addnext_comment(self) + source code + +
+ +
+   + + + + + + +
test_addnext_root_comment(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_comment(self) + source code + +
+ +
+   + + + + + + +
test_addprevious_root_comment(self) + source code + +
+ +
+   + + + + + + +
test_attribute_values(self) + source code + +
+ +
+   + + + + + + +
test_comment_empty(self) + source code + +
+ +
+   + + + + + + +
test_comment_parse_empty(self) + source code + +
+ +
+   + + + + + + +
test_comment_no_proxy_yet(self) + source code + +
+ +
+   + + + + + + +
test_comment_immutable(self) + source code + +
+ +
+   + + + + + + +
test_dump_none(self) + source code + +
+ +
+   + + + + + + +
test_prefix(self) + source code + +
+ +
+   + + + + + + +
test_prefix_default_ns(self) + source code + +
+ +
+   + + + + + + +
test_getparent(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_reversed(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterchildren_tag_reversed(self) + source code + +
+ +
+   + + + + + + +
test_iterancestors(self) + source code + +
+ +
+   + + + + + + +
test_iterancestors_tag(self) + source code + +
+ +
+   + + + + + + +
test_iterdescendants(self) + source code + +
+ +
+   + + + + + + +
test_iterdescendants_tag(self) + source code + +
+ +
+   + + + + + + +
test_getroottree(self) + source code + +
+ +
+   + + + + + + +
test_getnext(self) + source code + +
+ +
+   + + + + + + +
test_getprevious(self) + source code + +
+ +
+   + + + + + + +
test_itersiblings(self) + source code + +
+ +
+   + + + + + + +
test_itersiblings_tag(self) + source code + +
+ +
+   + + + + + + +
test_parseid(self) + source code + +
+ +
+   + + + + + + +
test_XMLDTDID(self) + source code + +
+ +
+   + + + + + + +
test_XMLDTDID_empty(self) + source code + +
+ +
+   + + + + + + +
_checkIDDict(self, + dic, + expected) + source code + +
+ +
+   + + + + + + +
test_namespaces(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_default(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_default_and_attr(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_elementtree(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_default_copy_element(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_copy_element(self) + source code + +
+ +
+   + + + + + + +
test_namespaces_reuse_after_move(self) + source code + +
+ +
+   + + + + + + +
test_namespace_cleanup(self) + source code + +
+ +
+   + + + + + + +
test_element_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_subelement_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_namespace(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_entities(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_element(self) + source code + +
+ +
+   + + + + + + +
test_getiterator_filter_all_comment_pi(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_find_qname(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_findall_qname(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_findall_ns_qname(self) + source code + +
+ +
+   + + + + + + +
test_findall_ns(self) + source code + +
+ +
+   + + + + + + +
test_index(self) + source code + +
+ +
+   + + + + + + +
test_replace(self) + source code + +
+ +
+   + + + + + + +
test_replace_new(self) + source code + +
+ +
+   + + + + + + +
test_setslice_all_empty_reversed(self) + source code + +
+ +
+   + + + + + + +
test_setslice_step(self) + source code + +
+ +
+   + + + + + + +
test_setslice_step_negative(self) + source code + +
+ +
+   + + + + + + +
test_setslice_step_negative2(self) + source code + +
+ +
+   + + + + + + +
test_setslice_step_overrun(self) + source code + +
+ +
+   + + + + + + +
test_sourceline_XML(self) + source code + +
+ +
+   + + + + + + +
test_sourceline_parse(self) + source code + +
+ +
+   + + + + + + +
test_sourceline_iterparse_end(self) + source code + +
+ +
+   + + + + + + +
test_sourceline_iterparse_start(self) + source code + +
+ +
+   + + + + + + +
test_sourceline_element(self) + source code + +
+ +
+   + + + + + + +
test_XML_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_XML_set_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_parse_stringio_base_url(self) + source code + +
+ +
+   + + + + + + +
test_parse_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_HTML_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_docinfo_public(self) + source code + +
+ +
+   + + + + + + +
test_docinfo_system(self) + source code + +
+ +
+   + + + + + + +
test_docinfo_empty(self) + source code + +
+ +
+   + + + + + + +
test_docinfo_name_only(self) + source code + +
+ +
+   + + + + + + +
test_doctype_name_only_roundtrip(self) + source code + +
+ +
+   + + + + + + +
test_xml_base(self) + source code + +
+ +
+   + + + + + + +
test_xml_base_attribute(self) + source code + +
+ +
+   + + + + + + +
test_html_base(self) + source code + +
+ +
+   + + + + + + +
test_html_base_tag(self) + source code + +
+ +
+   + + + + + + +
test_parse_fileobject_unicode(self) + source code + +
+ +
+   + + + + + + +
test_dtd_io(self) + source code + +
+ +
+   + + + + + + +
test_byte_zero(self) + source code + +
+ +
+   + + + + + + +
test_unicode_byte_zero(self) + source code + +
+ +
+   + + + + + + +
test_byte_invalid(self) + source code + +
+ +
+   + + + + + + +
test_unicode_byte_invalid(self) + source code + +
+ +
+   + + + + + + +
test_encoding_tostring_utf16(self) + source code + +
+ +
+   + + + + + + +
test_tostring_none(self) + source code + +
+ +
+   + + + + + + +
test_tostring_pretty(self) + source code + +
+ +
+   + + + + + + +
test_tostring_with_tail(self) + source code + +
+ +
+   + + + + + + +
test_standalone(self) + source code + +
+ +
+   + + + + + + +
test_tostring_standalone(self) + source code + +
+ +
+   + + + + + + +
test_tostring_standalone_in_out(self) + source code + +
+ +
+   + + + + + + +
test_tostring_method_text_encoding(self) + source code + +
+ +
+   + + + + + + +
test_tostring_method_text_unicode(self) + source code + +
+ +
+   + + + + + + +
test_tounicode(self) + source code + +
+ +
+   + + + + + + +
test_tounicode_element(self) + source code + +
+ +
+   + + + + + + +
test_tounicode_none(self) + source code + +
+ +
+   + + + + + + +
test_tounicode_element_tail(self) + source code + +
+ +
+   + + + + + + +
test_tounicode_pretty(self) + source code + +
+ +
+   + + + + + + +
test_tostring_unicode(self) + source code + +
+ +
+   + + + + + + +
test_tostring_unicode_element(self) + source code + +
+ +
+   + + + + + + +
test_tostring_unicode_none(self) + source code + +
+ +
+   + + + + + + +
test_tostring_unicode_element_tail(self) + source code + +
+ +
+   + + + + + + +
test_tostring_unicode_pretty(self) + source code + +
+ +
+   + + + + + + +
_writeElement(self, + element, + encoding='us-ascii', + compression=0)
+ Write out element for comparison.
+ source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.ETreeWriteTestCase-class.html b/doc/html/api/lxml.tests.test_etree.ETreeWriteTestCase-class.html new file mode 100644 index 0000000..4a9ca13 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeWriteTestCase-class.html @@ -0,0 +1,387 @@ + + + + + lxml.tests.test_etree.ETreeWriteTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class ETreeWriteTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeWriteTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeWriteTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_write(self) + source code + +
+ +
+   + + + + + + +
test_write_gzip(self) + source code + +
+ +
+   + + + + + + +
test_write_gzip_level(self) + source code + +
+ +
+   + + + + + + +
test_write_file(self) + source code + +
+ +
+   + + + + + + +
test_write_file_gzip(self) + source code + +
+ +
+   + + + + + + +
test_write_file_gzip_parse(self) + source code + +
+ +
+   + + + + + + +
test_write_file_gzipfile_parse(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.ETreeXIncludeTestCase-class.html b/doc/html/api/lxml.tests.test_etree.ETreeXIncludeTestCase-class.html new file mode 100644 index 0000000..4307a07 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ETreeXIncludeTestCase-class.html @@ -0,0 +1,299 @@ + + + + + lxml.tests.test_etree.ETreeXIncludeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class ETreeXIncludeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXIncludeTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                 XIncludeTestCase --+
+                                    |
+                                   ETreeXIncludeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
include(self, + tree) + source code + +
+ +
+

Inherited from XIncludeTestCase: + test_xinclude, + test_xinclude_resolver, + test_xinclude_text +

+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.ElementIncludeTestCase-class.html b/doc/html/api/lxml.tests.test_etree.ElementIncludeTestCase-class.html new file mode 100644 index 0000000..911fbfe --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.ElementIncludeTestCase-class.html @@ -0,0 +1,299 @@ + + + + + lxml.tests.test_etree.ElementIncludeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class ElementIncludeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementIncludeTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                 XIncludeTestCase --+
+                                    |
+                                   ElementIncludeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
include(self, + tree) + source code + +
+ +
+

Inherited from XIncludeTestCase: + test_xinclude, + test_xinclude_resolver, + test_xinclude_text +

+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_etree.XIncludeTestCase-class.html b/doc/html/api/lxml.tests.test_etree.XIncludeTestCase-class.html new file mode 100644 index 0000000..8dc7401 --- /dev/null +++ b/doc/html/api/lxml.tests.test_etree.XIncludeTestCase-class.html @@ -0,0 +1,329 @@ + + + + + lxml.tests.test_etree.XIncludeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_etree :: + Class XIncludeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class XIncludeTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               XIncludeTestCase
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xinclude_text(self) + source code + +
+ +
+   + + + + + + +
test_xinclude(self) + source code + +
+ +
+   + + + + + + +
test_xinclude_resolver(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_htmlparser-module.html b/doc/html/api/lxml.tests.test_htmlparser-module.html new file mode 100644 index 0000000..e22bb65 --- /dev/null +++ b/doc/html/api/lxml.tests.test_htmlparser-module.html @@ -0,0 +1,239 @@ + + + + + lxml.tests.test_htmlparser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_htmlparser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_htmlparser

source code

+HTML parser test cases for etree + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + HtmlParserTestCase
+ HTML parser test cases +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_htmlparser-pysrc.html b/doc/html/api/lxml.tests.test_htmlparser-pysrc.html new file mode 100644 index 0000000..d855805 --- /dev/null +++ b/doc/html/api/lxml.tests.test_htmlparser-pysrc.html @@ -0,0 +1,1217 @@ + + + + + lxml.tests.test_htmlparser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_htmlparser + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_htmlparser

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  HTML parser test cases for etree 
+  5  """ 
+  6   
+  7  import unittest 
+  8  import tempfile, os, os.path, sys 
+  9   
+ 10  this_dir = os.path.dirname(__file__) 
+ 11  if this_dir not in sys.path: 
+ 12      sys.path.insert(0, this_dir) # needed for Py3 
+ 13   
+ 14  from common_imports import etree, StringIO, BytesIO, fileInTestDir, _bytes, _str 
+ 15  from common_imports import SillyFileLike, HelperTestCase 
+ 16   
+ 17  try: 
+ 18      unicode = __builtins__["unicode"] 
+ 19  except (NameError, KeyError): 
+ 20      unicode = str 
+ 21   
+
22 -class HtmlParserTestCase(HelperTestCase): +
23 """HTML parser test cases + 24 """ + 25 etree = etree + 26 + 27 html_str = _bytes("<html><head><title>test</title></head><body><h1>page title</h1></body></html>") + 28 html_str_pretty = _bytes("""\ + 29 <html> + 30 <head><title>test</title></head> + 31 <body><h1>page title</h1></body> + 32 </html> + 33 """) + 34 broken_html_str = _bytes("<html><head><title>test<body><h1>page title</h3></p></html>") + 35 uhtml_str = _str("<html><head><title>test á\uF8D2</title></head><body><h1>page á\uF8D2 title</h1></body></html>") + 36 +
37 - def tearDown(self): +
38 super(HtmlParserTestCase, self).tearDown() + 39 self.etree.set_default_parser() +
40 +
41 - def test_module_HTML(self): +
42 element = self.etree.HTML(self.html_str) + 43 self.assertEqual(self.etree.tostring(element, method="html"), + 44 self.html_str) +
45 +
46 - def test_module_HTML_unicode(self): +
47 element = self.etree.HTML(self.uhtml_str) + 48 self.assertEqual(unicode(self.etree.tostring(element, method="html", + 49 encoding='UTF8'), 'UTF8'), + 50 unicode(self.uhtml_str.encode('UTF8'), 'UTF8')) +
51 +
53 element = self.etree.HTML(self.html_str) + 54 self.assertEqual(self.etree.tostring(element, method="html", pretty_print=True), + 55 self.html_str_pretty) +
56 +
58 parser = self.etree.HTMLParser(recover=False) + 59 parse = self.etree.parse + 60 f = BytesIO("<html></body>") + 61 self.assertRaises(self.etree.XMLSyntaxError, + 62 parse, f, parser) +
63 +
65 parser = self.etree.HTMLParser() + 66 Element = parser.makeelement + 67 + 68 el = Element('name') + 69 self.assertRaises(ValueError, Element, '{}') + 70 self.assertRaises(ValueError, setattr, el, 'tag', '{}') + 71 + 72 self.assertRaises(ValueError, Element, '{test}') + 73 self.assertRaises(ValueError, setattr, el, 'tag', '{test}') +
74 +
76 parser = self.etree.HTMLParser() + 77 Element = parser.makeelement + 78 + 79 pname = Element('p:name') + 80 self.assertEquals(pname.tag, 'p:name') + 81 + 82 pname = Element('{test}p:name') + 83 self.assertEquals(pname.tag, '{test}p:name') + 84 + 85 pname = Element('name') + 86 pname.tag = 'p:name' + 87 self.assertEquals(pname.tag, 'p:name') +
88 +
90 parser = self.etree.HTMLParser() + 91 Element = parser.makeelement + 92 + 93 self.assertRaises(ValueError, Element, 'p"name') + 94 self.assertRaises(ValueError, Element, "na'me") + 95 self.assertRaises(ValueError, Element, '{test}"name') + 96 self.assertRaises(ValueError, Element, "{test}name'") + 97 + 98 el = Element('name') + 99 self.assertRaises(ValueError, setattr, el, 'tag', "pname'") +100 self.assertRaises(ValueError, setattr, el, 'tag', '"pname') +101 self.assertEquals(el.tag, "name") +
102 +
104 parser = self.etree.HTMLParser() +105 Element = parser.makeelement +106 +107 self.assertRaises(ValueError, Element, ' name ') +108 self.assertRaises(ValueError, Element, 'na me') +109 self.assertRaises(ValueError, Element, '{test} name') +110 +111 el = Element('name') +112 self.assertRaises(ValueError, setattr, el, 'tag', ' name ') +113 self.assertEquals(el.tag, "name") +
114 +
116 parser = self.etree.HTMLParser() +117 Element = parser.makeelement +118 +119 SubElement = self.etree.SubElement +120 +121 el = Element('name') +122 self.assertRaises(ValueError, SubElement, el, '{}') +123 self.assertRaises(ValueError, SubElement, el, '{test}') +
124 +
126 parser = self.etree.HTMLParser() +127 Element = parser.makeelement +128 SubElement = self.etree.SubElement +129 +130 el = Element('name') +131 pname = SubElement(el, 'p:name') +132 self.assertEquals(pname.tag, 'p:name') +133 +134 pname = SubElement(el, '{test}p:name') +135 self.assertEquals(pname.tag, '{test}p:name') +
136 +
138 parser = self.etree.HTMLParser() +139 Element = parser.makeelement +140 SubElement = self.etree.SubElement +141 +142 el = Element('name') +143 self.assertRaises(ValueError, SubElement, el, "name'") +144 self.assertRaises(ValueError, SubElement, el, 'na"me') +145 self.assertRaises(ValueError, SubElement, el, "{test}na'me") +146 self.assertRaises(ValueError, SubElement, el, '{test}"name') +
147 +
149 parser = self.etree.HTMLParser() +150 Element = parser.makeelement +151 SubElement = self.etree.SubElement +152 +153 el = Element('name') +154 self.assertRaises(ValueError, SubElement, el, ' name ') +155 self.assertRaises(ValueError, SubElement, el, 'na me') +156 self.assertRaises(ValueError, SubElement, el, '{test} name') +
157 +
159 parser = self.etree.HTMLParser(recover=False) +160 parse = self.etree.parse +161 f = BytesIO(self.broken_html_str) +162 self.assertRaises(self.etree.XMLSyntaxError, +163 parse, f, parser) +
164 +
166 text = _str('Søk på nettet') +167 html_latin1 = (_str('<p>%s</p>') % text).encode('iso-8859-1') +168 +169 tree = self.etree.parse( +170 BytesIO(html_latin1), +171 self.etree.HTMLParser(encoding="iso-8859-1")) +172 p = tree.find("//p") +173 self.assertEquals(p.text, text) +
174 +
176 text = _str('Søk på nettet') +177 wrong_head = _str(''' +178 <head> +179 <meta http-equiv="Content-Type" +180 content="text/html; charset=UTF-8" /> +181 </head>''') +182 html_latin1 = (_str('<html>%s<body><p>%s</p></body></html>') % (wrong_head, +183 text) +184 ).encode('iso-8859-1') +185 +186 self.assertRaises(self.etree.ParseError, +187 self.etree.parse, +188 BytesIO(html_latin1)) +189 +190 tree = self.etree.parse( +191 BytesIO(html_latin1), +192 self.etree.HTMLParser(encoding="iso-8859-1")) +193 p = tree.find("//p") +194 self.assertEquals(p.text, text) +
195 +
196 - def test_module_HTML_broken(self): +
197 element = self.etree.HTML(self.broken_html_str) +198 self.assertEqual(self.etree.tostring(element, method="html"), +199 self.html_str) +
200 +
201 - def test_module_HTML_cdata(self): +
202 # by default, libxml2 generates CDATA nodes for <script> content +203 html = _bytes('<html><head><style>foo</style></head></html>') +204 element = self.etree.HTML(html) +205 self.assertEquals(element[0][0].text, "foo") +
206 +
207 - def test_module_HTML_access(self): +
208 element = self.etree.HTML(self.html_str) +209 self.assertEqual(element[0][0].tag, 'title') +
210 +
211 - def test_module_parse_html(self): +
212 parser = self.etree.HTMLParser() +213 filename = tempfile.mktemp(suffix=".html") +214 open(filename, 'wb').write(self.html_str) +215 try: +216 f = open(filename, 'rb') +217 tree = self.etree.parse(f, parser) +218 f.close() +219 self.assertEqual(self.etree.tostring(tree.getroot(), method="html"), +220 self.html_str) +221 finally: +222 os.remove(filename) +
223 +
225 parser = self.etree.HTMLParser() +226 f = SillyFileLike(self.html_str) +227 tree = self.etree.parse(f, parser) +228 html = self.etree.tostring(tree.getroot(), +229 method="html", encoding='UTF-8') +230 self.assertEqual(html, self.html_str) +
231 +232 ## def test_module_parse_html_filelike_unicode(self): +233 ## parser = self.etree.HTMLParser() +234 ## f = SillyFileLike(self.uhtml_str) +235 ## tree = self.etree.parse(f, parser) +236 ## html = self.etree.tostring(tree.getroot(), encoding='UTF-8') +237 ## self.assertEqual(unicode(html, 'UTF-8'), self.uhtml_str) +238 +
239 - def test_html_file_error(self): +
240 parser = self.etree.HTMLParser() +241 parse = self.etree.parse +242 self.assertRaises(IOError, +243 parse, "__some_hopefully_nonexisting_file__.html", +244 parser) +
245 +
247 self.assertRaises(self.etree.XMLSyntaxError, +248 self.etree.parse, BytesIO(self.broken_html_str)) +249 +250 self.etree.set_default_parser( self.etree.HTMLParser() ) +251 +252 tree = self.etree.parse(BytesIO(self.broken_html_str)) +253 self.assertEqual(self.etree.tostring(tree.getroot(), method="html"), +254 self.html_str) +255 +256 self.etree.set_default_parser() +257 +258 self.assertRaises(self.etree.XMLSyntaxError, +259 self.etree.parse, BytesIO(self.broken_html_str)) +
260 +
261 - def test_html_iterparse(self): +
262 iterparse = self.etree.iterparse +263 f = BytesIO( +264 '<html><head><title>TITLE</title><body><p>P</p></body></html>') +265 +266 iterator = iterparse(f, html=True) +267 self.assertEquals(None, iterator.root) +268 +269 events = list(iterator) +270 root = iterator.root +271 self.assert_(root is not None) +272 self.assertEquals( +273 [('end', root[0][0]), ('end', root[0]), ('end', root[1][0]), +274 ('end', root[1]), ('end', root)], +275 events) +
276 +
277 - def test_html_iterparse_file(self): +
278 iterparse = self.etree.iterparse +279 iterator = iterparse(fileInTestDir("css_shakespear.html"), +280 html=True) +281 +282 self.assertEquals(None, iterator.root) +283 events = list(iterator) +284 root = iterator.root +285 self.assert_(root is not None) +286 self.assertEquals(249, len(events)) +287 self.assertEquals( +288 [], +289 [ event for (event, element) in events if event != 'end' ]) +
290 +
291 -def test_suite(): +
292 suite = unittest.TestSuite() +293 suite.addTests([unittest.makeSuite(HtmlParserTestCase)]) +294 return suite +
295 +296 if __name__ == '__main__': +297 print('to test use test.py %s' % __file__) +298 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_htmlparser.HtmlParserTestCase-class.html b/doc/html/api/lxml.tests.test_htmlparser.HtmlParserTestCase-class.html new file mode 100644 index 0000000..e1c8f0b --- /dev/null +++ b/doc/html/api/lxml.tests.test_htmlparser.HtmlParserTestCase-class.html @@ -0,0 +1,875 @@ + + + + + lxml.tests.test_htmlparser.HtmlParserTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_htmlparser :: + Class HtmlParserTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class HtmlParserTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               HtmlParserTestCase
+
+ +
+HTML parser test cases + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
test_module_HTML(self) + source code + +
+ +
+   + + + + + + +
test_module_HTML_unicode(self) + source code + +
+ +
+   + + + + + + +
test_module_HTML_pretty_print(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_html_error(self) + source code + +
+ +
+   + + + + + + +
test_html_element_name_empty(self) + source code + +
+ +
+   + + + + + + +
test_html_element_name_colon(self) + source code + +
+ +
+   + + + + + + +
test_html_element_name_quote(self) + source code + +
+ +
+   + + + + + + +
test_html_element_name_space(self) + source code + +
+ +
+   + + + + + + +
test_html_subelement_name_empty(self) + source code + +
+ +
+   + + + + + + +
test_html_subelement_name_colon(self) + source code + +
+ +
+   + + + + + + +
test_html_subelement_name_quote(self) + source code + +
+ +
+   + + + + + + +
test_html_subelement_name_space(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_html_norecover(self) + source code + +
+ +
+   + + + + + + +
test_parse_encoding_8bit_explicit(self) + source code + +
+ +
+   + + + + + + +
test_parse_encoding_8bit_override(self) + source code + +
+ +
+   + + + + + + +
test_module_HTML_broken(self) + source code + +
+ +
+   + + + + + + +
test_module_HTML_cdata(self) + source code + +
+ +
+   + + + + + + +
test_module_HTML_access(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_html(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_html_filelike(self) + source code + +
+ +
+   + + + + + + +
test_html_file_error(self) + source code + +
+ +
+   + + + + + + +
test_default_parser_HTML_broken(self) + source code + +
+ +
+   + + + + + + +
test_html_iterparse(self) + source code + +
+ +
+   + + + + + + +
test_html_iterparse_file(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+   + + html_str = '<html><head><title>test</title></head><body><h1>pa... +
+   + + html_str_pretty = '<html>\n<head><title>test</title></head>\n<... +
+   + + broken_html_str = '<html><head><title>test<body><h1>page title... +
+   + + uhtml_str = u'<html><head><title>test á\uF8D2</title></head><... +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+ +
+ +
+

html_str

+ +
+
+
+
Value:
+
+'<html><head><title>test</title></head><body><h1>page title</h1></body\
+></html>'
+
+
+
+
+
+ +
+ +
+

html_str_pretty

+ +
+
+
+
Value:
+
+'''<html>
+<head><title>test</title></head>
+<body><h1>page title</h1></body>
+</html>
+'''
+
+
+
+
+
+ +
+ +
+

broken_html_str

+ +
+
+
+
Value:
+
+'<html><head><title>test<body><h1>page title</h3></p></html>'
+
+
+
+
+
+ +
+ +
+

uhtml_str

+ +
+
+
+
Value:
+
+u'<html><head><title>test á\uF8D2</title></head><body><h1>page á\uF8\
+D2 title</h1></body></html>'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_io-module.html b/doc/html/api/lxml.tests.test_io-module.html new file mode 100644 index 0000000..a42560c --- /dev/null +++ b/doc/html/api/lxml.tests.test_io-module.html @@ -0,0 +1,253 @@ + + + + + lxml.tests.test_io + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_io + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_io

source code

+IO test cases that apply to both etree and ElementTree + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + IOTestCaseBase
+ (c)ElementTree compatibility for IO functions/methods +
+   + + ETreeIOTestCase +
+   + + ElementTreeIOTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_io-pysrc.html b/doc/html/api/lxml.tests.test_io-pysrc.html new file mode 100644 index 0000000..f6bbfcc --- /dev/null +++ b/doc/html/api/lxml.tests.test_io-pysrc.html @@ -0,0 +1,869 @@ + + + + + lxml.tests.test_io + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_io + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_io

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  IO test cases that apply to both etree and ElementTree 
+  5  """ 
+  6   
+  7  import unittest 
+  8  import tempfile, gzip, os, os.path, sys, gc, shutil 
+  9   
+ 10  this_dir = os.path.dirname(__file__) 
+ 11  if this_dir not in sys.path: 
+ 12      sys.path.insert(0, this_dir) # needed for Py3 
+ 13   
+ 14  from common_imports import etree, ElementTree, fileInTestDir, _str, _bytes 
+ 15  from common_imports import SillyFileLike, LargeFileLike, HelperTestCase 
+ 16   
+
17 -class IOTestCaseBase(HelperTestCase): +
18 """(c)ElementTree compatibility for IO functions/methods + 19 """ + 20 etree = None + 21 +
22 - def setUp(self): +
23 """Setting up a minimal tree + 24 """ + 25 self.root = self.etree.Element('a') + 26 self.root_str = self.etree.tostring(self.root) + 27 self.tree = self.etree.ElementTree(self.root) + 28 self._temp_dir = tempfile.mkdtemp() +
29 +
30 - def tearDown(self): +
31 gc.collect() + 32 shutil.rmtree(self._temp_dir) +
33 +
34 - def getTestFilePath(self, name): +
35 return os.path.join(self._temp_dir, name) +
36 +
37 - def buildNodes(self, element, children, depth): +
38 Element = self.etree.Element + 39 + 40 if depth == 0: + 41 return + 42 for i in range(children): + 43 new_element = Element('element_%s_%s' % (depth, i)) + 44 self.buildNodes(new_element, children, depth - 1) + 45 element.append(new_element) +
46 +
47 - def test_tree_io(self): +
48 Element = self.etree.Element + 49 ElementTree = self.etree.ElementTree + 50 + 51 element = Element('top') + 52 element.text = _str("qwrtioüöä\uAABB") + 53 tree = ElementTree(element) + 54 self.buildNodes(element, 10, 3) + 55 f = open(self.getTestFilePath('testdump.xml'), 'wb') + 56 tree.write(f, encoding='UTF-8') + 57 f.close() + 58 f = open(self.getTestFilePath('testdump.xml'), 'rb') + 59 tree = ElementTree(file=f) + 60 f.close() + 61 f = open(self.getTestFilePath('testdump2.xml'), 'wb') + 62 tree.write(f, encoding='UTF-8') + 63 f.close() + 64 f = open(self.getTestFilePath('testdump.xml'), 'rb') + 65 data1 = f.read() + 66 f.close() + 67 f = open(self.getTestFilePath('testdump2.xml'), 'rb') + 68 data2 = f.read() + 69 f.close() + 70 self.assertEquals(data1, data2) +
71 +
72 - def test_tree_io_latin1(self): +
73 Element = self.etree.Element + 74 ElementTree = self.etree.ElementTree + 75 + 76 element = Element('top') + 77 element.text = _str("qwrtioüöäßá") + 78 tree = ElementTree(element) + 79 self.buildNodes(element, 10, 3) + 80 f = open(self.getTestFilePath('testdump.xml'), 'wb') + 81 tree.write(f, encoding='iso-8859-1') + 82 f.close() + 83 f = open(self.getTestFilePath('testdump.xml'), 'rb') + 84 tree = ElementTree(file=f) + 85 f.close() + 86 f = open(self.getTestFilePath('testdump2.xml'), 'wb') + 87 tree.write(f, encoding='iso-8859-1') + 88 f.close() + 89 f = open(self.getTestFilePath('testdump.xml'), 'rb') + 90 data1 = f.read() + 91 f.close() + 92 f = open(self.getTestFilePath('testdump2.xml'), 'rb') + 93 data2 = f.read() + 94 f.close() + 95 self.assertEquals(data1, data2) +
96 +
97 - def test_write_filename(self): +
98 # (c)ElementTree supports filename strings as write argument + 99 +100 handle, filename = tempfile.mkstemp(suffix=".xml") +101 self.tree.write(filename) +102 try: +103 self.assertEqual(open(filename, 'rb').read().replace(_bytes('\n'), _bytes('')), +104 self.root_str) +105 finally: +106 os.close(handle) +107 os.remove(filename) +
108 +
110 filename = os.path.join( +111 os.path.join('hopefullynonexistingpathname'), +112 'invalid_file.xml') +113 try: +114 self.tree.write(filename) +115 except IOError: +116 pass +117 else: +118 self.assertTrue( +119 False, "writing to an invalid file path should fail") +
120 +
122 # (c)ElementTree supports gzip instance as parse argument +123 handle, filename = tempfile.mkstemp(suffix=".xml.gz") +124 f = gzip.open(filename, 'wb') +125 f.write(self.root_str) +126 f.close() +127 try: +128 f_gz = gzip.open(filename, 'rb') +129 tree = self.etree.parse(f_gz) +130 f_gz.close() +131 self.assertEqual(self.etree.tostring(tree.getroot()), self.root_str) +132 finally: +133 os.close(handle) +134 os.remove(filename) +
135 +
136 - def test_class_parse_filename(self): +
137 # (c)ElementTree class ElementTree has a 'parse' method that returns +138 # the root of the tree +139 +140 # parse from filename +141 +142 handle, filename = tempfile.mkstemp(suffix=".xml") +143 open(filename, 'wb').write(self.root_str) +144 try: +145 tree = self.etree.ElementTree() +146 root = tree.parse(filename) +147 self.assertEqual(self.etree.tostring(root), self.root_str) +148 finally: +149 os.close(handle) +150 os.remove(filename) +
151 +
153 handle, filename = tempfile.mkstemp(suffix=".xml") +154 open(filename, 'wb').write(self.root_str) +155 try: +156 tree = self.etree.ElementTree() +157 root = tree.parse(filename) +158 # and now do it again; previous content should still be there +159 root2 = tree.parse(filename) +160 self.assertEquals('a', root.tag) +161 self.assertEquals('a', root2.tag) +162 # now remove all references to root2, and parse again +163 del root2 +164 root3 = tree.parse(filename) +165 self.assertEquals('a', root.tag) +166 self.assertEquals('a', root3.tag) +167 # root2's memory should've been freed here +168 # XXX how to check? +169 finally: +170 os.close(handle) +171 os.remove(filename) +
172 +
174 # (c)ElementTree class ElementTree has a 'parse' method that returns +175 # the root of the tree +176 +177 # parse from file object +178 +179 handle, filename = tempfile.mkstemp(suffix=".xml") +180 os.write(handle, self.root_str) +181 try: +182 f = open(filename, 'rb') +183 tree = self.etree.ElementTree() +184 root = tree.parse(f) +185 f.close() +186 self.assertEqual(self.etree.tostring(root), self.root_str) +187 finally: +188 os.close(handle) +189 os.remove(filename) +
190 +
192 # (c)ElementTree class ElementTree has a 'parse' method that returns +193 # the root of the tree +194 +195 # parse from unamed file object +196 f = SillyFileLike() +197 root = self.etree.ElementTree().parse(f) +198 self.assert_(root.tag.endswith('foo')) +
199 +
201 # parse from unamed file object +202 f = LargeFileLike() +203 tree = self.etree.parse(f) +204 root = tree.getroot() +205 self.assert_(root.tag.endswith('root')) +
206 +
208 class LocalError(Exception): +209 pass +
210 class TestFile: +211 def read(*args): +212 raise LocalError +
213 f = TestFile() +214 self.assertRaises(LocalError, self.etree.parse, f) +215 +
217 class LocalError(Exception): +218 pass +
219 class TestFile: +220 data = '<root>test</' +221 try: +222 next_char = iter(data).next +223 except AttributeError: +224 # Python 3 +225 next_char = iter(data).__next__ +226 counter = 0 +227 def read(self, amount=None): +228 if amount is None: +229 while True: +230 self.read(1) +231 else: +232 try: +233 self.counter += 1 +234 return _bytes(self.next_char()) +235 except StopIteration: +236 raise LocalError +237 f = TestFile() +238 self.assertRaises(LocalError, self.etree.parse, f) +239 self.assertEquals(f.counter, len(f.data)+1) +240 +
242 class TestFile: +243 def read(*args): +244 return 1 +
245 f = TestFile() +246 self.assertRaises(TypeError, self.etree.parse, f) +247 +248 +
249 -class ETreeIOTestCase(IOTestCaseBase): +
250 etree = etree +
251 +252 if ElementTree: +
253 - class ElementTreeIOTestCase(IOTestCaseBase): +
255 +
256 -def test_suite(): +
257 suite = unittest.TestSuite() +258 suite.addTests([unittest.makeSuite(ETreeIOTestCase)]) +259 if ElementTree: +260 suite.addTests([unittest.makeSuite(ElementTreeIOTestCase)]) +261 return suite +
262 +263 if __name__ == '__main__': +264 print('to test use test.py %s' % __file__) +265 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_io.ETreeIOTestCase-class.html b/doc/html/api/lxml.tests.test_io.ETreeIOTestCase-class.html new file mode 100644 index 0000000..3d51074 --- /dev/null +++ b/doc/html/api/lxml.tests.test_io.ETreeIOTestCase-class.html @@ -0,0 +1,338 @@ + + + + + lxml.tests.test_io.ETreeIOTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_io :: + Class ETreeIOTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeIOTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                   IOTestCaseBase --+
+                                    |
+                                   ETreeIOTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from IOTestCaseBase: + buildNodes, + getTestFilePath, + setUp, + tearDown, + test_class_parse_filename, + test_class_parse_filename_remove_previous, + test_class_parse_fileobject, + test_class_parse_unamed_fileobject, + test_module_parse_fileobject_error, + test_module_parse_fileobject_late_error, + test_module_parse_fileobject_type_error, + test_module_parse_gzipobject, + test_module_parse_large_fileobject, + test_tree_io, + test_tree_io_latin1, + test_write_filename, + test_write_invalid_filename +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_io.ElementTreeIOTestCase-class.html b/doc/html/api/lxml.tests.test_io.ElementTreeIOTestCase-class.html new file mode 100644 index 0000000..1b1d7b5 --- /dev/null +++ b/doc/html/api/lxml.tests.test_io.ElementTreeIOTestCase-class.html @@ -0,0 +1,335 @@ + + + + + lxml.tests.test_io.ElementTreeIOTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_io :: + Class ElementTreeIOTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ElementTreeIOTestCase

source code

+
+               object --+            
+                        |            
+        unittest.TestCase --+        
+                            |        
+common_imports.HelperTestCase --+    
+                                |    
+                   IOTestCaseBase --+
+                                    |
+                                   ElementTreeIOTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from IOTestCaseBase: + buildNodes, + getTestFilePath, + setUp, + tearDown, + test_class_parse_filename, + test_class_parse_filename_remove_previous, + test_class_parse_fileobject, + test_class_parse_unamed_fileobject, + test_module_parse_fileobject_error, + test_module_parse_fileobject_late_error, + test_module_parse_fileobject_type_error, + test_module_parse_gzipobject, + test_module_parse_large_fileobject, + test_tree_io, + test_tree_io_latin1, + test_write_filename, + test_write_invalid_filename +

+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ +
+
+
+
Value:
+
elementtree.ElementTree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_io.IOTestCaseBase-class.html b/doc/html/api/lxml.tests.test_io.IOTestCaseBase-class.html new file mode 100644 index 0000000..75acf7b --- /dev/null +++ b/doc/html/api/lxml.tests.test_io.IOTestCaseBase-class.html @@ -0,0 +1,630 @@ + + + + + lxml.tests.test_io.IOTestCaseBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_io :: + Class IOTestCaseBase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class IOTestCaseBase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               IOTestCaseBase
+
+ +
Known Subclasses:
+
+ +
+ +
+(c)ElementTree compatibility for IO functions/methods + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Setting up a minimal tree
+ source code + +
+ +
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
getTestFilePath(self, + name) + source code + +
+ +
+   + + + + + + +
buildNodes(self, + element, + children, + depth) + source code + +
+ +
+   + + + + + + +
test_tree_io(self) + source code + +
+ +
+   + + + + + + +
test_tree_io_latin1(self) + source code + +
+ +
+   + + + + + + +
test_write_filename(self) + source code + +
+ +
+   + + + + + + +
test_write_invalid_filename(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_gzipobject(self) + source code + +
+ +
+   + + + + + + +
test_class_parse_filename(self) + source code + +
+ +
+   + + + + + + +
test_class_parse_filename_remove_previous(self) + source code + +
+ +
+   + + + + + + +
test_class_parse_fileobject(self) + source code + +
+ +
+   + + + + + + +
test_class_parse_unamed_fileobject(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_large_fileobject(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_fileobject_error(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_fileobject_late_error(self) + source code + +
+ +
+   + + + + + + +
test_module_parse_fileobject_type_error(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree = None +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

setUp(self) +

+
source code  +
+ + Setting up a minimal tree +
+
Overrides: + unittest.TestCase.setUp +
+
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_nsclasses-module.html b/doc/html/api/lxml.tests.test_nsclasses-module.html new file mode 100644 index 0000000..d139438 --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses-module.html @@ -0,0 +1,239 @@ + + + + + lxml.tests.test_nsclasses + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_nsclasses + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_nsclasses

source code

+Test cases related to namespace implementation classes and the +namespace registry mechanism + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeNamespaceClassesTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_nsclasses-pysrc.html b/doc/html/api/lxml.tests.test_nsclasses-pysrc.html new file mode 100644 index 0000000..4fe3159 --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses-pysrc.html @@ -0,0 +1,633 @@ + + + + + lxml.tests.test_nsclasses + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_nsclasses + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_nsclasses

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to namespace implementation classes and the 
+  5  namespace registry mechanism 
+  6  """ 
+  7   
+  8  import unittest, sys, os.path 
+  9   
+ 10  this_dir = os.path.dirname(__file__) 
+ 11  if this_dir not in sys.path: 
+ 12      sys.path.insert(0, this_dir) # needed for Py3 
+ 13   
+ 14  from common_imports import etree, HelperTestCase, _bytes 
+ 15  from common_imports import doctest, make_doctest 
+ 16   
+
17 -class ETreeNamespaceClassesTestCase(HelperTestCase): +
18 +
19 - class default_class(etree.ElementBase): +
20 pass +
21 - class maeh_class(etree.ElementBase): +
22 - def maeh(self): +
23 return 'maeh' +
24 - class bluff_class(etree.ElementBase): +
25 - def bluff(self): +
26 return 'bluff' +
27 +
28 - def setUp(self): +
35 +
36 - def tearDown(self): +
37 etree.set_default_parser() + 38 del self.Namespace + 39 super(ETreeNamespaceClassesTestCase, self).tearDown() +
40 +
41 - def test_registry(self): +
42 ns = self.Namespace('ns01') + 43 ns['maeh'] = self.maeh_class + 44 + 45 self.Namespace('ns01').clear() + 46 + 47 self.Namespace('ns02').update({'maeh' : self.maeh_class}) + 48 self.Namespace('ns03').update({'bluff' : self.bluff_class}.items()) + 49 self.Namespace('ns02').clear() + 50 self.Namespace('ns03').clear() +
51 +
52 - def test_ns_classes(self): +
53 bluff_dict = {'bluff' : self.bluff_class} + 54 maeh_dict = {'maeh' : self.maeh_class} + 55 + 56 self.Namespace('ns10').update(bluff_dict) + 57 + 58 tree = self.parse(_bytes('<bluff xmlns="ns10"><ns11:maeh xmlns:ns11="ns11"/></bluff>')) + 59 + 60 el = tree.getroot() + 61 self.assert_(isinstance(el, etree.ElementBase)) + 62 self.assert_(hasattr(el, 'bluff')) + 63 self.assertFalse(hasattr(el[0], 'maeh')) + 64 self.assertFalse(hasattr(el[0], 'bluff')) + 65 self.assertEquals(el.bluff(), 'bluff') + 66 del el + 67 + 68 self.Namespace('ns11').update(maeh_dict) + 69 el = tree.getroot() + 70 self.assert_(hasattr(el, 'bluff')) + 71 self.assert_(hasattr(el[0], 'maeh')) + 72 self.assertEquals(el.bluff(), 'bluff') + 73 self.assertEquals(el[0].maeh(), 'maeh') + 74 del el + 75 + 76 self.Namespace('ns10').clear() + 77 + 78 tree = self.parse(_bytes('<bluff xmlns="ns10"><ns11:maeh xmlns:ns11="ns11"/></bluff>')) + 79 el = tree.getroot() + 80 self.assertFalse(hasattr(el, 'bluff')) + 81 self.assertFalse(hasattr(el, 'maeh')) + 82 self.assertFalse(hasattr(el[0], 'bluff')) + 83 self.assert_(hasattr(el[0], 'maeh')) + 84 + 85 self.Namespace('ns11').clear() +
86 +
87 - def test_default_tagname(self): +
88 bluff_dict = { + 89 None : self.bluff_class, + 90 'maeh' : self.maeh_class + 91 } + 92 + 93 ns = self.Namespace("uri:nsDefClass") + 94 ns.update(bluff_dict) + 95 + 96 tree = self.parse(_bytes(''' + 97 <test xmlns="bla" xmlns:ns1="uri:nsDefClass" xmlns:ns2="uri:nsDefClass"> + 98 <ns2:el1/><ns1:el2/><ns1:maeh/><ns2:maeh/><maeh/> + 99 </test> +100 ''')) +101 +102 el = tree.getroot() +103 self.assertFalse(isinstance(el, etree.ElementBase)) +104 for child in el[:-1]: +105 self.assert_(isinstance(child, etree.ElementBase), child.tag) +106 self.assertFalse(isinstance(el[-1], etree.ElementBase)) +107 +108 self.assert_(hasattr(el[0], 'bluff')) +109 self.assert_(hasattr(el[1], 'bluff')) +110 self.assert_(hasattr(el[2], 'maeh')) +111 self.assert_(hasattr(el[3], 'maeh')) +112 self.assertFalse(hasattr(el[4], 'maeh')) +113 del el +114 +115 ns.clear() +
116 +
117 - def test_create_element(self): +
118 bluff_dict = {'bluff' : self.bluff_class} +119 self.Namespace('ns20').update(bluff_dict) +120 +121 maeh_dict = {'maeh' : self.maeh_class} +122 self.Namespace('ns21').update(maeh_dict) +123 +124 el = etree.Element("{ns20}bluff") +125 self.assert_(hasattr(el, 'bluff')) +126 +127 child = etree.SubElement(el, "{ns21}maeh") +128 self.assert_(hasattr(child, 'maeh')) +129 child = etree.SubElement(el, "{ns20}bluff") +130 self.assert_(hasattr(child, 'bluff')) +131 child = etree.SubElement(el, "{ns21}bluff") +132 self.assertFalse(hasattr(child, 'bluff')) +133 self.assertFalse(hasattr(child, 'maeh')) +134 +135 self.assert_(hasattr(el[0], 'maeh')) +136 self.assert_(hasattr(el[1], 'bluff')) +137 self.assertFalse(hasattr(el[2], 'bluff')) +138 self.assertFalse(hasattr(el[2], 'maeh')) +139 +140 self.assertEquals(el.bluff(), 'bluff') +141 self.assertEquals(el[0].maeh(), 'maeh') +142 self.assertEquals(el[1].bluff(), 'bluff') +143 +144 self.Namespace('ns20').clear() +145 self.Namespace('ns21').clear() +
146 +
148 bluff_dict = {None : self.bluff_class} +149 self.Namespace('ns30').update(bluff_dict) +150 +151 maeh_dict = {'maeh' : self.maeh_class} +152 self.Namespace(None).update(maeh_dict) +153 +154 el = etree.Element("{ns30}bluff") +155 etree.SubElement(el, "maeh") +156 self.assert_(hasattr(el, 'bluff')) +157 self.assert_(hasattr(el[0], 'maeh')) +158 self.assertEquals(el.bluff(), 'bluff') +159 self.assertEquals(el[0].maeh(), 'maeh') +160 +161 self.Namespace(None).clear() +162 self.Namespace('ns30').clear() +
163 +
164 - def test_element_creation(self): +
165 default, bluff, maeh = ( +166 self.default_class, self.bluff_class, self.maeh_class) +167 +168 class honk(etree.ElementBase): +169 TAG = 'HONK' +170 NAMESPACE = 'http://a.b/c' +
171 +172 el = default( +173 "test", +174 "text", +175 bluff(honk, "TaIL", maeh), +176 maeh("TeXT", bluff, honk(), "TAiL"), +177 "Tail") +178 +179 self.assertEquals('default_class', el.tag) +180 self.assertEquals('testtext', el.text) +181 self.assertEquals(None, el.tail) +182 self.assertEquals(2, len(el)) +183 self.assertEquals(7, len(list(el.iter()))) +184 +185 self.assertEquals('bluff_class', el[0].tag) +186 self.assertEquals('TaIL', el[0][0].tail) +187 self.assertEquals('TaIL', ''.join(el[0].itertext())) +188 self.assertEquals('{http://a.b/c}HONK', +189 el[0][0].tag) +190 self.assertEquals('maeh_class', +191 el[0][1].tag) +192 +193 self.assertEquals('maeh_class', el[1].tag) +194 self.assertEquals('TeXT', el[1].text) +195 self.assertEquals('bluff_class', el[1][0].tag) +196 self.assertEquals('{http://a.b/c}HONK', el[1][1].tag) +197 self.assertEquals('TAiL', el[1][1].tail) +198 +199 self.assertEquals('TeXTTAiL', +200 ''.join(el[1].itertext())) +201 self.assertEquals('Tail', el[1].tail) +202 self.assertEquals('TAiL', el[1][1].tail) +203 self.assertEquals('bluff_class', el[1][0].tag) +204 self.assertEquals('{http://a.b/c}HONK', el[1][1].tag) +
205 +206 +
207 -def test_suite(): +
208 suite = unittest.TestSuite() +209 suite.addTests([unittest.makeSuite(ETreeNamespaceClassesTestCase)]) +210 suite.addTests( +211 [make_doctest('../../../doc/element_classes.txt')]) +212 return suite +
213 +214 if __name__ == '__main__': +215 print('to test use test.py %s' % __file__) +216 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html new file mode 100644 index 0000000..5d34f8c --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase-class.html @@ -0,0 +1,489 @@ + + + + + lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_nsclasses :: + Class ETreeNamespaceClassesTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeNamespaceClassesTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeNamespaceClassesTestCase
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + default_class +
+   + + maeh_class +
+   + + bluff_class +
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
test_registry(self) + source code + +
+ +
+   + + + + + + +
test_ns_classes(self) + source code + +
+ +
+   + + + + + + +
test_default_tagname(self) + source code + +
+ +
+   + + + + + + +
test_create_element(self) + source code + +
+ +
+   + + + + + + +
test_create_element_default(self) + source code + +
+ +
+   + + + + + + +
test_element_creation(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

setUp(self) +

+
source code  +
+ + Hook method for setting up the test fixture before exercising it. +
+
Overrides: + unittest.TestCase.setUp +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html new file mode 100644 index 0000000..0929d1b --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class-class.html @@ -0,0 +1,262 @@ + + + + + lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_nsclasses :: + Class ETreeNamespaceClassesTestCase :: + Class bluff_class + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class bluff_class

source code

+
+    object --+        
+             |        
+etree._Element --+    
+                 |    
+ etree.ElementBase --+
+                     |
+                    ETreeNamespaceClassesTestCase.bluff_class
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
bluff(self) + source code + +
+ +
+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html new file mode 100644 index 0000000..7a11ea9 --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class-class.html @@ -0,0 +1,246 @@ + + + + + lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_nsclasses :: + Class ETreeNamespaceClassesTestCase :: + Class default_class + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class default_class

source code

+
+    object --+        
+             |        
+etree._Element --+    
+                 |    
+ etree.ElementBase --+
+                     |
+                    ETreeNamespaceClassesTestCase.default_class
+
+ +
+ + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html new file mode 100644 index 0000000..980c788 --- /dev/null +++ b/doc/html/api/lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class-class.html @@ -0,0 +1,262 @@ + + + + + lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_nsclasses :: + Class ETreeNamespaceClassesTestCase :: + Class maeh_class + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class maeh_class

source code

+
+    object --+        
+             |        
+etree._Element --+    
+                 |    
+ etree.ElementBase --+
+                     |
+                    ETreeNamespaceClassesTestCase.maeh_class
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
maeh(self) + source code + +
+ +
+

Inherited from etree.ElementBase: + __init__, + __new__ +

+

Inherited from etree._Element: + __contains__, + __copy__, + __deepcopy__, + __delitem__, + __getitem__, + __iter__, + __len__, + __nonzero__, + __repr__, + __reversed__, + __setitem__, + addnext, + addprevious, + append, + clear, + extend, + find, + findall, + findtext, + get, + getchildren, + getiterator, + getnext, + getparent, + getprevious, + getroottree, + index, + insert, + items, + iter, + iterancestors, + iterchildren, + iterdescendants, + iterfind, + itersiblings, + itertext, + keys, + makeelement, + remove, + replace, + set, + values, + xpath +

+

Inherited from etree._Element (private): + _init +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from etree._Element: + attrib, + base, + nsmap, + prefix, + sourceline, + tag, + tail, + text +

+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_objectify-module.html b/doc/html/api/lxml.tests.test_objectify-module.html new file mode 100644 index 0000000..393670c --- /dev/null +++ b/doc/html/api/lxml.tests.test_objectify-module.html @@ -0,0 +1,556 @@ + + + + + lxml.tests.test_objectify + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_objectify + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_objectify

source code

+Tests specific to the lxml.objectify API + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ObjectifyTestCase
+ Test cases for lxml.objectify +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + PYTYPE_NAMESPACE = 'http://codespeak.net/lxml/objectify/pytype' +
+   + + XML_SCHEMA_NS = 'http://www.w3.org/2001/XMLSchema' +
+   + + XML_SCHEMA_INSTANCE_NS = 'http://www.w3.org/2001/XMLSchema-ins... +
+   + + XML_SCHEMA_INSTANCE_TYPE_ATTR = '{http://www.w3.org/2001/XMLSc... +
+   + + XML_SCHEMA_NIL_ATTR = '{http://www.w3.org/2001/XMLSchema-insta... +
+   + + TREE_PYTYPE = 'TREE' +
+   + + DEFAULT_NSMAP = {'py': 'http://codespeak.net/lxml/objectify/py... +
+   + + objectclass2xsitype = {<type 'lxml.objectify.IntElement'>: ('i... +
+   + + xsitype2objclass = {'ENTITY': <type 'lxml.objectify.StringElem... +
+   + + objectclass2pytype = {<type 'lxml.objectify.IntElement'>: 'int... +
+   + + pytype2objclass = {'bool': <type 'lxml.objectify.BoolElement'>... +
+   + + xml_str = '<obj:root xmlns:obj="objectified" xmlns:other="othe... +
+   + + v = 'NMTOKEN' +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+ +
+ +
+

XML_SCHEMA_INSTANCE_NS

+ +
+
+
+
Value:
+
+'http://www.w3.org/2001/XMLSchema-instance'
+
+
+
+
+
+ +
+ +
+

XML_SCHEMA_INSTANCE_TYPE_ATTR

+ +
+
+
+
Value:
+
+'{http://www.w3.org/2001/XMLSchema-instance}type'
+
+
+
+
+
+ +
+ +
+

XML_SCHEMA_NIL_ATTR

+ +
+
+
+
Value:
+
+'{http://www.w3.org/2001/XMLSchema-instance}nil'
+
+
+
+
+
+ +
+ +
+

DEFAULT_NSMAP

+ +
+
+
+
Value:
+
+{'py': 'http://codespeak.net/lxml/objectify/pytype',
+ 'xsd': 'http://www.w3.org/2001/XMLSchema',
+ 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
+
+
+
+
+
+ +
+ +
+

objectclass2xsitype

+ +
+
+
+
Value:
+
+{<type 'lxml.objectify.IntElement'>: ('int',
+                                      'short',
+                                      'byte',
+                                      'unsignedShort',
+                                      'unsignedByte',
+                                      'integer',
+                                      'nonPositiveInteger',
+                                      'negativeInteger',
+...
+
+
+
+
+
+ +
+ +
+

xsitype2objclass

+ +
+
+
+
Value:
+
+{'ENTITY': <type 'lxml.objectify.StringElement'>,
+ 'ID': <type 'lxml.objectify.StringElement'>,
+ 'IDREF': <type 'lxml.objectify.StringElement'>,
+ 'NCName': <type 'lxml.objectify.StringElement'>,
+ 'NMTOKEN': <type 'lxml.objectify.StringElement'>,
+ 'Name': <type 'lxml.objectify.StringElement'>,
+ 'boolean': <type 'lxml.objectify.BoolElement'>,
+ 'byte': <type 'lxml.objectify.IntElement'>,
+...
+
+
+
+
+
+ +
+ +
+

objectclass2pytype

+ +
+
+
+
Value:
+
+{<type 'lxml.objectify.IntElement'>: 'int',
+ <type 'lxml.objectify.FloatElement'>: 'float',
+ <type 'lxml.objectify.StringElement'>: 'str',
+ <type 'lxml.objectify.BoolElement'>: 'bool'}
+
+
+
+
+
+ +
+ +
+

pytype2objclass

+ +
+
+
+
Value:
+
+{'bool': <type 'lxml.objectify.BoolElement'>,
+ 'float': <type 'lxml.objectify.FloatElement'>,
+ 'int': <type 'lxml.objectify.IntElement'>,
+ 'str': <type 'lxml.objectify.StringElement'>}
+
+
+
+
+
+ +
+ +
+

xml_str

+ +
+
+
+
Value:
+
+'''<obj:root xmlns:obj="objectified" xmlns:other="otherNS">
+  <obj:c1 a1="A1" a2="A2" other:a3="A3">
+    <obj:c2>0</obj:c2>
+    <obj:c2>1</obj:c2>
+    <obj:c2>2</obj:c2>
+    <other:c2>3</other:c2>
+    <c2>3</c2>
+  </obj:c1>
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_objectify-pysrc.html b/doc/html/api/lxml.tests.test_objectify-pysrc.html new file mode 100644 index 0000000..c3d038f --- /dev/null +++ b/doc/html/api/lxml.tests.test_objectify-pysrc.html @@ -0,0 +1,6321 @@ + + + + + lxml.tests.test_objectify + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_objectify + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_objectify

+
+   1  # -*- coding: utf-8 -*- 
+   2   
+   3  """ 
+   4  Tests specific to the lxml.objectify API 
+   5  """ 
+   6   
+   7   
+   8  import unittest, operator, sys, os.path 
+   9   
+  10  this_dir = os.path.dirname(__file__) 
+  11  if this_dir not in sys.path: 
+  12      sys.path.insert(0, this_dir) # needed for Py3 
+  13   
+  14  from common_imports import etree, HelperTestCase, fileInTestDir 
+  15  from common_imports import SillyFileLike, canonicalize, doctest, make_doctest 
+  16  from common_imports import _bytes, _str, StringIO, BytesIO 
+  17   
+  18  from lxml import objectify 
+  19   
+  20  PYTYPE_NAMESPACE = "http://codespeak.net/lxml/objectify/pytype" 
+  21  XML_SCHEMA_NS = "http://www.w3.org/2001/XMLSchema" 
+  22  XML_SCHEMA_INSTANCE_NS = "http://www.w3.org/2001/XMLSchema-instance" 
+  23  XML_SCHEMA_INSTANCE_TYPE_ATTR = "{%s}type" % XML_SCHEMA_INSTANCE_NS 
+  24  XML_SCHEMA_NIL_ATTR = "{%s}nil" % XML_SCHEMA_INSTANCE_NS 
+  25  TREE_PYTYPE = "TREE" 
+  26  DEFAULT_NSMAP = { "py"  : PYTYPE_NAMESPACE, 
+  27                    "xsi" : XML_SCHEMA_INSTANCE_NS, 
+  28                    "xsd" : XML_SCHEMA_NS} 
+  29   
+  30  objectclass2xsitype = { 
+  31      # objectify built-in 
+  32      objectify.IntElement: ("int", "short", "byte", "unsignedShort", 
+  33                             "unsignedByte", "integer", "nonPositiveInteger", 
+  34                             "negativeInteger", "long", "nonNegativeInteger", 
+  35                             "unsignedLong", "unsignedInt", "positiveInteger",), 
+  36      objectify.FloatElement: ("float", "double"), 
+  37      objectify.BoolElement: ("boolean",), 
+  38      objectify.StringElement: ("string", "normalizedString", "token", "language", 
+  39                                "Name", "NCName", "ID", "IDREF", "ENTITY", 
+  40                                "NMTOKEN", ), 
+  41      # None: xsi:nil="true" 
+  42      } 
+  43   
+  44  xsitype2objclass = dict([ (v, k) for k in objectclass2xsitype 
+  45                            for v in objectclass2xsitype[k] ]) 
+  46   
+  47  objectclass2pytype = { 
+  48      # objectify built-in 
+  49      objectify.IntElement: "int", 
+  50      objectify.FloatElement: "float", 
+  51      objectify.BoolElement: "bool", 
+  52      objectify.StringElement: "str", 
+  53      # None: xsi:nil="true" 
+  54      } 
+  55   
+  56  pytype2objclass = dict([ (objectclass2pytype[k], k) 
+  57                           for k in objectclass2pytype]) 
+  58   
+  59  xml_str = '''\ 
+  60  <obj:root xmlns:obj="objectified" xmlns:other="otherNS"> 
+  61    <obj:c1 a1="A1" a2="A2" other:a3="A3"> 
+  62      <obj:c2>0</obj:c2> 
+  63      <obj:c2>1</obj:c2> 
+  64      <obj:c2>2</obj:c2> 
+  65      <other:c2>3</other:c2> 
+  66      <c2>3</c2> 
+  67    </obj:c1> 
+  68  </obj:root>''' 
+  69   
+
70 -class ObjectifyTestCase(HelperTestCase): +
71 """Test cases for lxml.objectify + 72 """ + 73 etree = etree + 74 +
75 - def XML(self, xml): +
76 return self.etree.XML(xml, self.parser) +
77 +
78 - def setUp(self): +
79 super(ObjectifyTestCase, self).setUp() + 80 self.parser = self.etree.XMLParser(remove_blank_text=True) + 81 self.lookup = etree.ElementNamespaceClassLookup( + 82 objectify.ObjectifyElementClassLookup() ) + 83 self.parser.set_element_class_lookup(self.lookup) + 84 + 85 self.Element = self.parser.makeelement + 86 + 87 ns = self.lookup.get_namespace("otherNS") + 88 ns[None] = self.etree.ElementBase + 89 + 90 self._orig_types = objectify.getRegisteredTypes() +
91 +
92 - def tearDown(self): +
93 self.lookup.get_namespace("otherNS").clear() + 94 objectify.set_pytype_attribute_tag() + 95 del self.lookup + 96 del self.parser + 97 + 98 for pytype in objectify.getRegisteredTypes(): + 99 pytype.unregister() + 100 for pytype in self._orig_types: + 101 pytype.register() + 102 del self._orig_types + 103 + 104 super(ObjectifyTestCase, self).tearDown() +
105 + 106 +
107 - def test_element_nsmap_default(self): +
108 elt = objectify.Element("test") + 109 self.assertEquals(elt.nsmap, DEFAULT_NSMAP) +
110 +
111 - def test_element_nsmap_empty(self): +
112 nsmap = {} + 113 elt = objectify.Element("test", nsmap=nsmap) + 114 self.assertEquals(list(elt.nsmap.values()), [PYTYPE_NAMESPACE]) +
115 +
117 nsmap = {"mypy": PYTYPE_NAMESPACE, + 118 "myxsi": XML_SCHEMA_INSTANCE_NS, + 119 "myxsd": XML_SCHEMA_NS} + 120 elt = objectify.Element("test", nsmap=nsmap) + 121 self.assertEquals(elt.nsmap, nsmap) +
122 +
123 - def test_element_nsmap_custom(self): +
124 nsmap = {"my": "someNS", + 125 "myother": "someOtherNS", + 126 "myxsd": XML_SCHEMA_NS} + 127 elt = objectify.Element("test", nsmap=nsmap) + 128 self.assert_(PYTYPE_NAMESPACE in elt.nsmap.values()) + 129 for prefix, ns in nsmap.items(): + 130 self.assert_(prefix in elt.nsmap) + 131 self.assertEquals(nsmap[prefix], elt.nsmap[prefix]) +
132 +
134 root = objectify.Element("root") + 135 root.sub = objectify.Element("test") + 136 self.assertEquals(root.sub.nsmap, DEFAULT_NSMAP) +
137 +
139 root = objectify.Element("root") + 140 nsmap = {} + 141 root.sub = objectify.Element("test", nsmap=nsmap) + 142 self.assertEquals(root.sub.nsmap, DEFAULT_NSMAP) +
143 +
145 root = objectify.Element("root") + 146 nsmap = {"mypy": PYTYPE_NAMESPACE, + 147 "myxsi": XML_SCHEMA_INSTANCE_NS, + 148 "myxsd": XML_SCHEMA_NS} + 149 root.sub = objectify.Element("test", nsmap=nsmap) + 150 self.assertEquals(root.sub.nsmap, DEFAULT_NSMAP) +
151 +
153 root = objectify.Element("root") + 154 nsmap = {"my": "someNS", + 155 "myother": "someOtherNS", + 156 "myxsd": XML_SCHEMA_NS,} + 157 root.sub = objectify.Element("test", nsmap=nsmap) + 158 expected = nsmap.copy() + 159 del expected["myxsd"] + 160 expected.update(DEFAULT_NSMAP) + 161 self.assertEquals(root.sub.nsmap, expected) +
162 +
164 value = objectify.DataElement("test this") + 165 self.assertEquals(value.nsmap, DEFAULT_NSMAP) +
166 +
168 nsmap = {} + 169 value = objectify.DataElement("test this", nsmap=nsmap) + 170 self.assertEquals(list(value.nsmap.values()), [PYTYPE_NAMESPACE]) +
171 +
173 nsmap = {"mypy": PYTYPE_NAMESPACE, + 174 "myxsi": XML_SCHEMA_INSTANCE_NS, + 175 "myxsd": XML_SCHEMA_NS} + 176 value = objectify.DataElement("test this", nsmap=nsmap) + 177 self.assertEquals(value.nsmap, nsmap) +
178 +
180 nsmap = {"my": "someNS", + 181 "myother": "someOtherNS", + 182 "myxsd": XML_SCHEMA_NS,} + 183 value = objectify.DataElement("test", nsmap=nsmap) + 184 self.assert_(PYTYPE_NAMESPACE in value.nsmap.values()) + 185 for prefix, ns in nsmap.items(): + 186 self.assert_(prefix in value.nsmap) + 187 self.assertEquals(nsmap[prefix], value.nsmap[prefix]) +
188 +
190 root = objectify.Element("root") + 191 root.value = objectify.DataElement("test this") + 192 self.assertEquals(root.value.nsmap, DEFAULT_NSMAP) +
193 +
195 root = objectify.Element("root") + 196 nsmap = {} + 197 root.value = objectify.DataElement("test this", nsmap=nsmap) + 198 self.assertEquals(root.value.nsmap, DEFAULT_NSMAP) +
199 +
201 root = objectify.Element("root") + 202 nsmap = {"mypy": PYTYPE_NAMESPACE, + 203 "myxsi": XML_SCHEMA_INSTANCE_NS, + 204 "myxsd": XML_SCHEMA_NS} + 205 root.value = objectify.DataElement("test this", nsmap=nsmap) + 206 self.assertEquals(root.value.nsmap, DEFAULT_NSMAP) +
207 +
209 root = objectify.Element("root") + 210 nsmap = {"my": "someNS", + 211 "myother": "someOtherNS", + 212 "myxsd": XML_SCHEMA_NS} + 213 root.value = objectify.DataElement("test", nsmap=nsmap) + 214 expected = nsmap.copy() + 215 del expected["myxsd"] + 216 expected.update(DEFAULT_NSMAP) + 217 self.assertEquals(root.value.nsmap, expected) +
218 +
220 # keyword arguments override attrib entries + 221 value = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 222 attrib={"gnu": "muh", "cat": "meeow", + 223 "dog": "wuff"}, + 224 bird="tchilp", dog="grrr") + 225 self.assertEquals(value.get("gnu"), "muh") + 226 self.assertEquals(value.get("cat"), "meeow") + 227 self.assertEquals(value.get("dog"), "grrr") + 228 self.assertEquals(value.get("bird"), "tchilp") +
229 +
231 # Check that DataElement preserves all attributes ObjectifiedDataElement + 232 # arguments + 233 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 234 attrib={"gnu": "muh", "cat": "meeow", + 235 "dog": "wuff"}, + 236 bird="tchilp", dog="grrr") + 237 value = objectify.DataElement(arg) + 238 self.assert_(isinstance(value, objectify.StringElement)) + 239 for attr in arg.attrib: + 240 self.assertEquals(value.get(attr), arg.get(attr)) +
241 +
243 # Check that _pytype arg overrides original py:pytype of + 244 # ObjectifiedDataElement + 245 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 246 attrib={"gnu": "muh", "cat": "meeow", + 247 "dog": "wuff"}, + 248 bird="tchilp", dog="grrr") + 249 value = objectify.DataElement(arg, _pytype="NoneType") + 250 self.assert_(isinstance(value, objectify.NoneElement)) + 251 self.assertEquals(value.get(XML_SCHEMA_NIL_ATTR), "true") + 252 self.assertEquals(value.text, None) + 253 self.assertEquals(value.pyval, None) + 254 for attr in arg.attrib: + 255 #if not attr == objectify.PYTYPE_ATTRIBUTE: + 256 self.assertEquals(value.get(attr), arg.get(attr)) +
257 +
259 # Check that _pytype arg overrides original py:pytype of + 260 # ObjectifiedDataElement + 261 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 262 attrib={"gnu": "muh", "cat": "meeow", + 263 "dog": "wuff"}, + 264 bird="tchilp", dog="grrr") + 265 value = objectify.DataElement(arg, _pytype="int") + 266 self.assert_(isinstance(value, objectify.IntElement)) + 267 self.assertEquals(value.get(objectify.PYTYPE_ATTRIBUTE), "int") + 268 for attr in arg.attrib: + 269 if not attr == objectify.PYTYPE_ATTRIBUTE: + 270 self.assertEquals(value.get(attr), arg.get(attr)) +
271 +
273 # Check that _xsi arg overrides original xsi:type of given + 274 # ObjectifiedDataElement + 275 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 276 attrib={"gnu": "muh", "cat": "meeow", + 277 "dog": "wuff"}, + 278 bird="tchilp", dog="grrr") + 279 value = objectify.DataElement(arg, _xsi="xsd:int") + 280 self.assert_(isinstance(value, objectify.IntElement)) + 281 self.assertEquals(value.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), "xsd:int") + 282 self.assertEquals(value.get(objectify.PYTYPE_ATTRIBUTE), "int") + 283 for attr in arg.attrib: + 284 if not attr in [objectify.PYTYPE_ATTRIBUTE, + 285 XML_SCHEMA_INSTANCE_TYPE_ATTR]: + 286 self.assertEquals(value.get(attr), arg.get(attr)) +
287 +
289 # Check that _pytype and _xsi args override original py:pytype and + 290 # xsi:type attributes of given ObjectifiedDataElement + 291 arg = objectify.DataElement(23, _pytype="str", _xsi="foobar", + 292 attrib={"gnu": "muh", "cat": "meeow", + 293 "dog": "wuff"}, + 294 bird="tchilp", dog="grrr") + 295 value = objectify.DataElement(arg, _pytype="int", _xsi="xsd:int") + 296 self.assert_(isinstance(value, objectify.IntElement)) + 297 self.assertEquals(value.get(objectify.PYTYPE_ATTRIBUTE), "int") + 298 self.assertEquals(value.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), "xsd:int") + 299 for attr in arg.attrib: + 300 if not attr in [objectify.PYTYPE_ATTRIBUTE, + 301 XML_SCHEMA_INSTANCE_TYPE_ATTR]: + 302 self.assertEquals(value.get(attr), arg.get(attr)) +
303 +
305 self.assertRaises(ValueError, objectify.DataElement, 3.1415, + 306 _pytype="int") +
307 +
309 self.assertRaises(ValueError, objectify.DataElement, 3.1415, + 310 _xsi="xsd:int") +
311 +
313 arg = objectify.DataElement(3.1415) + 314 self.assertRaises(ValueError, objectify.DataElement, arg, + 315 _pytype="int") +
316 +
318 arg = objectify.DataElement(3.1415) + 319 self.assertRaises(ValueError, objectify.DataElement, arg, + 320 _xsi="xsd:int") +
321 +
322 - def test_root(self): +
323 root = self.Element("test") + 324 self.assert_(isinstance(root, objectify.ObjectifiedElement)) +
325 +
326 - def test_str(self): +
327 root = self.Element("test") + 328 self.assertEquals('', str(root)) +
329 +
330 - def test_child(self): +
331 root = self.XML(xml_str) + 332 self.assertEquals("0", root.c1.c2.text) +
333 +
334 - def test_countchildren(self): +
335 root = self.XML(xml_str) + 336 self.assertEquals(1, root.countchildren()) + 337 self.assertEquals(5, root.c1.countchildren()) +
338 +
339 - def test_child_getattr(self): +
340 root = self.XML(xml_str) + 341 self.assertEquals("0", getattr(root.c1, "{objectified}c2").text) + 342 self.assertEquals("3", getattr(root.c1, "{otherNS}c2").text) +
343 +
344 - def test_child_nonexistant(self): +
345 root = self.XML(xml_str) + 346 self.assertRaises(AttributeError, getattr, root.c1, "NOT_THERE") + 347 self.assertRaises(AttributeError, getattr, root.c1, "{unknownNS}c2") +
348 +
349 - def test_setattr(self): +
350 for val in [ + 351 2, 2**32, 1.2, "Won't get fooled again", + 352 _str("W\xf6n't get f\xf6\xf6led \xe4g\xe4in", 'ISO-8859-1'), True, + 353 False, None]: + 354 root = self.Element('root') + 355 attrname = 'val' + 356 setattr(root, attrname, val) + 357 result = getattr(root, attrname) + 358 self.assertEquals(val, result) + 359 self.assertEquals(type(val), type(result.pyval)) +
360 +
361 - def test_setattr_nonunicode(self): +
362 root = self.Element('root') + 363 attrname = 'val' + 364 val = _bytes("W\xf6n't get f\xf6\xf6led \xe4g\xe4in", 'ISO-8859-1') + 365 self.assertRaises(ValueError, setattr, root, attrname, val) + 366 self.assertRaises(AttributeError, getattr, root, attrname) +
367 +
368 - def test_addattr(self): +
369 root = self.XML(xml_str) + 370 self.assertEquals(1, len(root.c1)) + 371 root.addattr("c1", "test") + 372 self.assertEquals(2, len(root.c1)) + 373 self.assertEquals("test", root.c1[1].text) +
374 +
375 - def test_addattr_element(self): +
376 root = self.XML(xml_str) + 377 self.assertEquals(1, len(root.c1)) + 378 + 379 new_el = self.Element("test", myattr="5") + 380 root.addattr("c1", new_el) + 381 self.assertEquals(2, len(root.c1)) + 382 self.assertEquals(None, root.c1[0].get("myattr")) + 383 self.assertEquals("5", root.c1[1].get("myattr")) +
384 +
385 - def test_addattr_list(self): +
386 root = self.XML(xml_str) + 387 self.assertEquals(1, len(root.c1)) + 388 + 389 new_el = self.Element("test") + 390 self.etree.SubElement(new_el, "a", myattr="A") + 391 self.etree.SubElement(new_el, "a", myattr="B") + 392 + 393 root.addattr("c1", list(new_el.a)) + 394 self.assertEquals(3, len(root.c1)) + 395 self.assertEquals(None, root.c1[0].get("myattr")) + 396 self.assertEquals("A", root.c1[1].get("myattr")) + 397 self.assertEquals("B", root.c1[2].get("myattr")) +
398 +
399 - def test_child_addattr(self): +
400 root = self.XML(xml_str) + 401 self.assertEquals(3, len(root.c1.c2)) + 402 root.c1.addattr("c2", 3) + 403 self.assertEquals(4, len(root.c1.c2)) + 404 self.assertEquals("3", root.c1.c2[3].text) +
405 +
406 - def test_child_index(self): +
407 root = self.XML(xml_str) + 408 self.assertEquals("0", root.c1.c2[0].text) + 409 self.assertEquals("1", root.c1.c2[1].text) + 410 self.assertEquals("2", root.c1.c2[2].text) + 411 self.assertRaises(IndexError, operator.getitem, root.c1.c2, 3) +
412 +
413 - def test_child_index_neg(self): +
414 root = self.XML(xml_str) + 415 self.assertEquals("0", root.c1.c2[0].text) + 416 self.assertEquals("0", root.c1.c2[-3].text) + 417 self.assertEquals("1", root.c1.c2[-2].text) + 418 self.assertEquals("2", root.c1.c2[-1].text) + 419 self.assertRaises(IndexError, operator.getitem, root.c1.c2, -4) +
420 +
421 - def test_child_len(self): +
422 root = self.XML(xml_str) + 423 self.assertEquals(1, len(root)) + 424 self.assertEquals(1, len(root.c1)) + 425 self.assertEquals(3, len(root.c1.c2)) +
426 +
427 - def test_child_iter(self): +
428 root = self.XML(xml_str) + 429 self.assertEquals([root], + 430 list(iter(root))) + 431 self.assertEquals([root.c1], + 432 list(iter(root.c1))) + 433 self.assertEquals([root.c1.c2[0], root.c1.c2[1], root.c1.c2[2]], + 434 list(iter((root.c1.c2)))) +
435 +
436 - def test_class_lookup(self): +
437 root = self.XML(xml_str) + 438 self.assert_(isinstance(root.c1.c2, objectify.ObjectifiedElement)) + 439 self.assertFalse(isinstance(getattr(root.c1, "{otherNS}c2"), + 440 objectify.ObjectifiedElement)) +
441 +
442 - def test_dir(self): +
443 root = self.XML(xml_str) + 444 dir_c1 = dir(objectify.ObjectifiedElement) + ['c1'] + 445 dir_c1.sort() + 446 dir_c2 = dir(objectify.ObjectifiedElement) + ['c2'] + 447 dir_c2.sort() + 448 + 449 self.assertEquals(dir_c1, dir(root)) + 450 self.assertEquals(dir_c2, dir(root.c1)) +
451 +
452 - def test_vars(self): +
453 root = self.XML(xml_str) + 454 self.assertEquals({'c1' : root.c1}, vars(root)) + 455 self.assertEquals({'c2' : root.c1.c2}, vars(root.c1)) +
456 +
457 - def test_child_set_ro(self): +
458 root = self.XML(xml_str) + 459 self.assertRaises(TypeError, setattr, root.c1.c2, 'text', "test") + 460 self.assertRaises(TypeError, setattr, root.c1.c2, 'pyval', "test") +
461 + 462 # slicing + 463 +
464 - def test_getslice_complete(self): +
465 root = self.XML("<root><c>c1</c><c>c2</c></root>") + 466 self.assertEquals(["c1", "c2"], + 467 [ c.text for c in root.c[:] ]) +
468 +
469 - def test_getslice_partial(self): +
470 root = self.XML("<root><c>c1</c><c>c2</c><c>c3</c><c>c4</c></root>") + 471 test_list = ["c1", "c2", "c3", "c4"] + 472 + 473 self.assertEquals(test_list, + 474 [ c.text for c in root.c[:] ]) + 475 self.assertEquals(test_list[1:2], + 476 [ c.text for c in root.c[1:2] ]) + 477 self.assertEquals(test_list[-3:-1], + 478 [ c.text for c in root.c[-3:-1] ]) + 479 self.assertEquals(test_list[-3:3], + 480 [ c.text for c in root.c[-3:3] ]) + 481 self.assertEquals(test_list[-3000:3], + 482 [ c.text for c in root.c[-3000:3] ]) + 483 self.assertEquals(test_list[-3:3000], + 484 [ c.text for c in root.c[-3:3000] ]) +
485 +
486 - def test_getslice_partial_neg(self): +
487 root = self.XML("<root><c>c1</c><c>c2</c><c>c3</c><c>c4</c></root>") + 488 test_list = ["c1", "c2", "c3", "c4"] + 489 + 490 self.assertEquals(test_list, + 491 [ c.text for c in root.c[:] ]) + 492 self.assertEquals(test_list[2:1:-1], + 493 [ c.text for c in root.c[2:1:-1] ]) + 494 self.assertEquals(test_list[-1:-3:-1], + 495 [ c.text for c in root.c[-1:-3:-1] ]) + 496 self.assertEquals(test_list[2:-3:-1], + 497 [ c.text for c in root.c[2:-3:-1] ]) + 498 self.assertEquals(test_list[2:-3000:-1], + 499 [ c.text for c in root.c[2:-3000:-1] ]) +
500 + 501 # slice assignment + 502 +
503 - def test_setslice_complete(self): +
504 Element = self.Element + 505 root = Element("root") + 506 root.c = ["c1", "c2"] + 507 + 508 c1 = root.c[0] + 509 c2 = root.c[1] + 510 + 511 self.assertEquals([c1,c2], list(root.c)) + 512 self.assertEquals(["c1", "c2"], + 513 [ c.text for c in root.c ]) +
514 +
515 - def test_setslice_elements(self): +
516 Element = self.Element + 517 root = Element("root") + 518 root.c = ["c1", "c2"] + 519 + 520 c1 = root.c[0] + 521 c2 = root.c[1] + 522 + 523 self.assertEquals([c1,c2], list(root.c)) + 524 self.assertEquals(["c1", "c2"], + 525 [ c.text for c in root.c ]) + 526 + 527 root2 = Element("root2") + 528 root2.el = [ "test", "test" ] + 529 self.assertEquals(["test", "test"], + 530 [ el.text for el in root2.el ]) + 531 + 532 root.c = [ root2.el, root2.el ] + 533 self.assertEquals(["test", "test"], + 534 [ c.text for c in root.c ]) + 535 self.assertEquals(["test", "test"], + 536 [ el.text for el in root2.el ]) + 537 + 538 root.c[:] = [ c1, c2, c2, c1 ] + 539 self.assertEquals(["c1", "c2", "c2", "c1"], + 540 [ c.text for c in root.c ]) +
541 +
542 - def test_setslice_partial(self): +
543 Element = self.Element + 544 root = Element("root") + 545 l = ["c1", "c2", "c3", "c4"] + 546 root.c = l + 547 + 548 self.assertEquals(["c1", "c2", "c3", "c4"], + 549 [ c.text for c in root.c ]) + 550 self.assertEquals(l, + 551 [ c.text for c in root.c ]) + 552 + 553 new_slice = ["cA", "cB"] + 554 l[1:2] = new_slice + 555 root.c[1:2] = new_slice + 556 + 557 self.assertEquals(["c1", "cA", "cB", "c3", "c4"], l) + 558 self.assertEquals(["c1", "cA", "cB", "c3", "c4"], + 559 [ c.text for c in root.c ]) + 560 self.assertEquals(l, + 561 [ c.text for c in root.c ]) +
562 +
563 - def test_setslice_insert(self): +
564 Element = self.Element + 565 root = Element("root") + 566 l = ["c1", "c2", "c3", "c4"] + 567 root.c = l + 568 + 569 self.assertEquals(["c1", "c2", "c3", "c4"], + 570 [ c.text for c in root.c ]) + 571 self.assertEquals(l, + 572 [ c.text for c in root.c ]) + 573 + 574 new_slice = ["cA", "cB"] + 575 l[1:1] = new_slice + 576 root.c[1:1] = new_slice + 577 + 578 self.assertEquals(["c1", "cA", "cB", "c2", "c3", "c4"], l) + 579 self.assertEquals(["c1", "cA", "cB", "c2", "c3", "c4"], + 580 [ c.text for c in root.c ]) + 581 self.assertEquals(l, + 582 [ c.text for c in root.c ]) +
583 +
584 - def test_setslice_insert_neg(self): +
585 Element = self.Element + 586 root = Element("root") + 587 l = ["c1", "c2", "c3", "c4"] + 588 root.c = l + 589 + 590 self.assertEquals(["c1", "c2", "c3", "c4"], + 591 [ c.text for c in root.c ]) + 592 self.assertEquals(l, + 593 [ c.text for c in root.c ]) + 594 + 595 new_slice = ["cA", "cB"] + 596 l[-2:-2] = new_slice + 597 root.c[-2:-2] = new_slice + 598 + 599 self.assertEquals(["c1", "c2", "cA", "cB", "c3", "c4"], l) + 600 self.assertEquals(["c1", "c2", "cA", "cB", "c3", "c4"], + 601 [ c.text for c in root.c ]) + 602 self.assertEquals(l, + 603 [ c.text for c in root.c ]) +
604 +
605 - def test_setslice_empty(self): +
606 Element = self.Element + 607 root = Element("root") + 608 + 609 root.c = [] + 610 self.assertRaises( + 611 AttributeError, getattr, root, 'c') +
612 +
614 Element = self.Element + 615 root = Element("root") + 616 l = ["c1", "c2", "c3", "c4"] + 617 root.c = l + 618 + 619 self.assertEquals(["c1", "c2", "c3", "c4"], + 620 [ c.text for c in root.c ]) + 621 self.assertEquals(l, + 622 [ c.text for c in root.c ]) + 623 + 624 new_slice = ["cA", "cB", "cC"] + 625 self.assertRaises( + 626 ValueError, operator.setitem, + 627 l, slice(1,2,-1), new_slice) + 628 self.assertRaises( + 629 ValueError, operator.setitem, + 630 root.c, slice(1,2,-1), new_slice) +
631 +
632 - def test_setslice_partial_neg(self): +
633 Element = self.Element + 634 root = Element("root") + 635 l = ["c1", "c2", "c3", "c4"] + 636 root.c = l + 637 + 638 self.assertEquals(["c1", "c2", "c3", "c4"], + 639 [ c.text for c in root.c ]) + 640 self.assertEquals(l, + 641 [ c.text for c in root.c ]) + 642 + 643 new_slice = ["cA", "cB"] + 644 l[-1:1:-1] = new_slice + 645 root.c[-1:1:-1] = new_slice + 646 + 647 self.assertEquals(["c1", "c2", "cB", "cA"], l) + 648 self.assertEquals(["c1", "c2", "cB", "cA"], + 649 [ c.text for c in root.c ]) + 650 self.assertEquals(l, + 651 [ c.text for c in root.c ]) +
652 +
654 Element = self.Element + 655 root = Element("root") + 656 l = ["c1", "c2", "c3", "c4"] + 657 root.c = l + 658 + 659 self.assertEquals(["c1", "c2", "c3", "c4"], + 660 [ c.text for c in root.c ]) + 661 self.assertEquals(l, + 662 [ c.text for c in root.c ]) + 663 + 664 new_slice = ["cA", "cB"] + 665 l[-1:-4:-2] = new_slice + 666 root.c[-1:-4:-2] = new_slice + 667 + 668 self.assertEquals(["c1", "cB", "c3", "cA"], l) + 669 self.assertEquals(["c1", "cB", "c3", "cA"], + 670 [ c.text for c in root.c ]) + 671 self.assertEquals(l, + 672 [ c.text for c in root.c ]) +
673 + 674 # other stuff + 675 +
676 - def test_set_string(self): +
677 # make sure strings are not handled as sequences + 678 Element = self.Element + 679 root = Element("root") + 680 root.c = "TEST" + 681 self.assertEquals(["TEST"], + 682 [ c.text for c in root.c ]) +
683 +
684 - def test_setitem_string(self): +
685 # make sure strings are set as children + 686 Element = self.Element + 687 root = Element("root") + 688 root["c"] = "TEST" + 689 self.assertEquals(["TEST"], + 690 [ c.text for c in root.c ]) +
691 +
692 - def test_setitem_string_special(self): +
693 # make sure 'text' etc. are set as children + 694 Element = self.Element + 695 root = Element("root") + 696 + 697 root["text"] = "TEST" + 698 self.assertEquals(["TEST"], + 699 [ c.text for c in root["text"] ]) + 700 + 701 root["tail"] = "TEST" + 702 self.assertEquals(["TEST"], + 703 [ c.text for c in root["tail"] ]) + 704 + 705 root["pyval"] = "TEST" + 706 self.assertEquals(["TEST"], + 707 [ c.text for c in root["pyval"] ]) + 708 + 709 root["tag"] = "TEST" + 710 self.assertEquals(["TEST"], + 711 [ c.text for c in root["tag"] ]) +
712 +
713 - def test_findall(self): +
714 XML = self.XML + 715 root = XML('<a><b><c/></b><b/><c><b/></c></a>') + 716 self.assertEquals(1, len(root.findall("c"))) + 717 self.assertEquals(2, len(root.findall(".//c"))) + 718 self.assertEquals(3, len(root.findall(".//b"))) + 719 self.assert_(root.findall(".//b")[1] is root.getchildren()[1]) +
720 +
721 - def test_findall_ns(self): +
722 XML = self.XML + 723 root = XML('<a xmlns:x="X" xmlns:y="Y"><x:b><c/></x:b><b/><c><x:b/><b/></c><b/></a>') + 724 self.assertEquals(2, len(root.findall(".//{X}b"))) + 725 self.assertEquals(3, len(root.findall(".//b"))) + 726 self.assertEquals(2, len(root.findall("b"))) +
727 +
728 - def test_build_tree(self): +
729 root = self.Element('root') + 730 root.a = 5 + 731 root.b = 6 + 732 self.assert_(isinstance(root, objectify.ObjectifiedElement)) + 733 self.assert_(isinstance(root.a, objectify.IntElement)) + 734 self.assert_(isinstance(root.b, objectify.IntElement)) +
735 +
736 - def test_type_NoneType(self): +
737 Element = self.Element + 738 SubElement = self.etree.SubElement + 739 + 740 nil_attr = XML_SCHEMA_NIL_ATTR + 741 root = Element("{objectified}root") + 742 SubElement(root, "{objectified}none") + 743 SubElement(root, "{objectified}none", {nil_attr : "true"}) + 744 self.assertFalse(isinstance(root.none, objectify.NoneElement)) + 745 self.assertFalse(isinstance(root.none[0], objectify.NoneElement)) + 746 self.assert_(isinstance(root.none[1], objectify.NoneElement)) + 747 self.assertEquals(root.none[1], None) + 748 self.assertFalse(root.none[1]) +
749 +
750 - def test_data_element_NoneType(self): +
751 value = objectify.DataElement(None) + 752 self.assert_(isinstance(value, objectify.NoneElement)) + 753 self.assertEquals(value, None) + 754 self.assertEquals(value.get(XML_SCHEMA_NIL_ATTR), "true") +
755 +
756 - def test_type_bool(self): +
757 Element = self.Element + 758 SubElement = self.etree.SubElement + 759 root = Element("{objectified}root") + 760 root.bool = True + 761 self.assertEquals(root.bool, True) + 762 self.assertEquals(root.bool + root.bool, True + True) + 763 self.assertEquals(True + root.bool, True + root.bool) + 764 self.assertEquals(root.bool * root.bool, True * True) + 765 self.assertEquals(int(root.bool), int(True)) + 766 self.assertEquals(complex(root.bool), complex(True)) + 767 self.assert_(isinstance(root.bool, objectify.BoolElement)) + 768 + 769 root.bool = False + 770 self.assertEquals(root.bool, False) + 771 self.assertEquals(root.bool + root.bool, False + False) + 772 self.assertEquals(False + root.bool, False + root.bool) + 773 self.assertEquals(root.bool * root.bool, False * False) + 774 self.assertEquals(int(root.bool), int(False)) + 775 self.assertEquals(complex(root.bool), complex(False)) + 776 self.assert_(isinstance(root.bool, objectify.BoolElement)) +
777 +
778 - def test_data_element_bool(self): +
779 value = objectify.DataElement(True) + 780 self.assert_(isinstance(value, objectify.BoolElement)) + 781 self.assertEquals(value, True) + 782 + 783 value = objectify.DataElement(False) + 784 self.assert_(isinstance(value, objectify.BoolElement)) + 785 self.assertEquals(value, False) +
786 +
787 - def test_type_str(self): +
788 Element = self.Element + 789 SubElement = self.etree.SubElement + 790 root = Element("{objectified}root") + 791 root.s = "test" + 792 self.assert_(isinstance(root.s, objectify.StringElement)) +
793 +
794 - def test_type_str_intliteral(self): +
795 Element = self.Element + 796 SubElement = self.etree.SubElement + 797 root = Element("{objectified}root") + 798 root.s = "3" + 799 self.assert_(isinstance(root.s, objectify.StringElement)) +
800 +
801 - def test_type_str_floatliteral(self): +
802 Element = self.Element + 803 SubElement = self.etree.SubElement + 804 root = Element("{objectified}root") + 805 root.s = "3.72" + 806 self.assert_(isinstance(root.s, objectify.StringElement)) +
807 +
808 - def test_type_str_mul(self): +
809 Element = self.Element + 810 SubElement = self.etree.SubElement + 811 root = Element("{objectified}root") + 812 root.s = "test" + 813 + 814 self.assertEquals("test" * 5, root.s * 5) + 815 self.assertEquals(5 * "test", 5 * root.s) + 816 + 817 self.assertRaises(TypeError, operator.mul, root.s, "honk") + 818 self.assertRaises(TypeError, operator.mul, "honk", root.s) +
819 +
820 - def test_type_str_add(self): +
821 Element = self.Element + 822 SubElement = self.etree.SubElement + 823 root = Element("{objectified}root") + 824 root.s = "test" + 825 + 826 s = "toast" + 827 self.assertEquals("test" + s, root.s + s) + 828 self.assertEquals(s + "test", s + root.s) +
829 +
830 - def test_type_str_mod(self): +
831 s = "%d %f %s %r" + 832 el = objectify.DataElement(s) + 833 values = (1, 7.0, "abcd", None) + 834 self.assertEquals(s % values, el % values) + 835 + 836 s = "%d" + 837 el = objectify.DataElement(s) + 838 val = 5 + 839 self.assertEquals(s % val, el % val) + 840 + 841 s = "%d %s" + 842 el = objectify.DataElement(s) + 843 val = 5 + 844 self.assertRaises(TypeError, el.__mod__, val) + 845 + 846 s = "" + 847 el = objectify.DataElement(s) + 848 val = 5 + 849 self.assertRaises(TypeError, el.__mod__, val) +
850 +
851 - def test_type_str_as_int(self): +
852 v = "1" + 853 el = objectify.DataElement(v) + 854 self.assertEquals(int(el), 1) +
855 +
856 - def test_type_str_as_float(self): +
857 v = "1" + 858 el = objectify.DataElement(v) + 859 self.assertEquals(float(el), 1) +
860 +
861 - def test_type_str_as_complex(self): +
862 v = "1" + 863 el = objectify.DataElement(v) + 864 self.assertEquals(complex(el), 1) +
865 +
867 s = "%d %f %s %r" + 868 el = objectify.DataElement(s) + 869 values = (objectify.DataElement(1), + 870 objectify.DataElement(7.0), + 871 objectify.DataElement("abcd"), + 872 objectify.DataElement(None)) + 873 self.assertEquals(s % values, el % values) +
874 +
875 - def test_data_element_str(self): +
876 value = objectify.DataElement("test") + 877 self.assert_(isinstance(value, objectify.StringElement)) + 878 self.assertEquals(value, "test") +
879 +
881 value = objectify.DataElement("3") + 882 self.assert_(isinstance(value, objectify.StringElement)) + 883 self.assertEquals(value, "3") +
884 +
886 value = objectify.DataElement("3.20") + 887 self.assert_(isinstance(value, objectify.StringElement)) + 888 self.assertEquals(value, "3.20") +
889 +
890 - def test_type_ustr(self): +
891 Element = self.Element + 892 SubElement = self.etree.SubElement + 893 root = Element("{objectified}root") + 894 root.s = _str("test") + 895 self.assert_(isinstance(root.s, objectify.StringElement)) +
896 +
897 - def test_type_ustr_intliteral(self): +
898 Element = self.Element + 899 SubElement = self.etree.SubElement + 900 root = Element("{objectified}root") + 901 root.s = _str("3") + 902 self.assert_(isinstance(root.s, objectify.StringElement)) +
903 +
904 - def test_type_ustr_floatliteral(self): +
905 Element = self.Element + 906 SubElement = self.etree.SubElement + 907 root = Element("{objectified}root") + 908 root.s = _str("3.72") + 909 self.assert_(isinstance(root.s, objectify.StringElement)) +
910 +
911 - def test_type_ustr_mul(self): +
912 Element = self.Element + 913 SubElement = self.etree.SubElement + 914 root = Element("{objectified}root") + 915 root.s = _str("test") + 916 + 917 self.assertEquals(_str("test") * 5, root.s * 5) + 918 self.assertEquals(5 * _str("test"), 5 * root.s) + 919 + 920 self.assertRaises(TypeError, operator.mul, root.s, _str("honk")) + 921 self.assertRaises(TypeError, operator.mul, _str("honk"), root.s) +
922 +
923 - def test_type_ustr_add(self): +
924 Element = self.Element + 925 SubElement = self.etree.SubElement + 926 root = Element("{objectified}root") + 927 root.s = _str("test") + 928 + 929 s = _str("toast") + 930 self.assertEquals(_str("test") + s, root.s + s) + 931 self.assertEquals(s + _str("test"), s + root.s) +
932 +
933 - def test_data_element_ustr(self): +
934 value = objectify.DataElement(_str("test")) + 935 self.assert_(isinstance(value, objectify.StringElement)) + 936 self.assertEquals(value, _str("test")) +
937 +
939 value = objectify.DataElement("3") + 940 self.assert_(isinstance(value, objectify.StringElement)) + 941 self.assertEquals(value, _str("3")) +
942 +
944 value = objectify.DataElement(_str("3.20")) + 945 self.assert_(isinstance(value, objectify.StringElement)) + 946 self.assertEquals(value, _str("3.20")) +
947 +
948 - def test_type_int(self): +
949 Element = self.Element + 950 SubElement = self.etree.SubElement + 951 root = Element("{objectified}root") + 952 root.none = 5 + 953 self.assert_(isinstance(root.none, objectify.IntElement)) +
954 +
955 - def test_data_element_int(self): +
956 value = objectify.DataElement(5) + 957 self.assert_(isinstance(value, objectify.IntElement)) + 958 self.assertEquals(value, 5) +
959 +
960 - def test_type_float(self): +
961 Element = self.Element + 962 SubElement = self.etree.SubElement + 963 root = Element("{objectified}root") + 964 root.none = 5.5 + 965 self.assert_(isinstance(root.none, objectify.FloatElement)) +
966 +
967 - def test_data_element_float(self): +
968 value = objectify.DataElement(5.5) + 969 self.assert_(isinstance(value, objectify.FloatElement)) + 970 self.assertEquals(value, 5.5) +
971 +
972 - def test_data_element_xsitypes(self): +
973 for xsi, objclass in xsitype2objclass.items(): + 974 # 1 is a valid value for all ObjectifiedDataElement classes + 975 pyval = 1 + 976 value = objectify.DataElement(pyval, _xsi=xsi) + 977 self.assert_(isinstance(value, objclass), + 978 "DataElement(%s, _xsi='%s') returns %s, expected %s" + 979 % (pyval, xsi, type(value), objclass)) +
980 +
982 for xsi, objclass in xsitype2objclass.items(): + 983 # 1 is a valid value for all ObjectifiedDataElement classes + 984 pyval = 1 + 985 value = objectify.DataElement(pyval, _xsi="xsd:%s" % xsi) + 986 self.assert_(isinstance(value, objclass), + 987 "DataElement(%s, _xsi='%s') returns %s, expected %s" + 988 % (pyval, xsi, type(value), objclass)) +
989 +
991 for xsi, objclass in xsitype2objclass.items(): + 992 # 1 is a valid value for all ObjectifiedDataElement classes + 993 self.assertRaises(ValueError, objectify.DataElement, 1, + 994 _xsi="foo:%s" % xsi) +
995 +
996 - def test_data_element_pytypes(self): +
997 for pytype, objclass in pytype2objclass.items(): + 998 # 1 is a valid value for all ObjectifiedDataElement classes + 999 pyval = 1 +1000 value = objectify.DataElement(pyval, _pytype=pytype) +1001 self.assert_(isinstance(value, objclass), +1002 "DataElement(%s, _pytype='%s') returns %s, expected %s" +1003 % (pyval, pytype, type(value), objclass)) +
1004 +
1006 pyval = 1 +1007 pytype = "NoneType" +1008 objclass = objectify.NoneElement +1009 value = objectify.DataElement(pyval, _pytype=pytype) +1010 self.assert_(isinstance(value, objclass), +1011 "DataElement(%s, _pytype='%s') returns %s, expected %s" +1012 % (pyval, pytype, type(value), objclass)) +1013 self.assertEquals(value.text, None) +1014 self.assertEquals(value.pyval, None) +
1015 +
1017 # pre-2.0 lxml called NoneElement "none" +1018 pyval = 1 +1019 pytype = "none" +1020 objclass = objectify.NoneElement +1021 value = objectify.DataElement(pyval, _pytype=pytype) +1022 self.assert_(isinstance(value, objclass), +1023 "DataElement(%s, _pytype='%s') returns %s, expected %s" +1024 % (pyval, pytype, type(value), objclass)) +1025 self.assertEquals(value.text, None) +1026 self.assertEquals(value.pyval, None) +
1027 +
1028 - def test_type_unregistered(self): +
1029 Element = self.Element +1030 SubElement = self.etree.SubElement +1031 class MyFloat(float): +1032 pass +
1033 root = Element("{objectified}root") +1034 root.myfloat = MyFloat(5.5) +1035 self.assert_(isinstance(root.myfloat, objectify.FloatElement)) +1036 self.assertEquals(root.myfloat.get(objectify.PYTYPE_ATTRIBUTE), None) +
1037 +
1039 class MyFloat(float): +1040 pass +
1041 value = objectify.DataElement(MyFloat(5.5)) +1042 self.assert_(isinstance(value, objectify.FloatElement)) +1043 self.assertEquals(value, 5.5) +1044 self.assertEquals(value.get(objectify.PYTYPE_ATTRIBUTE), None) +1045 +
1046 - def test_schema_types(self): +
1047 XML = self.XML +1048 root = XML('''\ +1049 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +1050 <b xsi:type="boolean">true</b> +1051 <b xsi:type="boolean">false</b> +1052 <b xsi:type="boolean">1</b> +1053 <b xsi:type="boolean">0</b> +1054 +1055 <f xsi:type="float">5</f> +1056 <f xsi:type="double">5</f> +1057 +1058 <s xsi:type="string">5</s> +1059 <s xsi:type="normalizedString">5</s> +1060 <s xsi:type="token">5</s> +1061 <s xsi:type="language">5</s> +1062 <s xsi:type="Name">5</s> +1063 <s xsi:type="NCName">5</s> +1064 <s xsi:type="ID">5</s> +1065 <s xsi:type="IDREF">5</s> +1066 <s xsi:type="ENTITY">5</s> +1067 <s xsi:type="NMTOKEN">5</s> +1068 +1069 <l xsi:type="integer">5</l> +1070 <l xsi:type="nonPositiveInteger">5</l> +1071 <l xsi:type="negativeInteger">5</l> +1072 <l xsi:type="long">5</l> +1073 <l xsi:type="nonNegativeInteger">5</l> +1074 <l xsi:type="unsignedLong">5</l> +1075 <l xsi:type="unsignedInt">5</l> +1076 <l xsi:type="positiveInteger">5</l> +1077 +1078 <i xsi:type="int">5</i> +1079 <i xsi:type="short">5</i> +1080 <i xsi:type="byte">5</i> +1081 <i xsi:type="unsignedShort">5</i> +1082 <i xsi:type="unsignedByte">5</i> +1083 +1084 <n xsi:nil="true"/> +1085 </root> +1086 ''') +1087 +1088 for b in root.b: +1089 self.assert_(isinstance(b, objectify.BoolElement)) +1090 self.assertEquals(True, root.b[0]) +1091 self.assertEquals(False, root.b[1]) +1092 self.assertEquals(True, root.b[2]) +1093 self.assertEquals(False, root.b[3]) +1094 +1095 for f in root.f: +1096 self.assert_(isinstance(f, objectify.FloatElement)) +1097 self.assertEquals(5, f) +1098 +1099 for s in root.s: +1100 self.assert_(isinstance(s, objectify.StringElement)) +1101 self.assertEquals("5", s) +1102 +1103 for i in root.i: +1104 self.assert_(isinstance(i, objectify.IntElement)) +1105 self.assertEquals(5, i) +1106 +1107 for l in root.l: +1108 self.assert_(isinstance(l, objectify.IntElement)) +1109 self.assertEquals(5, i) +1110 +1111 self.assert_(isinstance(root.n, objectify.NoneElement)) +1112 self.assertEquals(None, root.n) +
1113 +
1114 - def test_schema_types_prefixed(self): +
1115 XML = self.XML +1116 root = XML('''\ +1117 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1118 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +1119 <b xsi:type="xsd:boolean">true</b> +1120 <b xsi:type="xsd:boolean">false</b> +1121 <b xsi:type="xsd:boolean">1</b> +1122 <b xsi:type="xsd:boolean">0</b> +1123 +1124 <f xsi:type="xsd:float">5</f> +1125 <f xsi:type="xsd:double">5</f> +1126 +1127 <s xsi:type="xsd:string">5</s> +1128 <s xsi:type="xsd:normalizedString">5</s> +1129 <s xsi:type="xsd:token">5</s> +1130 <s xsi:type="xsd:language">5</s> +1131 <s xsi:type="xsd:Name">5</s> +1132 <s xsi:type="xsd:NCName">5</s> +1133 <s xsi:type="xsd:ID">5</s> +1134 <s xsi:type="xsd:IDREF">5</s> +1135 <s xsi:type="xsd:ENTITY">5</s> +1136 <s xsi:type="xsd:NMTOKEN">5</s> +1137 +1138 <l xsi:type="xsd:integer">5</l> +1139 <l xsi:type="xsd:nonPositiveInteger">5</l> +1140 <l xsi:type="xsd:negativeInteger">5</l> +1141 <l xsi:type="xsd:long">5</l> +1142 <l xsi:type="xsd:nonNegativeInteger">5</l> +1143 <l xsi:type="xsd:unsignedLong">5</l> +1144 <l xsi:type="xsd:unsignedInt">5</l> +1145 <l xsi:type="xsd:positiveInteger">5</l> +1146 +1147 <i xsi:type="xsd:int">5</i> +1148 <i xsi:type="xsd:short">5</i> +1149 <i xsi:type="xsd:byte">5</i> +1150 <i xsi:type="xsd:unsignedShort">5</i> +1151 <i xsi:type="xsd:unsignedByte">5</i> +1152 +1153 <n xsi:nil="true"/> +1154 </root> +1155 ''') +1156 +1157 for b in root.b: +1158 self.assert_(isinstance(b, objectify.BoolElement)) +1159 self.assertEquals(True, root.b[0]) +1160 self.assertEquals(False, root.b[1]) +1161 self.assertEquals(True, root.b[2]) +1162 self.assertEquals(False, root.b[3]) +1163 +1164 for f in root.f: +1165 self.assert_(isinstance(f, objectify.FloatElement)) +1166 self.assertEquals(5, f) +1167 +1168 for s in root.s: +1169 self.assert_(isinstance(s, objectify.StringElement)) +1170 self.assertEquals("5", s) +1171 +1172 for i in root.i: +1173 self.assert_(isinstance(i, objectify.IntElement)) +1174 self.assertEquals(5, i) +1175 +1176 for l in root.l: +1177 self.assert_(isinstance(l, objectify.IntElement)) +1178 self.assertEquals(5, l) +1179 +1180 self.assert_(isinstance(root.n, objectify.NoneElement)) +1181 self.assertEquals(None, root.n) +
1182 +
1183 - def test_type_str_sequence(self): +
1184 XML = self.XML +1185 root = XML(_bytes('<root><b>why</b><b>try</b></root>')) +1186 strs = [ str(s) for s in root.b ] +1187 self.assertEquals(["why", "try"], +1188 strs) +
1189 +
1190 - def test_type_str_cmp(self): +
1191 XML = self.XML +1192 root = XML(_bytes('<root><b>test</b><b>taste</b><b></b><b/></root>')) +1193 self.assertFalse(root.b[0] < root.b[1]) +1194 self.assertFalse(root.b[0] <= root.b[1]) +1195 self.assertFalse(root.b[0] == root.b[1]) +1196 +1197 self.assert_(root.b[0] != root.b[1]) +1198 self.assert_(root.b[0] >= root.b[1]) +1199 self.assert_(root.b[0] > root.b[1]) +1200 +1201 self.assertEquals(root.b[0], "test") +1202 self.assertEquals("test", root.b[0]) +1203 +1204 self.assertEquals("", root.b[2]) +1205 self.assertEquals(root.b[2], "") +1206 self.assertEquals("", root.b[3]) +1207 self.assertEquals(root.b[3], "") +1208 self.assertEquals(root.b[2], root.b[3]) +1209 +1210 root.b = "test" +1211 self.assert_(root.b) +1212 root.b = "" +1213 self.assertFalse(root.b) +1214 self.assertEquals(root.b, "") +1215 self.assertEquals("", root.b) +
1216 +
1217 - def test_type_int_cmp(self): +
1218 XML = self.XML +1219 root = XML(_bytes('<root><b>5</b><b>6</b></root>')) +1220 self.assert_(root.b[0] < root.b[1]) +1221 self.assert_(root.b[0] <= root.b[1]) +1222 self.assert_(root.b[0] != root.b[1]) +1223 +1224 self.assertFalse(root.b[0] == root.b[1]) +1225 self.assertFalse(root.b[0] >= root.b[1]) +1226 self.assertFalse(root.b[0] > root.b[1]) +1227 +1228 self.assertEquals(root.b[0], 5) +1229 self.assertEquals(5, root.b[0]) +1230 self.assertNotEquals(root.b[0], "5") +1231 +1232 root.b = 5 +1233 self.assert_(root.b) +1234 root.b = 0 +1235 self.assertFalse(root.b) +
1236 +1237 # float + long share the NumberElement implementation with int +1238 +
1239 - def test_type_bool_cmp(self): +
1240 XML = self.XML +1241 root = XML(_bytes('<root><b>false</b><b>true</b></root>')) +1242 self.assert_(root.b[0] < root.b[1]) +1243 self.assert_(root.b[0] <= root.b[1]) +1244 self.assert_(root.b[0] != root.b[1]) +1245 +1246 self.assertFalse(root.b[0] == root.b[1]) +1247 self.assertFalse(root.b[0] >= root.b[1]) +1248 self.assertFalse(root.b[0] > root.b[1]) +1249 +1250 self.assertFalse(root.b[0]) +1251 self.assert_(root.b[1]) +1252 +1253 self.assertEquals(root.b[0], False) +1254 self.assertEquals(False, root.b[0]) +1255 self.assert_(root.b[0] < 5) +1256 self.assert_(5 > root.b[0]) +1257 +1258 root.b = True +1259 self.assert_(root.b) +1260 root.b = False +1261 self.assertFalse(root.b) +
1262 +
1263 - def test_type_none_cmp(self): +
1264 XML = self.XML +1265 root = XML(_bytes(""" +1266 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +1267 <b xsi:nil="true"></b><b xsi:nil="true"/> +1268 </root>""")) +1269 self.assert_(root.b[0] == root.b[1]) +1270 self.assertFalse(root.b[0]) +1271 self.assertEquals(root.b[0], None) +1272 self.assertEquals(None, root.b[0]) +
1273 +1274 # doesn't work in Py3: +1275 +1276 #for comparison in ["abc", 5, 7.3, True, [], ()]: +1277 # none = root.b[1] +1278 # self.assert_(none < comparison, "%s (%s) should be < %s" % +1279 # (none, type(none), comparison) ) +1280 # self.assert_(comparison > none, "%s should be > %s (%s)" % +1281 # (comparison, none, type(none)) ) +1282 +
1283 - def test_dataelement_xsi(self): +
1284 el = objectify.DataElement(1, _xsi="string") +1285 self.assertEquals( +1286 el.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), +1287 'xsd:string') +
1288 +
1289 - def test_dataelement_xsi_nsmap(self): +
1290 el = objectify.DataElement(1, _xsi="string", +1291 nsmap={'schema': XML_SCHEMA_NS}) +1292 self.assertEquals( +1293 el.get(XML_SCHEMA_INSTANCE_TYPE_ATTR), +1294 'schema:string') +
1295 +
1297 self.assertRaises(ValueError, objectify.DataElement, 1, +1298 _xsi="foo:string") +
1299 +
1300 - def test_pytype_annotation(self): +
1301 XML = self.XML +1302 root = XML(_bytes('''\ +1303 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1304 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1305 <b>5</b> +1306 <b>test</b> +1307 <c>1.1</c> +1308 <c>\uF8D2</c> +1309 <x>true</x> +1310 <n xsi:nil="true" /> +1311 <n></n> +1312 <b xsi:type="double">5</b> +1313 <b xsi:type="float">5</b> +1314 <s xsi:type="string">23</s> +1315 <s py:pytype="str">42</s> +1316 <f py:pytype="float">300</f> +1317 <l py:pytype="long">2</l> +1318 <t py:pytype="TREE"></t> +1319 </a> +1320 ''')) +1321 objectify.annotate(root) +1322 +1323 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1324 for c in root.iterchildren() ] +1325 self.assertEquals("int", child_types[ 0]) +1326 self.assertEquals("str", child_types[ 1]) +1327 self.assertEquals("float", child_types[ 2]) +1328 self.assertEquals("str", child_types[ 3]) +1329 self.assertEquals("bool", child_types[ 4]) +1330 self.assertEquals("NoneType", child_types[ 5]) +1331 self.assertEquals(None, child_types[ 6]) +1332 self.assertEquals("float", child_types[ 7]) +1333 self.assertEquals("float", child_types[ 8]) +1334 self.assertEquals("str", child_types[ 9]) +1335 self.assertEquals("int", child_types[10]) +1336 self.assertEquals("int", child_types[11]) +1337 self.assertEquals("int", child_types[12]) +1338 self.assertEquals(None, child_types[13]) +1339 +1340 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1341 +
1343 XML = self.XML +1344 root = XML(_bytes('''\ +1345 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1346 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1347 <n></n> +1348 </a> +1349 ''')) +1350 objectify.annotate(root) +1351 +1352 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1353 for c in root.iterchildren() ] +1354 self.assertEquals(None, child_types[0]) +1355 +1356 objectify.annotate(root, empty_pytype="str") +1357 +1358 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1359 for c in root.iterchildren() ] +1360 self.assertEquals("str", child_types[0]) +
1361 +
1363 XML = self.XML +1364 root = XML(_bytes('''\ +1365 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1366 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1367 <b>5</b> +1368 <b>test</b> +1369 <c>1.1</c> +1370 <c>\uF8D2</c> +1371 <x>true</x> +1372 <n xsi:nil="true" /> +1373 <n></n> +1374 <b xsi:type="double">5</b> +1375 <b xsi:type="float">5</b> +1376 <s xsi:type="string">23</s> +1377 <s py:pytype="str">42</s> +1378 <f py:pytype="float">300</f> +1379 <l py:pytype="long">2</l> +1380 <t py:pytype="TREE"></t> +1381 </a> +1382 ''')) +1383 objectify.annotate(root, ignore_old=False) +1384 +1385 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1386 for c in root.iterchildren() ] +1387 self.assertEquals("int", child_types[ 0]) +1388 self.assertEquals("str", child_types[ 1]) +1389 self.assertEquals("float", child_types[ 2]) +1390 self.assertEquals("str", child_types[ 3]) +1391 self.assertEquals("bool", child_types[ 4]) +1392 self.assertEquals("NoneType", child_types[ 5]) +1393 self.assertEquals(None, child_types[ 6]) +1394 self.assertEquals("float", child_types[ 7]) +1395 self.assertEquals("float", child_types[ 8]) +1396 self.assertEquals("str", child_types[ 9]) +1397 self.assertEquals("str", child_types[10]) +1398 self.assertEquals("float", child_types[11]) +1399 self.assertEquals("int", child_types[12]) +1400 self.assertEquals(TREE_PYTYPE, child_types[13]) +1401 +1402 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1403 +
1405 XML = self.XML +1406 root = XML(_bytes('''\ +1407 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1408 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1409 <b>5</b> +1410 <b>test</b> +1411 <c>1.1</c> +1412 <c>\uF8D2</c> +1413 <x>true</x> +1414 <n xsi:nil="true" /> +1415 <n></n> +1416 <b xsi:type="double">5</b> +1417 <b xsi:type="float">5</b> +1418 <s xsi:type="string">23</s> +1419 <s py:pytype="str">42</s> +1420 <f py:pytype="float">300</f> +1421 <l py:pytype="long">2</l> +1422 <t py:pytype="TREE"></t> +1423 </a> +1424 ''')) +1425 objectify.annotate(root, ignore_old=False, ignore_xsi=False, +1426 annotate_xsi=1, annotate_pytype=1) +1427 +1428 # check py annotations +1429 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1430 for c in root.iterchildren() ] +1431 self.assertEquals("int", child_types[ 0]) +1432 self.assertEquals("str", child_types[ 1]) +1433 self.assertEquals("float", child_types[ 2]) +1434 self.assertEquals("str", child_types[ 3]) +1435 self.assertEquals("bool", child_types[ 4]) +1436 self.assertEquals("NoneType", child_types[ 5]) +1437 self.assertEquals(None, child_types[ 6]) +1438 self.assertEquals("float", child_types[ 7]) +1439 self.assertEquals("float", child_types[ 8]) +1440 self.assertEquals("str", child_types[ 9]) +1441 self.assertEquals("str", child_types[10]) +1442 self.assertEquals("float", child_types[11]) +1443 self.assertEquals("int", child_types[12]) +1444 self.assertEquals(TREE_PYTYPE, child_types[13]) +1445 +1446 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +1447 +1448 child_xsitypes = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1449 for c in root.iterchildren() ] +1450 +1451 # check xsi annotations +1452 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1453 for c in root.iterchildren() ] +1454 self.assertEquals("xsd:integer", child_types[ 0]) +1455 self.assertEquals("xsd:string", child_types[ 1]) +1456 self.assertEquals("xsd:double", child_types[ 2]) +1457 self.assertEquals("xsd:string", child_types[ 3]) +1458 self.assertEquals("xsd:boolean", child_types[ 4]) +1459 self.assertEquals(None, child_types[ 5]) +1460 self.assertEquals(None, child_types[ 6]) +1461 self.assertEquals("xsd:double", child_types[ 7]) +1462 self.assertEquals("xsd:float", child_types[ 8]) +1463 self.assertEquals("xsd:string", child_types[ 9]) +1464 self.assertEquals("xsd:string", child_types[10]) +1465 self.assertEquals("xsd:double", child_types[11]) +1466 self.assertEquals("xsd:integer", child_types[12]) +1467 self.assertEquals(None, child_types[13]) +1468 +1469 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1470 +
1471 - def test_xsiannotate_use_old(self): +
1472 XML = self.XML +1473 root = XML(_bytes('''\ +1474 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1475 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1476 <b>5</b> +1477 <b>test</b> +1478 <c>1.1</c> +1479 <c>\uF8D2</c> +1480 <x>true</x> +1481 <n xsi:nil="true" /> +1482 <n></n> +1483 <b xsi:type="double">5</b> +1484 <b xsi:type="float">5</b> +1485 <s xsi:type="string">23</s> +1486 <s py:pytype="str">42</s> +1487 <f py:pytype="float">300</f> +1488 <l py:pytype="long">2</l> +1489 <t py:pytype="TREE"></t> +1490 </a> +1491 ''')) +1492 objectify.xsiannotate(root, ignore_old=False) +1493 +1494 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1495 for c in root.iterchildren() ] +1496 self.assertEquals("xsd:integer", child_types[ 0]) +1497 self.assertEquals("xsd:string", child_types[ 1]) +1498 self.assertEquals("xsd:double", child_types[ 2]) +1499 self.assertEquals("xsd:string", child_types[ 3]) +1500 self.assertEquals("xsd:boolean", child_types[ 4]) +1501 self.assertEquals(None, child_types[ 5]) +1502 self.assertEquals(None, child_types[ 6]) +1503 self.assertEquals("xsd:double", child_types[ 7]) +1504 self.assertEquals("xsd:float", child_types[ 8]) +1505 self.assertEquals("xsd:string", child_types[ 9]) +1506 self.assertEquals("xsd:string", child_types[10]) +1507 self.assertEquals("xsd:double", child_types[11]) +1508 self.assertEquals("xsd:integer", child_types[12]) +1509 self.assertEquals(None, child_types[13]) +
1510 +
1511 - def test_pyannotate_ignore_old(self): +
1512 XML = self.XML +1513 root = XML(_bytes('''\ +1514 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1515 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1516 <b>5</b> +1517 <b>test</b> +1518 <c>1.1</c> +1519 <c>\uF8D2</c> +1520 <x>true</x> +1521 <n xsi:nil="true" /> +1522 <n></n> +1523 <b xsi:type="double">5</b> +1524 <b xsi:type="float">5</b> +1525 <s xsi:type="string">23</s> +1526 <s py:pytype="str">42</s> +1527 <f py:pytype="float">300</f> +1528 <l py:pytype="long">2</l> +1529 <t py:pytype="TREE"></t> +1530 </a> +1531 ''')) +1532 objectify.pyannotate(root, ignore_old=True) +1533 +1534 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1535 for c in root.iterchildren() ] +1536 self.assertEquals("int", child_types[ 0]) +1537 self.assertEquals("str", child_types[ 1]) +1538 self.assertEquals("float", child_types[ 2]) +1539 self.assertEquals("str", child_types[ 3]) +1540 self.assertEquals("bool", child_types[ 4]) +1541 self.assertEquals("NoneType", child_types[ 5]) +1542 self.assertEquals(None, child_types[ 6]) +1543 self.assertEquals("float", child_types[ 7]) +1544 self.assertEquals("float", child_types[ 8]) +1545 self.assertEquals("str", child_types[ 9]) +1546 self.assertEquals("int", child_types[10]) +1547 self.assertEquals("int", child_types[11]) +1548 self.assertEquals("int", child_types[12]) +1549 self.assertEquals(None, child_types[13]) +1550 +1551 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1552 +
1553 - def test_pyannotate_empty(self): +
1554 XML = self.XML +1555 root = XML('''\ +1556 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1557 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1558 <n></n> +1559 </a> +1560 ''') +1561 objectify.pyannotate(root) +1562 +1563 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1564 for c in root.iterchildren() ] +1565 self.assertEquals(None, child_types[0]) +1566 +1567 objectify.annotate(root, empty_pytype="str") +1568 +1569 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1570 for c in root.iterchildren() ] +1571 self.assertEquals("str", child_types[0]) +
1572 +
1573 - def test_pyannotate_use_old(self): +
1574 XML = self.XML +1575 root = XML('''\ +1576 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1577 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1578 <b>5</b> +1579 <b>test</b> +1580 <c>1.1</c> +1581 <c>\uF8D2</c> +1582 <x>true</x> +1583 <n xsi:nil="true" /> +1584 <n></n> +1585 <b xsi:type="double">5</b> +1586 <b xsi:type="float">5</b> +1587 <s xsi:type="string">23</s> +1588 <s py:pytype="str">42</s> +1589 <f py:pytype="float">300</f> +1590 <l py:pytype="long">2</l> +1591 <t py:pytype="TREE"></t> +1592 </a> +1593 ''') +1594 objectify.pyannotate(root) +1595 +1596 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1597 for c in root.iterchildren() ] +1598 self.assertEquals("int", child_types[ 0]) +1599 self.assertEquals("str", child_types[ 1]) +1600 self.assertEquals("float", child_types[ 2]) +1601 self.assertEquals("str", child_types[ 3]) +1602 self.assertEquals("bool", child_types[ 4]) +1603 self.assertEquals("NoneType", child_types[ 5]) +1604 self.assertEquals(None, child_types[ 6]) +1605 self.assertEquals("float", child_types[ 7]) +1606 self.assertEquals("float", child_types[ 8]) +1607 self.assertEquals("str", child_types[ 9]) +1608 self.assertEquals("str", child_types[10]) +1609 self.assertEquals("float", child_types[11]) +1610 self.assertEquals("int", child_types[12]) +1611 self.assertEquals(TREE_PYTYPE, child_types[13]) +1612 +1613 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1614 +
1615 - def test_xsiannotate_ignore_old(self): +
1616 XML = self.XML +1617 root = XML(_bytes('''\ +1618 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1619 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1620 <b>5</b> +1621 <b>test</b> +1622 <c>1.1</c> +1623 <c>\uF8D2</c> +1624 <x>true</x> +1625 <n xsi:nil="true" /> +1626 <n></n> +1627 <b xsi:type="double">5</b> +1628 <b xsi:type="float">5</b> +1629 <s xsi:type="string">23</s> +1630 <s py:pytype="str">42</s> +1631 <f py:pytype="float">300</f> +1632 <l py:pytype="long">2</l> +1633 <t py:pytype="TREE"></t> +1634 </a> +1635 ''')) +1636 objectify.xsiannotate(root, ignore_old=True) +1637 +1638 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1639 for c in root.iterchildren() ] +1640 self.assertEquals("xsd:integer", child_types[ 0]) +1641 self.assertEquals("xsd:string", child_types[ 1]) +1642 self.assertEquals("xsd:double", child_types[ 2]) +1643 self.assertEquals("xsd:string", child_types[ 3]) +1644 self.assertEquals("xsd:boolean", child_types[ 4]) +1645 self.assertEquals(None, child_types[ 5]) +1646 self.assertEquals(None, child_types[ 6]) +1647 self.assertEquals("xsd:integer", child_types[ 7]) +1648 self.assertEquals("xsd:integer", child_types[ 8]) +1649 self.assertEquals("xsd:integer", child_types[ 9]) +1650 self.assertEquals("xsd:string", child_types[10]) +1651 self.assertEquals("xsd:double", child_types[11]) +1652 self.assertEquals("xsd:integer", child_types[12]) +1653 self.assertEquals(None, child_types[13]) +1654 +1655 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1656 +
1657 - def test_deannotate(self): +
1658 XML = self.XML +1659 root = XML(_bytes('''\ +1660 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1661 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1662 <b>5</b> +1663 <b>test</b> +1664 <c>1.1</c> +1665 <c>\uF8D2</c> +1666 <x>true</x> +1667 <n xsi:nil="true" /> +1668 <n></n> +1669 <b xsi:type="double">5</b> +1670 <b xsi:type="float">5</b> +1671 <s xsi:type="string">23</s> +1672 <s py:pytype="str">42</s> +1673 <f py:pytype="float">300</f> +1674 <l py:pytype="long">2</l> +1675 <t py:pytype="TREE"></t> +1676 </a> +1677 ''')) +1678 objectify.deannotate(root) +1679 +1680 for c in root.getiterator(): +1681 self.assertEquals(None, c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR)) +1682 self.assertEquals(None, c.get(objectify.PYTYPE_ATTRIBUTE)) +1683 +1684 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +
1685 +
1686 - def test_xsinil_deannotate(self): +
1687 XML = self.XML +1688 root = XML(_bytes('''\ +1689 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1690 xmlns:py="http://codespeak.net/lxml/objectify/pytype"> +1691 <b>5</b> +1692 <b>test</b> +1693 <c>1.1</c> +1694 <c>\uF8D2</c> +1695 <x>true</x> +1696 <n xsi:nil="true" /> +1697 <n></n> +1698 <b xsi:type="double">5</b> +1699 <b xsi:type="float">5</b> +1700 <s xsi:type="string">23</s> +1701 <s py:pytype="str">42</s> +1702 <f py:pytype="float">300</f> +1703 <l py:pytype="long">2</l> +1704 <t py:pytype="TREE"></t> +1705 </a> +1706 ''')) +1707 objectify.annotate( +1708 root, ignore_old=False, ignore_xsi=False, annotate_xsi=True, +1709 empty_pytype='str', empty_type='string') +1710 objectify.deannotate(root, pytype=False, xsi=False, xsi_nil=True) +1711 +1712 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1713 for c in root.iterchildren() ] +1714 self.assertEquals("xsd:integer", child_types[ 0]) +1715 self.assertEquals("xsd:string", child_types[ 1]) +1716 self.assertEquals("xsd:double", child_types[ 2]) +1717 self.assertEquals("xsd:string", child_types[ 3]) +1718 self.assertEquals("xsd:boolean", child_types[ 4]) +1719 self.assertEquals(None, child_types[ 5]) +1720 self.assertEquals("xsd:string", child_types[ 6]) +1721 self.assertEquals("xsd:double", child_types[ 7]) +1722 self.assertEquals("xsd:float", child_types[ 8]) +1723 self.assertEquals("xsd:string", child_types[ 9]) +1724 self.assertEquals("xsd:string", child_types[10]) +1725 self.assertEquals("xsd:double", child_types[11]) +1726 self.assertEquals("xsd:integer", child_types[12]) +1727 self.assertEquals(None, child_types[13]) +1728 +1729 self.assertEquals(None, root.n.get(XML_SCHEMA_NIL_ATTR)) +1730 +1731 for c in root.iterchildren(): +1732 self.assertNotEquals(None, c.get(objectify.PYTYPE_ATTRIBUTE)) +1733 # these have no equivalent in xsi:type +1734 if (c.get(objectify.PYTYPE_ATTRIBUTE) not in [TREE_PYTYPE, +1735 "NoneType"]): +1736 self.assertNotEquals( +1737 None, c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR)) +
1738 +
1739 - def test_xsitype_deannotate(self): +
1740 XML = self.XML +1741 root = XML(_bytes('''\ +1742 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1743 xmlns:py="http://codespeak.net/lxml/objectify/pytype" +1744 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +1745 <b>5</b> +1746 <b>test</b> +1747 <c>1.1</c> +1748 <c>\uF8D2</c> +1749 <x>true</x> +1750 <n xsi:nil="true" /> +1751 <n></n> +1752 <b xsi:type="xsd:double">5</b> +1753 <b xsi:type="xsd:float">5</b> +1754 <s xsi:type="xsd:string">23</s> +1755 <s py:pytype="str">42</s> +1756 <f py:pytype="float">300</f> +1757 <l py:pytype="long">2</l> +1758 <t py:pytype="TREE"></t> +1759 </a> +1760 ''')) +1761 objectify.annotate(root) +1762 objectify.deannotate(root, pytype=False) +1763 +1764 child_types = [ c.get(objectify.PYTYPE_ATTRIBUTE) +1765 for c in root.iterchildren() ] +1766 self.assertEquals("int", child_types[ 0]) +1767 self.assertEquals("str", child_types[ 1]) +1768 self.assertEquals("float", child_types[ 2]) +1769 self.assertEquals("str", child_types[ 3]) +1770 self.assertEquals("bool", child_types[ 4]) +1771 self.assertEquals("NoneType", child_types[ 5]) +1772 self.assertEquals(None, child_types[ 6]) +1773 self.assertEquals("float", child_types[ 7]) +1774 self.assertEquals("float", child_types[ 8]) +1775 self.assertEquals("str", child_types[ 9]) +1776 self.assertEquals("int", child_types[10]) +1777 self.assertEquals("int", child_types[11]) +1778 self.assertEquals("int", child_types[12]) +1779 self.assertEquals(None, child_types[13]) +1780 +1781 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +1782 +1783 for c in root.getiterator(): +1784 self.assertEquals(None, c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR)) +
1785 +
1786 - def test_pytype_deannotate(self): +
1787 XML = self.XML +1788 root = XML(_bytes('''\ +1789 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +1790 xmlns:py="http://codespeak.net/lxml/objectify/pytype" +1791 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +1792 <b xsi:type="xsd:int">5</b> +1793 <b xsi:type="xsd:string">test</b> +1794 <c xsi:type="xsd:float">1.1</c> +1795 <c xsi:type="xsd:string">\uF8D2</c> +1796 <x xsi:type="xsd:boolean">true</x> +1797 <n xsi:nil="true" /> +1798 <n></n> +1799 <b xsi:type="xsd:double">5</b> +1800 <b xsi:type="xsd:float">5</b> +1801 <s xsi:type="xsd:string">23</s> +1802 <s xsi:type="xsd:string">42</s> +1803 <f xsi:type="xsd:float">300</f> +1804 <l xsi:type="xsd:long">2</l> +1805 <t py:pytype="TREE"></t> +1806 </a> +1807 ''')) +1808 objectify.annotate(root) +1809 objectify.deannotate(root, xsi=False) +1810 +1811 child_types = [ c.get(XML_SCHEMA_INSTANCE_TYPE_ATTR) +1812 for c in root.iterchildren() ] +1813 self.assertEquals("xsd:int", child_types[ 0]) +1814 self.assertEquals("xsd:string", child_types[ 1]) +1815 self.assertEquals("xsd:float", child_types[ 2]) +1816 self.assertEquals("xsd:string", child_types[ 3]) +1817 self.assertEquals("xsd:boolean", child_types[ 4]) +1818 self.assertEquals(None, child_types[ 5]) +1819 self.assertEquals(None, child_types[ 6]) +1820 self.assertEquals("xsd:double", child_types[ 7]) +1821 self.assertEquals("xsd:float", child_types[ 8]) +1822 self.assertEquals("xsd:string", child_types[ 9]) +1823 self.assertEquals("xsd:string", child_types[10]) +1824 self.assertEquals("xsd:float", child_types[11]) +1825 self.assertEquals("xsd:long", child_types[12]) +1826 self.assertEquals(None, child_types[13]) +1827 +1828 self.assertEquals("true", root.n.get(XML_SCHEMA_NIL_ATTR)) +1829 +1830 for c in root.getiterator(): +1831 self.assertEquals(None, c.get(objectify.PYTYPE_ATTRIBUTE)) +
1832 +
1834 XML = self.XML +1835 +1836 xml = _bytes('''\ +1837 <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +1838 <b>5</b> +1839 <b>test</b> +1840 <c>1.1</c> +1841 <c>\uF8D2</c> +1842 <x>true</x> +1843 <n xsi:nil="true" /> +1844 <n></n> +1845 <b xsi:type="double">5</b> +1846 </a> +1847 ''') +1848 +1849 pytype_ns, pytype_name = objectify.PYTYPE_ATTRIBUTE[1:].split('}') +1850 objectify.set_pytype_attribute_tag("{TEST}test") +1851 +1852 root = XML(xml) +1853 objectify.annotate(root) +1854 +1855 attribs = root.xpath("//@py:%s" % pytype_name, +1856 namespaces={"py" : pytype_ns}) +1857 self.assertEquals(0, len(attribs)) +1858 attribs = root.xpath("//@py:test", +1859 namespaces={"py" : "TEST"}) +1860 self.assertEquals(7, len(attribs)) +1861 +1862 objectify.set_pytype_attribute_tag() +1863 pytype_ns, pytype_name = objectify.PYTYPE_ATTRIBUTE[1:].split('}') +1864 +1865 self.assertNotEqual("test", pytype_ns.lower()) +1866 self.assertNotEqual("test", pytype_name.lower()) +1867 +1868 root = XML(xml) +1869 attribs = root.xpath("//@py:%s" % pytype_name, +1870 namespaces={"py" : pytype_ns}) +1871 self.assertEquals(0, len(attribs)) +1872 +1873 objectify.annotate(root) +1874 attribs = root.xpath("//@py:%s" % pytype_name, +1875 namespaces={"py" : pytype_ns}) +1876 self.assertEquals(7, len(attribs)) +
1877 +
1878 - def test_registered_types(self): +
1879 orig_types = objectify.getRegisteredTypes() +1880 orig_types[0].unregister() +1881 self.assertEquals(orig_types[1:], objectify.getRegisteredTypes()) +1882 +1883 class NewType(objectify.ObjectifiedDataElement): +1884 pass +
1885 +1886 def checkMyType(s): +1887 return True +1888 +1889 pytype = objectify.PyType("mytype", checkMyType, NewType) +1890 self.assert_(pytype not in objectify.getRegisteredTypes()) +1891 pytype.register() +1892 self.assert_(pytype in objectify.getRegisteredTypes()) +1893 pytype.unregister() +1894 self.assert_(pytype not in objectify.getRegisteredTypes()) +1895 +1896 pytype.register(before = [objectify.getRegisteredTypes()[0].name]) +1897 self.assertEquals(pytype, objectify.getRegisteredTypes()[0]) +1898 pytype.unregister() +1899 +1900 pytype.register(after = [objectify.getRegisteredTypes()[0].name]) +1901 self.assertNotEqual(pytype, objectify.getRegisteredTypes()[0]) +1902 pytype.unregister() +1903 +1904 self.assertRaises(ValueError, pytype.register, +1905 before = [objectify.getRegisteredTypes()[0].name], +1906 after = [objectify.getRegisteredTypes()[1].name]) +1907 +
1909 from datetime import datetime +1910 def parse_date(value): +1911 if len(value) != 14: +1912 raise ValueError(value) +1913 Y = int(value[0:4]) +1914 M = int(value[4:6]) +1915 D = int(value[6:8]) +1916 h = int(value[8:10]) +1917 m = int(value[10:12]) +1918 s = int(value[12:14]) +1919 return datetime(Y, M, D, h, m, s) +
1920 +1921 def stringify_date(date): +1922 return date.strftime("%Y%m%d%H%M%S") +1923 +1924 class DatetimeElement(objectify.ObjectifiedDataElement): +1925 def pyval(self): +1926 return parse_date(self.text) +1927 pyval = property(pyval) +1928 +1929 datetime_type = objectify.PyType( +1930 "datetime", parse_date, DatetimeElement, stringify_date) +1931 datetime_type.xmlSchemaTypes = "dateTime" +1932 datetime_type.register() +1933 +1934 NAMESPACE = "http://foo.net/xmlns" +1935 NAMESPACE_MAP = {'ns': NAMESPACE} +1936 +1937 r = objectify.Element("{%s}root" % NAMESPACE, nsmap=NAMESPACE_MAP) +1938 time = datetime.now() +1939 r.date = time +1940 +1941 self.assert_(isinstance(r.date, DatetimeElement)) +1942 self.assert_(isinstance(r.date.pyval, datetime)) +1943 +1944 self.assertEquals(r.date.pyval, parse_date(stringify_date(time))) +1945 self.assertEquals(r.date.text, stringify_date(time)) +1946 +1947 r.date = objectify.E.date(time) +1948 +1949 self.assert_(isinstance(r.date, DatetimeElement)) +1950 self.assert_(isinstance(r.date.pyval, datetime)) +1951 +1952 self.assertEquals(r.date.pyval, parse_date(stringify_date(time))) +1953 self.assertEquals(r.date.text, stringify_date(time)) +1954 +
1955 - def test_object_path(self): +
1956 root = self.XML(xml_str) +1957 path = objectify.ObjectPath( "root.c1.c2" ) +1958 self.assertEquals(root.c1.c2.text, path.find(root).text) +1959 self.assertEquals(root.c1.c2.text, path(root).text) +
1960 +
1961 - def test_object_path_list(self): +
1962 root = self.XML(xml_str) +1963 path = objectify.ObjectPath( ['root', 'c1', 'c2'] ) +1964 self.assertEquals(root.c1.c2.text, path.find(root).text) +1965 self.assertEquals(root.c1.c2.text, path(root).text) +
1966 +
1967 - def test_object_path_fail(self): +
1968 root = self.XML(xml_str) +1969 path = objectify.ObjectPath( "root.c1.c99" ) +1970 self.assertRaises(AttributeError, path, root) +
1971 +
1973 root = self.XML(xml_str) +1974 path = objectify.ObjectPath( "root.c1.c99" ) +1975 self.assertEquals(None, path(root, None)) +1976 path = objectify.ObjectPath( "root.c99.c2" ) +1977 self.assertEquals(None, path(root, None)) +1978 path = objectify.ObjectPath( "notroot.c99.c2" ) +1979 self.assertEquals(None, path(root, None)) +
1980 +
1982 root = self.XML(xml_str) +1983 path = objectify.ObjectPath( ".c1.c99" ) +1984 self.assertEquals(None, path(root, None)) +1985 path = objectify.ObjectPath( ".c99.c2" ) +1986 self.assertEquals(None, path(root, None)) +
1987 +
1988 - def test_object_path_syntax(self): +
1989 root = self.XML(xml_str) +1990 path = objectify.ObjectPath("root . {objectified}c1. c2") +1991 self.assertEquals(root.c1.c2.text, path(root).text) +1992 +1993 path = objectify.ObjectPath(" root.{objectified} c1.c2 [ 0 ] ") +1994 self.assertEquals(root.c1.c2.text, path(root).text) +
1995 +
1997 self.assertRaises(ValueError, objectify.ObjectPath, "") +
1998 +
2000 self.assertRaises(ValueError, objectify.ObjectPath, []) +
2001 +
2002 - def test_object_path_hasattr(self): +
2003 root = self.XML(xml_str) +2004 path = objectify.ObjectPath( "root" ) +2005 self.assert_(path.hasattr(root)) +2006 path = objectify.ObjectPath( "root.c1" ) +2007 self.assert_(path.hasattr(root)) +2008 path = objectify.ObjectPath( "root.c1.c2" ) +2009 self.assert_(path.hasattr(root)) +2010 path = objectify.ObjectPath( "root.c1.{otherNS}c2" ) +2011 self.assert_(path.hasattr(root)) +2012 path = objectify.ObjectPath( "root.c1.c2[1]" ) +2013 self.assert_(path.hasattr(root)) +2014 path = objectify.ObjectPath( "root.c1.c2[2]" ) +2015 self.assert_(path.hasattr(root)) +2016 path = objectify.ObjectPath( "root.c1.c2[3]" ) +2017 self.assertFalse(path.hasattr(root)) +2018 path = objectify.ObjectPath( "root.c1[1].c2" ) +2019 self.assertFalse(path.hasattr(root)) +
2020 +
2021 - def test_object_path_dot(self): +
2022 root = self.XML(xml_str) +2023 path = objectify.ObjectPath( "." ) +2024 self.assertEquals(root.c1.c2.text, path(root).c1.c2.text) +
2025 +
2026 - def test_object_path_dot_list(self): +
2027 root = self.XML(xml_str) +2028 path = objectify.ObjectPath( [''] ) +2029 self.assertEquals(root.c1.c2.text, path(root).c1.c2.text) +
2030 +
2031 - def test_object_path_dot_root(self): +
2032 root = self.XML(xml_str) +2033 path = objectify.ObjectPath( ".c1.c2" ) +2034 self.assertEquals(root.c1.c2.text, path(root).text) +
2035 +
2037 root = self.XML(xml_str) +2038 path = objectify.ObjectPath( ['', 'c1', 'c2'] ) +2039 self.assertEquals(root.c1.c2.text, path(root).text) +
2040 +
2041 - def test_object_path_index(self): +
2042 root = self.XML(xml_str) +2043 path = objectify.ObjectPath( "root.c1[0].c2[0]" ) +2044 self.assertEquals(root.c1.c2.text, path(root).text) +2045 +2046 path = objectify.ObjectPath( "root.c1[0].c2" ) +2047 self.assertEquals(root.c1.c2.text, path(root).text) +2048 +2049 path = objectify.ObjectPath( "root.c1[0].c2[1]" ) +2050 self.assertEquals(root.c1.c2[1].text, path(root).text) +2051 +2052 path = objectify.ObjectPath( "root.c1.c2[2]" ) +2053 self.assertEquals(root.c1.c2[2].text, path(root).text) +2054 +2055 path = objectify.ObjectPath( "root.c1.c2[-1]" ) +2056 self.assertEquals(root.c1.c2[-1].text, path(root).text) +2057 +2058 path = objectify.ObjectPath( "root.c1.c2[-3]" ) +2059 self.assertEquals(root.c1.c2[-3].text, path(root).text) +
2060 +
2061 - def test_object_path_index_list(self): +
2062 root = self.XML(xml_str) +2063 path = objectify.ObjectPath( ['root', 'c1[0]', 'c2[0]'] ) +2064 self.assertEquals(root.c1.c2.text, path(root).text) +2065 +2066 path = objectify.ObjectPath( ['root', 'c1[0]', 'c2[2]'] ) +2067 self.assertEquals(root.c1.c2[2].text, path(root).text) +2068 +2069 path = objectify.ObjectPath( ['root', 'c1', 'c2[2]'] ) +2070 self.assertEquals(root.c1.c2[2].text, path(root).text) +2071 +2072 path = objectify.ObjectPath( ['root', 'c1', 'c2[-1]'] ) +2073 self.assertEquals(root.c1.c2[-1].text, path(root).text) +2074 +2075 path = objectify.ObjectPath( ['root', 'c1', 'c2[-3]'] ) +2076 self.assertEquals(root.c1.c2[-3].text, path(root).text) +
2077 +
2079 self.assertRaises(ValueError, objectify.ObjectPath, +2080 "root.c1[0].c2[-1-2]") +2081 self.assertRaises(ValueError, objectify.ObjectPath, +2082 ['root', 'c1[0]', 'c2[-1-2]']) +2083 +2084 self.assertRaises(ValueError, objectify.ObjectPath, +2085 "root[2].c1.c2") +2086 self.assertRaises(ValueError, objectify.ObjectPath, +2087 ['root[2]', 'c1', 'c2']) +2088 +2089 self.assertRaises(ValueError, objectify.ObjectPath, +2090 []) +2091 self.assertRaises(ValueError, objectify.ObjectPath, +2092 ['', '', '']) +
2093 +
2095 root = self.XML(xml_str) +2096 path = objectify.ObjectPath("root.c1[9999].c2") +2097 self.assertRaises(AttributeError, path, root) +2098 +2099 path = objectify.ObjectPath("root.c1[0].c2[9999]") +2100 self.assertRaises(AttributeError, path, root) +2101 +2102 path = objectify.ObjectPath(".c1[9999].c2[0]") +2103 self.assertRaises(AttributeError, path, root) +2104 +2105 path = objectify.ObjectPath("root.c1[-2].c2") +2106 self.assertRaises(AttributeError, path, root) +2107 +2108 path = objectify.ObjectPath("root.c1[0].c2[-4]") +2109 self.assertRaises(AttributeError, path, root) +
2110 +
2111 - def test_object_path_ns(self): +
2112 root = self.XML(xml_str) +2113 path = objectify.ObjectPath( "{objectified}root.c1.c2" ) +2114 self.assertEquals(root.c1.c2.text, path.find(root).text) +2115 path = objectify.ObjectPath( "{objectified}root.{objectified}c1.c2" ) +2116 self.assertEquals(root.c1.c2.text, path.find(root).text) +2117 path = objectify.ObjectPath( "root.{objectified}c1.{objectified}c2" ) +2118 self.assertEquals(root.c1.c2.text, path.find(root).text) +2119 path = objectify.ObjectPath( "root.c1.{objectified}c2" ) +2120 self.assertEquals(root.c1.c2.text, path.find(root).text) +2121 path = objectify.ObjectPath( "root.c1.{otherNS}c2" ) +2122 self.assertEquals(getattr(root.c1, '{otherNS}c2').text, +2123 path.find(root).text) +
2124 +
2125 - def test_object_path_ns_list(self): +
2126 root = self.XML(xml_str) +2127 path = objectify.ObjectPath( ['{objectified}root', 'c1', 'c2'] ) +2128 self.assertEquals(root.c1.c2.text, path.find(root).text) +2129 path = objectify.ObjectPath( ['{objectified}root', '{objectified}c1', 'c2'] ) +2130 self.assertEquals(root.c1.c2.text, path.find(root).text) +2131 path = objectify.ObjectPath( ['root', '{objectified}c1', '{objectified}c2'] ) +2132 self.assertEquals(root.c1.c2.text, path.find(root).text) +2133 path = objectify.ObjectPath( ['root', '{objectified}c1', '{objectified}c2[2]'] ) +2134 self.assertEquals(root.c1.c2[2].text, path.find(root).text) +2135 path = objectify.ObjectPath( ['root', 'c1', '{objectified}c2'] ) +2136 self.assertEquals(root.c1.c2.text, path.find(root).text) +2137 path = objectify.ObjectPath( ['root', 'c1', '{objectified}c2[2]'] ) +2138 self.assertEquals(root.c1.c2[2].text, path.find(root).text) +2139 path = objectify.ObjectPath( ['root', 'c1', '{otherNS}c2'] ) +2140 self.assertEquals(getattr(root.c1, '{otherNS}c2').text, +2141 path.find(root).text) +
2142 +
2143 - def test_object_path_set(self): +
2144 root = self.XML(xml_str) +2145 path = objectify.ObjectPath( "root.c1.c2" ) +2146 self.assertEquals(root.c1.c2.text, path.find(root).text) +2147 self.assertEquals("1", root.c1.c2[1].text) +2148 +2149 new_value = "my new value" +2150 path.setattr(root, new_value) +2151 +2152 self.assertEquals(new_value, root.c1.c2.text) +2153 self.assertEquals(new_value, path(root).text) +2154 self.assertEquals("1", root.c1.c2[1].text) +
2155 +
2157 root = self.XML(xml_str) +2158 path = objectify.ObjectPath( "root.c1.c2" ) +2159 self.assertEquals(root.c1.c2.text, path.find(root).text) +2160 self.assertEquals("1", root.c1.c2[1].text) +2161 +2162 new_el = self.Element("{objectified}test") +2163 etree.SubElement(new_el, "{objectified}sub", myattr="ATTR").a = "TEST" +2164 path.setattr(root, new_el.sub) +2165 +2166 self.assertEquals("ATTR", root.c1.c2.get("myattr")) +2167 self.assertEquals("TEST", root.c1.c2.a.text) +2168 self.assertEquals("TEST", path(root).a.text) +2169 self.assertEquals("1", root.c1.c2[1].text) +
2170 +
2171 - def test_object_path_set_create(self): +
2172 root = self.XML(xml_str) +2173 path = objectify.ObjectPath( "root.c1.c99" ) +2174 self.assertRaises(AttributeError, path.find, root) +2175 +2176 new_value = "my new value" +2177 path.setattr(root, new_value) +2178 +2179 self.assertEquals(1, len(root.c1.c99)) +2180 self.assertEquals(new_value, root.c1.c99.text) +2181 self.assertEquals(new_value, path(root).text) +
2182 +
2184 root = self.XML(xml_str) +2185 path = objectify.ObjectPath( "root.c1.c99" ) +2186 self.assertRaises(AttributeError, path.find, root) +2187 +2188 new_el = self.Element("{objectified}test") +2189 etree.SubElement(new_el, "{objectified}sub", myattr="ATTR").a = "TEST" +2190 path.setattr(root, new_el.sub) +2191 +2192 self.assertEquals(1, len(root.c1.c99)) +2193 self.assertEquals("ATTR", root.c1.c99.get("myattr")) +2194 self.assertEquals("TEST", root.c1.c99.a.text) +2195 self.assertEquals("TEST", path(root).a.text) +
2196 +
2198 root = self.XML(xml_str) +2199 path = objectify.ObjectPath( "root.c1.c99" ) +2200 self.assertRaises(AttributeError, path.find, root) +2201 +2202 new_el = self.Element("{objectified}test") +2203 new_el.a = ["TEST1", "TEST2"] +2204 new_el.a[0].set("myattr", "ATTR1") +2205 new_el.a[1].set("myattr", "ATTR2") +2206 +2207 path.setattr(root, list(new_el.a)) +2208 +2209 self.assertEquals(2, len(root.c1.c99)) +2210 self.assertEquals("ATTR1", root.c1.c99[0].get("myattr")) +2211 self.assertEquals("TEST1", root.c1.c99[0].text) +2212 self.assertEquals("ATTR2", root.c1.c99[1].get("myattr")) +2213 self.assertEquals("TEST2", root.c1.c99[1].text) +2214 self.assertEquals("TEST1", path(root).text) +
2215 +
2216 - def test_object_path_addattr(self): +
2217 root = self.XML(xml_str) +2218 path = objectify.ObjectPath( "root.c1.c2" ) +2219 self.assertEquals(3, len(root.c1.c2)) +2220 path.addattr(root, "test") +2221 self.assertEquals(4, len(root.c1.c2)) +2222 self.assertEquals(["0", "1", "2", "test"], +2223 [el.text for el in root.c1.c2]) +
2224 +
2226 root = self.XML(xml_str) +2227 path = objectify.ObjectPath( "root.c1.c2" ) +2228 self.assertEquals(3, len(root.c1.c2)) +2229 +2230 new_el = self.Element("{objectified}test") +2231 etree.SubElement(new_el, "{objectified}sub").a = "TEST" +2232 +2233 path.addattr(root, new_el.sub) +2234 self.assertEquals(4, len(root.c1.c2)) +2235 self.assertEquals("TEST", root.c1.c2[3].a.text) +2236 self.assertEquals(["0", "1", "2"], +2237 [el.text for el in root.c1.c2[:3]]) +
2238 +
2240 root = self.XML(xml_str) +2241 path = objectify.ObjectPath( "root.c1.c99" ) +2242 self.assertRaises(AttributeError, path.find, root) +2243 +2244 new_value = "my new value" +2245 path.addattr(root, new_value) +2246 +2247 self.assertEquals(1, len(root.c1.c99)) +2248 self.assertEquals(new_value, root.c1.c99.text) +2249 self.assertEquals(new_value, path(root).text) +
2250 +
2252 root = self.XML(xml_str) +2253 path = objectify.ObjectPath( "root.c1.c99" ) +2254 self.assertRaises(AttributeError, path.find, root) +2255 +2256 new_el = self.Element("{objectified}test") +2257 etree.SubElement(new_el, "{objectified}sub", myattr="ATTR").a = "TEST" +2258 +2259 path.addattr(root, new_el.sub) +2260 self.assertEquals(1, len(root.c1.c99)) +2261 self.assertEquals("TEST", root.c1.c99.a.text) +2262 self.assertEquals("TEST", path(root).a.text) +2263 self.assertEquals("ATTR", root.c1.c99.get("myattr")) +
2264 +
2266 root = self.XML(xml_str) +2267 path = objectify.ObjectPath( "root.c1.c99" ) +2268 self.assertRaises(AttributeError, path.find, root) +2269 +2270 new_el = self.Element("{objectified}test") +2271 new_el.a = ["TEST1", "TEST2"] +2272 +2273 self.assertEquals(2, len(new_el.a)) +2274 +2275 path.addattr(root, list(new_el.a)) +2276 self.assertEquals(2, len(root.c1.c99)) +2277 self.assertEquals("TEST1", root.c1.c99.text) +2278 self.assertEquals("TEST2", path(root)[1].text) +
2279 +
2280 - def test_descendant_paths(self): +
2281 root = self.XML(xml_str) +2282 self.assertEquals( +2283 ['{objectified}root', '{objectified}root.c1', +2284 '{objectified}root.c1.c2', +2285 '{objectified}root.c1.c2[1]', '{objectified}root.c1.c2[2]', +2286 '{objectified}root.c1.{otherNS}c2', '{objectified}root.c1.{}c2'], +2287 root.descendantpaths()) +
2288 +
2289 - def test_descendant_paths_child(self): +
2290 root = self.XML(xml_str) +2291 self.assertEquals( +2292 ['{objectified}c1', '{objectified}c1.c2', +2293 '{objectified}c1.c2[1]', '{objectified}c1.c2[2]', +2294 '{objectified}c1.{otherNS}c2', '{objectified}c1.{}c2'], +2295 root.c1.descendantpaths()) +
2296 +
2298 root = self.XML(xml_str) +2299 self.assertEquals( +2300 ['root.{objectified}c1', 'root.{objectified}c1.c2', +2301 'root.{objectified}c1.c2[1]', 'root.{objectified}c1.c2[2]', +2302 'root.{objectified}c1.{otherNS}c2', +2303 'root.{objectified}c1.{}c2'], +2304 root.c1.descendantpaths('root')) +
2305 +
2306 - def test_pickle(self): +
2307 import pickle +2308 +2309 root = self.XML(xml_str) +2310 out = BytesIO() +2311 pickle.dump(root, out) +2312 +2313 new_root = pickle.loads(out.getvalue()) +2314 self.assertEquals( +2315 etree.tostring(new_root), +2316 etree.tostring(root)) +
2317 +
2318 - def test_pickle_elementtree(self): +
2319 import pickle +2320 +2321 tree = etree.ElementTree(self.XML(xml_str + "<?my pi?>")) +2322 out = BytesIO() +2323 pickle.dump(tree, out) +2324 +2325 new_tree = pickle.loads(out.getvalue()) +2326 self.assert_(isinstance(new_tree, etree._ElementTree)) +2327 self.assertEquals( +2328 etree.tostring(new_tree), +2329 etree.tostring(tree)) +
2330 +2331 # E-Factory tests, need to use sub-elements as root element is always +2332 # type-looked-up as ObjectifiedElement (no annotations) +
2333 - def test_efactory_int(self): +
2334 E = objectify.E +2335 root = E.root(E.val(23)) +2336 self.assert_(isinstance(root.val, objectify.IntElement)) +
2337 +
2338 - def test_efactory_float(self): +
2339 E = objectify.E +2340 root = E.root(E.val(233.23)) +2341 self.assert_(isinstance(root.val, objectify.FloatElement)) +
2342 +
2343 - def test_efactory_str(self): +
2344 E = objectify.E +2345 root = E.root(E.val("what?")) +2346 self.assert_(isinstance(root.val, objectify.StringElement)) +
2347 +
2348 - def test_efactory_unicode(self): +
2349 E = objectify.E +2350 root = E.root(E.val(_str("blöödy häll", encoding="ISO-8859-1"))) +2351 self.assert_(isinstance(root.val, objectify.StringElement)) +
2352 +
2353 - def test_efactory_bool(self): +
2354 E = objectify.E +2355 root = E.root(E.val(True)) +2356 self.assert_(isinstance(root.val, objectify.BoolElement)) +
2357 +
2358 - def test_efactory_none(self): +
2359 E = objectify.E +2360 root = E.root(E.val(None)) +2361 self.assert_(isinstance(root.val, objectify.NoneElement)) +
2362 +
2364 E = objectify.E +2365 root = E.root(E.val(1, "foo", 2.0, "bar ", True, None)) +2366 self.assert_(isinstance(root.val, objectify.StringElement)) +
2367 +
2368 - def test_efactory_attrib(self): +
2369 E = objectify.E +2370 root = E.root(foo="bar") +2371 self.assertEquals(root.get("foo"), "bar") +
2372 +
2373 - def test_efactory_nested(self): +
2374 E = objectify.E +2375 DataElement = objectify.DataElement +2376 root = E.root("text", E.sub(E.subsub()), "tail", DataElement(1), +2377 DataElement(2.0)) +2378 self.assert_(isinstance(root, objectify.ObjectifiedElement)) +2379 self.assertEquals(root.text, "text") +2380 self.assert_(isinstance(root.sub, objectify.ObjectifiedElement)) +2381 self.assertEquals(root.sub.tail, "tail") +2382 self.assert_(isinstance(root.sub.subsub, objectify.StringElement)) +2383 self.assertEquals(len(root.value), 2) +2384 self.assert_(isinstance(root.value[0], objectify.IntElement)) +2385 self.assert_(isinstance(root.value[1], objectify.FloatElement)) +
2386 +
2387 - def test_XML_base_url_docinfo(self): +
2388 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2389 docinfo = root.getroottree().docinfo +2390 self.assertEquals(docinfo.URL, "http://no/such/url") +
2391 +
2393 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2394 docinfo = root.getroottree().docinfo +2395 self.assertEquals(docinfo.URL, "http://no/such/url") +2396 docinfo.URL = "https://secret/url" +2397 self.assertEquals(docinfo.URL, "https://secret/url") +
2398 +
2400 tree = objectify.parse(BytesIO("<root/>"), base_url="http://no/such/url") +2401 docinfo = tree.docinfo +2402 self.assertEquals(docinfo.URL, "http://no/such/url") +
2403 +
2404 - def test_parse_base_url_docinfo(self): +
2405 tree = objectify.parse(fileInTestDir('include/test_xinclude.xml'), +2406 base_url="http://no/such/url") +2407 docinfo = tree.docinfo +2408 self.assertEquals(docinfo.URL, "http://no/such/url") +
2409 +
2410 - def test_xml_base(self): +
2411 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2412 self.assertEquals(root.base, "http://no/such/url") +2413 self.assertEquals( +2414 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +2415 root.base = "https://secret/url" +2416 self.assertEquals(root.base, "https://secret/url") +2417 self.assertEquals( +2418 root.get('{http://www.w3.org/XML/1998/namespace}base'), +2419 "https://secret/url") +
2420 +
2421 - def test_xml_base_attribute(self): +
2422 root = objectify.XML(_bytes("<root/>"), base_url="http://no/such/url") +2423 self.assertEquals(root.base, "http://no/such/url") +2424 self.assertEquals( +2425 root.get('{http://www.w3.org/XML/1998/namespace}base'), None) +2426 root.set('{http://www.w3.org/XML/1998/namespace}base', +2427 "https://secret/url") +2428 self.assertEquals(root.base, "https://secret/url") +2429 self.assertEquals( +2430 root.get('{http://www.w3.org/XML/1998/namespace}base'), +2431 "https://secret/url") +
2432 +
2433 - def test_standard_lookup(self): +
2434 XML = self.XML +2435 +2436 xml = _bytes('''\ +2437 <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +2438 <i>5</i> +2439 <i>-5</i> +2440 <l>4294967296</l> +2441 <l>-4294967296</l> +2442 <f>1.1</f> +2443 <b>true</b> +2444 <b>false</b> +2445 <s>Strange things happen, where strings collide</s> +2446 <s>True</s> +2447 <s>False</s> +2448 <s>t</s> +2449 <s>f</s> +2450 <s></s> +2451 <s>None</s> +2452 <n xsi:nil="true" /> +2453 </root> +2454 ''') +2455 root = XML(xml) +2456 +2457 for i in root.i: +2458 self.assert_(isinstance(i, objectify.IntElement)) +2459 for l in root.l: +2460 self.assert_(isinstance(l, objectify.IntElement)) +2461 for f in root.f: +2462 self.assert_(isinstance(f, objectify.FloatElement)) +2463 for b in root.b: +2464 self.assert_(isinstance(b, objectify.BoolElement)) +2465 self.assertEquals(True, root.b[0]) +2466 self.assertEquals(False, root.b[1]) +2467 for s in root.s: +2468 self.assert_(isinstance(s, objectify.StringElement)) +2469 self.assert_(isinstance(root.n, objectify.NoneElement)) +2470 self.assertEquals(None, root.n) +
2471 +
2472 -def test_suite(): +
2473 suite = unittest.TestSuite() +2474 suite.addTests([unittest.makeSuite(ObjectifyTestCase)]) +2475 suite.addTests(doctest.DocTestSuite(objectify)) +2476 if sys.version_info >= (2,4): +2477 suite.addTests( +2478 [make_doctest('../../../doc/objectify.txt')]) +2479 return suite +
2480 +2481 if __name__ == '__main__': +2482 print('to test use test.py %s' % __file__) +2483 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_objectify.ObjectifyTestCase-class.html b/doc/html/api/lxml.tests.test_objectify.ObjectifyTestCase-class.html new file mode 100644 index 0000000..28c4b4a --- /dev/null +++ b/doc/html/api/lxml.tests.test_objectify.ObjectifyTestCase-class.html @@ -0,0 +1,3267 @@ + + + + + lxml.tests.test_objectify.ObjectifyTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_objectify :: + Class ObjectifyTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ObjectifyTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ObjectifyTestCase
+
+ +
+Test cases for lxml.objectify + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
XML(self, + xml) + source code + +
+ +
+   + + + + + + +
setUp(self)
+ Hook method for setting up the test fixture before exercising it.
+ source code + +
+ +
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
test_element_nsmap_default(self) + source code + +
+ +
+   + + + + + + +
test_element_nsmap_empty(self) + source code + +
+ +
+   + + + + + + +
test_element_nsmap_custom_prefixes(self) + source code + +
+ +
+   + + + + + + +
test_element_nsmap_custom(self) + source code + +
+ +
+   + + + + + + +
test_sub_element_nsmap_default(self) + source code + +
+ +
+   + + + + + + +
test_sub_element_nsmap_empty(self) + source code + +
+ +
+   + + + + + + +
test_sub_element_nsmap_custom_prefixes(self) + source code + +
+ +
+   + + + + + + +
test_sub_element_nsmap_custom(self) + source code + +
+ +
+   + + + + + + +
test_data_element_nsmap_default(self) + source code + +
+ +
+   + + + + + + +
test_data_element_nsmap_empty(self) + source code + +
+ +
+   + + + + + + +
test_data_element_nsmap_custom_prefixes(self) + source code + +
+ +
+   + + + + + + +
test_data_element_nsmap_custom(self) + source code + +
+ +
+   + + + + + + +
test_sub_data_element_nsmap_default(self) + source code + +
+ +
+   + + + + + + +
test_sub_data_element_nsmap_empty(self) + source code + +
+ +
+   + + + + + + +
test_sub_data_element_nsmap_custom_prefixes(self) + source code + +
+ +
+   + + + + + + +
test_sub_data_element_nsmap_custom(self) + source code + +
+ +
+   + + + + + + +
test_data_element_attrib_attributes_precedence(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg_pytype_none(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg_pytype(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg_xsitype(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg_pytype_xsitype(self) + source code + +
+ +
+   + + + + + + +
test_data_element_invalid_pytype(self) + source code + +
+ +
+   + + + + + + +
test_data_element_invalid_xsi(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg_invalid_pytype(self) + source code + +
+ +
+   + + + + + + +
test_data_element_data_element_arg_invalid_xsi(self) + source code + +
+ +
+   + + + + + + +
test_root(self) + source code + +
+ +
+   + + + + + + +
test_str(self) + source code + +
+ +
+   + + + + + + +
test_child(self) + source code + +
+ +
+   + + + + + + +
test_countchildren(self) + source code + +
+ +
+   + + + + + + +
test_child_getattr(self) + source code + +
+ +
+   + + + + + + +
test_child_nonexistant(self) + source code + +
+ +
+   + + + + + + +
test_setattr(self) + source code + +
+ +
+   + + + + + + +
test_setattr_nonunicode(self) + source code + +
+ +
+   + + + + + + +
test_addattr(self) + source code + +
+ +
+   + + + + + + +
test_addattr_element(self) + source code + +
+ +
+   + + + + + + +
test_addattr_list(self) + source code + +
+ +
+   + + + + + + +
test_child_addattr(self) + source code + +
+ +
+   + + + + + + +
test_child_index(self) + source code + +
+ +
+   + + + + + + +
test_child_index_neg(self) + source code + +
+ +
+   + + + + + + +
test_child_len(self) + source code + +
+ +
+   + + + + + + +
test_child_iter(self) + source code + +
+ +
+   + + + + + + +
test_class_lookup(self) + source code + +
+ +
+   + + + + + + +
test_dir(self) + source code + +
+ +
+   + + + + + + +
test_vars(self) + source code + +
+ +
+   + + + + + + +
test_child_set_ro(self) + source code + +
+ +
+   + + + + + + +
test_getslice_complete(self) + source code + +
+ +
+   + + + + + + +
test_getslice_partial(self) + source code + +
+ +
+   + + + + + + +
test_getslice_partial_neg(self) + source code + +
+ +
+   + + + + + + +
test_setslice_complete(self) + source code + +
+ +
+   + + + + + + +
test_setslice_elements(self) + source code + +
+ +
+   + + + + + + +
test_setslice_partial(self) + source code + +
+ +
+   + + + + + + +
test_setslice_insert(self) + source code + +
+ +
+   + + + + + + +
test_setslice_insert_neg(self) + source code + +
+ +
+   + + + + + + +
test_setslice_empty(self) + source code + +
+ +
+   + + + + + + +
test_setslice_partial_wrong_length(self) + source code + +
+ +
+   + + + + + + +
test_setslice_partial_neg(self) + source code + +
+ +
+   + + + + + + +
test_setslice_partial_allneg(self) + source code + +
+ +
+   + + + + + + +
test_set_string(self) + source code + +
+ +
+   + + + + + + +
test_setitem_string(self) + source code + +
+ +
+   + + + + + + +
test_setitem_string_special(self) + source code + +
+ +
+   + + + + + + +
test_findall(self) + source code + +
+ +
+   + + + + + + +
test_findall_ns(self) + source code + +
+ +
+   + + + + + + +
test_build_tree(self) + source code + +
+ +
+   + + + + + + +
test_type_NoneType(self) + source code + +
+ +
+   + + + + + + +
test_data_element_NoneType(self) + source code + +
+ +
+   + + + + + + +
test_type_bool(self) + source code + +
+ +
+   + + + + + + +
test_data_element_bool(self) + source code + +
+ +
+   + + + + + + +
test_type_str(self) + source code + +
+ +
+   + + + + + + +
test_type_str_intliteral(self) + source code + +
+ +
+   + + + + + + +
test_type_str_floatliteral(self) + source code + +
+ +
+   + + + + + + +
test_type_str_mul(self) + source code + +
+ +
+   + + + + + + +
test_type_str_add(self) + source code + +
+ +
+   + + + + + + +
test_type_str_mod(self) + source code + +
+ +
+   + + + + + + +
test_type_str_as_int(self) + source code + +
+ +
+   + + + + + + +
test_type_str_as_float(self) + source code + +
+ +
+   + + + + + + +
test_type_str_as_complex(self) + source code + +
+ +
+   + + + + + + +
test_type_str_mod_data_elements(self) + source code + +
+ +
+   + + + + + + +
test_data_element_str(self) + source code + +
+ +
+   + + + + + + +
test_data_element_str_intliteral(self) + source code + +
+ +
+   + + + + + + +
test_data_element_str_floatliteral(self) + source code + +
+ +
+   + + + + + + +
test_type_ustr(self) + source code + +
+ +
+   + + + + + + +
test_type_ustr_intliteral(self) + source code + +
+ +
+   + + + + + + +
test_type_ustr_floatliteral(self) + source code + +
+ +
+   + + + + + + +
test_type_ustr_mul(self) + source code + +
+ +
+   + + + + + + +
test_type_ustr_add(self) + source code + +
+ +
+   + + + + + + +
test_data_element_ustr(self) + source code + +
+ +
+   + + + + + + +
test_data_element_ustr_intliteral(self) + source code + +
+ +
+   + + + + + + +
test_data_element_ustr_floatliteral(self) + source code + +
+ +
+   + + + + + + +
test_type_int(self) + source code + +
+ +
+   + + + + + + +
test_data_element_int(self) + source code + +
+ +
+   + + + + + + +
test_type_float(self) + source code + +
+ +
+   + + + + + + +
test_data_element_float(self) + source code + +
+ +
+   + + + + + + +
test_data_element_xsitypes(self) + source code + +
+ +
+   + + + + + + +
test_data_element_xsitypes_xsdprefixed(self) + source code + +
+ +
+   + + + + + + +
test_data_element_xsitypes_prefixed(self) + source code + +
+ +
+   + + + + + + +
test_data_element_pytypes(self) + source code + +
+ +
+   + + + + + + +
test_data_element_pytype_none(self) + source code + +
+ +
+   + + + + + + +
test_data_element_pytype_none_compat(self) + source code + +
+ +
+   + + + + + + +
test_type_unregistered(self) + source code + +
+ +
+   + + + + + + +
test_data_element_unregistered(self) + source code + +
+ +
+   + + + + + + +
test_schema_types(self) + source code + +
+ +
+   + + + + + + +
test_schema_types_prefixed(self) + source code + +
+ +
+   + + + + + + +
test_type_str_sequence(self) + source code + +
+ +
+   + + + + + + +
test_type_str_cmp(self) + source code + +
+ +
+   + + + + + + +
test_type_int_cmp(self) + source code + +
+ +
+   + + + + + + +
test_type_bool_cmp(self) + source code + +
+ +
+   + + + + + + +
test_type_none_cmp(self) + source code + +
+ +
+   + + + + + + +
test_dataelement_xsi(self) + source code + +
+ +
+   + + + + + + +
test_dataelement_xsi_nsmap(self) + source code + +
+ +
+   + + + + + + +
test_dataelement_xsi_prefix_error(self) + source code + +
+ +
+   + + + + + + +
test_pytype_annotation(self) + source code + +
+ +
+   + + + + + + +
test_pytype_annotation_empty(self) + source code + +
+ +
+   + + + + + + +
test_pytype_annotation_use_old(self) + source code + +
+ +
+   + + + + + + +
test_pytype_xsitype_annotation(self) + source code + +
+ +
+   + + + + + + +
test_xsiannotate_use_old(self) + source code + +
+ +
+   + + + + + + +
test_pyannotate_ignore_old(self) + source code + +
+ +
+   + + + + + + +
test_pyannotate_empty(self) + source code + +
+ +
+   + + + + + + +
test_pyannotate_use_old(self) + source code + +
+ +
+   + + + + + + +
test_xsiannotate_ignore_old(self) + source code + +
+ +
+   + + + + + + +
test_deannotate(self) + source code + +
+ +
+   + + + + + + +
test_xsinil_deannotate(self) + source code + +
+ +
+   + + + + + + +
test_xsitype_deannotate(self) + source code + +
+ +
+   + + + + + + +
test_pytype_deannotate(self) + source code + +
+ +
+   + + + + + + +
test_change_pytype_attribute(self) + source code + +
+ +
+   + + + + + + +
test_registered_types(self) + source code + +
+ +
+   + + + + + + +
test_registered_type_stringify(self) + source code + +
+ +
+   + + + + + + +
test_object_path(self) + source code + +
+ +
+   + + + + + + +
test_object_path_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_fail(self) + source code + +
+ +
+   + + + + + + +
test_object_path_default_absolute(self) + source code + +
+ +
+   + + + + + + +
test_object_path_default_relative(self) + source code + +
+ +
+   + + + + + + +
test_object_path_syntax(self) + source code + +
+ +
+   + + + + + + +
test_object_path_fail_parse_empty(self) + source code + +
+ +
+   + + + + + + +
test_object_path_fail_parse_empty_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_hasattr(self) + source code + +
+ +
+   + + + + + + +
test_object_path_dot(self) + source code + +
+ +
+   + + + + + + +
test_object_path_dot_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_dot_root(self) + source code + +
+ +
+   + + + + + + +
test_object_path_dot_root_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_index(self) + source code + +
+ +
+   + + + + + + +
test_object_path_index_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_index_fail_parse(self) + source code + +
+ +
+   + + + + + + +
test_object_path_index_fail_lookup(self) + source code + +
+ +
+   + + + + + + +
test_object_path_ns(self) + source code + +
+ +
+   + + + + + + +
test_object_path_ns_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_set(self) + source code + +
+ +
+   + + + + + + +
test_object_path_set_element(self) + source code + +
+ +
+   + + + + + + +
test_object_path_set_create(self) + source code + +
+ +
+   + + + + + + +
test_object_path_set_create_element(self) + source code + +
+ +
+   + + + + + + +
test_object_path_set_create_list(self) + source code + +
+ +
+   + + + + + + +
test_object_path_addattr(self) + source code + +
+ +
+   + + + + + + +
test_object_path_addattr_element(self) + source code + +
+ +
+   + + + + + + +
test_object_path_addattr_create(self) + source code + +
+ +
+   + + + + + + +
test_object_path_addattr_create_element(self) + source code + +
+ +
+   + + + + + + +
test_object_path_addattr_create_list(self) + source code + +
+ +
+   + + + + + + +
test_descendant_paths(self) + source code + +
+ +
+   + + + + + + +
test_descendant_paths_child(self) + source code + +
+ +
+   + + + + + + +
test_descendant_paths_prefix(self) + source code + +
+ +
+   + + + + + + +
test_pickle(self) + source code + +
+ +
+   + + + + + + +
test_pickle_elementtree(self) + source code + +
+ +
+   + + + + + + +
test_efactory_int(self) + source code + +
+ +
+   + + + + + + +
test_efactory_float(self) + source code + +
+ +
+   + + + + + + +
test_efactory_str(self) + source code + +
+ +
+   + + + + + + +
test_efactory_unicode(self) + source code + +
+ +
+   + + + + + + +
test_efactory_bool(self) + source code + +
+ +
+   + + + + + + +
test_efactory_none(self) + source code + +
+ +
+   + + + + + + +
test_efactory_value_concatenation(self) + source code + +
+ +
+   + + + + + + +
test_efactory_attrib(self) + source code + +
+ +
+   + + + + + + +
test_efactory_nested(self) + source code + +
+ +
+   + + + + + + +
test_XML_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_XML_set_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_parse_stringio_base_url(self) + source code + +
+ +
+   + + + + + + +
test_parse_base_url_docinfo(self) + source code + +
+ +
+   + + + + + + +
test_xml_base(self) + source code + +
+ +
+   + + + + + + +
test_xml_base_attribute(self) + source code + +
+ +
+   + + + + + + +
test_standard_lookup(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

setUp(self) +

+
source code  +
+ + Hook method for setting up the test fixture before exercising it. +
+
Overrides: + unittest.TestCase.setUp +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_pyclasslookup-module.html b/doc/html/api/lxml.tests.test_pyclasslookup-module.html new file mode 100644 index 0000000..c86f0dc --- /dev/null +++ b/doc/html/api/lxml.tests.test_pyclasslookup-module.html @@ -0,0 +1,280 @@ + + + + + lxml.tests.test_pyclasslookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_pyclasslookup + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_pyclasslookup

source code

+Tests specific to the Python based class lookup. + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + PyClassLookupTestCase
+ Test cases for the lxml.pyclasslookup class lookup mechanism. +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + xml_str = '<obj:root xmlns:obj="objectified" xmlns:other="othe... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+ +
+ +
+

xml_str

+ +
+
+
+
Value:
+
+'''<obj:root xmlns:obj="objectified" xmlns:other="otherNS">
+  <obj:c1 a1="A1" a2="A2" other:a3="A3">
+    <obj:c2>0</obj:c2>
+    <obj:c2>1</obj:c2>
+    <obj:c2>2</obj:c2>
+    <other:c2>3</other:c2>
+    <c2>3</c2>
+  </obj:c1>
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_pyclasslookup-pysrc.html b/doc/html/api/lxml.tests.test_pyclasslookup-pysrc.html new file mode 100644 index 0000000..c1262ae --- /dev/null +++ b/doc/html/api/lxml.tests.test_pyclasslookup-pysrc.html @@ -0,0 +1,941 @@ + + + + + lxml.tests.test_pyclasslookup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_pyclasslookup + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_pyclasslookup

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Tests specific to the Python based class lookup. 
+  5  """ 
+  6   
+  7   
+  8  import unittest, operator, os.path, sys 
+  9   
+ 10  this_dir = os.path.dirname(__file__) 
+ 11  if this_dir not in sys.path: 
+ 12      sys.path.insert(0, this_dir) # needed for Py3 
+ 13   
+ 14  from common_imports import etree, StringIO, HelperTestCase, fileInTestDir 
+ 15  from common_imports import SillyFileLike, canonicalize, doctest, _bytes 
+ 16   
+ 17  from lxml.etree import PythonElementClassLookup 
+ 18   
+ 19  xml_str = _bytes('''\ 
+ 20  <obj:root xmlns:obj="objectified" xmlns:other="otherNS"> 
+ 21    <obj:c1 a1="A1" a2="A2" other:a3="A3"> 
+ 22      <obj:c2>0</obj:c2> 
+ 23      <obj:c2>1</obj:c2> 
+ 24      <obj:c2>2</obj:c2> 
+ 25      <other:c2>3</other:c2> 
+ 26      <c2>3</c2> 
+ 27    </obj:c1> 
+ 28  </obj:root>''') 
+ 29   
+ 30   
+
31 -class PyClassLookupTestCase(HelperTestCase): +
32 """Test cases for the lxml.pyclasslookup class lookup mechanism. + 33 """ + 34 etree = etree + 35 parser = etree.XMLParser() + 36 Element = parser.makeelement + 37 +
38 - def tearDown(self): +
39 self.parser.set_element_class_lookup(None) + 40 super(PyClassLookupTestCase, self).tearDown() +
41 +
42 - def _setClassLookup(self, lookup_function): +
43 class Lookup(PythonElementClassLookup): + 44 def lookup(self, *args): + 45 return lookup_function(*args) +
46 self.parser.set_element_class_lookup( Lookup() ) + 47 +
48 - def _buildElementClass(self): +
49 class LocalElement(etree.ElementBase): + 50 pass +
51 return LocalElement + 52 +
53 - def XML(self, xml): +
54 return self.etree.XML(xml, self.parser) +
55 + 56 # --- Test cases + 57 +
58 - def test_lookup(self): +
59 el_class = self._buildElementClass() + 60 el_class.i = 1 + 61 def lookup(*args): + 62 if el_class.i == 1: + 63 el_class.i = 2 + 64 return el_class +
65 self._setClassLookup(lookup) + 66 root = self.XML(xml_str) + 67 self.assertEquals(2, el_class.i) + 68 +
70 el_class = self._buildElementClass() + 71 el_class.EL = None + 72 def lookup(doc, el): + 73 if el_class.EL is None: + 74 el_class.EL = el + 75 return el_class +
76 self._setClassLookup(lookup) + 77 root = self.XML(xml_str) + 78 self.assertNotEquals(None, el_class.EL) + 79 self.assertRaises(AssertionError, el_class.EL.getchildren) + 80 +
81 - def test_lookup_tag(self): +
82 el_class = self._buildElementClass() + 83 el_class.TAG = None + 84 def lookup(doc, el): + 85 if el_class.TAG is None: + 86 el_class.TAG = el.tag + 87 return el_class +
88 self._setClassLookup(lookup) + 89 root = self.XML(xml_str) + 90 self.assertNotEquals(None, root.TAG) + 91 self.assertEquals(root.tag, root.TAG) + 92 +
93 - def test_lookup_text(self): +
94 el_class = self._buildElementClass() + 95 el_class.TEXT = None + 96 def lookup(doc, el): + 97 if el_class.TEXT is None: + 98 el_class.TEXT = el.text + 99 return el_class +
100 self._setClassLookup(lookup) +101 root = self.XML(xml_str) +102 self.assertNotEquals(None, root.TEXT) +103 self.assertEquals(root.text, root.TEXT) +104 +
105 - def test_lookup_tail(self): +
106 el_class = self._buildElementClass() +107 el_class.TAIL = None +108 def lookup(doc, el): +109 if el_class.TAIL is None: +110 el_class.TAIL = el.tail +111 return el_class +
112 self._setClassLookup(lookup) +113 root = self.XML(xml_str) +114 self.assertEquals(root.tail, root.TAIL) +115 +
116 - def test_lookup_attrib(self): +
117 el_class = self._buildElementClass() +118 el_class.ATTRIB = None +119 def lookup(doc, el): +120 if el_class.ATTRIB is None: +121 el_class.ATTRIB = el[0].attrib +122 return el_class +
123 self._setClassLookup(lookup) +124 root = self.XML(xml_str) +125 items1 = list(root[0].attrib.items()) +126 items1.sort() +127 items2 = list(root.ATTRIB.items()) +128 items2.sort() +129 self.assertEquals(items1, items2) +130 +
131 - def test_lookup_prefix(self): +
132 el_class = self._buildElementClass() +133 el_class.PREFIX = None +134 def lookup(doc, el): +135 if el_class.PREFIX is None: +136 el_class.PREFIX = el.prefix +137 return el_class +
138 self._setClassLookup(lookup) +139 root = self.XML(xml_str) +140 self.assertEquals(root.prefix, root.PREFIX) +141 +
142 - def test_lookup_sourceline(self): +
143 el_class = self._buildElementClass() +144 el_class.LINE = None +145 def lookup(doc, el): +146 if el_class.LINE is None: +147 el_class.LINE = el.sourceline +148 return el_class +
149 self._setClassLookup(lookup) +150 root = self.XML(xml_str) +151 self.assertEquals(root.sourceline, root.LINE) +152 +
153 - def test_lookup_getitem(self): +
154 el_class = self._buildElementClass() +155 el_class.CHILD_TAG = None +156 def lookup(doc, el): +157 el_class.CHILD_TAG = el[0].tag +158 return el_class +
159 self._setClassLookup(lookup) +160 root = self.XML(xml_str) +161 child_tag = root.CHILD_TAG +162 self.assertNotEquals(None, child_tag) +163 self.assertEquals(root[0].tag, child_tag) +164 +
165 - def test_lookup_getitem_neg(self): +
166 el_class = self._buildElementClass() +167 el_class.CHILD_TAG = None +168 def lookup(doc, el): +169 if el_class.CHILD_TAG is None: +170 el_class.CHILD_TAG = el[-1].tag +171 return el_class +
172 self._setClassLookup(lookup) +173 root = self.XML(xml_str) +174 child_tag = root.CHILD_TAG +175 self.assertNotEquals(None, child_tag) +176 self.assertEquals(root[-1].tag, child_tag) +177 +
178 - def test_lookup_getslice(self): +
179 el_class = self._buildElementClass() +180 el_class.CHILD_TAGS = None +181 def lookup(doc, el): +182 if el_class.CHILD_TAGS is None: +183 el_class.CHILD_TAGS = [ c.tag for c in el[1:-1] ] +184 return el_class +
185 self._setClassLookup(lookup) +186 root = self.XML(xml_str) +187 child_tags = root.CHILD_TAGS +188 self.assertNotEquals(None, child_tags) +189 self.assertEquals([ c.tag for c in root[1:-1] ], +190 child_tags) +191 +
192 - def test_lookup_len(self): +
193 el_class = self._buildElementClass() +194 el_class.LEN = None +195 def lookup(doc, el): +196 if el_class.LEN is None: +197 el_class.LEN = len(el) +198 return el_class +
199 self._setClassLookup(lookup) +200 root = self.XML(xml_str) +201 self.assertEquals(1, el_class.LEN) +202 +
203 - def test_lookup_bool(self): +
204 el_class = self._buildElementClass() +205 el_class.TRUE = None +206 def lookup(doc, el): +207 if el_class.TRUE is None: +208 el_class.TRUE = bool(el) +209 return el_class +
210 self._setClassLookup(lookup) +211 root = self.XML(xml_str) +212 self.assert_(el_class.TRUE) +213 +
214 - def test_lookup_get(self): +
215 el_class = self._buildElementClass() +216 el_class.VAL = None +217 def lookup(doc, el): +218 if el_class.VAL is None: +219 el_class.VAL = el[0].get('a1') +220 return el_class +
221 self._setClassLookup(lookup) +222 root = self.XML(xml_str) +223 self.assertNotEquals(None, el_class.VAL) +224 self.assertEquals(root[0].get('a1'), el_class.VAL) +225 +
226 - def test_lookup_get_default(self): +
227 el_class = self._buildElementClass() +228 default = str(id(el_class)) +229 el_class.VAL = None +230 def lookup(doc, el): +231 if el_class.VAL is None: +232 el_class.VAL = el[0].get('unknownattribute', default) +233 return el_class +
234 self._setClassLookup(lookup) +235 root = self.XML(xml_str) +236 self.assertEquals(default, el_class.VAL) +237 +
238 - def test_lookup_getchildren(self): +
239 el_class = self._buildElementClass() +240 el_class.CHILD_TAGS = None +241 def lookup(doc, el): +242 if el_class.CHILD_TAGS is None: +243 el_class.CHILD_TAGS = [ c.tag for c in el.getchildren() ] +244 return el_class +
245 self._setClassLookup(lookup) +246 root = self.XML(xml_str) +247 child_tags = root.CHILD_TAGS +248 self.assertNotEquals(None, child_tags) +249 self.assertEquals([ c.tag for c in root.getchildren() ], +250 child_tags) +251 +
252 - def test_lookup_iter_children(self): +
253 el_class = self._buildElementClass() +254 el_class.CHILD_TAGS = None +255 def lookup(doc, el): +256 if el_class.CHILD_TAGS is None: +257 el_class.CHILD_TAGS = [ c.tag for c in el ] +258 return el_class +
259 self._setClassLookup(lookup) +260 root = self.XML(xml_str) +261 child_tags = root.CHILD_TAGS +262 self.assertNotEquals(None, child_tags) +263 self.assertEquals([ c.tag for c in root.getchildren() ], +264 child_tags) +265 +
266 - def test_lookup_iterchildren(self): +
267 el_class = self._buildElementClass() +268 el_class.CHILD_TAGS = None +269 def lookup(doc, el): +270 if el_class.CHILD_TAGS is None: +271 el_class.CHILD_TAGS = [ c.tag for c in el.iterchildren() ] +272 return el_class +
273 self._setClassLookup(lookup) +274 root = self.XML(xml_str) +275 child_tags = root.CHILD_TAGS +276 self.assertNotEquals(None, child_tags) +277 self.assertEquals([ c.tag for c in root.getchildren() ], +278 child_tags) +279 +
281 el_class = self._buildElementClass() +282 el_class.CHILD_TAGS = None +283 def lookup(doc, el): +284 if not el_class.CHILD_TAGS: +285 el_class.CHILD_TAGS = [ +286 c.tag for c in el.iterchildren(tag='{objectified}c2') ] +287 return el_class +
288 self._setClassLookup(lookup) +289 +290 root = self.XML(xml_str) +291 child_tags = root.CHILD_TAGS +292 self.assertNotEquals(None, child_tags) +293 self.assertEquals([], child_tags) +294 +295 c1 = root[0] +296 child_tags = root.CHILD_TAGS +297 self.assertNotEquals(None, child_tags) +298 self.assertNotEquals([], child_tags) +299 self.assertEquals( +300 [ c.tag for c in root[0].iterchildren(tag='{objectified}c2') ], +301 child_tags) +302 +
303 - def test_lookup_getparent(self): +
304 el_class = self._buildElementClass() +305 el_class.PARENT = None +306 def lookup(doc, el): +307 if el_class.PARENT is None: +308 el_class.PARENT = el[0].getparent().tag +309 return el_class +
310 self._setClassLookup(lookup) +311 root = self.XML(xml_str) +312 self.assertEquals(root.tag, root.PARENT) +313 +
314 - def test_lookup_getnext(self): +
315 el_class = self._buildElementClass() +316 el_class.NEXT = None +317 def lookup(doc, el): +318 if el_class.NEXT is None: +319 el_class.NEXT = el[0][1].getnext().tag +320 return el_class +
321 self._setClassLookup(lookup) +322 root = self.XML(xml_str) +323 self.assertNotEquals(None, el_class.NEXT) +324 self.assertEquals(root[0][1].getnext().tag, el_class.NEXT) +325 +
326 - def test_lookup_getprevious(self): +
327 el_class = self._buildElementClass() +328 el_class.PREV = None +329 def lookup(doc, el): +330 if el_class.PREV is None: +331 el_class.PREV = el[0][1].getprevious().tag +332 return el_class +
333 self._setClassLookup(lookup) +334 root = self.XML(xml_str) +335 self.assertNotEquals(None, el_class.PREV) +336 self.assertEquals(root[0][1].getprevious().tag, el_class.PREV) +337 +338 +
339 -def test_suite(): +
340 suite = unittest.TestSuite() +341 suite.addTests([unittest.makeSuite(PyClassLookupTestCase)]) +342 return suite +
343 +344 if __name__ == '__main__': +345 print('to test use test.py %s' % __file__) +346 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html b/doc/html/api/lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html new file mode 100644 index 0000000..bbaebac --- /dev/null +++ b/doc/html/api/lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html @@ -0,0 +1,809 @@ + + + + + lxml.tests.test_pyclasslookup.PyClassLookupTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_pyclasslookup :: + Class PyClassLookupTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class PyClassLookupTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               PyClassLookupTestCase
+
+ +
+Test cases for the lxml.pyclasslookup class lookup mechanism. + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
Element(self, + _tag, + attrib=None, + nsmap=None, + **_extra)
+ Creates a new element associated with this parser.
+ source code + +
+ +
+   + + + + + + +
tearDown(self)
+ Hook method for deconstructing the test fixture after testing it.
+ source code + +
+ +
+   + + + + + + +
_setClassLookup(self, + lookup_function) + source code + +
+ +
+   + + + + + + +
_buildElementClass(self) + source code + +
+ +
+   + + + + + + +
XML(self, + xml) + source code + +
+ +
+   + + + + + + +
test_lookup(self) + source code + +
+ +
+   + + + + + + +
test_lookup_keep_ref_assertion(self) + source code + +
+ +
+   + + + + + + +
test_lookup_tag(self) + source code + +
+ +
+   + + + + + + +
test_lookup_text(self) + source code + +
+ +
+   + + + + + + +
test_lookup_tail(self) + source code + +
+ +
+   + + + + + + +
test_lookup_attrib(self) + source code + +
+ +
+   + + + + + + +
test_lookup_prefix(self) + source code + +
+ +
+   + + + + + + +
test_lookup_sourceline(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getitem(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getitem_neg(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getslice(self) + source code + +
+ +
+   + + + + + + +
test_lookup_len(self) + source code + +
+ +
+   + + + + + + +
test_lookup_bool(self) + source code + +
+ +
+   + + + + + + +
test_lookup_get(self) + source code + +
+ +
+   + + + + + + +
test_lookup_get_default(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getchildren(self) + source code + +
+ +
+   + + + + + + +
test_lookup_iter_children(self) + source code + +
+ +
+   + + + + + + +
test_lookup_iterchildren(self) + source code + +
+ +
+   + + + + + + +
test_lookup_iterchildren_tag(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getparent(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getnext(self) + source code + +
+ +
+   + + + + + + +
test_lookup_getprevious(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+   + + parser = etree.XMLParser() +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

tearDown(self) +

+
source code  +
+ + Hook method for deconstructing the test fixture after testing it. +
+
Overrides: + unittest.TestCase.tearDown +
(inherited documentation)
+ +
+
+
+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_relaxng-module.html b/doc/html/api/lxml.tests.test_relaxng-module.html new file mode 100644 index 0000000..b2cf530 --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng-module.html @@ -0,0 +1,238 @@ + + + + + lxml.tests.test_relaxng + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_relaxng + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_relaxng

source code

+Test cases related to RelaxNG parsing and validation + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeRelaxNGTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_relaxng-pysrc.html b/doc/html/api/lxml.tests.test_relaxng-pysrc.html new file mode 100644 index 0000000..7d1f2a4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng-pysrc.html @@ -0,0 +1,565 @@ + + + + + lxml.tests.test_relaxng + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_relaxng + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_relaxng

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to RelaxNG parsing and validation 
+  5  """ 
+  6   
+  7  import unittest, sys, os.path 
+  8   
+  9  this_dir = os.path.dirname(__file__) 
+ 10  if this_dir not in sys.path: 
+ 11      sys.path.insert(0, this_dir) # needed for Py3 
+ 12   
+ 13  from common_imports import etree, BytesIO, _bytes, HelperTestCase, fileInTestDir 
+ 14  from common_imports import doctest, make_doctest 
+ 15   
+
16 -class ETreeRelaxNGTestCase(HelperTestCase): +
17 - def test_relaxng(self): +
18 tree_valid = self.parse('<a><b></b></a>') + 19 tree_invalid = self.parse('<a><c></c></a>') + 20 schema = self.parse('''\ + 21 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 22 <zeroOrMore> + 23 <element name="b"> + 24 <text /> + 25 </element> + 26 </zeroOrMore> + 27 </element> + 28 ''') + 29 schema = etree.RelaxNG(schema) + 30 self.assert_(schema.validate(tree_valid)) + 31 self.assert_(not schema.validate(tree_invalid)) +
32 +
33 - def test_relaxng_stringio(self): +
34 tree_valid = self.parse('<a><b></b></a>') + 35 tree_invalid = self.parse('<a><c></c></a>') + 36 schema_file = BytesIO('''\ + 37 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 38 <zeroOrMore> + 39 <element name="b"> + 40 <text /> + 41 </element> + 42 </zeroOrMore> + 43 </element> + 44 ''') + 45 schema = etree.RelaxNG(file=schema_file) + 46 self.assert_(schema.validate(tree_valid)) + 47 self.assert_(not schema.validate(tree_invalid)) +
48 +
50 self.assertRaises(ValueError, etree.RelaxNG, etree.ElementTree()) +
51 +
52 - def test_relaxng_error(self): +
53 tree_invalid = self.parse('<a><c></c></a>') + 54 schema = self.parse('''\ + 55 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 56 <zeroOrMore> + 57 <element name="b"> + 58 <text /> + 59 </element> + 60 </zeroOrMore> + 61 </element> + 62 ''') + 63 schema = etree.RelaxNG(schema) + 64 self.assert_(not schema.validate(tree_invalid)) + 65 errors = schema.error_log + 66 self.assert_([ log for log in errors + 67 if log.level_name == "ERROR" ]) + 68 self.assert_([ log for log in errors + 69 if "not expect" in log.message ]) +
70 +
72 schema = self.parse('''\ + 73 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> + 74 <zeroOrMore> + 75 <element name="b" /> + 76 </zeroOrMore> + 77 </element> + 78 ''') + 79 self.assertRaises(etree.RelaxNGParseError, + 80 etree.RelaxNG, schema) +
81 +
83 schema = self.parse('''\ + 84 <grammar xmlns="http://relaxng.org/ns/structure/1.0" /> + 85 ''') + 86 self.assertRaises(etree.RelaxNGParseError, + 87 etree.RelaxNG, schema) +
88 +
90 schema = self.parse('''\ + 91 <grammar xmlns="http://relaxng.org/ns/structure/1.0"> + 92 <define name="test"> + 93 <element name="test"/> + 94 </define> + 95 </grammar> + 96 ''') + 97 self.assertRaises(etree.RelaxNGParseError, + 98 etree.RelaxNG, schema) +
99 +
101 # segfault +102 schema = self.parse('''\ +103 <element name="a" xmlns="mynamespace" /> +104 ''') +105 self.assertRaises(etree.RelaxNGParseError, +106 etree.RelaxNG, schema) +
107 +
108 - def test_relaxng_include(self): +
109 # this will only work if we access the file through path or +110 # file object.. +111 f = open(fileInTestDir('test1.rng'), 'rb') +112 schema = etree.RelaxNG(file=f) +
113 +
114 - def test_relaxng_shortcut(self): +
115 tree_valid = self.parse('<a><b></b></a>') +116 tree_invalid = self.parse('<a><c></c></a>') +117 schema = self.parse('''\ +118 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> +119 <zeroOrMore> +120 <element name="b"> +121 <text /> +122 </element> +123 </zeroOrMore> +124 </element> +125 ''') +126 self.assert_(tree_valid.relaxng(schema)) +127 self.assert_(not tree_invalid.relaxng(schema)) +
128 +
129 - def test_multiple_elementrees(self): +
130 tree = self.parse('<a><b>B</b><c>C</c></a>') +131 schema = etree.RelaxNG( self.parse('''\ +132 <element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> +133 <element name="b"> +134 <text /> +135 </element> +136 <element name="c"> +137 <text /> +138 </element> +139 </element> +140 ''') ) +141 self.assert_(schema.validate(tree)) +142 self.assert_(schema.validate(tree)) +143 +144 schema = etree.RelaxNG( self.parse('''\ +145 <element name="b" xmlns="http://relaxng.org/ns/structure/1.0"> +146 <text /> +147 </element> +148 ''') ) +149 c_tree = etree.ElementTree(tree.getroot()[1]) +150 self.assertEqual(self._rootstring(c_tree), _bytes('<c>C</c>')) +151 self.assert_(not schema.validate(c_tree)) +152 +153 b_tree = etree.ElementTree(tree.getroot()[0]) +154 self.assertEqual(self._rootstring(b_tree), _bytes('<b>B</b>')) +155 self.assert_(schema.validate(b_tree)) +
156 +157 +
158 -def test_suite(): +
159 suite = unittest.TestSuite() +160 suite.addTests([unittest.makeSuite(ETreeRelaxNGTestCase)]) +161 suite.addTests( +162 [make_doctest('../../../doc/validation.txt')]) +163 return suite +
164 +165 if __name__ == '__main__': +166 print('to test use test.py %s' % __file__) +167 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html b/doc/html/api/lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html new file mode 100644 index 0000000..8b82661 --- /dev/null +++ b/doc/html/api/lxml.tests.test_relaxng.ETreeRelaxNGTestCase-class.html @@ -0,0 +1,451 @@ + + + + + lxml.tests.test_relaxng.ETreeRelaxNGTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_relaxng :: + Class ETreeRelaxNGTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeRelaxNGTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeRelaxNGTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_relaxng(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_stringio(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_elementtree_error(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_error(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_invalid_schema(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_invalid_schema2(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_invalid_schema3(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_invalid_schema4(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_include(self) + source code + +
+ +
+   + + + + + + +
test_relaxng_shortcut(self) + source code + +
+ +
+   + + + + + + +
test_multiple_elementrees(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_sax-module.html b/doc/html/api/lxml.tests.test_sax-module.html new file mode 100644 index 0000000..e07acc6 --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax-module.html @@ -0,0 +1,238 @@ + + + + + lxml.tests.test_sax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_sax + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_sax

source code

+Test cases related to SAX I/O + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeSaxTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_sax-pysrc.html b/doc/html/api/lxml.tests.test_sax-pysrc.html new file mode 100644 index 0000000..37b3422 --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax-pysrc.html @@ -0,0 +1,613 @@ + + + + + lxml.tests.test_sax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_sax + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_sax

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to SAX I/O 
+  5  """ 
+  6   
+  7  import unittest, sys, os.path 
+  8   
+  9  this_dir = os.path.dirname(__file__) 
+ 10  if this_dir not in sys.path: 
+ 11      sys.path.insert(0, this_dir) # needed for Py3 
+ 12   
+ 13  from common_imports import HelperTestCase, doctest, make_doctest, BytesIO, _bytes 
+ 14  from lxml import sax 
+ 15  from xml.dom import pulldom 
+ 16   
+
17 -class ETreeSaxTestCase(HelperTestCase): +
18 +
19 - def test_etree_sax_simple(self): +
20 tree = self.parse('<a>ab<b/>ba</a>') + 21 xml_out = self._saxify_serialize(tree) + 22 self.assertEquals(_bytes('<a>ab<b/>ba</a>'), + 23 xml_out) +
24 +
25 - def test_etree_sax_double(self): +
26 tree = self.parse('<a>ab<b>bb</b>ba</a>') + 27 xml_out = self._saxify_serialize(tree) + 28 self.assertEquals(_bytes('<a>ab<b>bb</b>ba</a>'), + 29 xml_out) +
30 +
31 - def test_etree_sax_comment(self): +
32 tree = self.parse('<a>ab<!-- TEST -->ba</a>') + 33 xml_out = self._saxify_serialize(tree) + 34 self.assertEquals(_bytes('<a>abba</a>'), + 35 xml_out) +
36 +
37 - def test_etree_sax_pi(self): +
38 tree = self.parse('<a>ab<?this and that?>ba</a>') + 39 xml_out = self._saxify_serialize(tree) + 40 self.assertEquals(_bytes('<a>ab<?this and that?>ba</a>'), + 41 xml_out) +
42 +
44 tree = self.parse('<!-- TEST --><a>ab</a>') + 45 xml_out = self._saxify_serialize(tree) + 46 self.assertEquals(_bytes('<a>ab</a>'), + 47 xml_out) +
48 +
49 - def test_etree_sax_pi_root(self): +
50 tree = self.parse('<?this and that?><a>ab</a>') + 51 xml_out = self._saxify_serialize(tree) + 52 self.assertEquals(_bytes('<?this and that?><a>ab</a>'), + 53 xml_out) +
54 +
55 - def test_etree_sax_attributes(self): +
56 tree = self.parse('<a aa="5">ab<b b="5"/>ba</a>') + 57 xml_out = self._saxify_serialize(tree) + 58 self.assertEquals(_bytes('<a aa="5">ab<b b="5"/>ba</a>'), + 59 xml_out) +
60 +
61 - def test_etree_sax_ns1(self): +
62 tree = self.parse('<a xmlns="bla">ab<b>bb</b>ba</a>') + 63 new_tree = self._saxify_unsaxify(tree) + 64 root = new_tree.getroot() + 65 self.assertEqual('{bla}a', + 66 root.tag) + 67 self.assertEqual('{bla}b', + 68 root[0].tag) +
69 +
70 - def test_etree_sax_ns2(self): +
71 tree = self.parse('<a xmlns="blaA">ab<b:b xmlns:b="blaB">bb</b:b>ba</a>') + 72 new_tree = self._saxify_unsaxify(tree) + 73 root = new_tree.getroot() + 74 self.assertEqual('{blaA}a', + 75 root.tag) + 76 self.assertEqual('{blaB}b', + 77 root[0].tag) +
78 +
79 - def test_sax_to_pulldom(self): +
80 tree = self.parse('<a xmlns="blaA">ab<b:b xmlns:b="blaB">bb</b:b>ba</a>') + 81 handler = pulldom.SAX2DOM() + 82 sax.saxify(tree, handler) + 83 dom = handler.document + 84 + 85 self.assertEqual('a', + 86 dom.firstChild.localName) + 87 self.assertEqual('blaA', + 88 dom.firstChild.namespaceURI) + 89 + 90 children = dom.firstChild.childNodes + 91 self.assertEqual('ab', + 92 children[0].nodeValue) + 93 self.assertEqual('blaB', + 94 children[1].namespaceURI) + 95 self.assertEqual('ba', + 96 children[2].nodeValue) +
97 +
98 - def test_element_sax(self): +
99 tree = self.parse('<a><b/></a>') +100 a = tree.getroot() +101 b = a[0] +102 +103 xml_out = self._saxify_serialize(a) +104 self.assertEquals(_bytes('<a><b/></a>'), +105 xml_out) +106 +107 xml_out = self._saxify_serialize(b) +108 self.assertEquals(_bytes('<b/>'), +109 xml_out) +
110 +
111 - def test_element_sax_ns(self): +
112 tree = self.parse('<a:a xmlns:a="blaA"><b/></a:a>') +113 a = tree.getroot() +114 b = a[0] +115 +116 new_tree = self._saxify_unsaxify(a) +117 root = new_tree.getroot() +118 self.assertEqual('{blaA}a', +119 root.tag) +120 self.assertEqual('b', +121 root[0].tag) +122 +123 new_tree = self._saxify_unsaxify(b) +124 root = new_tree.getroot() +125 self.assertEqual('b', +126 root.tag) +127 self.assertEqual(0, +128 len(root)) +
129 +
131 handler = sax.ElementTreeContentHandler() +132 handler.startDocument() +133 handler.startPrefixMapping(None, 'blaA') +134 handler.startElementNS(('blaA', 'a'), 'a', {}) +135 handler.startPrefixMapping(None, 'blaB') +136 handler.startElementNS(('blaB', 'b'), 'b', {}) +137 handler.endElementNS( ('blaB', 'b'), 'b') +138 handler.endPrefixMapping(None) +139 handler.startElementNS(('blaA', 'c'), 'c', {}) +140 handler.endElementNS( ('blaA', 'c'), 'c') +141 handler.endElementNS( ('blaA', 'a'), 'a') +142 handler.endPrefixMapping(None) +143 handler.endDocument() +144 +145 new_tree = handler.etree +146 root = new_tree.getroot() +147 self.assertEqual('{blaA}a', +148 root.tag) +149 self.assertEqual('{blaB}b', +150 root[0].tag) +151 self.assertEqual('{blaA}c', +152 root[1].tag) +
153 +
154 - def test_etree_sax_redefine_ns(self): +
155 handler = sax.ElementTreeContentHandler() +156 handler.startDocument() +157 handler.startPrefixMapping('ns', 'blaA') +158 handler.startElementNS(('blaA', 'a'), 'ns:a', {}) +159 handler.startPrefixMapping('ns', 'blaB') +160 handler.startElementNS(('blaB', 'b'), 'ns:b', {}) +161 handler.endElementNS( ('blaB', 'b'), 'ns:b') +162 handler.endPrefixMapping('ns') +163 handler.startElementNS(('blaA', 'c'), 'ns:c', {}) +164 handler.endElementNS( ('blaA', 'c'), 'ns:c') +165 handler.endElementNS( ('blaA', 'a'), 'ns:a') +166 handler.endPrefixMapping('ns') +167 handler.endDocument() +168 +169 new_tree = handler.etree +170 root = new_tree.getroot() +171 self.assertEqual('{blaA}a', +172 root.tag) +173 self.assertEqual('{blaB}b', +174 root[0].tag) +175 self.assertEqual('{blaA}c', +176 root[1].tag) +
177 +
178 - def test_etree_sax_no_ns(self): +
179 handler = sax.ElementTreeContentHandler() +180 handler.startDocument() +181 handler.startElement('a', {}) +182 handler.startElement('b', {}) +183 handler.endElement('b') +184 handler.startElement('c') # with empty attributes +185 handler.endElement('c') +186 handler.endElement('a') +187 handler.endDocument() +188 +189 new_tree = handler.etree +190 root = new_tree.getroot() +191 self.assertEqual('a', root.tag) +192 self.assertEqual('b', root[0].tag) +193 self.assertEqual('c', root[1].tag) +
194 +
195 - def test_etree_sax_error(self): +
196 handler = sax.ElementTreeContentHandler() +197 handler.startDocument() +198 handler.startElement('a') +199 self.assertRaises(sax.SaxError, handler.endElement, 'b') +
200 +
201 - def test_etree_sax_error2(self): +
202 handler = sax.ElementTreeContentHandler() +203 handler.startDocument() +204 handler.startElement('a') +205 handler.startElement('b') +206 self.assertRaises(sax.SaxError, handler.endElement, 'a') +
207 +
208 - def _saxify_unsaxify(self, saxifiable): +
209 handler = sax.ElementTreeContentHandler() +210 sax.ElementTreeProducer(saxifiable, handler).saxify() +211 return handler.etree +
212 +
213 - def _saxify_serialize(self, tree): +
214 new_tree = self._saxify_unsaxify(tree) +215 f = BytesIO() +216 new_tree.write(f) +217 return f.getvalue().replace(_bytes('\n'), _bytes('')) +
218 +219 +
220 -def test_suite(): +
221 suite = unittest.TestSuite() +222 suite.addTests([unittest.makeSuite(ETreeSaxTestCase)]) +223 suite.addTests( +224 [make_doctest('../../../doc/sax.txt')]) +225 return suite +
226 +227 if __name__ == '__main__': +228 print('to test use test.py %s' % __file__) +229 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_sax.ETreeSaxTestCase-class.html b/doc/html/api/lxml.tests.test_sax.ETreeSaxTestCase-class.html new file mode 100644 index 0000000..c46b41b --- /dev/null +++ b/doc/html/api/lxml.tests.test_sax.ETreeSaxTestCase-class.html @@ -0,0 +1,581 @@ + + + + + lxml.tests.test_sax.ETreeSaxTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_sax :: + Class ETreeSaxTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeSaxTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeSaxTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_etree_sax_simple(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_double(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_comment(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_pi(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_comment_root(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_pi_root(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_attributes(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_ns1(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_ns2(self) + source code + +
+ +
+   + + + + + + +
test_sax_to_pulldom(self) + source code + +
+ +
+   + + + + + + +
test_element_sax(self) + source code + +
+ +
+   + + + + + + +
test_element_sax_ns(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_handler_default_ns(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_redefine_ns(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_no_ns(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_error(self) + source code + +
+ +
+   + + + + + + +
test_etree_sax_error2(self) + source code + +
+ +
+   + + + + + + +
_saxify_unsaxify(self, + saxifiable) + source code + +
+ +
+   + + + + + + +
_saxify_serialize(self, + tree) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_schematron-module.html b/doc/html/api/lxml.tests.test_schematron-module.html new file mode 100644 index 0000000..0023e98 --- /dev/null +++ b/doc/html/api/lxml.tests.test_schematron-module.html @@ -0,0 +1,238 @@ + + + + + lxml.tests.test_schematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_schematron + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_schematron

source code

+Test cases related to Schematron parsing and validation + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeSchematronTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_schematron-pysrc.html b/doc/html/api/lxml.tests.test_schematron-pysrc.html new file mode 100644 index 0000000..37e4152 --- /dev/null +++ b/doc/html/api/lxml.tests.test_schematron-pysrc.html @@ -0,0 +1,342 @@ + + + + + lxml.tests.test_schematron + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_schematron + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_schematron

+
+ 1  # -*- coding: utf-8 -*- 
+ 2   
+ 3  """ 
+ 4  Test cases related to Schematron parsing and validation 
+ 5  """ 
+ 6   
+ 7  import unittest, sys, os.path 
+ 8   
+ 9  this_dir = os.path.dirname(__file__) 
+10  if this_dir not in sys.path: 
+11      sys.path.insert(0, this_dir) # needed for Py3 
+12   
+13  from common_imports import etree, HelperTestCase, fileInTestDir 
+14  from common_imports import doctest, make_doctest 
+15   
+
16 -class ETreeSchematronTestCase(HelperTestCase): +
17 - def test_schematron(self): +
18 tree_valid = self.parse('<AAA><BBB/><CCC/></AAA>') +19 tree_invalid = self.parse('<AAA><BBB/><CCC/><DDD/></AAA>') +20 schema = self.parse('''\ +21 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > +22 <pattern name="Open model"> +23 <rule context="AAA"> +24 <assert test="BBB"> BBB element is not present</assert> +25 <assert test="CCC"> CCC element is not present</assert> +26 </rule> +27 </pattern> +28 <pattern name="Closed model"> +29 <rule context="AAA"> +30 <assert test="BBB"> BBB element is not present</assert> +31 <assert test="CCC"> CCC element is not present</assert> +32 <assert test="count(BBB|CCC) = count (*)">There is an extra element</assert> +33 </rule> +34 </pattern> +35 </schema> +36 ''') +37 schema = etree.Schematron(schema) +38 self.assert_(schema.validate(tree_valid)) +39 self.assert_(not schema.validate(tree_invalid)) +
40 +
42 self.assertRaises(ValueError, etree.Schematron, etree.ElementTree()) +
43 +
45 schema = self.parse('''\ +46 <schema xmlns="http://purl.oclc.org/dsdl/schematron" > +47 <pattern name="Open model"> +48 </pattern> +49 </schema> +50 ''') +51 self.assertRaises(etree.SchematronParseError, +52 etree.Schematron, schema) +
53 +
55 schema = self.parse('''\ +56 <schema xmlns="http://purl.oclc.org/dsdl/schematron" /> +57 ''') +58 self.assertRaises(etree.SchematronParseError, +59 etree.Schematron, schema) +
60 +
62 # segfault +63 schema = self.parse('''\ +64 <schema xmlns="mynamespace" /> +65 ''') +66 self.assertRaises(etree.SchematronParseError, +67 etree.Schematron, schema) +
68 +69 +
70 -def test_suite(): +
71 suite = unittest.TestSuite() +72 suite.addTests([unittest.makeSuite(ETreeSchematronTestCase)]) +73 suite.addTests( +74 [make_doctest('../../../doc/validation.txt')]) +75 return suite +
76 +77 if __name__ == '__main__': +78 print('to test use test.py %s' % __file__) +79 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_schematron.ETreeSchematronTestCase-class.html b/doc/html/api/lxml.tests.test_schematron.ETreeSchematronTestCase-class.html new file mode 100644 index 0000000..d86e187 --- /dev/null +++ b/doc/html/api/lxml.tests.test_schematron.ETreeSchematronTestCase-class.html @@ -0,0 +1,355 @@ + + + + + lxml.tests.test_schematron.ETreeSchematronTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_schematron :: + Class ETreeSchematronTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeSchematronTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeSchematronTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_schematron(self) + source code + +
+ +
+   + + + + + + +
test_schematron_elementtree_error(self) + source code + +
+ +
+   + + + + + + +
test_schematron_invalid_schema(self) + source code + +
+ +
+   + + + + + + +
test_schematron_invalid_schema_empty(self) + source code + +
+ +
+   + + + + + + +
test_schematron_invalid_schema_namespace(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading-module.html b/doc/html/api/lxml.tests.test_threading-module.html new file mode 100644 index 0000000..ff0613c --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading-module.html @@ -0,0 +1,247 @@ + + + + + lxml.tests.test_threading + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_threading

source code

+Tests for thread usage in lxml.etree. + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ThreadingTestCase
+ Threading tests +
+   + + ThreadPipelineTestCase
+ Threading tests based on a thread worker pipeline. +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading-pysrc.html b/doc/html/api/lxml.tests.test_threading-pysrc.html new file mode 100644 index 0000000..26322c4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading-pysrc.html @@ -0,0 +1,1194 @@ + + + + + lxml.tests.test_threading + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_threading

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Tests for thread usage in lxml.etree. 
+  5  """ 
+  6   
+  7  import unittest, threading, sys, os.path 
+  8   
+  9  this_dir = os.path.dirname(__file__) 
+ 10  if this_dir not in sys.path: 
+ 11      sys.path.insert(0, this_dir) # needed for Py3 
+ 12   
+ 13  from common_imports import etree, HelperTestCase, BytesIO, _bytes 
+ 14   
+ 15  try: 
+ 16      from Queue import Queue 
+ 17  except ImportError: 
+ 18      from queue import Queue # Py3 
+ 19   
+
20 -class ThreadingTestCase(HelperTestCase): +
21 """Threading tests""" + 22 etree = etree + 23 +
24 - def _run_thread(self, func): +
25 thread = threading.Thread(target=func) + 26 thread.start() + 27 thread.join() +
28 +
29 - def test_subtree_copy_thread(self): +
30 tostring = self.etree.tostring + 31 XML = self.etree.XML + 32 xml = _bytes("<root><threadtag/></root>") + 33 main_root = XML(_bytes("<root/>")) + 34 + 35 def run_thread(): + 36 thread_root = XML(xml) + 37 main_root.append(thread_root[0]) + 38 del thread_root +
39 + 40 self._run_thread(run_thread) + 41 self.assertEquals(xml, tostring(main_root)) +
42 +
43 - def test_main_xslt_in_thread(self): +
44 XML = self.etree.XML + 45 style = XML(_bytes('''\ + 46 <xsl:stylesheet version="1.0" + 47 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 48 <xsl:template match="*"> + 49 <foo><xsl:copy><xsl:value-of select="/a/b/text()" /></xsl:copy></foo> + 50 </xsl:template> + 51 </xsl:stylesheet>''')) + 52 st = etree.XSLT(style) + 53 + 54 result = [] + 55 + 56 def run_thread(): + 57 root = XML(_bytes('<a><b>B</b><c>C</c></a>')) + 58 result.append( st(root) ) +
59 + 60 self._run_thread(run_thread) + 61 self.assertEquals('''\ + 62 <?xml version="1.0"?> + 63 <foo><a>B</a></foo> + 64 ''', + 65 str(result[0])) + 66 +
67 - def test_thread_xslt(self): +
68 XML = self.etree.XML + 69 tostring = self.etree.tostring + 70 root = XML(_bytes('<a><b>B</b><c>C</c></a>')) + 71 + 72 def run_thread(): + 73 style = XML(_bytes('''\ + 74 <xsl:stylesheet version="1.0" + 75 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 76 <xsl:template match="*"> + 77 <foo><xsl:copy><xsl:value-of select="/a/b/text()" /></xsl:copy></foo> + 78 </xsl:template> + 79 </xsl:stylesheet>''')) + 80 st = etree.XSLT(style) + 81 root.append( st(root).getroot() ) +
82 + 83 self._run_thread(run_thread) + 84 self.assertEquals(_bytes('<a><b>B</b><c>C</c><foo><a>B</a></foo></a>'), + 85 tostring(root)) + 86 +
88 # this is the only case in XSLT where the result tree can be + 89 # modified in-place + 90 XML = self.etree.XML + 91 tostring = self.etree.tostring + 92 style = self.etree.XSLT(XML(_bytes('''\ + 93 <xsl:stylesheet version="1.0" + 94 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 95 <xsl:template match="*"> + 96 <root class="abc"> + 97 <xsl:copy-of select="@class" /> + 98 <xsl:attribute name="class">xyz</xsl:attribute> + 99 </root> +100 </xsl:template> +101 </xsl:stylesheet>'''))) +102 +103 result = [] +104 def run_thread(): +105 root = XML(_bytes('<ROOT class="ABC" />')) +106 result.append( style(root).getroot() ) +
107 +108 self._run_thread(run_thread) +109 self.assertEquals(_bytes('<root class="xyz"/>'), +110 tostring(result[0])) +111 +
112 - def test_thread_create_xslt(self): +
113 XML = self.etree.XML +114 tostring = self.etree.tostring +115 root = XML(_bytes('<a><b>B</b><c>C</c></a>')) +116 +117 stylesheets = [] +118 +119 def run_thread(): +120 style = XML(_bytes('''\ +121 <xsl:stylesheet +122 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +123 version="1.0"> +124 <xsl:output method="xml" /> +125 <xsl:template match="/"> +126 <div id="test"> +127 <xsl:apply-templates/> +128 </div> +129 </xsl:template> +130 </xsl:stylesheet>''')) +131 stylesheets.append( etree.XSLT(style) ) +
132 +133 self._run_thread(run_thread) +134 +135 st = stylesheets[0] +136 result = tostring( st(root) ) +137 +138 self.assertEquals(_bytes('<div id="test">BC</div>'), +139 result) +140 +
141 - def test_thread_error_log(self): +
142 XML = self.etree.XML +143 ParseError = self.etree.ParseError +144 expected_error = [self.etree.ErrorTypes.ERR_TAG_NAME_MISMATCH] +145 children = "<a>test</a>" * 100 +146 +147 def parse_error_test(thread_no): +148 tag = "tag%d" % thread_no +149 xml = "<%s>%s</%s>" % (tag, children, tag.upper()) +150 parser = self.etree.XMLParser() +151 for _ in range(10): +152 errors = None +153 try: +154 XML(xml, parser) +155 except self.etree.ParseError: +156 e = sys.exc_info()[1] +157 errors = e.error_log.filter_types(expected_error) +158 self.assert_(errors, "Expected error not found") +159 for error in errors: +160 self.assert_( +161 tag in error.message and tag.upper() in error.message, +162 "%s and %s not found in '%s'" % ( +163 tag, tag.upper(), error.message)) +
164 +165 self.etree.clear_error_log() +166 threads = [] +167 for thread_no in range(1, 10): +168 t = threading.Thread(target=parse_error_test, +169 args=(thread_no,)) +170 threads.append(t) +171 t.start() +172 +173 parse_error_test(0) +174 +175 for t in threads: +176 t.join() +177 +
178 - def test_thread_mix(self): +
179 XML = self.etree.XML +180 Element = self.etree.Element +181 SubElement = self.etree.SubElement +182 tostring = self.etree.tostring +183 xml = _bytes('<a><b>B</b><c xmlns="test">C</c></a>') +184 root = XML(xml) +185 fragment = XML(_bytes("<other><tags/></other>")) +186 +187 result = self.etree.Element("{myns}root", att = "someval") +188 +189 def run_XML(): +190 thread_root = XML(xml) +191 result.append(thread_root[0]) +192 result.append(thread_root[-1]) +
193 +194 def run_parse(): +195 thread_root = self.etree.parse(BytesIO(xml)).getroot() +196 result.append(thread_root[0]) +197 result.append(thread_root[-1]) +198 +199 def run_move_main(): +200 result.append(fragment[0]) +201 +202 def run_build(): +203 result.append( +204 Element("{myns}foo", attrib={'{test}attr':'val'})) +205 SubElement(result, "{otherns}tasty") +206 +207 def run_xslt(): +208 style = XML(_bytes('''\ +209 <xsl:stylesheet version="1.0" +210 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +211 <xsl:template match="*"> +212 <foo><xsl:copy><xsl:value-of select="/a/b/text()" /></xsl:copy></foo> +213 </xsl:template> +214 </xsl:stylesheet>''')) +215 st = etree.XSLT(style) +216 result.append( st(root).getroot()[0] ) +217 +218 for test in (run_XML, run_parse, run_move_main, run_xslt): +219 tostring(result) +220 self._run_thread(test) +221 +222 self.assertEquals( +223 _bytes('<ns0:root xmlns:ns0="myns" att="someval"><b>B</b><c xmlns="test">C</c><b>B</b><c xmlns="test">C</c><tags/><a>B</a></ns0:root>'), +224 tostring(result)) +225 +226 def strip_first(): +227 root = Element("newroot") +228 root.append(result[0]) +229 +230 while len(result): +231 self._run_thread(strip_first) +232 +233 self.assertEquals( +234 _bytes('<ns0:root xmlns:ns0="myns" att="someval"/>'), +235 tostring(result)) +236 +
237 - def test_concurrent_proxies(self): +
238 XML = self.etree.XML +239 root = XML(_bytes('<root><a>A</a><b xmlns="test">B</b><c/></root>')) +240 child_count = len(root) +241 def testrun(): +242 for i in range(10000): +243 el = root[i%child_count] +244 del el +
245 threads = [ threading.Thread(target=testrun) +246 for _ in range(10) ] +247 for thread in threads: +248 thread.start() +249 for thread in threads: +250 thread.join() +251 +
253 XML = self.etree.XML +254 +255 class TestElement(etree.ElementBase): +256 pass +
257 +258 class MyLookup(etree.CustomElementClassLookup): +259 repeat = range(100) +260 def lookup(self, t, d, ns, name): +261 count = 0 +262 for i in self.repeat: +263 # allow other threads to run +264 count += 1 +265 return TestElement +266 +267 parser = self.etree.XMLParser() +268 parser.set_element_class_lookup(MyLookup()) +269 +270 root = XML(_bytes('<root><a>A</a><b xmlns="test">B</b><c/></root>'), +271 parser) +272 +273 child_count = len(root) +274 def testrun(): +275 for i in range(1000): +276 el = root[i%child_count] +277 del el +278 threads = [ threading.Thread(target=testrun) +279 for _ in range(10) ] +280 for thread in threads: +281 thread.start() +282 for thread in threads: +283 thread.join() +284 +285 +
286 -class ThreadPipelineTestCase(HelperTestCase): +
287 """Threading tests based on a thread worker pipeline. +288 """ +289 etree = etree +290 item_count = 20 +291 +
292 - class Worker(threading.Thread): +
293 - def __init__(self, in_queue, in_count, **kwargs): +
294 threading.Thread.__init__(self) +295 self.in_queue = in_queue +296 self.in_count = in_count +297 self.out_queue = Queue(in_count) +298 self.__dict__.update(kwargs) +
299 - def run(self): +
300 get, put = self.in_queue.get, self.out_queue.put +301 handle = self.handle +302 for _ in range(self.in_count): +303 put(handle(get())) +
304 +
305 - class ParseWorker(Worker): +
306 XML = etree.XML +
307 - def handle(self, xml): +
308 return self.XML(xml) +
309 - class RotateWorker(Worker): +
310 - def handle(self, element): +
311 first = element[0] +312 element[:] = element[1:] +313 element.append(first) +314 return element +
315 - class ReverseWorker(Worker): +
316 - def handle(self, element): +
317 element[:] = element[::-1] +318 return element +
319 - class ParseAndExtendWorker(Worker): +
320 XML = etree.XML +
321 - def handle(self, element): +
322 element.extend(self.XML(self.xml)) +323 return element +
324 - class SerialiseWorker(Worker): +
325 - def handle(self, element): +
326 return etree.tostring(element) +
327 +328 xml = _bytes('''\ +329 <xsl:stylesheet +330 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +331 version="1.0"> +332 <xsl:output method="xml" /> +333 <xsl:template match="/"> +334 <div id="test"> +335 <xsl:apply-templates/> +336 </div> +337 </xsl:template> +338 </xsl:stylesheet>''') +339 +
340 - def _build_pipeline(self, item_count, *classes, **kwargs): +
341 in_queue = Queue(item_count) +342 start = last = classes[0](in_queue, item_count, **kwargs) +343 start.setDaemon(True) +344 for worker_class in classes[1:]: +345 last = worker_class(last.out_queue, item_count, **kwargs) +346 last.setDaemon(True) +347 last.start() +348 return (in_queue, start, last) +
349 +
351 item_count = self.item_count +352 # build and start the pipeline +353 in_queue, start, last = self._build_pipeline( +354 item_count, +355 self.ParseWorker, +356 self.RotateWorker, +357 self.ReverseWorker, +358 self.ParseAndExtendWorker, +359 self.SerialiseWorker, +360 xml = self.xml) +361 +362 # fill the queue +363 put = start.in_queue.put +364 for _ in range(item_count): +365 put(self.xml) +366 +367 # start the first thread and thus everything +368 start.start() +369 # make sure the last thread has terminated +370 last.join(60) # time out after 60 seconds +371 self.assertEquals(item_count, last.out_queue.qsize()) +372 # read the results +373 get = last.out_queue.get +374 results = [ get() for _ in range(item_count) ] +375 +376 comparison = results[0] +377 for i, result in enumerate(results[1:]): +378 self.assertEquals(comparison, result) +
379 +
381 item_count = self.item_count +382 XML = self.etree.XML +383 # build and start the pipeline +384 in_queue, start, last = self._build_pipeline( +385 item_count, +386 self.RotateWorker, +387 self.ReverseWorker, +388 self.ParseAndExtendWorker, +389 self.SerialiseWorker, +390 xml = self.xml) +391 +392 # fill the queue +393 put = start.in_queue.put +394 for _ in range(item_count): +395 put(XML(self.xml)) +396 +397 # start the first thread and thus everything +398 start.start() +399 # make sure the last thread has terminated +400 last.join(60) # time out after 90 seconds +401 self.assertEquals(item_count, last.out_queue.qsize()) +402 # read the results +403 get = last.out_queue.get +404 results = [ get() for _ in range(item_count) ] +405 +406 comparison = results[0] +407 for i, result in enumerate(results[1:]): +408 self.assertEquals(comparison, result) +
409 +410 +
411 -def test_suite(): +
412 suite = unittest.TestSuite() +413 suite.addTests([unittest.makeSuite(ThreadingTestCase)]) +414 suite.addTests([unittest.makeSuite(ThreadPipelineTestCase)]) +415 return suite +
416 +417 if __name__ == '__main__': +418 print('to test use test.py %s' % __file__) +419 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase-class.html new file mode 100644 index 0000000..50df708 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase-class.html @@ -0,0 +1,462 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ThreadPipelineTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ThreadPipelineTestCase
+
+ +
+Threading tests based on a thread worker pipeline. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + Worker +
+   + + ParseWorker +
+   + + RotateWorker +
+   + + ReverseWorker +
+   + + ParseAndExtendWorker +
+   + + SerialiseWorker +
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_build_pipeline(self, + item_count, + *classes, + **kwargs) + source code + +
+ +
+   + + + + + + +
test_thread_pipeline_thread_parse(self) + source code + +
+ +
+   + + + + + + +
test_thread_pipeline_global_parse(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+   + + item_count = 20 +
+   + + xml = '<xsl:stylesheet\n xmlns:xsl="http://www.w3.org/1999/... +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+ +
+ +
+

xml

+ +
+
+
+
Value:
+
+'''<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+  <xsl:output method="xml" />
+  <xsl:template match="/">
+     <div id="test">
+       <xsl:apply-templates/>
+     </div>
+...
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html new file mode 100644 index 0000000..e410e22 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html @@ -0,0 +1,295 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class ParseAndExtendWorker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParseAndExtendWorker

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.ParseAndExtendWorker
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
XML(text, + parser=None, + base_url=None)
+ Parses an XML document or fragment from a string constant.
+ + +
+ +
+   + + + + + + +
handle(self, + element) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _set_daemon +

+

Inherited from threading._Verbose (private): + _note +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

XML(text, + parser=None, + base_url=None) +

+
  +
+ +

Parses an XML document or fragment from a string constant. +Returns the root node (or the result returned by a parser target). +This function can be used to embed "XML literals" in Python code, +like in

+
+
+>>> root = etree.XML("<root><test/></root>")
+
+

To override the parser with a different XMLParser you can pass it to +the parser keyword argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html new file mode 100644 index 0000000..f2d3cc7 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html @@ -0,0 +1,295 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class ParseWorker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ParseWorker

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.ParseWorker
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
XML(text, + parser=None, + base_url=None)
+ Parses an XML document or fragment from a string constant.
+ + +
+ +
+   + + + + + + +
handle(self, + xml) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _set_daemon +

+

Inherited from threading._Verbose (private): + _note +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

XML(text, + parser=None, + base_url=None) +

+
  +
+ +

Parses an XML document or fragment from a string constant. +Returns the root node (or the result returned by a parser target). +This function can be used to embed "XML literals" in Python code, +like in

+
+
+>>> root = etree.XML("<root><test/></root>")
+
+

To override the parser with a different XMLParser you can pass it to +the parser keyword argument.

+

The base_url keyword argument allows to set the original base URL of +the document to support relative Paths when looking up external entities +(DTD, XInclude, ...).

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html new file mode 100644 index 0000000..9034c49 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html @@ -0,0 +1,224 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class ReverseWorker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ReverseWorker

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.ReverseWorker
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
handle(self, + element) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _set_daemon +

+

Inherited from threading._Verbose (private): + _note +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html new file mode 100644 index 0000000..a5f25e7 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html @@ -0,0 +1,224 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class RotateWorker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RotateWorker

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.RotateWorker
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
handle(self, + element) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _set_daemon +

+

Inherited from threading._Verbose (private): + _note +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html new file mode 100644 index 0000000..be3ed67 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html @@ -0,0 +1,224 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class SerialiseWorker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SerialiseWorker

source code

+
+           object --+            
+                    |            
+   threading._Verbose --+        
+                        |        
+         threading.Thread --+    
+                            |    
+ThreadPipelineTestCase.Worker --+
+                                |
+                               ThreadPipelineTestCase.SerialiseWorker
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
handle(self, + element) + source code + +
+ +
+

Inherited from Worker: + __init__, + run +

+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _set_daemon +

+

Inherited from threading._Verbose (private): + _note +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html new file mode 100644 index 0000000..b4130b7 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html @@ -0,0 +1,311 @@ + + + + + lxml.tests.test_threading.ThreadPipelineTestCase.Worker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadPipelineTestCase :: + Class Worker + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Worker

source code

+
+        object --+        
+                 |        
+threading._Verbose --+    
+                     |    
+      threading.Thread --+
+                         |
+                        ThreadPipelineTestCase.Worker
+
+ +
Known Subclasses:
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + in_queue, + in_count, + **kwargs)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
run(self) + source code + +
+ +
+

Inherited from threading.Thread: + __repr__, + getName, + isAlive, + isDaemon, + join, + setDaemon, + setName, + start +

+

Inherited from threading.Thread (private): + _set_daemon +

+

Inherited from threading._Verbose (private): + _note +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + in_queue, + in_count, + **kwargs) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

run(self) +

+
source code  +
+ + +
+
Overrides: + threading.Thread.run +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_threading.ThreadingTestCase-class.html b/doc/html/api/lxml.tests.test_threading.ThreadingTestCase-class.html new file mode 100644 index 0000000..c07b946 --- /dev/null +++ b/doc/html/api/lxml.tests.test_threading.ThreadingTestCase-class.html @@ -0,0 +1,482 @@ + + + + + lxml.tests.test_threading.ThreadingTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_threading :: + Class ThreadingTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ThreadingTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ThreadingTestCase
+
+ +
+Threading tests + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
_run_thread(self, + func) + source code + +
+ +
+   + + + + + + +
test_subtree_copy_thread(self) + source code + +
+ +
+   + + + + + + +
test_main_xslt_in_thread(self) + source code + +
+ +
+   + + + + + + +
test_thread_xslt(self) + source code + +
+ +
+   + + + + + + +
test_thread_xslt_attr_replace(self) + source code + +
+ +
+   + + + + + + +
test_thread_create_xslt(self) + source code + +
+ +
+   + + + + + + +
test_thread_error_log(self) + source code + +
+ +
+   + + + + + + +
test_thread_mix(self) + source code + +
+ +
+   + + + + + + +
test_concurrent_proxies(self) + source code + +
+ +
+   + + + + + + +
test_concurrent_class_lookup(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + etree
+ The lxml.etree module implements the extended ElementTree API +for XML. +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

etree

+ The lxml.etree module implements the extended ElementTree API +for XML. +
+
+
+
Value:
+
lxml.etree
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_unicode-module.html b/doc/html/api/lxml.tests.test_unicode-module.html new file mode 100644 index 0000000..304507c --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode-module.html @@ -0,0 +1,289 @@ + + + + + lxml.tests.test_unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_unicode + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_unicode

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + UnicodeTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + ascii_uni = u'a' +
+   + + klingon = u'' +
+   + + invalid_tag = u'test' +
+   + + uni = u'Ãڀㄠ' +
+   + + uxml = u'<test><title>test áㄠ</title><h1>page áㄠ title</h1><... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+ +
+ +
+

uxml

+ +
+
+
+
Value:
+
+u'<test><title>test áㄠ</title><h1>page áㄠ title</h1></test>'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_unicode-pysrc.html b/doc/html/api/lxml.tests.test_unicode-pysrc.html new file mode 100644 index 0000000..3140c42 --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode-pysrc.html @@ -0,0 +1,440 @@ + + + + + lxml.tests.test_unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_unicode + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_unicode

+
+ 1  # -*- coding: utf-8 -*- 
+ 2  import unittest, doctest, sys, os.path 
+ 3   
+ 4  this_dir = os.path.dirname(__file__) 
+ 5  if this_dir not in sys.path: 
+ 6      sys.path.insert(0, this_dir) # needed for Py3 
+ 7   
+ 8  from common_imports import StringIO, etree, SillyFileLike, HelperTestCase 
+ 9  from common_imports import _str, _bytes 
+10   
+11  try: 
+12      unicode = __builtins__["unicode"] 
+13  except (NameError, KeyError): 
+14      unicode = str 
+15   
+16  ascii_uni = _str('a') 
+17   
+18  klingon = _bytes("\\uF8D2").decode("unicode_escape") # not valid for XML names 
+19   
+20  invalid_tag = _str("test") + klingon 
+21   
+22  uni = _bytes('\\xc3\\u0680\\u3120').decode("unicode_escape") # some non-ASCII characters 
+23   
+24  uxml = _bytes("<test><title>test \\xc3\\xa1\\u3120</title><h1>page \\xc3\\xa1\\u3120 title</h1></test>" 
+25                ).decode("unicode_escape") 
+26   
+
27 -class UnicodeTestCase(HelperTestCase): +
28 - def test_unicode_xml(self): +
29 tree = etree.XML(_str('<p>%s</p>') % uni) +30 self.assertEquals(uni, tree.text) +
31 +
32 - def test_unicode_xml_broken(self): +
33 uxml = _str('<?xml version="1.0" encoding="UTF-8"?>') + \ +34 _str('<p>%s</p>') % uni +35 self.assertRaises(ValueError, etree.XML, uxml) +
36 +
37 - def test_unicode_tag(self): +
38 el = etree.Element(uni) +39 self.assertEquals(uni, el.tag) +
40 +
41 - def test_unicode_tag_invalid(self): +
42 # sadly, Klingon is not well-formed +43 self.assertRaises(ValueError, etree.Element, invalid_tag) +
44 +
45 - def test_unicode_nstag(self): +
46 tag = _str("{%s}%s") % (uni, uni) +47 el = etree.Element(tag) +48 self.assertEquals(tag, el.tag) +
49 +
51 # sadly, Klingon is not well-formed +52 tag = _str("{%s}%s") % (uni, invalid_tag) +53 self.assertRaises(ValueError, etree.Element, tag) +
54 +
55 - def test_unicode_qname(self): +
56 qname = etree.QName(uni, uni) +57 tag = _str("{%s}%s") % (uni, uni) +58 self.assertEquals(qname.text, tag) +59 self.assertEquals(unicode(qname), tag) +
60 +
62 self.assertRaises(ValueError, etree.QName, invalid_tag) +
63 +
64 - def test_unicode_attr(self): +
65 el = etree.Element('foo', {'bar': uni}) +66 self.assertEquals(uni, el.attrib['bar']) +
67 +
68 - def test_unicode_comment(self): +
69 el = etree.Comment(uni) +70 self.assertEquals(uni, el.text) +
71 +
73 el = etree.parse(StringIO(_str('<p>%s</p>') % uni)).getroot() +74 self.assertEquals(uni, el.text) +
75 +76 ## def test_parse_fileobject_unicode(self): +77 ## # parse unicode from unamed file object (not support by ElementTree) +78 ## f = SillyFileLike(uxml) +79 ## root = etree.parse(f).getroot() +80 ## self.assertEquals(unicode(etree.tostring(root, 'UTF-8'), 'UTF-8'), +81 ## uxml) +82 +
83 -def test_suite(): +
84 suite = unittest.TestSuite() +85 suite.addTests([unittest.makeSuite(UnicodeTestCase)]) +86 return suite +
87 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_unicode.UnicodeTestCase-class.html b/doc/html/api/lxml.tests.test_unicode.UnicodeTestCase-class.html new file mode 100644 index 0000000..d9dfe17 --- /dev/null +++ b/doc/html/api/lxml.tests.test_unicode.UnicodeTestCase-class.html @@ -0,0 +1,451 @@ + + + + + lxml.tests.test_unicode.UnicodeTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_unicode :: + Class UnicodeTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class UnicodeTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               UnicodeTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_unicode_xml(self) + source code + +
+ +
+   + + + + + + +
test_unicode_xml_broken(self) + source code + +
+ +
+   + + + + + + +
test_unicode_tag(self) + source code + +
+ +
+   + + + + + + +
test_unicode_tag_invalid(self) + source code + +
+ +
+   + + + + + + +
test_unicode_nstag(self) + source code + +
+ +
+   + + + + + + +
test_unicode_nstag_invalid(self) + source code + +
+ +
+   + + + + + + +
test_unicode_qname(self) + source code + +
+ +
+   + + + + + + +
test_unicode_qname_invalid(self) + source code + +
+ +
+   + + + + + + +
test_unicode_attr(self) + source code + +
+ +
+   + + + + + + +
test_unicode_comment(self) + source code + +
+ +
+   + + + + + + +
test_unicode_parse_stringio(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xmlschema-module.html b/doc/html/api/lxml.tests.test_xmlschema-module.html new file mode 100644 index 0000000..e0f4fcc --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema-module.html @@ -0,0 +1,245 @@ + + + + + lxml.tests.test_xmlschema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xmlschema + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_xmlschema

source code

+Test cases related to XML Schema parsing and validation + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeXMLSchemaTestCase +
+   + + ETreeXMLSchemaResolversTestCase +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xmlschema-pysrc.html b/doc/html/api/lxml.tests.test_xmlschema-pysrc.html new file mode 100644 index 0000000..c38d451 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema-pysrc.html @@ -0,0 +1,1169 @@ + + + + + lxml.tests.test_xmlschema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xmlschema + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_xmlschema

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to XML Schema parsing and validation 
+  5  """ 
+  6   
+  7  import unittest, sys, os.path 
+  8   
+  9  this_dir = os.path.dirname(__file__) 
+ 10  if this_dir not in sys.path: 
+ 11      sys.path.insert(0, this_dir) # needed for Py3 
+ 12   
+ 13  from common_imports import etree, BytesIO, HelperTestCase, fileInTestDir 
+ 14  from common_imports import doctest, make_doctest 
+ 15   
+
16 -class ETreeXMLSchemaTestCase(HelperTestCase): +
17 - def test_xmlschema(self): +
18 tree_valid = self.parse('<a><b></b></a>') + 19 tree_invalid = self.parse('<a><c></c></a>') + 20 schema = self.parse(''' + 21 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 22 <xsd:element name="a" type="AType"/> + 23 <xsd:complexType name="AType"> + 24 <xsd:sequence> + 25 <xsd:element name="b" type="xsd:string" /> + 26 </xsd:sequence> + 27 </xsd:complexType> + 28 </xsd:schema> + 29 ''') + 30 schema = etree.XMLSchema(schema) + 31 self.assert_(schema.validate(tree_valid)) + 32 self.assert_(not schema.validate(tree_invalid)) +
33 +
35 schema = self.parse(''' + 36 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 37 <xsd:element name="a" type="AType"/> + 38 <xsd:complexType name="AType"> + 39 <xsd:sequence minOccurs="4" maxOccurs="4"> + 40 <xsd:element name="b" type="BType" /> + 41 </xsd:sequence> + 42 </xsd:complexType> + 43 <xsd:complexType name="BType"> + 44 <xsd:attribute name="hardy" type="xsd:string" default="hey" /> + 45 </xsd:complexType> + 46 </xsd:schema> + 47 ''') + 48 schema = etree.XMLSchema(schema, attribute_defaults=True) + 49 + 50 tree = self.parse('<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>') + 51 + 52 root = tree.getroot() + 53 self.assertEquals('ho', root[0].get('hardy')) + 54 self.assertEquals(None, root[1].get('hardy')) + 55 self.assertEquals('ho', root[2].get('hardy')) + 56 self.assertEquals(None, root[3].get('hardy')) + 57 + 58 self.assert_(schema(tree)) + 59 + 60 root = tree.getroot() + 61 self.assertEquals('ho', root[0].get('hardy')) + 62 self.assertEquals('hey', root[1].get('hardy')) + 63 self.assertEquals('ho', root[2].get('hardy')) + 64 self.assertEquals('hey', root[3].get('hardy')) +
65 +
66 - def test_xmlschema_parse(self): +
67 schema = self.parse(''' + 68 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 69 <xsd:element name="a" type="AType"/> + 70 <xsd:complexType name="AType"> + 71 <xsd:sequence> + 72 <xsd:element name="b" type="xsd:string" /> + 73 </xsd:sequence> + 74 </xsd:complexType> + 75 </xsd:schema> + 76 ''') + 77 schema = etree.XMLSchema(schema) + 78 parser = etree.XMLParser(schema=schema) + 79 + 80 tree_valid = self.parse('<a><b></b></a>', parser=parser) + 81 self.assertEquals('a', tree_valid.getroot().tag) + 82 + 83 self.assertRaises(etree.XMLSyntaxError, + 84 self.parse, '<a><c></c></a>', parser=parser) +
85 +
87 # does not work as of libxml2 2.7.3 + 88 schema = self.parse(''' + 89 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + 90 <xsd:element name="a" type="AType"/> + 91 <xsd:complexType name="AType"> + 92 <xsd:sequence minOccurs="4" maxOccurs="4"> + 93 <xsd:element name="b" type="BType" /> + 94 </xsd:sequence> + 95 </xsd:complexType> + 96 <xsd:complexType name="BType"> + 97 <xsd:attribute name="hardy" type="xsd:string" default="hey" /> + 98 </xsd:complexType> + 99 </xsd:schema> +100 ''') +101 schema = etree.XMLSchema(schema) +102 parser = etree.XMLParser(schema=schema, attribute_defaults=True) +103 +104 tree_valid = self.parse('<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>', +105 parser=parser) +106 root = tree_valid.getroot() +107 self.assertEquals('ho', root[0].get('hardy')) +108 self.assertEquals('hey', root[1].get('hardy')) +109 self.assertEquals('ho', root[2].get('hardy')) +110 self.assertEquals('hey', root[3].get('hardy')) +
111 +
113 # does not work as of libxml2 2.7.3 +114 schema = self.parse(''' +115 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +116 <xsd:element name="a" type="AType"/> +117 <xsd:complexType name="AType"> +118 <xsd:sequence minOccurs="4" maxOccurs="4"> +119 <xsd:element name="b" type="BType" /> +120 </xsd:sequence> +121 </xsd:complexType> +122 <xsd:complexType name="BType"> +123 <xsd:attribute name="hardy" type="xsd:string" default="hey" /> +124 </xsd:complexType> +125 </xsd:schema> +126 ''') +127 schema = etree.XMLSchema(schema, attribute_defaults=True) +128 parser = etree.XMLParser(schema=schema) +129 +130 tree_valid = self.parse('<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>', +131 parser=parser) +132 root = tree_valid.getroot() +133 self.assertEquals('ho', root[0].get('hardy')) +134 self.assertEquals('hey', root[1].get('hardy')) +135 self.assertEquals('ho', root[2].get('hardy')) +136 self.assertEquals('hey', root[3].get('hardy')) +
137 +
139 # does not work as of libxml2 2.7.3 +140 schema = self.parse(''' +141 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +142 <xsd:element name="a" type="AType"/> +143 <xsd:complexType name="AType"> +144 <xsd:sequence minOccurs="3" maxOccurs="3"> +145 <xsd:element name="b" type="BType" /> +146 </xsd:sequence> +147 </xsd:complexType> +148 <xsd:complexType name="BType"> +149 <xsd:attribute name="hardy" type="xsd:string" fixed="hey" /> +150 </xsd:complexType> +151 </xsd:schema> +152 ''') +153 schema = etree.XMLSchema(schema) +154 parser = etree.XMLParser(schema=schema, attribute_defaults=True) +155 +156 tree_valid = self.parse('<a><b/><b hardy="hey"/><b/></a>', +157 parser=parser) +158 root = tree_valid.getroot() +159 self.assertEquals('hey', root[0].get('hardy')) +160 self.assertEquals('hey', root[1].get('hardy')) +161 self.assertEquals('hey', root[2].get('hardy')) +
162 +
163 - def test_xmlschema_stringio(self): +
164 schema_file = BytesIO(''' +165 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +166 <xsd:element name="a" type="AType"/> +167 <xsd:complexType name="AType"> +168 <xsd:sequence> +169 <xsd:element name="b" type="xsd:string" /> +170 </xsd:sequence> +171 </xsd:complexType> +172 </xsd:schema> +173 ''') +174 schema = etree.XMLSchema(file=schema_file) +175 parser = etree.XMLParser(schema=schema) +176 +177 tree_valid = self.parse('<a><b></b></a>', parser=parser) +178 self.assertEquals('a', tree_valid.getroot().tag) +179 +180 self.assertRaises(etree.XMLSyntaxError, +181 self.parse, '<a><c></c></a>', parser=parser) +
182 +
183 - def test_xmlschema_iterparse(self): +
184 schema = self.parse(''' +185 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +186 <xsd:element name="a" type="AType"/> +187 <xsd:complexType name="AType"> +188 <xsd:sequence> +189 <xsd:element name="b" type="xsd:string" /> +190 </xsd:sequence> +191 </xsd:complexType> +192 </xsd:schema> +193 ''') +194 schema = etree.XMLSchema(schema) +195 xml = BytesIO('<a><b></b></a>') +196 events = [ (event, el.tag) +197 for (event, el) in etree.iterparse(xml, schema=schema) ] +198 +199 self.assertEquals([('end', 'b'), ('end', 'a')], +200 events) +
201 +
203 schema = self.parse(''' +204 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +205 <xsd:element name="a" type="AType"/> +206 <xsd:complexType name="AType"> +207 <xsd:sequence> +208 <xsd:element name="b" type="xsd:string" /> +209 </xsd:sequence> +210 </xsd:complexType> +211 </xsd:schema> +212 ''') +213 schema = etree.XMLSchema(schema) +214 self.assertRaises( +215 etree.XMLSyntaxError, +216 list, etree.iterparse(BytesIO('<a><c></c></a>'), schema=schema)) +
217 +
219 self.assertRaises(ValueError, etree.XMLSchema, etree.ElementTree()) +
220 +
222 schema = self.parse('''\ +223 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +224 <element name="a" type="AType"/> +225 <xsd:complexType name="AType"> +226 <xsd:sequence> +227 <xsd:element name="b" type="xsd:string" /> +228 </xsd:sequence> +229 </xsd:complexType> +230 </xsd:schema> +231 ''') +232 self.assertRaises(etree.XMLSchemaParseError, +233 etree.XMLSchema, schema) +
234 +
236 schema = self.parse('<test/>') +237 self.assertRaises(etree.XMLSchemaParseError, +238 etree.XMLSchema, schema) +
239 +
240 - def test_xmlschema_file(self): +
241 # this will only work if we access the file through path or +242 # file object.. +243 f = open(fileInTestDir('test.xsd'), 'rb') +244 try: +245 schema = etree.XMLSchema(file=f) +246 finally: +247 f.close() +248 tree_valid = self.parse('<a><b></b></a>') +249 self.assert_(schema.validate(tree_valid)) +
250 +
251 - def test_xmlschema_import_file(self): +
252 # this will only work if we access the file through path or +253 # file object.. +254 schema = etree.XMLSchema(file=fileInTestDir('test_import.xsd')) +255 tree_valid = self.parse( +256 '<a:x xmlns:a="http://codespeak.net/lxml/schema/ns1"><b></b></a:x>') +257 self.assert_(schema.validate(tree_valid)) +
258 +
259 - def test_xmlschema_shortcut(self): +
260 tree_valid = self.parse('<a><b></b></a>') +261 tree_invalid = self.parse('<a><c></c></a>') +262 schema = self.parse('''\ +263 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +264 <xsd:element name="a" type="AType"/> +265 <xsd:complexType name="AType"> +266 <xsd:sequence> +267 <xsd:element name="b" type="xsd:string" /> +268 </xsd:sequence> +269 </xsd:complexType> +270 </xsd:schema> +271 ''') +272 self.assert_(tree_valid.xmlschema(schema)) +273 self.assert_(not tree_invalid.xmlschema(schema)) +
274 +275 +
276 -class ETreeXMLSchemaResolversTestCase(HelperTestCase): +
277 resolver_schema_int = BytesIO("""\ +278 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" +279 xmlns:etype="http://codespeak.net/lxml/test/external" +280 targetNamespace="http://codespeak.net/lxml/test/internal"> +281 <xsd:import namespace="http://codespeak.net/lxml/test/external" schemaLocation="XXX.xsd" /> +282 <xsd:element name="a" type="etype:AType"/> +283 </xsd:schema>""") +284 +285 resolver_schema_int2 = BytesIO("""\ +286 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" +287 xmlns:etype="http://codespeak.net/lxml/test/external" +288 targetNamespace="http://codespeak.net/lxml/test/internal"> +289 <xsd:import namespace="http://codespeak.net/lxml/test/external" schemaLocation="YYY.xsd" /> +290 <xsd:element name="a" type="etype:AType"/> +291 </xsd:schema>""") +292 +293 resolver_schema_ext = """\ +294 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" +295 targetNamespace="http://codespeak.net/lxml/test/external"> +296 <xsd:complexType name="AType"> +297 <xsd:sequence><xsd:element name="b" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /></xsd:sequence> +298 </xsd:complexType> +299 </xsd:schema>""" +300 +
301 - class simple_resolver(etree.Resolver): +
302 - def __init__(self, schema): +
303 self.schema = schema +
304 +
305 - def resolve(self, url, id, context): +
306 assert url == 'XXX.xsd' +307 return self.resolve_string(self.schema, context) +
308 +309 # tests: +310 +
311 - def test_xmlschema_resolvers(self): +
312 """Test that resolvers work with schema.""" +313 parser = etree.XMLParser() +314 parser.resolvers.add(self.simple_resolver(self.resolver_schema_ext)) +315 schema_doc = etree.parse(self.resolver_schema_int, parser = parser) +316 schema = etree.XMLSchema(schema_doc) +
317 +
319 """Test that the default resolver will get called if there's no +320 specific parser resolver.""" +321 root_resolver = self.simple_resolver(self.resolver_schema_ext) +322 etree.get_default_parser().resolvers.add(root_resolver) +323 schema_doc = etree.parse(self.resolver_schema_int) +324 schema = etree.XMLSchema(schema_doc) +325 etree.get_default_parser().resolvers.remove(root_resolver) +
326 +
328 """Test that the default resolver will not get called when a more +329 specific resolver is registered.""" +330 +331 class res_root(etree.Resolver): +332 def resolve(self, url, id, context): +333 assert False +334 return None +
335 +336 root_resolver = res_root() +337 etree.get_default_parser().resolvers.add(root_resolver) +338 +339 parser = etree.XMLParser() +340 parser.resolvers.add(self.simple_resolver(self.resolver_schema_ext)) +341 +342 schema_doc = etree.parse(self.resolver_schema_int, parser = parser) +343 schema = etree.XMLSchema(schema_doc) +344 etree.get_default_parser().resolvers.remove(root_resolver) +345 +
347 """Test that resolvers work in a nested fashion.""" +348 +349 resolver_schema = self.resolver_schema_ext +350 +351 class res_nested(etree.Resolver): +352 def __init__(self, ext_schema): +353 self.ext_schema = ext_schema +
354 +355 def resolve(self, url, id, context): +356 assert url == 'YYY.xsd' +357 return self.resolve_string(self.ext_schema, context) +358 +359 class res(etree.Resolver): +360 def __init__(self, ext_schema_1, ext_schema_2): +361 self.ext_schema_1 = ext_schema_1 +362 self.ext_schema_2 = ext_schema_2 +363 +364 def resolve(self, url, id, context): +365 assert url == 'XXX.xsd' +366 +367 new_parser = etree.XMLParser() +368 new_parser.resolvers.add(res_nested(self.ext_schema_2)) +369 new_schema_doc = etree.parse(self.ext_schema_1, parser = new_parser) +370 new_schema = etree.XMLSchema(new_schema_doc) +371 +372 return self.resolve_string(resolver_schema, context) +373 +374 parser = etree.XMLParser() +375 parser.resolvers.add(res(self.resolver_schema_int2, self.resolver_schema_ext)) +376 schema_doc = etree.parse(self.resolver_schema_int, parser = parser) +377 schema = etree.XMLSchema(schema_doc) +378 +
379 -def test_suite(): +
380 suite = unittest.TestSuite() +381 suite.addTests([unittest.makeSuite(ETreeXMLSchemaTestCase)]) +382 suite.addTests([unittest.makeSuite(ETreeXMLSchemaResolversTestCase)]) +383 suite.addTests( +384 [make_doctest('../../../doc/validation.txt')]) +385 return suite +
386 +387 if __name__ == '__main__': +388 print('to test use test.py %s' % __file__) +389 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html new file mode 100644 index 0000000..a1960e6 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase-class.html @@ -0,0 +1,486 @@ + + + + + lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xmlschema :: + Class ETreeXMLSchemaResolversTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXMLSchemaResolversTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXMLSchemaResolversTestCase
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+   + + simple_resolver +
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xmlschema_resolvers(self)
+ Test that resolvers work with schema.
+ source code + +
+ +
+   + + + + + + +
test_xmlschema_resolvers_root(self)
+ Test that the default resolver will get called if there's no +specific parser resolver.
+ source code + +
+ +
+   + + + + + + +
test_xmlschema_resolvers_noroot(self)
+ Test that the default resolver will not get called when a more +specific resolver is registered.
+ source code + +
+ +
+   + + + + + + +
test_xmlschema_nested_resolvers(self)
+ Test that resolvers work in a nested fashion.
+ source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+   + + resolver_schema_int = BytesIO("... +
+   + + resolver_schema_int2 = BytesIO("... +
+   + + resolver_schema_ext = '<xsd:schema xmlns:xsd="http://www.w3.or... +
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Class Variable Details[hide private]
+
+ +
+ +
+

resolver_schema_int

+ +
+
+
+
Value:
+
+BytesIO("""\
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:etype="http://codespeak.net/lxml/test/external"
+    targetNamespace="http://codespeak.net/lxml/test/internal">
+        <xsd:import namespace="http://codespeak.net/lxml/test/external\
+" schemaLocation="XXX.xsd" />
+        <xsd:element name="a" type="etype:AType"/>
+</xsd:schema>""")
+
+
+
+
+
+ +
+ +
+

resolver_schema_int2

+ +
+
+
+
Value:
+
+BytesIO("""\
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:etype="http://codespeak.net/lxml/test/external"
+    targetNamespace="http://codespeak.net/lxml/test/internal">
+        <xsd:import namespace="http://codespeak.net/lxml/test/external\
+" schemaLocation="YYY.xsd" />
+        <xsd:element name="a" type="etype:AType"/>
+</xsd:schema>""")
+
+
+
+
+
+ +
+ +
+

resolver_schema_ext

+ +
+
+
+
Value:
+
+'''<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://codespeak.net/lxml/test/external">
+    <xsd:complexType name="AType">
+      <xsd:sequence><xsd:element name="b" type="xsd:string" minOccurs=\
+"0" maxOccurs="unbounded" /></xsd:sequence>
+    </xsd:complexType>
+</xsd:schema>'''
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html new file mode 100644 index 0000000..6ad909d --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html @@ -0,0 +1,302 @@ + + + + + lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xmlschema :: + Class ETreeXMLSchemaResolversTestCase :: + Class simple_resolver + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class simple_resolver

source code

+
+    object --+    
+             |    
+etree.Resolver --+
+                 |
+                ETreeXMLSchemaResolversTestCase.simple_resolver
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + schema)
+ x.__init__(...) initializes x; see x.__class__.__doc__ for signature
+ source code + +
+ +
+   + + + + + + +
resolve(self, + url, + id, + context)
+ Override this method to resolve an external source by +system_url and public_id.
+ source code + +
+ +
+

Inherited from etree.Resolver: + __new__, + resolve_empty, + resolve_file, + resolve_filename, + resolve_string +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __str__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + schema) +
(Constructor) +

+
source code  +
+ + x.__init__(...) initializes x; see x.__class__.__doc__ for signature +
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

resolve(self, + url, + id, + context) +

+
source code  +
+ +

Override this method to resolve an external source by +system_url and public_id. The third argument is an +opaque context object.

+

Return the result of one of the resolve_*() methods.

+
+
Overrides: + etree.Resolver.resolve +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html new file mode 100644 index 0000000..a01d8d4 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase-class.html @@ -0,0 +1,515 @@ + + + + + lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xmlschema :: + Class ETreeXMLSchemaTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXMLSchemaTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXMLSchemaTestCase
+
+ +
+ + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xmlschema(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_default_attributes(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_parse(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_parse_default_attributes(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_parse_default_attributes_schema_config(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_parse_fixed_attributes(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_stringio(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_iterparse(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_iterparse_fail(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_elementtree_error(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_invalid_schema1(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_invalid_schema2(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_file(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_import_file(self) + source code + +
+ +
+   + + + + + + +
test_xmlschema_shortcut(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xpathevaluator-module.html b/doc/html/api/lxml.tests.test_xpathevaluator-module.html new file mode 100644 index 0000000..1ea3d68 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator-module.html @@ -0,0 +1,524 @@ + + + + + lxml.tests.test_xpathevaluator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xpathevaluator + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_xpathevaluator

source code

+Test cases related to XPath evaluation and the XPath class + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeXPathTestCase
+ XPath tests etree +
+   + + ETreeXPathClassTestCase
+ Tests for the XPath class +
+   + + ETreeETXPathClassTestCase
+ Tests for the ETXPath class +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
tag(elem) + source code + +
+ +
+   + + + + + + +
stringTest(ctxt, + s1) + source code + +
+ +
+   + + + + + + +
floatTest(ctxt, + f1) + source code + +
+ +
+   + + + + + + +
booleanTest(ctxt, + b1) + source code + +
+ +
+   + + + + + + +
setTest(ctxt, + st1) + source code + +
+ +
+   + + + + + + +
setTest2(ctxt, + st1) + source code + +
+ +
+   + + + + + + +
argsTest1(ctxt, + s, + f, + b, + st) + source code + +
+ +
+   + + + + + + +
argsTest2(ctxt, + st1, + st2) + source code + +
+ +
+   + + + + + + +
resultTypesTest(ctxt) + source code + +
+ +
+   + + + + + + +
resultTypesTest2(ctxt) + source code + +
+ +
+   + + + + + + +
xpath()
+ Test xpath extension functions.
+ source code + +
+ +
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + SAMPLE_XML = etree.parse(BytesIO(... +
+   + + uri = 'http://www.example.com/' +
+   + + extension = {(None, 'argsTest1'): <function argsTest1 at 0x93e... +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+ +
+ +
+

SAMPLE_XML

+ +
+
+
+
Value:
+
+etree.parse(BytesIO("""
+<body>
+  <tag>text</tag>
+  <section>
+    <tag>subtext</tag>
+  </section>
+  <tag />
+  <tag />
+...
+
+
+
+
+
+ +
+ +
+

extension

+ +
+
+
+
Value:
+
+{(None, 'stringTest'): stringTest, (None, 'floatTest'): floatTest, (No\
+ne, 'booleanTest'): booleanTest, (None, 'setTest'): setTest, (None, 's\
+etTest2'): setTest2, (None, 'argsTest1'): argsTest1, (None, 'argsTest2\
+'): argsTest2, (None, 'resultTypesTest'): resultTypesTest, (None, 'res\
+ultTypesTest2'): resultTypesTest2,}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xpathevaluator-pysrc.html b/doc/html/api/lxml.tests.test_xpathevaluator-pysrc.html new file mode 100644 index 0000000..170212b --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator-pysrc.html @@ -0,0 +1,2372 @@ + + + + + lxml.tests.test_xpathevaluator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xpathevaluator + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_xpathevaluator

+
+  1  # -*- coding: utf-8 -*- 
+  2   
+  3  """ 
+  4  Test cases related to XPath evaluation and the XPath class 
+  5  """ 
+  6   
+  7  import unittest, sys, os.path 
+  8   
+  9  this_dir = os.path.dirname(__file__) 
+ 10  if this_dir not in sys.path: 
+ 11      sys.path.insert(0, this_dir) # needed for Py3 
+ 12   
+ 13  from common_imports import etree, HelperTestCase, _bytes, BytesIO 
+ 14  from common_imports import doctest, make_doctest 
+ 15   
+
16 -class ETreeXPathTestCase(HelperTestCase): +
17 """XPath tests etree""" + 18 +
19 - def test_xpath_boolean(self): +
20 tree = self.parse('<a><b></b><b></b></a>') + 21 self.assert_(tree.xpath('boolean(/a/b)')) + 22 self.assert_(not tree.xpath('boolean(/a/c)')) +
23 +
24 - def test_xpath_number(self): +
25 tree = self.parse('<a>1</a>') + 26 self.assertEquals(1., + 27 tree.xpath('number(/a)')) + 28 tree = self.parse('<a>A</a>') + 29 actual = str(tree.xpath('number(/a)')) + 30 expected = ['nan', '1.#qnan', 'nanq'] + 31 if not actual.lower() in expected: + 32 self.fail('Expected a NAN value, got %s' % actual) +
33 +
34 - def test_xpath_string(self): +
35 tree = self.parse('<a>Foo</a>') + 36 self.assertEquals('Foo', + 37 tree.xpath('string(/a/text())')) +
38 +
39 - def test_xpath_document_root(self): +
40 tree = self.parse('<a><b/></a>') + 41 self.assertEquals([], + 42 tree.xpath('/')) +
43 +
44 - def test_xpath_namespace(self): +
45 tree = self.parse('<a xmlns="test" xmlns:p="myURI"/>') + 46 self.assert_((None, "test") in tree.xpath('namespace::*')) + 47 self.assert_(('p', 'myURI') in tree.xpath('namespace::*')) +
48 +
49 - def test_xpath_namespace_empty(self): +
50 tree = self.parse('<a/>') + 51 self.assertEquals([('xml', 'http://www.w3.org/XML/1998/namespace')], + 52 tree.xpath('namespace::*')) +
53 +
54 - def test_xpath_list_elements(self): +
55 tree = self.parse('<a><b>Foo</b><b>Bar</b></a>') + 56 root = tree.getroot() + 57 self.assertEquals([root[0], root[1]], + 58 tree.xpath('/a/b')) +
59 +
60 - def test_xpath_list_nothing(self): +
61 tree = self.parse('<a><b/></a>') + 62 self.assertEquals([], + 63 tree.xpath('/a/c')) + 64 # this seems to pass a different code path, also should return nothing + 65 self.assertEquals([], + 66 tree.xpath('/a/c/text()')) +
67 +
68 - def test_xpath_list_text(self): +
69 tree = self.parse('<a><b>Foo</b><b>Bar</b></a>') + 70 root = tree.getroot() + 71 self.assertEquals(['Foo', 'Bar'], + 72 tree.xpath('/a/b/text()')) +
73 +
75 tree = self.parse('<a><b>FooBar</b><b>BarFoo</b></a>') + 76 root = tree.getroot() + 77 self.assertEquals(['FooBar', 'BarFoo'], + 78 tree.xpath('/a/b/text()')) + 79 self.assertEquals([root[0], root[1]], + 80 [r.getparent() for r in tree.xpath('/a/b/text()')]) +
81 +
83 tree = self.parse('<a><b>FooBar</b><b>BarFoo</b></a>') + 84 root = tree.getroot() + 85 self.assertEquals(['FooBar', 'BarFoo'], + 86 tree.xpath('/a/b/text()', smart_strings=True)) + 87 self.assertEquals([root[0], root[1]], + 88 [r.getparent() for r in + 89 tree.xpath('/a/b/text()', smart_strings=True)]) + 90 + 91 self.assertEquals(['FooBar', 'BarFoo'], + 92 tree.xpath('/a/b/text()', smart_strings=False)) + 93 self.assertEquals([False, False], + 94 [hasattr(r, 'getparent') for r in + 95 tree.xpath('/a/b/text()', smart_strings=False)]) +
96 +
98 xml = _bytes('<a><b>FooBar\\u0680\\u3120</b><b>BarFoo\\u0680\\u3120</b></a>').decode("unicode_escape") + 99 tree = self.parse(xml.encode('utf-8')) +100 root = tree.getroot() +101 self.assertEquals([_bytes('FooBar\\u0680\\u3120').decode("unicode_escape"), +102 _bytes('BarFoo\\u0680\\u3120').decode("unicode_escape")], +103 tree.xpath('/a/b/text()')) +104 self.assertEquals([root[0], root[1]], +105 [r.getparent() for r in tree.xpath('/a/b/text()')]) +
106 +
107 - def test_xpath_list_attribute(self): +
108 tree = self.parse('<a b="B" c="C"/>') +109 self.assertEquals(['B'], +110 tree.xpath('/a/@b')) +
111 +
113 tree = self.parse('<a b="BaSdFgHjKl" c="CqWeRtZuI"/>') +114 results = tree.xpath('/a/@c') +115 self.assertEquals(1, len(results)) +116 self.assertEquals('CqWeRtZuI', results[0]) +117 self.assertEquals(tree.getroot().tag, results[0].getparent().tag) +
118 +
120 tree = self.parse('<a b="BaSdFgHjKl" c="CqWeRtZuI"/>') +121 +122 results = tree.xpath('/a/@c', smart_strings=True) +123 self.assertEquals(1, len(results)) +124 self.assertEquals('CqWeRtZuI', results[0]) +125 self.assertEquals(tree.getroot().tag, results[0].getparent().tag) +126 +127 results = tree.xpath('/a/@c', smart_strings=False) +128 self.assertEquals(1, len(results)) +129 self.assertEquals('CqWeRtZuI', results[0]) +130 self.assertEquals(False, hasattr(results[0], 'getparent')) +
131 +
132 - def test_xpath_list_comment(self): +
133 tree = self.parse('<a><!-- Foo --></a>') +134 self.assertEquals(['<!-- Foo -->'], +135 list(map(repr, tree.xpath('/a/node()')))) +
136 +
137 - def test_rel_xpath_boolean(self): +
138 root = etree.XML('<a><b><c/></b></a>') +139 el = root[0] +140 self.assert_(el.xpath('boolean(c)')) +141 self.assert_(not el.xpath('boolean(d)')) +
142 +
144 tree = self.parse('<a><c><b>Foo</b><b>Bar</b></c><c><b>Hey</b></c></a>') +145 root = tree.getroot() +146 c = root[0] +147 self.assertEquals([c[0], c[1]], +148 c.xpath('b')) +149 self.assertEquals([c[0], c[1], root[1][0]], +150 c.xpath('//b')) +
151 +
152 - def test_xpath_ns(self): +
153 tree = self.parse('<a xmlns="uri:a"><b></b></a>') +154 root = tree.getroot() +155 self.assertEquals( +156 [root[0]], +157 tree.xpath('//foo:b', namespaces={'foo': 'uri:a'})) +158 self.assertEquals( +159 [], +160 tree.xpath('//foo:b', namespaces={'foo': 'uri:c'})) +161 self.assertEquals( +162 [root[0]], +163 root.xpath('//baz:b', namespaces={'baz': 'uri:a'})) +
164 +
165 - def test_xpath_ns_none(self): +
166 tree = self.parse('<a xmlns="uri:a"><b></b></a>') +167 root = tree.getroot() +168 self.assertRaises( +169 TypeError, +170 root.xpath, '//b', namespaces={None: 'uri:a'}) +
171 +
172 - def test_xpath_ns_empty(self): +
173 tree = self.parse('<a xmlns="uri:a"><b></b></a>') +174 root = tree.getroot() +175 self.assertRaises( +176 TypeError, +177 root.xpath, '//b', namespaces={'': 'uri:a'}) +
178 +
179 - def test_xpath_error(self): +
180 tree = self.parse('<a/>') +181 self.assertRaises(etree.XPathEvalError, tree.xpath, '\\fad') +
182 +
183 - def test_xpath_class_error(self): +
184 self.assertRaises(SyntaxError, etree.XPath, '\\fad') +185 self.assertRaises(etree.XPathSyntaxError, etree.XPath, '\\fad') +
186 +
187 - def test_xpath_prefix_error(self): +
188 tree = self.parse('<a/>') +189 self.assertRaises(etree.XPathEvalError, tree.xpath, '/fa:d') +
190 +
192 tree = self.parse('<a/>') +193 xpath = etree.XPath("/fa:d") +194 self.assertRaises(etree.XPathEvalError, xpath, tree) +
195 +
196 - def test_elementtree_getpath(self): +
197 a = etree.Element("a") +198 b = etree.SubElement(a, "b") +199 c = etree.SubElement(a, "c") +200 d1 = etree.SubElement(c, "d") +201 d2 = etree.SubElement(c, "d") +202 +203 tree = etree.ElementTree(a) +204 self.assertEqual('/a/c/d', +205 tree.getpath(d2)[:6]) +206 self.assertEqual([d2], +207 tree.xpath(tree.getpath(d2))) +
208 +
210 a = etree.Element("a") +211 b = etree.SubElement(a, "b") +212 c = etree.SubElement(a, "c") +213 d1 = etree.SubElement(c, "d") +214 d2 = etree.SubElement(c, "d") +215 +216 tree = etree.ElementTree(c) +217 self.assertEqual('/c/d', +218 tree.getpath(d2)[:4]) +219 self.assertEqual([d2], +220 tree.xpath(tree.getpath(d2))) +
221 +
222 - def test_xpath_evaluator(self): +
223 tree = self.parse('<a><b><c></c></b></a>') +224 e = etree.XPathEvaluator(tree) +225 root = tree.getroot() +226 self.assertEquals( +227 [root], +228 e('//a')) +
229 +
230 - def test_xpath_evaluator_tree(self): +
231 tree = self.parse('<a><b><c></c></b></a>') +232 child_tree = etree.ElementTree(tree.getroot()[0]) +233 e = etree.XPathEvaluator(child_tree) +234 self.assertEquals( +235 [], +236 e('a')) +237 root = child_tree.getroot() +238 self.assertEquals( +239 [root[0]], +240 e('c')) +
241 +
243 tree = self.parse('<a><b><c></c></b></a>') +244 child_tree = etree.ElementTree(tree.getroot()[0]) +245 e = etree.XPathEvaluator(child_tree) +246 self.assertEquals( +247 [], +248 e('/a')) +249 root = child_tree.getroot() +250 self.assertEquals( +251 [root], +252 e('/b')) +253 self.assertEquals( +254 [], +255 e('/c')) +
256 +
258 tree = self.parse('<a><b><c></c></b></a>') +259 root = tree.getroot() +260 e = etree.XPathEvaluator(root[0]) +261 self.assertEquals( +262 [root[0][0]], +263 e('c')) +
264 +
265 - def test_xpath_extensions(self): +
266 def foo(evaluator, a): +267 return 'hello %s' % a +
268 extension = {(None, 'foo'): foo} +269 tree = self.parse('<a><b></b></a>') +270 e = etree.XPathEvaluator(tree, extensions=[extension]) +271 self.assertEquals( +272 "hello you", e("foo('you')")) +
273 +
275 def foo(evaluator, a, b): +276 return "hello %s and %s" % (a, b) +
277 extension = {(None, 'foo'): foo} +278 tree = self.parse('<a><b></b></a>') +279 e = etree.XPathEvaluator(tree, extensions=[extension]) +280 self.assertRaises(TypeError, e, "foo('you')") +281 +
283 def foo(evaluator, a): +284 return 1/0 +
285 extension = {(None, 'foo'): foo} +286 tree = self.parse('<a/>') +287 e = etree.XPathEvaluator(tree, extensions=[extension]) +288 self.assertRaises(ZeroDivisionError, e, "foo('test')") +289 +
291 def f(evaluator, arg): +292 r = etree.Element('results') +293 b = etree.SubElement(r, 'result') +294 b.text = 'Hoi' +295 b = etree.SubElement(r, 'result') +296 b.text = 'Dag' +297 return r +
298 +299 x = self.parse('<a/>') +300 e = etree.XPathEvaluator(x, extensions=[{(None, 'foo'): f}]) +301 r = e("foo('World')/result") +302 self.assertEquals(2, len(r)) +303 self.assertEquals('Hoi', r[0].text) +304 self.assertEquals('Dag', r[1].text) +305 +
307 def f(evaluator, nodes): +308 r = etree.SubElement(nodes[0], 'results') +309 b = etree.SubElement(r, 'result') +310 b.text = 'Hoi' +311 b = etree.SubElement(r, 'result') +312 b.text = 'Dag' +313 return r +
314 +315 x = self.parse('<a/>') +316 e = etree.XPathEvaluator(x, extensions=[{(None, 'foo'): f}]) +317 r = e("foo(/*)/result") +318 self.assertEquals(2, len(r)) +319 self.assertEquals('Hoi', r[0].text) +320 self.assertEquals('Dag', r[1].text) +321 +
323 def f(evaluator, nodes): +324 r = etree.Element('results') +325 b = etree.SubElement(r, 'result') +326 b.text = 'Hoi' +327 b = etree.SubElement(r, 'result') +328 b.text = 'Dag' +329 r.append(nodes[0]) +330 return r +
331 +332 x = self.parse('<result>Honk</result>') +333 e = etree.XPathEvaluator(x, extensions=[{(None, 'foo'): f}]) +334 r = e("foo(/*)/result") +335 self.assertEquals(3, len(r)) +336 self.assertEquals('Hoi', r[0].text) +337 self.assertEquals('Dag', r[1].text) +338 self.assertEquals('Honk', r[2].text) +339 +
340 - def test_xpath_context_node(self): +
341 tree = self.parse('<root><a/><b><c/></b></root>') +342 +343 check_call = [] +344 def check_context(ctxt, nodes): +345 self.assertEquals(len(nodes), 1) +346 check_call.append(nodes[0].tag) +347 self.assertEquals(ctxt.context_node, nodes[0]) +348 return True +
349 +350 find = etree.XPath("//*[p:foo(.)]", +351 namespaces={'p' : 'ns'}, +352 extensions=[{('ns', 'foo') : check_context}]) +353 find(tree) +354 +355 check_call.sort() +356 self.assertEquals(check_call, ["a", "b", "c", "root"]) +357 +
359 tree = self.parse('<root><a/><b><c/></b></root>') +360 +361 check_call = {} +362 def check_context(ctxt, nodes): +363 self.assertEquals(len(nodes), 1) +364 tag = nodes[0].tag +365 # empty during the "b" call, a "b" during the "c" call +366 check_call[tag] = ctxt.eval_context.get("b") +367 ctxt.eval_context[tag] = tag +368 return True +
369 +370 find = etree.XPath("//b[p:foo(.)]/c[p:foo(.)]", +371 namespaces={'p' : 'ns'}, +372 extensions=[{('ns', 'foo') : check_context}]) +373 result = find(tree) +374 +375 self.assertEquals(result, [tree.getroot()[1][0]]) +376 self.assertEquals(check_call, {'b':None, 'c':'b'}) +377 +
379 tree = self.parse('<root><a/><b><c/></b></root>') +380 +381 check_call = {} +382 def check_context(ctxt): +383 check_call["done"] = True +384 # context must be empty for each new evaluation +385 self.assertEquals(len(ctxt.eval_context), 0) +386 ctxt.eval_context["test"] = True +387 return True +
388 +389 find = etree.XPath("//b[p:foo()]", +390 namespaces={'p' : 'ns'}, +391 extensions=[{('ns', 'foo') : check_context}]) +392 result = find(tree) +393 +394 self.assertEquals(result, [tree.getroot()[1]]) +395 self.assertEquals(check_call["done"], True) +396 +397 check_call.clear() +398 find = etree.XPath("//b[p:foo()]", +399 namespaces={'p' : 'ns'}, +400 extensions=[{('ns', 'foo') : check_context}]) +401 result = find(tree) +402 +403 self.assertEquals(result, [tree.getroot()[1]]) +404 self.assertEquals(check_call["done"], True) +405 +
406 - def test_xpath_variables(self): +
407 x = self.parse('<a attr="true"/>') +408 e = etree.XPathEvaluator(x) +409 +410 expr = "/a[@attr=$aval]" +411 r = e(expr, aval=1) +412 self.assertEquals(0, len(r)) +413 +414 r = e(expr, aval="true") +415 self.assertEquals(1, len(r)) +416 self.assertEquals("true", r[0].get('attr')) +417 +418 r = e(expr, aval=True) +419 self.assertEquals(1, len(r)) +420 self.assertEquals("true", r[0].get('attr')) +
421 +
423 x = self.parse('<a attr="true"/>') +424 e = etree.XPathEvaluator(x) +425 +426 element = etree.Element("test-el") +427 etree.SubElement(element, "test-sub") +428 expr = "$value" +429 r = e(expr, value=element) +430 self.assertEquals(1, len(r)) +431 self.assertEquals(element.tag, r[0].tag) +432 self.assertEquals(element[0].tag, r[0][0].tag) +
433 +
434 - def test_xpath_extensions_mix(self): +
435 x = self.parse('<a attr="true"><test/></a>') +436 +437 class LocalException(Exception): +438 pass +
439 +440 def foo(evaluator, a, varval): +441 etree.Element("DUMMY") +442 if varval == 0: +443 raise LocalException +444 elif varval == 1: +445 return () +446 elif varval == 2: +447 return None +448 elif varval == 3: +449 return a[0][0] +450 a = a[0] +451 if a.get("attr") == str(varval): +452 return a +453 else: +454 return etree.Element("NODE") +455 +456 extension = {(None, 'foo'): foo} +457 e = etree.XPathEvaluator(x, extensions=[extension]) +458 del x +459 +460 self.assertRaises(LocalException, e, "foo(., 0)") +461 self.assertRaises(LocalException, e, "foo(., $value)", value=0) +462 +463 r = e("foo(., $value)", value=1) +464 self.assertEqual(len(r), 0) +465 +466 r = e("foo(., 1)") +467 self.assertEqual(len(r), 0) +468 +469 r = e("foo(., $value)", value=2) +470 self.assertEqual(len(r), 0) +471 +472 r = e("foo(., $value)", value=3) +473 self.assertEqual(len(r), 1) +474 self.assertEqual(r[0].tag, "test") +475 +476 r = e("foo(., $value)", value="false") +477 self.assertEqual(len(r), 1) +478 self.assertEqual(r[0].tag, "NODE") +479 +480 r = e("foo(., 'false')") +481 self.assertEqual(len(r), 1) +482 self.assertEqual(r[0].tag, "NODE") +483 +484 r = e("foo(., 'true')") +485 self.assertEqual(len(r), 1) +486 self.assertEqual(r[0].tag, "a") +487 self.assertEqual(r[0][0].tag, "test") +488 +489 r = e("foo(., $value)", value="true") +490 self.assertEqual(len(r), 1) +491 self.assertEqual(r[0].tag, "a") +492 +493 self.assertRaises(LocalException, e, "foo(., 0)") +494 self.assertRaises(LocalException, e, "foo(., $value)", value=0) +495 +496 +
497 -class ETreeXPathClassTestCase(HelperTestCase): +
498 "Tests for the XPath class" +
499 - def test_xpath_compile_doc(self): +
500 x = self.parse('<a attr="true"/>') +501 +502 expr = etree.XPath("/a[@attr != 'true']") +503 r = expr(x) +504 self.assertEquals(0, len(r)) +505 +506 expr = etree.XPath("/a[@attr = 'true']") +507 r = expr(x) +508 self.assertEquals(1, len(r)) +509 +510 expr = etree.XPath( expr.path ) +511 r = expr(x) +512 self.assertEquals(1, len(r)) +
513 +
514 - def test_xpath_compile_element(self): +
515 x = self.parse('<a><b/><c/></a>') +516 root = x.getroot() +517 +518 expr = etree.XPath("./b") +519 r = expr(root) +520 self.assertEquals(1, len(r)) +521 self.assertEquals('b', r[0].tag) +522 +523 expr = etree.XPath("./*") +524 r = expr(root) +525 self.assertEquals(2, len(r)) +
526 +
527 - def test_xpath_compile_vars(self): +
528 x = self.parse('<a attr="true"/>') +529 +530 expr = etree.XPath("/a[@attr=$aval]") +531 r = expr(x, aval=False) +532 self.assertEquals(0, len(r)) +533 +534 r = expr(x, aval=True) +535 self.assertEquals(1, len(r)) +
536 +
537 - def test_xpath_compile_error(self): +
538 self.assertRaises(SyntaxError, etree.XPath, '\\fad') +
539 +
541 self.assertRaises(ValueError, etree.XPath('*'), etree.ElementTree()) +
542 +
543 -class ETreeETXPathClassTestCase(HelperTestCase): +
544 "Tests for the ETXPath class" +
545 - def test_xpath_compile_ns(self): +
546 x = self.parse('<a><b xmlns="nsa"/><b xmlns="nsb"/></a>') +547 +548 expr = etree.ETXPath("/a/{nsa}b") +549 r = expr(x) +550 self.assertEquals(1, len(r)) +551 self.assertEquals('{nsa}b', r[0].tag) +552 +553 expr = etree.ETXPath("/a/{nsb}b") +554 r = expr(x) +555 self.assertEquals(1, len(r)) +556 self.assertEquals('{nsb}b', r[0].tag) +
557 +558 # disabled this test as non-ASCII characters in namespace URIs are +559 # not acceptable +
561 x = self.parse(_bytes('<a><b xmlns="http://nsa/\\uf8d2"/><b xmlns="http://nsb/\\uf8d1"/></a>' +562 ).decode("unicode_escape")) +563 +564 expr = etree.ETXPath(_bytes("/a/{http://nsa/\\uf8d2}b").decode("unicode_escape")) +565 r = expr(x) +566 self.assertEquals(1, len(r)) +567 self.assertEquals(_bytes('{http://nsa/\\uf8d2}b').decode("unicode_escape"), r[0].tag) +568 +569 expr = etree.ETXPath(_bytes("/a/{http://nsb/\\uf8d1}b").decode("unicode_escape")) +570 r = expr(x) +571 self.assertEquals(1, len(r)) +572 self.assertEquals(_bytes('{http://nsb/\\uf8d1}b').decode("unicode_escape"), r[0].tag) +
573 +574 SAMPLE_XML = etree.parse(BytesIO(""" +575 <body> +576 <tag>text</tag> +577 <section> +578 <tag>subtext</tag> +579 </section> +580 <tag /> +581 <tag /> +582 </body> +583 """)) +584 +
585 -def tag(elem): +
586 return elem.tag +
587 +
588 -def stringTest(ctxt, s1): +
589 return "Hello "+s1 +
590 +
591 -def floatTest(ctxt, f1): +
592 return f1+4 +
593 +
594 -def booleanTest(ctxt, b1): +
595 return not b1 +
596 +
597 -def setTest(ctxt, st1): +
598 return st1[0] +
599 +
600 -def setTest2(ctxt, st1): +
601 return st1[0:2] +
602 +
603 -def argsTest1(ctxt, s, f, b, st): +
604 return ", ".join(map(str, (s, f, b, list(map(tag, st))))) +
605 +
606 -def argsTest2(ctxt, st1, st2): +
607 st1.extend(st2) +608 return st1 +
609 +
610 -def resultTypesTest(ctxt): +
611 return ["x","y"] +
612 +
613 -def resultTypesTest2(ctxt): +
614 return resultTypesTest +
615 +616 uri = "http://www.example.com/" +617 +618 extension = {(None, 'stringTest'): stringTest, +619 (None, 'floatTest'): floatTest, +620 (None, 'booleanTest'): booleanTest, +621 (None, 'setTest'): setTest, +622 (None, 'setTest2'): setTest2, +623 (None, 'argsTest1'): argsTest1, +624 (None, 'argsTest2'): argsTest2, +625 (None, 'resultTypesTest'): resultTypesTest, +626 (None, 'resultTypesTest2'): resultTypesTest2,} +627 +
628 -def xpath(): +
629 """ +630 Test xpath extension functions. +631 +632 >>> root = SAMPLE_XML +633 >>> e = etree.XPathEvaluator(root, extensions=[extension]) +634 >>> e("stringTest('you')") +635 'Hello you' +636 >>> e(_bytes("stringTest('\\\\xe9lan')").decode("unicode_escape")) +637 u'Hello \\xe9lan' +638 >>> e("stringTest('you','there')") +639 Traceback (most recent call last): +640 ... +641 TypeError: stringTest() takes exactly 2 arguments (3 given) +642 >>> e("floatTest(2)") +643 6.0 +644 >>> e("booleanTest(true())") +645 False +646 >>> list(map(tag, e("setTest(/body/tag)"))) +647 ['tag'] +648 >>> list(map(tag, e("setTest2(/body/*)"))) +649 ['tag', 'section'] +650 >>> e("argsTest1('a',1.5,true(),/body/tag)") +651 "a, 1.5, True, ['tag', 'tag', 'tag']" +652 >>> list(map(tag, e("argsTest2(/body/tag, /body/section)"))) +653 ['tag', 'section', 'tag', 'tag'] +654 >>> e("resultTypesTest()") +655 Traceback (most recent call last): +656 ... +657 XPathResultError: This is not a node: 'x' +658 >>> try: +659 ... e("resultTypesTest2()") +660 ... except etree.XPathResultError: +661 ... print("Got error") +662 Got error +663 """ +
664 +665 if sys.version_info[0] >= 3: +666 xpath.__doc__ = xpath.__doc__.replace(" u'", " '") +667 xpath.__doc__ = xpath.__doc__.replace(" XPathResultError", +668 " lxml.etree.XPathResultError") +669 xpath.__doc__ = xpath.__doc__.replace(" exactly 2 arguments", +670 " exactly 2 positional arguments") +671 +
672 -def test_suite(): +
673 suite = unittest.TestSuite() +674 suite.addTests([unittest.makeSuite(ETreeXPathTestCase)]) +675 suite.addTests([unittest.makeSuite(ETreeXPathClassTestCase)]) +676 suite.addTests([unittest.makeSuite(ETreeETXPathClassTestCase)]) +677 suite.addTests([doctest.DocTestSuite()]) +678 suite.addTests( +679 [make_doctest('../../../doc/xpathxslt.txt')]) +680 return suite +
681 +682 if __name__ == '__main__': +683 print('to test use test.py %s' % __file__) +684 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html new file mode 100644 index 0000000..41bca14 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase-class.html @@ -0,0 +1,309 @@ + + + + + lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xpathevaluator :: + Class ETreeETXPathClassTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeETXPathClassTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeETXPathClassTestCase
+
+ +
+Tests for the ETXPath class + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xpath_compile_ns(self) + source code + +
+ +
+   + + + + + + +
_test_xpath_compile_unicode(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html new file mode 100644 index 0000000..49192bd --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase-class.html @@ -0,0 +1,357 @@ + + + + + lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xpathevaluator :: + Class ETreeXPathClassTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXPathClassTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXPathClassTestCase
+
+ +
+Tests for the XPath class + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xpath_compile_doc(self) + source code + +
+ +
+   + + + + + + +
test_xpath_compile_element(self) + source code + +
+ +
+   + + + + + + +
test_xpath_compile_vars(self) + source code + +
+ +
+   + + + + + + +
test_xpath_compile_error(self) + source code + +
+ +
+   + + + + + + +
test_xpath_elementtree_error(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html new file mode 100644 index 0000000..71b4b67 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xpathevaluator.ETreeXPathTestCase-class.html @@ -0,0 +1,965 @@ + + + + + lxml.tests.test_xpathevaluator.ETreeXPathTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xpathevaluator :: + Class ETreeXPathTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXPathTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXPathTestCase
+
+ +
+XPath tests etree + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xpath_boolean(self) + source code + +
+ +
+   + + + + + + +
test_xpath_number(self) + source code + +
+ +
+   + + + + + + +
test_xpath_string(self) + source code + +
+ +
+   + + + + + + +
test_xpath_document_root(self) + source code + +
+ +
+   + + + + + + +
test_xpath_namespace(self) + source code + +
+ +
+   + + + + + + +
test_xpath_namespace_empty(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_elements(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_nothing(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_text(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_text_parent(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_text_parent_no_smart_strings(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_unicode_text_parent(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_attribute(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_attribute_parent(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_attribute_parent_no_smart_strings(self) + source code + +
+ +
+   + + + + + + +
test_xpath_list_comment(self) + source code + +
+ +
+   + + + + + + +
test_rel_xpath_boolean(self) + source code + +
+ +
+   + + + + + + +
test_rel_xpath_list_elements(self) + source code + +
+ +
+   + + + + + + +
test_xpath_ns(self) + source code + +
+ +
+   + + + + + + +
test_xpath_ns_none(self) + source code + +
+ +
+   + + + + + + +
test_xpath_ns_empty(self) + source code + +
+ +
+   + + + + + + +
test_xpath_error(self) + source code + +
+ +
+   + + + + + + +
test_xpath_class_error(self) + source code + +
+ +
+   + + + + + + +
test_xpath_prefix_error(self) + source code + +
+ +
+   + + + + + + +
test_xpath_class_prefix_error(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_getpath(self) + source code + +
+ +
+   + + + + + + +
test_elementtree_getpath_partial(self) + source code + +
+ +
+   + + + + + + +
test_xpath_evaluator(self) + source code + +
+ +
+   + + + + + + +
test_xpath_evaluator_tree(self) + source code + +
+ +
+   + + + + + + +
test_xpath_evaluator_tree_absolute(self) + source code + +
+ +
+   + + + + + + +
test_xpath_evaluator_element(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions_wrong_args(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions_error(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions_nodes(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions_nodes_append(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions_nodes_append2(self) + source code + +
+ +
+   + + + + + + +
test_xpath_context_node(self) + source code + +
+ +
+   + + + + + + +
test_xpath_eval_context_propagation(self) + source code + +
+ +
+   + + + + + + +
test_xpath_eval_context_clear(self) + source code + +
+ +
+   + + + + + + +
test_xpath_variables(self) + source code + +
+ +
+   + + + + + + +
test_xpath_variables_nodeset(self) + source code + +
+ +
+   + + + + + + +
test_xpath_extensions_mix(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt-module.html b/doc/html/api/lxml.tests.test_xslt-module.html new file mode 100644 index 0000000..7424583 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt-module.html @@ -0,0 +1,254 @@ + + + + + lxml.tests.test_xslt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module test_xslt

source code

+Test cases related to XSLT processing + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ETreeXSLTTestCase
+ XSLT tests etree +
+   + + Py3XSLTTestCase
+ XSLT tests for etree under Python 3 +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
test_suite() + source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + this_dir = '/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml... +
+   + + is_python3 = False +
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

this_dir

+ +
+
+
+
Value:
+
+'/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/tests'
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt-pysrc.html b/doc/html/api/lxml.tests.test_xslt-pysrc.html new file mode 100644 index 0000000..540c8e1 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt-pysrc.html @@ -0,0 +1,3751 @@ + + + + + lxml.tests.test_xslt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.tests.test_xslt

+
+   1  # -*- coding: utf-8 -*- 
+   2   
+   3  """ 
+   4  Test cases related to XSLT processing 
+   5  """ 
+   6   
+   7  import unittest, copy, sys, os.path 
+   8   
+   9  this_dir = os.path.dirname(__file__) 
+  10  if this_dir not in sys.path: 
+  11      sys.path.insert(0, this_dir) # needed for Py3 
+  12   
+  13  is_python3 = sys.version_info[0] >= 3 
+  14   
+  15  try: 
+  16      unicode = __builtins__["unicode"] 
+  17  except (NameError, KeyError): # Python 3 
+  18      unicode = str 
+  19   
+  20  try: 
+  21      basestring = __builtins__["basestring"] 
+  22  except (NameError, KeyError): # Python 3 
+  23      basestring = str 
+  24   
+  25  from common_imports import etree, BytesIO, HelperTestCase, fileInTestDir 
+  26  from common_imports import doctest, _bytes, _str, make_doctest 
+  27   
+
28 -class ETreeXSLTTestCase(HelperTestCase): +
29 """XSLT tests etree""" + 30 +
31 - def test_xslt(self): +
32 tree = self.parse('<a><b>B</b><c>C</c></a>') + 33 style = self.parse('''\ + 34 <xsl:stylesheet version="1.0" + 35 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 36 <xsl:template match="*" /> + 37 <xsl:template match="/"> + 38 <foo><xsl:value-of select="/a/b/text()" /></foo> + 39 </xsl:template> + 40 </xsl:stylesheet>''') + 41 + 42 st = etree.XSLT(style) + 43 res = st(tree) + 44 self.assertEquals('''\ + 45 <?xml version="1.0"?> + 46 <foo>B</foo> + 47 ''', + 48 str(res)) +
49 +
51 self.assertRaises(ValueError, etree.XSLT, etree.ElementTree()) +
52 +
53 - def test_xslt_input_none(self): +
54 self.assertRaises(TypeError, etree.XSLT, None) +
55 + 56 if False and etree.LIBXSLT_VERSION >= (1,1,15): + 57 # earlier versions generate no error + 58 if etree.LIBXSLT_VERSION > (1,1,17): +
60 style = self.parse('''\ + 61 <xsl:stylesheet version="1.0" + 62 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 63 <xsl:stylesheet /> + 64 </xsl:stylesheet>''') + 65 + 66 self.assertRaises( + 67 etree.XSLTParseError, etree.XSLT, style) +
68 +
69 - def test_xslt_copy(self): +
70 tree = self.parse('<a><b>B</b><c>C</c></a>') + 71 style = self.parse('''\ + 72 <xsl:stylesheet version="1.0" + 73 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 74 <xsl:template match="*" /> + 75 <xsl:template match="/"> + 76 <foo><xsl:value-of select="/a/b/text()" /></foo> + 77 </xsl:template> + 78 </xsl:stylesheet>''') + 79 + 80 transform = etree.XSLT(style) + 81 res = transform(tree) + 82 self.assertEquals('''\ + 83 <?xml version="1.0"?> + 84 <foo>B</foo> + 85 ''', + 86 str(res)) + 87 + 88 transform_copy = copy.deepcopy(transform) + 89 res = transform_copy(tree) + 90 self.assertEquals('''\ + 91 <?xml version="1.0"?> + 92 <foo>B</foo> + 93 ''', + 94 str(res)) + 95 + 96 transform = etree.XSLT(style) + 97 res = transform(tree) + 98 self.assertEquals('''\ + 99 <?xml version="1.0"?> + 100 <foo>B</foo> + 101 ''', + 102 str(res)) +
103 +
104 - def test_xslt_utf8(self): +
105 tree = self.parse(_bytes('<a><b>\\uF8D2</b><c>\\uF8D2</c></a>' + 106 ).decode("unicode_escape")) + 107 style = self.parse('''\ + 108 <xsl:stylesheet version="1.0" + 109 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 110 <xsl:output encoding="UTF-8"/> + 111 <xsl:template match="/"> + 112 <foo><xsl:value-of select="/a/b/text()" /></foo> + 113 </xsl:template> + 114 </xsl:stylesheet>''') + 115 + 116 st = etree.XSLT(style) + 117 res = st(tree) + 118 expected = _bytes('''\ + 119 <?xml version="1.0" encoding="UTF-8"?> + 120 <foo>\\uF8D2</foo> + 121 ''').decode("unicode_escape") + 122 if is_python3: + 123 self.assertEquals(expected, + 124 str(bytes(res), 'UTF-8')) + 125 else: + 126 self.assertEquals(expected, + 127 unicode(str(res), 'UTF-8')) +
128 +
129 - def test_xslt_encoding(self): +
130 tree = self.parse(_bytes('<a><b>\\uF8D2</b><c>\\uF8D2</c></a>' + 131 ).decode("unicode_escape")) + 132 style = self.parse('''\ + 133 <xsl:stylesheet version="1.0" + 134 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 135 <xsl:output encoding="UTF-16"/> + 136 <xsl:template match="/"> + 137 <foo><xsl:value-of select="/a/b/text()" /></foo> + 138 </xsl:template> + 139 </xsl:stylesheet>''') + 140 + 141 st = etree.XSLT(style) + 142 res = st(tree) + 143 expected = _bytes('''\ + 144 <?xml version="1.0" encoding="UTF-16"?> + 145 <foo>\\uF8D2</foo> + 146 ''').decode("unicode_escape") + 147 if is_python3: + 148 self.assertEquals(expected, + 149 str(bytes(res), 'UTF-16')) + 150 else: + 151 self.assertEquals(expected, + 152 unicode(str(res), 'UTF-16')) +
153 +
154 - def test_xslt_encoding_override(self): +
155 tree = self.parse(_bytes('<a><b>\\uF8D2</b><c>\\uF8D2</c></a>' + 156 ).decode("unicode_escape")) + 157 style = self.parse('''\ + 158 <xsl:stylesheet version="1.0" + 159 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 160 <xsl:output encoding="UTF-8"/> + 161 <xsl:template match="/"> + 162 <foo><xsl:value-of select="/a/b/text()" /></foo> + 163 </xsl:template> + 164 </xsl:stylesheet>''') + 165 + 166 st = etree.XSLT(style) + 167 res = st(tree) + 168 expected = _bytes("""\ + 169 <?xml version='1.0' encoding='UTF-16'?>\ + 170 <foo>\\uF8D2</foo>""").decode("unicode_escape") + 171 + 172 f = BytesIO() + 173 res.write(f, encoding='UTF-16') + 174 if is_python3: + 175 result = str(f.getvalue(), 'UTF-16').replace('\n', '') + 176 else: + 177 result = unicode(str(f.getvalue()), 'UTF-16').replace('\n', '') + 178 self.assertEquals(expected, result) +
179 +
180 - def test_xslt_unicode(self): +
181 tree = self.parse(_bytes('<a><b>\\uF8D2</b><c>\\uF8D2</c></a>' + 182 ).decode("unicode_escape")) + 183 style = self.parse('''\ + 184 <xsl:stylesheet version="1.0" + 185 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 186 <xsl:output encoding="UTF-16"/> + 187 <xsl:template match="/"> + 188 <foo><xsl:value-of select="/a/b/text()" /></foo> + 189 </xsl:template> + 190 </xsl:stylesheet>''') + 191 + 192 st = etree.XSLT(style) + 193 res = st(tree) + 194 expected = _bytes('''\ + 195 <?xml version="1.0"?> + 196 <foo>\\uF8D2</foo> + 197 ''').decode("unicode_escape") + 198 self.assertEquals(expected, + 199 unicode(res)) +
200 +
201 - def test_exslt_str(self): +
202 tree = self.parse('<a><b>B</b><c>C</c></a>') + 203 style = self.parse('''\ + 204 <xsl:stylesheet version="1.0" + 205 xmlns:str="http://exslt.org/strings" + 206 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 207 exclude-result-prefixes="str xsl"> + 208 <xsl:template match="text()"> + 209 <xsl:value-of select="str:align(string(.), '***', 'center')" /> + 210 </xsl:template> + 211 <xsl:template match="*"> + 212 <xsl:copy> + 213 <xsl:apply-templates/> + 214 </xsl:copy> + 215 </xsl:template> + 216 </xsl:stylesheet>''') + 217 + 218 st = etree.XSLT(style) + 219 res = st(tree) + 220 self.assertEquals('''\ + 221 <?xml version="1.0"?> + 222 <a><b>*B*</b><c>*C*</c></a> + 223 ''', + 224 str(res)) +
225 + 226 if etree.LIBXSLT_VERSION >= (1,1,21): +
228 tree = self.parse('<a><b>B</b><c>C</c></a>') + 229 style = self.parse('''\ + 230 <xsl:stylesheet version = "1.0" + 231 xmlns:xsl='http://www.w3.org/1999/XSL/Transform' + 232 xmlns:str="http://exslt.org/strings" + 233 extension-element-prefixes="str"> + 234 + 235 <xsl:template match="/"> + 236 <h1 class="{str:replace('abc', 'b', 'x')}">test</h1> + 237 </xsl:template> + 238 + 239 </xsl:stylesheet>''') + 240 + 241 st = etree.XSLT(style) + 242 res = st(tree) + 243 self.assertEquals('''\ + 244 <?xml version="1.0"?> + 245 <h1 class="axc">test</h1> + 246 ''', + 247 str(res)) +
248 +
249 - def test_exslt_math(self): +
250 tree = self.parse('<a><b>B</b><c>C</c></a>') + 251 style = self.parse('''\ + 252 <xsl:stylesheet version="1.0" + 253 xmlns:math="http://exslt.org/math" + 254 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 255 exclude-result-prefixes="math xsl"> + 256 <xsl:template match="*"> + 257 <xsl:copy> + 258 <xsl:attribute name="pi"> + 259 <xsl:value-of select="math:constant('PI', count(*)+2)"/> + 260 </xsl:attribute> + 261 <xsl:apply-templates/> + 262 </xsl:copy> + 263 </xsl:template> + 264 </xsl:stylesheet>''') + 265 + 266 st = etree.XSLT(style) + 267 res = st(tree) + 268 self.assertEquals('''\ + 269 <?xml version="1.0"?> + 270 <a pi="3.14"><b pi="3">B</b><c pi="3">C</c></a> + 271 ''', + 272 str(res)) +
273 +
274 - def test_xslt_input(self): +
275 style = self.parse('''\ + 276 <xsl:stylesheet version="1.0" + 277 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 278 <xsl:template match="*" /> + 279 <xsl:template match="/"> + 280 <foo><xsl:value-of select="/a/b/text()" /></foo> + 281 </xsl:template> + 282 </xsl:stylesheet>''') + 283 + 284 st = etree.XSLT(style) + 285 st = etree.XSLT(style.getroot()) +
286 +
287 - def test_xslt_input_partial_doc(self): +
288 style = self.parse('''\ + 289 <otherroot> + 290 <xsl:stylesheet version="1.0" + 291 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 292 <xsl:template match="*" /> + 293 <xsl:template match="/"> + 294 <foo><xsl:value-of select="/a/b/text()" /></foo> + 295 </xsl:template> + 296 </xsl:stylesheet> + 297 </otherroot>''') + 298 + 299 self.assertRaises(etree.XSLTParseError, etree.XSLT, style) + 300 root_node = style.getroot() + 301 self.assertRaises(etree.XSLTParseError, etree.XSLT, root_node) + 302 st = etree.XSLT(root_node[0]) +
303 +
304 - def test_xslt_broken(self): +
305 tree = self.parse('<a/>') + 306 style = self.parse('''\ + 307 <xsl:stylesheet version="1.0" + 308 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 309 <xsl:foo /> + 310 </xsl:stylesheet>''') + 311 self.assertRaises(etree.XSLTParseError, + 312 etree.XSLT, style) +
313 +
314 - def test_xslt_parameters(self): +
315 tree = self.parse('<a><b>B</b><c>C</c></a>') + 316 style = self.parse('''\ + 317 <xsl:stylesheet version="1.0" + 318 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 319 <xsl:template match="/"> + 320 <foo><xsl:value-of select="$bar" /></foo> + 321 </xsl:template> + 322 </xsl:stylesheet>''') + 323 + 324 st = etree.XSLT(style) + 325 res = st(tree, bar="'Bar'") + 326 self.assertEquals('''\ + 327 <?xml version="1.0"?> + 328 <foo>Bar</foo> + 329 ''', + 330 str(res)) +
331 +
332 - def test_xslt_string_parameters(self): +
333 tree = self.parse('<a><b>B</b><c>C</c></a>') + 334 style = self.parse('''\ + 335 <xsl:stylesheet version="1.0" + 336 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 337 <xsl:template match="/"> + 338 <foo><xsl:value-of select="$bar" /></foo> + 339 </xsl:template> + 340 </xsl:stylesheet>''') + 341 + 342 st = etree.XSLT(style) + 343 res = st(tree, bar=etree.XSLT.strparam('''it's me, "Bar"''')) + 344 self.assertEquals('''\ + 345 <?xml version="1.0"?> + 346 <foo>it's me, "Bar"</foo> + 347 ''', + 348 str(res)) +
349 +
350 - def test_xslt_parameter_invalid(self): +
351 tree = self.parse('<a><b>B</b><c>C</c></a>') + 352 style = self.parse('''\ + 353 <xsl:stylesheet version="1.0" + 354 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 355 <xsl:param name="bar"/> + 356 <xsl:template match="/"> + 357 <foo><xsl:value-of select="$bar" /></foo> + 358 </xsl:template> + 359 </xsl:stylesheet>''') + 360 + 361 st = etree.XSLT(style) + 362 res = self.assertRaises(etree.XSLTApplyError, + 363 st, tree, bar="<test/>") + 364 res = self.assertRaises(etree.XSLTApplyError, + 365 st, tree, bar="....") +
366 + 367 if etree.LIBXSLT_VERSION < (1,1,18): + 368 # later versions produce no error +
369 - def test_xslt_parameter_missing(self): +
370 # apply() without needed parameter will lead to XSLTApplyError + 371 tree = self.parse('<a><b>B</b><c>C</c></a>') + 372 style = self.parse('''\ + 373 <xsl:stylesheet version="1.0" + 374 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 375 <xsl:template match="/"> + 376 <foo><xsl:value-of select="$bar" /></foo> + 377 </xsl:template> + 378 </xsl:stylesheet>''') + 379 + 380 st = etree.XSLT(style) + 381 self.assertRaises(etree.XSLTApplyError, + 382 st.apply, tree) +
383 +
385 tree = self.parse('<a><b>B</b><c>C</c></a>') + 386 style = self.parse('''\ + 387 <xsl:stylesheet version="1.0" + 388 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 389 <xsl:template match="*" /> + 390 <xsl:template match="/"> + 391 <foo><xsl:value-of select="$bar" /></foo> + 392 <foo><xsl:value-of select="$baz" /></foo> + 393 </xsl:template> + 394 </xsl:stylesheet>''') + 395 + 396 st = etree.XSLT(style) + 397 res = st(tree, bar="'Bar'", baz="'Baz'") + 398 self.assertEquals('''\ + 399 <?xml version="1.0"?> + 400 <foo>Bar</foo><foo>Baz</foo> + 401 ''', + 402 str(res)) +
403 +
404 - def test_xslt_parameter_xpath(self): +
405 tree = self.parse('<a><b>B</b><c>C</c></a>') + 406 style = self.parse('''\ + 407 <xsl:stylesheet version="1.0" + 408 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 409 <xsl:template match="*" /> + 410 <xsl:template match="/"> + 411 <foo><xsl:value-of select="$bar" /></foo> + 412 </xsl:template> + 413 </xsl:stylesheet>''') + 414 + 415 st = etree.XSLT(style) + 416 res = st(tree, bar="/a/b/text()") + 417 self.assertEquals('''\ + 418 <?xml version="1.0"?> + 419 <foo>B</foo> + 420 ''', + 421 str(res)) +
422 + 423 +
425 tree = self.parse('<a><b>B</b><c>C</c></a>') + 426 style = self.parse('''\ + 427 <xsl:stylesheet version="1.0" + 428 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 429 <xsl:param name="bar" select="'Default'" /> + 430 <xsl:template match="*" /> + 431 <xsl:template match="/"> + 432 <foo><xsl:value-of select="$bar" /></foo> + 433 </xsl:template> + 434 </xsl:stylesheet>''') + 435 + 436 st = etree.XSLT(style) + 437 res = st(tree, bar="'Bar'") + 438 self.assertEquals('''\ + 439 <?xml version="1.0"?> + 440 <foo>Bar</foo> + 441 ''', + 442 str(res)) + 443 res = st(tree) + 444 self.assertEquals('''\ + 445 <?xml version="1.0"?> + 446 <foo>Default</foo> + 447 ''', + 448 str(res)) +
449 +
450 - def test_xslt_html_output(self): +
451 tree = self.parse('<a><b>B</b><c>C</c></a>') + 452 style = self.parse('''\ + 453 <xsl:stylesheet version="1.0" + 454 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 455 <xsl:output method="html"/> + 456 <xsl:strip-space elements="*"/> + 457 <xsl:template match="/"> + 458 <html><body><xsl:value-of select="/a/b/text()" /></body></html> + 459 </xsl:template> + 460 </xsl:stylesheet>''') + 461 + 462 st = etree.XSLT(style) + 463 res = st(tree) + 464 self.assertEquals('<html><body>B</body></html>', + 465 str(res).strip()) +
466 +
467 - def test_xslt_include(self): +
468 tree = etree.parse(fileInTestDir('test1.xslt')) + 469 st = etree.XSLT(tree) +
470 +
472 f = open(fileInTestDir('test1.xslt'), 'rb') + 473 tree = etree.parse(f) + 474 f.close() + 475 st = etree.XSLT(tree) +
476 +
478 xml = '<a/>' + 479 xslt = '''\ + 480 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 481 <xsl:template match="/"> + 482 <response>Some text</response> + 483 </xsl:template> + 484 </xsl:stylesheet> + 485 ''' + 486 source = self.parse(xml) + 487 styledoc = self.parse(xslt) + 488 style = etree.XSLT(styledoc) + 489 result = style(source) + 490 + 491 etree.tostring(result.getroot()) + 492 + 493 source = self.parse(xml) + 494 styledoc = self.parse(xslt) + 495 style = etree.XSLT(styledoc) + 496 result = style(source) + 497 + 498 etree.tostring(result.getroot()) +
499 +
500 - def test_xslt_repeat_transform(self): +
501 xml = '<a/>' + 502 xslt = '''\ + 503 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 504 <xsl:template match="/"> + 505 <response>Some text</response> + 506 </xsl:template> + 507 </xsl:stylesheet> + 508 ''' + 509 source = self.parse(xml) + 510 styledoc = self.parse(xslt) + 511 transform = etree.XSLT(styledoc) + 512 result = transform(source) + 513 result = transform(source) + 514 etree.tostring(result.getroot()) + 515 result = transform(source) + 516 etree.tostring(result.getroot()) + 517 str(result) + 518 + 519 result1 = transform(source) + 520 result2 = transform(source) + 521 self.assertEquals(str(result1), str(result2)) + 522 result = transform(source) + 523 str(result) +
524 +
525 - def test_xslt_empty(self): +
526 # could segfault if result contains "empty document" + 527 xml = '<blah/>' + 528 xslt = ''' + 529 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 530 <xsl:template match="/" /> + 531 </xsl:stylesheet> + 532 ''' + 533 + 534 source = self.parse(xml) + 535 styledoc = self.parse(xslt) + 536 style = etree.XSLT(styledoc) + 537 result = style(source) + 538 self.assertEqual('', str(result)) +
539 +
540 - def test_xslt_message(self): +
541 xml = '<blah/>' + 542 xslt = ''' + 543 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 544 <xsl:template match="/"> + 545 <xsl:message>TEST TEST TEST</xsl:message> + 546 </xsl:template> + 547 </xsl:stylesheet> + 548 ''' + 549 + 550 source = self.parse(xml) + 551 styledoc = self.parse(xslt) + 552 style = etree.XSLT(styledoc) + 553 result = style(source) + 554 self.assertEqual('', str(result)) + 555 self.assert_("TEST TEST TEST" in [entry.message + 556 for entry in style.error_log]) +
557 +
558 - def test_xslt_message_terminate(self): +
559 xml = '<blah/>' + 560 xslt = ''' + 561 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + 562 <xsl:template match="/"> + 563 <xsl:message terminate="yes">TEST TEST TEST</xsl:message> + 564 </xsl:template> + 565 </xsl:stylesheet> + 566 ''' + 567 + 568 source = self.parse(xml) + 569 styledoc = self.parse(xslt) + 570 style = etree.XSLT(styledoc) + 571 + 572 self.assertRaises(etree.XSLTApplyError, style, source) + 573 self.assert_("TEST TEST TEST" in [entry.message + 574 for entry in style.error_log]) +
575 +
576 - def test_xslt_shortcut(self): +
577 tree = self.parse('<a><b>B</b><c>C</c></a>') + 578 style = self.parse('''\ + 579 <xsl:stylesheet version="1.0" + 580 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 581 <xsl:template match="*" /> + 582 <xsl:template match="/"> + 583 <doc> + 584 <foo><xsl:value-of select="$bar" /></foo> + 585 <foo><xsl:value-of select="$baz" /></foo> + 586 </doc> + 587 </xsl:template> + 588 </xsl:stylesheet>''') + 589 + 590 result = tree.xslt(style, bar="'Bar'", baz="'Baz'") + 591 self.assertEquals( + 592 _bytes('<doc><foo>Bar</foo><foo>Baz</foo></doc>'), + 593 etree.tostring(result.getroot())) +
594 +
595 - def test_multiple_elementrees(self): +
596 tree = self.parse('<a><b>B</b><c>C</c></a>') + 597 style = self.parse('''\ + 598 <xsl:stylesheet version="1.0" + 599 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 600 <xsl:template match="a"><A><xsl:apply-templates/></A></xsl:template> + 601 <xsl:template match="b"><B><xsl:apply-templates/></B></xsl:template> + 602 <xsl:template match="c"><C><xsl:apply-templates/></C></xsl:template> + 603 </xsl:stylesheet>''') + 604 + 605 self.assertEquals(self._rootstring(tree), + 606 _bytes('<a><b>B</b><c>C</c></a>')) + 607 result = tree.xslt(style) + 608 self.assertEquals(self._rootstring(tree), + 609 _bytes('<a><b>B</b><c>C</c></a>')) + 610 self.assertEquals(self._rootstring(result), + 611 _bytes('<A><B>B</B><C>C</C></A>')) + 612 + 613 b_tree = etree.ElementTree(tree.getroot()[0]) + 614 self.assertEquals(self._rootstring(b_tree), + 615 _bytes('<b>B</b>')) + 616 result = b_tree.xslt(style) + 617 self.assertEquals(self._rootstring(tree), + 618 _bytes('<a><b>B</b><c>C</c></a>')) + 619 self.assertEquals(self._rootstring(result), + 620 _bytes('<B>B</B>')) + 621 + 622 c_tree = etree.ElementTree(tree.getroot()[1]) + 623 self.assertEquals(self._rootstring(c_tree), + 624 _bytes('<c>C</c>')) + 625 result = c_tree.xslt(style) + 626 self.assertEquals(self._rootstring(tree), + 627 _bytes('<a><b>B</b><c>C</c></a>')) + 628 self.assertEquals(self._rootstring(result), + 629 _bytes('<C>C</C>')) +
630 +
631 - def test_extensions1(self): +
632 tree = self.parse('<a><b>B</b></a>') + 633 style = self.parse('''\ + 634 <xsl:stylesheet version="1.0" + 635 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 636 xmlns:myns="testns" + 637 exclude-result-prefixes="myns"> + 638 <xsl:template match="a"><A><xsl:value-of select="myns:mytext(b)"/></A></xsl:template> + 639 </xsl:stylesheet>''') + 640 + 641 def mytext(ctxt, values): + 642 return 'X' * len(values) +
643 + 644 result = tree.xslt(style, {('testns', 'mytext') : mytext}) + 645 self.assertEquals(self._rootstring(result), + 646 _bytes('<A>X</A>')) +
647 +
648 - def test_extensions2(self): +
649 tree = self.parse('<a><b>B</b></a>') + 650 style = self.parse('''\ + 651 <xsl:stylesheet version="1.0" + 652 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 653 xmlns:myns="testns" + 654 exclude-result-prefixes="myns"> + 655 <xsl:template match="a"><A><xsl:value-of select="myns:mytext(b)"/></A></xsl:template> + 656 </xsl:stylesheet>''') + 657 + 658 def mytext(ctxt, values): + 659 return 'X' * len(values) +
660 + 661 namespace = etree.FunctionNamespace('testns') + 662 namespace['mytext'] = mytext + 663 + 664 result = tree.xslt(style) + 665 self.assertEquals(self._rootstring(result), + 666 _bytes('<A>X</A>')) + 667 +
669 tree = self.parse('<a><b>B</b><b/></a>') + 670 style = self.parse('''\ + 671 <xsl:stylesheet version="1.0" + 672 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 673 xmlns:myns="testns" + 674 exclude-result-prefixes="myns"> + 675 <xsl:template match="a"> + 676 <xsl:variable name="content"> + 677 <xsl:apply-templates/> + 678 </xsl:variable> + 679 <A><xsl:value-of select="myns:mytext($content)"/></A> + 680 </xsl:template> + 681 <xsl:template match="b"><xsl:copy>BBB</xsl:copy></xsl:template> + 682 </xsl:stylesheet>''') + 683 + 684 def mytext(ctxt, values): + 685 for value in values: + 686 self.assert_(hasattr(value, 'tag'), + 687 "%s is not an Element" % type(value)) + 688 self.assertEquals(value.tag, 'b') + 689 self.assertEquals(value.text, 'BBB') + 690 return 'X'.join([el.tag for el in values]) +
691 + 692 namespace = etree.FunctionNamespace('testns') + 693 namespace['mytext'] = mytext + 694 + 695 result = tree.xslt(style) + 696 self.assertEquals(self._rootstring(result), + 697 _bytes('<A>bXb</A>')) + 698 +
699 - def test_extension_element(self): +
700 tree = self.parse('<a><b>B</b></a>') + 701 style = self.parse('''\ + 702 <xsl:stylesheet version="1.0" + 703 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 704 xmlns:myns="testns" + 705 extension-element-prefixes="myns" + 706 exclude-result-prefixes="myns"> + 707 <xsl:template match="a"> + 708 <A><myns:myext>b</myns:myext></A> + 709 </xsl:template> + 710 </xsl:stylesheet>''') + 711 + 712 class MyExt(etree.XSLTExtension): + 713 def execute(self, context, self_node, input_node, output_parent): + 714 child = etree.Element(self_node.text) + 715 child.text = 'X' + 716 output_parent.append(child) +
717 + 718 extensions = { ('testns', 'myext') : MyExt() } + 719 + 720 result = tree.xslt(style, extensions=extensions) + 721 self.assertEquals(self._rootstring(result), + 722 _bytes('<A><b>X</b></A>')) + 723 +
725 tree = self.parse('<a><b>B</b></a>') + 726 style = self.parse('''\ + 727 <xsl:stylesheet version="1.0" + 728 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 729 xmlns:myns="testns" + 730 extension-element-prefixes="myns"> + 731 <xsl:template match="a"> + 732 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> + 733 </xsl:template> + 734 </xsl:stylesheet>''') + 735 + 736 class MyExt(etree.XSLTExtension): + 737 def execute(self, context, self_node, input_node, output_parent): + 738 output_parent.extend(list(self_node)[1:]) +
739 + 740 extensions = { ('testns', 'myext') : MyExt() } + 741 + 742 result = tree.xslt(style, extensions=extensions) + 743 self.assertEquals(self._rootstring(result), + 744 _bytes('<A><y>Y</y><z/></A>')) + 745 +
747 tree = self.parse('<a><b>B</b></a>') + 748 style = self.parse('''\ + 749 <xsl:stylesheet version="1.0" + 750 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 751 xmlns:myns="testns" + 752 extension-element-prefixes="myns"> + 753 <xsl:template match="a"> + 754 <A><myns:myext><x>X</x><y>Y</y><z/></myns:myext></A> + 755 </xsl:template> + 756 <xsl:template match="x" /> + 757 <xsl:template match="z">XYZ</xsl:template> + 758 </xsl:stylesheet>''') + 759 + 760 class MyExt(etree.XSLTExtension): + 761 def execute(self, context, self_node, input_node, output_parent): + 762 for child in self_node: + 763 for result in self.apply_templates(context, child): + 764 if isinstance(result, basestring): + 765 el = etree.Element("T") + 766 el.text = result + 767 else: + 768 el = result + 769 output_parent.append(el) +
770 + 771 extensions = { ('testns', 'myext') : MyExt() } + 772 + 773 result = tree.xslt(style, extensions=extensions) + 774 self.assertEquals(self._rootstring(result), + 775 _bytes('<A><T>Y</T><T>XYZ</T></A>')) + 776 +
778 tree = self.parse('<a><b>B</b></a>') + 779 style = self.parse('''\ + 780 <xsl:stylesheet version="1.0" + 781 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 782 xmlns:myns="testns" + 783 extension-element-prefixes="myns" + 784 exclude-result-prefixes="myns"> + 785 <xsl:template match="a"> + 786 <A><myns:myext>b</myns:myext></A> + 787 </xsl:template> + 788 </xsl:stylesheet>''') + 789 + 790 class MyError(Exception): + 791 pass +
792 + 793 class MyExt(etree.XSLTExtension): + 794 def execute(self, context, self_node, input_node, output_parent): + 795 raise MyError("expected!") + 796 + 797 extensions = { ('testns', 'myext') : MyExt() } + 798 self.assertRaises(MyError, tree.xslt, style, extensions=extensions) + 799 +
800 - def test_xslt_document_XML(self): +
801 # make sure document('') works from parsed strings + 802 xslt = etree.XSLT(etree.XML("""\ + 803 <xsl:stylesheet version="1.0" + 804 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 805 <xsl:template match="/"> + 806 <test>TEXT<xsl:copy-of select="document('')//test"/></test> + 807 </xsl:template> + 808 </xsl:stylesheet> + 809 """)) + 810 result = xslt(etree.XML('<a/>')) + 811 root = result.getroot() + 812 self.assertEquals(root.tag, + 813 'test') + 814 self.assertEquals(root[0].tag, + 815 'test') + 816 self.assertEquals(root[0].text, + 817 'TEXT') + 818 self.assertEquals(root[0][0].tag, + 819 '{http://www.w3.org/1999/XSL/Transform}copy-of') +
820 +
821 - def test_xslt_document_parse(self): +
822 # make sure document('') works from loaded files + 823 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt"))) + 824 result = xslt(etree.XML('<a/>')) + 825 root = result.getroot() + 826 self.assertEquals(root.tag, + 827 'test') + 828 self.assertEquals(root[0].tag, + 829 '{http://www.w3.org/1999/XSL/Transform}stylesheet') +
830 +
832 # make sure document('') works from loaded files + 833 xslt = etree.XSLT(etree.ElementTree(file=fileInTestDir("test-document.xslt"))) + 834 result = xslt(etree.XML('<a/>')) + 835 root = result.getroot() + 836 self.assertEquals(root.tag, + 837 'test') + 838 self.assertEquals(root[0].tag, + 839 '{http://www.w3.org/1999/XSL/Transform}stylesheet') +
840 +
841 - def test_xslt_document_error(self): +
842 xslt = etree.XSLT(etree.XML("""\ + 843 <xsl:stylesheet version="1.0" + 844 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 845 <xsl:template match="/"> + 846 <test>TEXT<xsl:copy-of select="document('uri:__junkfood__is__evil__')//test"/></test> + 847 </xsl:template> + 848 </xsl:stylesheet> + 849 """)) + 850 self.assertRaises(etree.XSLTApplyError, xslt, etree.XML('<a/>')) +
851 +
853 # make sure document('') works when custom resolvers are in use + 854 assertEquals = self.assertEquals + 855 called = {'count' : 0} + 856 class TestResolver(etree.Resolver): + 857 def resolve(self, url, id, context): + 858 assertEquals(url, 'file://ANYTHING') + 859 called['count'] += 1 + 860 return self.resolve_string('<CALLED/>', context) +
861 + 862 parser = etree.XMLParser() + 863 parser.resolvers.add(TestResolver()) + 864 + 865 xslt = etree.XSLT(etree.XML(_bytes("""\ + 866 <xsl:stylesheet version="1.0" + 867 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 868 xmlns:l="local"> + 869 <xsl:template match="/"> + 870 <test> + 871 <xsl:for-each select="document('')//l:data/l:entry"> + 872 <xsl:copy-of select="document('file://ANYTHING')"/> + 873 <xsl:copy> + 874 <xsl:attribute name="value"> + 875 <xsl:value-of select="."/> + 876 </xsl:attribute> + 877 </xsl:copy> + 878 </xsl:for-each> + 879 </test> + 880 </xsl:template> + 881 <l:data> + 882 <l:entry>A</l:entry> + 883 <l:entry>B</l:entry> + 884 </l:data> + 885 </xsl:stylesheet> + 886 """), parser)) + 887 + 888 self.assertEquals(called['count'], 0) + 889 result = xslt(etree.XML('<a/>')) + 890 self.assertEquals(called['count'], 1) + 891 + 892 root = result.getroot() + 893 self.assertEquals(root.tag, + 894 'test') + 895 self.assertEquals(len(root), 4) + 896 + 897 self.assertEquals(root[0].tag, + 898 'CALLED') + 899 self.assertEquals(root[1].tag, + 900 '{local}entry') + 901 self.assertEquals(root[1].text, + 902 None) + 903 self.assertEquals(root[1].get("value"), + 904 'A') + 905 self.assertEquals(root[2].tag, + 906 'CALLED') + 907 self.assertEquals(root[3].tag, + 908 '{local}entry') + 909 self.assertEquals(root[3].text, + 910 None) + 911 self.assertEquals(root[3].get("value"), + 912 'B') + 913 +
915 assertEquals = self.assertEquals + 916 called = {'count' : 0} + 917 expected_url = None + 918 class TestResolver(etree.Resolver): + 919 def resolve(self, url, id, context): + 920 assertEquals(url, expected_url) + 921 called['count'] += 1 + 922 return self.resolve_string('<CALLED/>', context) +
923 + 924 stylesheet_xml = _bytes("""\ + 925 <xsl:stylesheet version="1.0" + 926 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + 927 xmlns:l="local"> + 928 <xsl:template match="/"> + 929 <xsl:copy-of select="document('test.xml')"/> + 930 </xsl:template> + 931 </xsl:stylesheet> + 932 """) + 933 + 934 parser = etree.XMLParser() + 935 parser.resolvers.add(TestResolver()) + 936 + 937 # test without base_url => relative path only + 938 expected_url = 'test.xml' + 939 xslt = etree.XSLT(etree.XML(stylesheet_xml, parser)) + 940 + 941 self.assertEquals(called['count'], 0) + 942 result = xslt(etree.XML('<a/>')) + 943 self.assertEquals(called['count'], 1) + 944 + 945 # now the same thing with a stylesheet base URL on the filesystem + 946 called['count'] = 0 + 947 expected_url = os.path.join('MY', 'BASE', 'test.xml') + 948 xslt = etree.XSLT(etree.XML(stylesheet_xml, parser, + 949 base_url=os.path.join('MY', 'BASE', 'FILE'))) + 950 + 951 self.assertEquals(called['count'], 0) + 952 result = xslt(etree.XML('<a/>')) + 953 self.assertEquals(called['count'], 1) + 954 + 955 # now the same thing with a stylesheet base URL + 956 called['count'] = 0 + 957 expected_url = 'http://server.com/BASE/DIR/test.xml' + 958 xslt = etree.XSLT(etree.XML(stylesheet_xml, parser, + 959 base_url='http://server.com/BASE/DIR/FILE')) + 960 + 961 self.assertEquals(called['count'], 0) + 962 result = xslt(etree.XML('<a/>')) + 963 self.assertEquals(called['count'], 1) + 964 +
966 access_control = etree.XSLTAccessControl(read_file=True) + 967 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt")), + 968 access_control = access_control) + 969 result = xslt(etree.XML('<a/>')) + 970 root = result.getroot() + 971 self.assertEquals(root.tag, + 972 'test') + 973 self.assertEquals(root[0].tag, + 974 '{http://www.w3.org/1999/XSL/Transform}stylesheet') +
975 +
977 access_control = etree.XSLTAccessControl(read_file=False) + 978 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt")), + 979 access_control = access_control) + 980 self.assertRaises(etree.XSLTApplyError, xslt, etree.XML('<a/>')) +
981 +
983 access_control = etree.XSLTAccessControl.DENY_ALL + 984 xslt = etree.XSLT(etree.parse(fileInTestDir("test-document.xslt")), + 985 access_control = access_control) + 986 self.assertRaises(etree.XSLTApplyError, xslt, etree.XML('<a/>')) +
987 +
988 - def test_xslt_move_result(self): +
989 root = etree.XML(_bytes('''\ + 990 <transform> + 991 <widget displayType="fieldset"/> + 992 </transform>''')) + 993 + 994 xslt = etree.XSLT(etree.XML(_bytes('''\ + 995 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + 996 <xsl:output method="html" indent="no"/> + 997 <xsl:template match="/"> + 998 <html> + 999 <xsl:apply-templates/> +1000 </html> +1001 </xsl:template> +1002 +1003 <xsl:template match="widget"> +1004 <xsl:element name="{@displayType}"/> +1005 </xsl:template> +1006 +1007 </xsl:stylesheet>'''))) +1008 +1009 result = xslt(root[0]) +1010 root[:] = result.getroot()[:] +1011 del root # segfaulted before +
1012 +
1013 - def test_xslt_pi(self): +
1014 tree = self.parse('''\ +1015 <?xml version="1.0"?> +1016 <?xml-stylesheet type="text/xsl" href="%s"?> +1017 <a> +1018 <b>B</b> +1019 <c>C</c> +1020 </a>''' % fileInTestDir("test1.xslt")) +1021 +1022 style_root = tree.getroot().getprevious().parseXSL().getroot() +1023 self.assertEquals("{http://www.w3.org/1999/XSL/Transform}stylesheet", +1024 style_root.tag) +
1025 +
1026 - def test_xslt_pi_embedded_xmlid(self): +
1027 # test xml:id dictionary lookup mechanism +1028 tree = self.parse('''\ +1029 <?xml version="1.0"?> +1030 <?xml-stylesheet type="text/xsl" href="#style"?> +1031 <a> +1032 <b>B</b> +1033 <c>C</c> +1034 <xsl:stylesheet version="1.0" xml:id="style" +1035 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1036 <xsl:template match="*" /> +1037 <xsl:template match="/"> +1038 <foo><xsl:value-of select="/a/b/text()" /></foo> +1039 </xsl:template> +1040 </xsl:stylesheet> +1041 </a>''') +1042 +1043 style_root = tree.getroot().getprevious().parseXSL().getroot() +1044 self.assertEquals("{http://www.w3.org/1999/XSL/Transform}stylesheet", +1045 style_root.tag) +1046 +1047 st = etree.XSLT(style_root) +1048 res = st(tree) +1049 self.assertEquals('''\ +1050 <?xml version="1.0"?> +1051 <foo>B</foo> +1052 ''', +1053 str(res)) +
1054 +
1055 - def test_xslt_pi_embedded_id(self): +
1056 # test XPath lookup mechanism +1057 tree = self.parse('''\ +1058 <?xml version="1.0"?> +1059 <?xml-stylesheet type="text/xsl" href="#style"?> +1060 <a> +1061 <b>B</b> +1062 <c>C</c> +1063 </a>''') +1064 +1065 style = self.parse('''\ +1066 <xsl:stylesheet version="1.0" xml:id="style" +1067 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1068 <xsl:template match="*" /> +1069 <xsl:template match="/"> +1070 <foo><xsl:value-of select="/a/b/text()" /></foo> +1071 </xsl:template> +1072 </xsl:stylesheet> +1073 ''') +1074 +1075 tree.getroot().append(style.getroot()) +1076 +1077 style_root = tree.getroot().getprevious().parseXSL().getroot() +1078 self.assertEquals("{http://www.w3.org/1999/XSL/Transform}stylesheet", +1079 style_root.tag) +1080 +1081 st = etree.XSLT(style_root) +1082 res = st(tree) +1083 self.assertEquals('''\ +1084 <?xml version="1.0"?> +1085 <foo>B</foo> +1086 ''', +1087 str(res)) +
1088 +
1089 - def test_xslt_pi_get(self): +
1090 tree = self.parse('''\ +1091 <?xml version="1.0"?> +1092 <?xml-stylesheet type="text/xsl" href="TEST"?> +1093 <a> +1094 <b>B</b> +1095 <c>C</c> +1096 </a>''') +1097 +1098 pi = tree.getroot().getprevious() +1099 self.assertEquals("TEST", pi.get("href")) +
1100 +
1101 - def test_xslt_pi_get_all(self): +
1102 tree = self.parse('''\ +1103 <?xml version="1.0"?> +1104 <?xml-stylesheet type="text/xsl" href="TEST"?> +1105 <a> +1106 <b>B</b> +1107 <c>C</c> +1108 </a>''') +1109 +1110 pi = tree.getroot().getprevious() +1111 self.assertEquals("TEST", pi.get("href")) +1112 self.assertEquals("text/xsl", pi.get("type")) +1113 self.assertEquals(None, pi.get("motz")) +
1114 +
1116 tree = self.parse('''\ +1117 <?xml version="1.0"?> +1118 <?xml-stylesheet href="TEST" type="text/xsl"?> +1119 <a> +1120 <b>B</b> +1121 <c>C</c> +1122 </a>''') +1123 +1124 pi = tree.getroot().getprevious() +1125 self.assertEquals("TEST", pi.get("href")) +1126 self.assertEquals("text/xsl", pi.get("type")) +1127 self.assertEquals(None, pi.get("motz")) +
1128 +
1129 - def test_xslt_pi_get_unknown(self): +
1130 tree = self.parse('''\ +1131 <?xml version="1.0"?> +1132 <?xml-stylesheet type="text/xsl" href="TEST"?> +1133 <a> +1134 <b>B</b> +1135 <c>C</c> +1136 </a>''') +1137 +1138 pi = tree.getroot().getprevious() +1139 self.assertEquals(None, pi.get("unknownattribute")) +
1140 +
1141 - def test_xslt_pi_set_replace(self): +
1142 tree = self.parse('''\ +1143 <?xml version="1.0"?> +1144 <?xml-stylesheet type="text/xsl" href="TEST"?> +1145 <a> +1146 <b>B</b> +1147 <c>C</c> +1148 </a>''') +1149 +1150 pi = tree.getroot().getprevious() +1151 self.assertEquals("TEST", pi.get("href")) +1152 +1153 pi.set("href", "TEST123") +1154 self.assertEquals("TEST123", pi.get("href")) +
1155 +
1156 - def test_xslt_pi_set_new(self): +
1157 tree = self.parse('''\ +1158 <?xml version="1.0"?> +1159 <?xml-stylesheet type="text/xsl"?> +1160 <a> +1161 <b>B</b> +1162 <c>C</c> +1163 </a>''') +1164 +1165 pi = tree.getroot().getprevious() +1166 self.assertEquals(None, pi.get("href")) +1167 +1168 pi.set("href", "TEST") +1169 self.assertEquals("TEST", pi.get("href")) +
1170 +
1171 - def test_exslt_regexp_test(self): +
1172 xslt = etree.XSLT(etree.XML(_bytes("""\ +1173 <xsl:stylesheet version="1.0" +1174 xmlns:regexp="http://exslt.org/regular-expressions" +1175 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1176 <xsl:template match="*"> +1177 <test><xsl:copy-of select="*[regexp:test(string(.), '8.')]"/></test> +1178 </xsl:template> +1179 </xsl:stylesheet> +1180 """))) +1181 result = xslt(etree.XML(_bytes('<a><b>123</b><b>098</b><b>987</b></a>'))) +1182 root = result.getroot() +1183 self.assertEquals(root.tag, +1184 'test') +1185 self.assertEquals(len(root), 1) +1186 self.assertEquals(root[0].tag, +1187 'b') +1188 self.assertEquals(root[0].text, +1189 '987') +
1190 +
1191 - def test_exslt_regexp_replace(self): +
1192 xslt = etree.XSLT(etree.XML("""\ +1193 <xsl:stylesheet version="1.0" +1194 xmlns:regexp="http://exslt.org/regular-expressions" +1195 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1196 <xsl:template match="*"> +1197 <test> +1198 <xsl:copy-of select="regexp:replace(string(.), 'd.', '', 'XX')"/> +1199 <xsl:text>-</xsl:text> +1200 <xsl:copy-of select="regexp:replace(string(.), 'd.', 'gi', 'XX')"/> +1201 </test> +1202 </xsl:template> +1203 </xsl:stylesheet> +1204 """)) +1205 result = xslt(etree.XML(_bytes('<a>abdCdEeDed</a>'))) +1206 root = result.getroot() +1207 self.assertEquals(root.tag, +1208 'test') +1209 self.assertEquals(len(root), 0) +1210 self.assertEquals(root.text, 'abXXdEeDed-abXXXXeXXd') +
1211 +
1212 - def test_exslt_regexp_match(self): +
1213 xslt = etree.XSLT(etree.XML("""\ +1214 <xsl:stylesheet version="1.0" +1215 xmlns:regexp="http://exslt.org/regular-expressions" +1216 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1217 <xsl:template match="*"> +1218 <test> +1219 <test1><xsl:copy-of select="regexp:match(string(.), 'd.')"/></test1> +1220 <test2><xsl:copy-of select="regexp:match(string(.), 'd.', 'g')"/></test2> +1221 <test2i><xsl:copy-of select="regexp:match(string(.), 'd.', 'gi')"/></test2i> +1222 </test> +1223 </xsl:template> +1224 </xsl:stylesheet> +1225 """)) +1226 result = xslt(etree.XML(_bytes('<a>abdCdEeDed</a>'))) +1227 root = result.getroot() +1228 self.assertEquals(root.tag, 'test') +1229 self.assertEquals(len(root), 3) +1230 +1231 self.assertEquals(len(root[0]), 1) +1232 self.assertEquals(root[0][0].tag, 'match') +1233 self.assertEquals(root[0][0].text, 'dC') +1234 +1235 self.assertEquals(len(root[1]), 2) +1236 self.assertEquals(root[1][0].tag, 'match') +1237 self.assertEquals(root[1][0].text, 'dC') +1238 self.assertEquals(root[1][1].tag, 'match') +1239 self.assertEquals(root[1][1].text, 'dE') +1240 +1241 self.assertEquals(len(root[2]), 3) +1242 self.assertEquals(root[2][0].tag, 'match') +1243 self.assertEquals(root[2][0].text, 'dC') +1244 self.assertEquals(root[2][1].tag, 'match') +1245 self.assertEquals(root[2][1].text, 'dE') +1246 self.assertEquals(root[2][2].tag, 'match') +1247 self.assertEquals(root[2][2].text, 'De') +
1248 +
1250 xslt = etree.XSLT(etree.XML(_bytes("""\ +1251 <xsl:stylesheet version="1.0" +1252 xmlns:regexp="http://exslt.org/regular-expressions" +1253 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1254 <xsl:template match="/"> +1255 <test> +1256 <xsl:for-each select="regexp:match( +1257 '123abc567', '([0-9]+)([a-z]+)([0-9]+)' )"> +1258 <test1><xsl:value-of select="."/></test1> +1259 </xsl:for-each> +1260 </test> +1261 </xsl:template> +1262 </xsl:stylesheet> +1263 """))) +1264 result = xslt(etree.XML(_bytes('<a/>'))) +1265 root = result.getroot() +1266 self.assertEquals(root.tag, 'test') +1267 self.assertEquals(len(root), 4) +1268 +1269 self.assertEquals(root[0].text, "123abc567") +1270 self.assertEquals(root[1].text, "123") +1271 self.assertEquals(root[2].text, "abc") +1272 self.assertEquals(root[3].text, "567") +
1273 +
1274 - def test_exslt_regexp_match1(self): +
1275 # taken from http://www.exslt.org/regexp/functions/match/index.html +1276 xslt = etree.XSLT(etree.XML(_bytes("""\ +1277 <xsl:stylesheet version="1.0" +1278 xmlns:regexp="http://exslt.org/regular-expressions" +1279 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1280 <xsl:template match="/"> +1281 <test> +1282 <xsl:for-each select="regexp:match( +1283 'http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml', +1284 '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')"> +1285 <test1><xsl:value-of select="."/></test1> +1286 </xsl:for-each> +1287 </test> +1288 </xsl:template> +1289 </xsl:stylesheet> +1290 """))) +1291 result = xslt(etree.XML(_bytes('<a/>'))) +1292 root = result.getroot() +1293 self.assertEquals(root.tag, 'test') +1294 self.assertEquals(len(root), 5) +1295 +1296 self.assertEquals( +1297 root[0].text, +1298 "http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml") +1299 self.assertEquals( +1300 root[1].text, +1301 "http") +1302 self.assertEquals( +1303 root[2].text, +1304 "www.bayes.co.uk") +1305 self.assertFalse(root[3].text) +1306 self.assertEquals( +1307 root[4].text, +1308 "/xml/index.xml?/xml/utils/rechecker.xml") +
1309 +
1310 - def test_exslt_regexp_match2(self): +
1311 # taken from http://www.exslt.org/regexp/functions/match/index.html +1312 xslt = etree.XSLT(self.parse("""\ +1313 <xsl:stylesheet version="1.0" +1314 xmlns:regexp="http://exslt.org/regular-expressions" +1315 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1316 <xsl:template match="/"> +1317 <test> +1318 <xsl:for-each select="regexp:match( +1319 'This is a test string', '(\w+)', 'g')"> +1320 <test1><xsl:value-of select="."/></test1> +1321 </xsl:for-each> +1322 </test> +1323 </xsl:template> +1324 </xsl:stylesheet> +1325 """)) +1326 result = xslt(etree.XML(_bytes('<a/>'))) +1327 root = result.getroot() +1328 self.assertEquals(root.tag, 'test') +1329 self.assertEquals(len(root), 5) +1330 +1331 self.assertEquals(root[0].text, "This") +1332 self.assertEquals(root[1].text, "is") +1333 self.assertEquals(root[2].text, "a") +1334 self.assertEquals(root[3].text, "test") +1335 self.assertEquals(root[4].text, "string") +
1336 +
1337 - def _test_exslt_regexp_match3(self): +
1338 # taken from http://www.exslt.org/regexp/functions/match/index.html +1339 # THIS IS NOT SUPPORTED! +1340 xslt = etree.XSLT(etree.XML(_bytes("""\ +1341 <xsl:stylesheet version="1.0" +1342 xmlns:regexp="http://exslt.org/regular-expressions" +1343 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1344 <xsl:template match="/"> +1345 <test> +1346 <xsl:for-each select="regexp:match( +1347 'This is a test string', '([a-z])+ ', 'g')"> +1348 <test1><xsl:value-of select="."/></test1> +1349 </xsl:for-each> +1350 </test> +1351 </xsl:template> +1352 </xsl:stylesheet> +1353 """))) +1354 result = xslt(etree.XML(_bytes('<a/>'))) +1355 root = result.getroot() +1356 self.assertEquals(root.tag, 'test') +1357 self.assertEquals(len(root), 4) +1358 +1359 self.assertEquals(root[0].text, "his") +1360 self.assertEquals(root[1].text, "is") +1361 self.assertEquals(root[2].text, "a") +1362 self.assertEquals(root[3].text, "test") +
1363 +
1364 - def _test_exslt_regexp_match4(self): +
1365 # taken from http://www.exslt.org/regexp/functions/match/index.html +1366 # THIS IS NOT SUPPORTED! +1367 xslt = etree.XSLT(etree.XML(_bytes("""\ +1368 <xsl:stylesheet version="1.0" +1369 xmlns:regexp="http://exslt.org/regular-expressions" +1370 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1371 <xsl:template match="/"> +1372 <test> +1373 <xsl:for-each select="regexp:match( +1374 'This is a test string', '([a-z])+ ', 'gi')"> +1375 <test1><xsl:value-of select="."/></test1> +1376 </xsl:for-each> +1377 </test> +1378 </xsl:template> +1379 </xsl:stylesheet> +1380 """))) +1381 result = xslt(etree.XML(_bytes('<a/>'))) +1382 root = result.getroot() +1383 self.assertEquals(root.tag, 'test') +1384 self.assertEquals(len(root), 4) +1385 +1386 self.assertEquals(root[0].text, "This") +1387 self.assertEquals(root[1].text, "is") +1388 self.assertEquals(root[2].text, "a") +1389 self.assertEquals(root[3].text, "test") +
1390 +1391 +
1392 -class Py3XSLTTestCase(HelperTestCase): +
1393 """XSLT tests for etree under Python 3""" +
1394 - def test_xslt_result_bytes(self): +
1395 tree = self.parse('<a><b>B</b><c>C</c></a>') +1396 style = self.parse('''\ +1397 <xsl:stylesheet version="1.0" +1398 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1399 <xsl:template match="*" /> +1400 <xsl:template match="/"> +1401 <foo><xsl:value-of select="/a/b/text()" /></foo> +1402 </xsl:template> +1403 </xsl:stylesheet>''') +1404 +1405 st = etree.XSLT(style) +1406 res = st(tree) +1407 self.assertEquals(_bytes('''\ +1408 <?xml version="1.0"?> +1409 <foo>B</foo> +1410 '''), +1411 bytes(res)) +
1412 +
1413 - def test_xslt_result_bytearray(self): +
1414 tree = self.parse('<a><b>B</b><c>C</c></a>') +1415 style = self.parse('''\ +1416 <xsl:stylesheet version="1.0" +1417 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1418 <xsl:template match="*" /> +1419 <xsl:template match="/"> +1420 <foo><xsl:value-of select="/a/b/text()" /></foo> +1421 </xsl:template> +1422 </xsl:stylesheet>''') +1423 +1424 st = etree.XSLT(style) +1425 res = st(tree) +1426 self.assertEquals(_bytes('''\ +1427 <?xml version="1.0"?> +1428 <foo>B</foo> +1429 '''), +1430 bytearray(res)) +
1431 +
1432 - def test_xslt_result_memoryview(self): +
1433 tree = self.parse('<a><b>B</b><c>C</c></a>') +1434 style = self.parse('''\ +1435 <xsl:stylesheet version="1.0" +1436 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +1437 <xsl:template match="*" /> +1438 <xsl:template match="/"> +1439 <foo><xsl:value-of select="/a/b/text()" /></foo> +1440 </xsl:template> +1441 </xsl:stylesheet>''') +1442 +1443 st = etree.XSLT(style) +1444 res = st(tree) +1445 self.assertEquals(_bytes('''\ +1446 <?xml version="1.0"?> +1447 <foo>B</foo> +1448 '''), +1449 bytes(memoryview(res))) +
1450 +1451 +
1452 -def test_suite(): +
1453 suite = unittest.TestSuite() +1454 suite.addTests([unittest.makeSuite(ETreeXSLTTestCase)]) +1455 if is_python3: +1456 suite.addTests([unittest.makeSuite(Py3XSLTTestCase)]) +1457 suite.addTests( +1458 [make_doctest('../../../doc/extensions.txt')]) +1459 suite.addTests( +1460 [make_doctest('../../../doc/xpathxslt.txt')]) +1461 return suite +
1462 +1463 if __name__ == '__main__': +1464 print('to test use test.py %s' % __file__) +1465 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt.ETreeXSLTTestCase-class.html b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTTestCase-class.html new file mode 100644 index 0000000..2b30270 --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.ETreeXSLTTestCase-class.html @@ -0,0 +1,1333 @@ + + + + + lxml.tests.test_xslt.ETreeXSLTTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt :: + Class ETreeXSLTTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ETreeXSLTTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               ETreeXSLTTestCase
+
+ +
+XSLT tests etree + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xslt(self) + source code + +
+ +
+   + + + + + + +
test_xslt_elementtree_error(self) + source code + +
+ +
+   + + + + + + +
test_xslt_input_none(self) + source code + +
+ +
+   + + + + + + +
test_xslt_invalid_stylesheet(self) + source code + +
+ +
+   + + + + + + +
test_xslt_copy(self) + source code + +
+ +
+   + + + + + + +
test_xslt_utf8(self) + source code + +
+ +
+   + + + + + + +
test_xslt_encoding(self) + source code + +
+ +
+   + + + + + + +
test_xslt_encoding_override(self) + source code + +
+ +
+   + + + + + + +
test_xslt_unicode(self) + source code + +
+ +
+   + + + + + + +
test_exslt_str(self) + source code + +
+ +
+   + + + + + + +
test_exslt_str_attribute_replace(self) + source code + +
+ +
+   + + + + + + +
test_exslt_math(self) + source code + +
+ +
+   + + + + + + +
test_xslt_input(self) + source code + +
+ +
+   + + + + + + +
test_xslt_input_partial_doc(self) + source code + +
+ +
+   + + + + + + +
test_xslt_broken(self) + source code + +
+ +
+   + + + + + + +
test_xslt_parameters(self) + source code + +
+ +
+   + + + + + + +
test_xslt_string_parameters(self) + source code + +
+ +
+   + + + + + + +
test_xslt_parameter_invalid(self) + source code + +
+ +
+   + + + + + + +
test_xslt_parameter_missing(self) + source code + +
+ +
+   + + + + + + +
test_xslt_multiple_parameters(self) + source code + +
+ +
+   + + + + + + +
test_xslt_parameter_xpath(self) + source code + +
+ +
+   + + + + + + +
test_xslt_default_parameters(self) + source code + +
+ +
+   + + + + + + +
test_xslt_html_output(self) + source code + +
+ +
+   + + + + + + +
test_xslt_include(self) + source code + +
+ +
+   + + + + + + +
test_xslt_include_from_filelike(self) + source code + +
+ +
+   + + + + + + +
test_xslt_multiple_transforms(self) + source code + +
+ +
+   + + + + + + +
test_xslt_repeat_transform(self) + source code + +
+ +
+   + + + + + + +
test_xslt_empty(self) + source code + +
+ +
+   + + + + + + +
test_xslt_message(self) + source code + +
+ +
+   + + + + + + +
test_xslt_message_terminate(self) + source code + +
+ +
+   + + + + + + +
test_xslt_shortcut(self) + source code + +
+ +
+   + + + + + + +
test_multiple_elementrees(self) + source code + +
+ +
+   + + + + + + +
test_extensions1(self) + source code + +
+ +
+   + + + + + + +
test_extensions2(self) + source code + +
+ +
+   + + + + + + +
test_variable_result_tree_fragment(self) + source code + +
+ +
+   + + + + + + +
test_extension_element(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_content(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_apply_templates(self) + source code + +
+ +
+   + + + + + + +
test_extension_element_raise(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_XML(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_parse(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_elementtree(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_error(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_XML_resolver(self) + source code + +
+ +
+   + + + + + + +
test_xslt_resolver_url_building(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_parse_allow(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_parse_deny(self) + source code + +
+ +
+   + + + + + + +
test_xslt_document_parse_deny_all(self) + source code + +
+ +
+   + + + + + + +
test_xslt_move_result(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_embedded_xmlid(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_embedded_id(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_get(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_get_all(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_get_all_reversed(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_get_unknown(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_set_replace(self) + source code + +
+ +
+   + + + + + + +
test_xslt_pi_set_new(self) + source code + +
+ +
+   + + + + + + +
test_exslt_regexp_test(self) + source code + +
+ +
+   + + + + + + +
test_exslt_regexp_replace(self) + source code + +
+ +
+   + + + + + + +
test_exslt_regexp_match(self) + source code + +
+ +
+   + + + + + + +
test_exslt_regexp_match_groups(self) + source code + +
+ +
+   + + + + + + +
test_exslt_regexp_match1(self) + source code + +
+ +
+   + + + + + + +
test_exslt_regexp_match2(self) + source code + +
+ +
+   + + + + + + +
_test_exslt_regexp_match3(self) + source code + +
+ +
+   + + + + + + +
_test_exslt_regexp_match4(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.tests.test_xslt.Py3XSLTTestCase-class.html b/doc/html/api/lxml.tests.test_xslt.Py3XSLTTestCase-class.html new file mode 100644 index 0000000..af993bd --- /dev/null +++ b/doc/html/api/lxml.tests.test_xslt.Py3XSLTTestCase-class.html @@ -0,0 +1,325 @@ + + + + + lxml.tests.test_xslt.Py3XSLTTestCase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Package tests :: + Module test_xslt :: + Class Py3XSLTTestCase + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Py3XSLTTestCase

source code

+
+               object --+        
+                        |        
+        unittest.TestCase --+    
+                            |    
+common_imports.HelperTestCase --+
+                                |
+                               Py3XSLTTestCase
+
+ +
+XSLT tests for etree under Python 3 + + + + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from unittest.TestCase: + failureException +

+
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
test_xslt_result_bytes(self) + source code + +
+ +
+   + + + + + + +
test_xslt_result_bytearray(self) + source code + +
+ +
+   + + + + + + +
test_xslt_result_memoryview(self) + source code + +
+ +
+

Inherited from common_imports.HelperTestCase: + parse, + tearDown +

+

Inherited from common_imports.HelperTestCase (private): + _rootstring +

+

Inherited from unittest.TestCase: + __call__, + __init__, + __repr__, + __str__, + assertAlmostEqual, + assertAlmostEquals, + assertEqual, + assertEquals, + assertNotAlmostEqual, + assertNotAlmostEquals, + assertNotEqual, + assertNotEquals, + assertRaises, + assertTrue, + assert_, + countTestCases, + debug, + defaultTestResult, + fail, + failIf, + failIfAlmostEqual, + failIfEqual, + failUnless, + failUnlessAlmostEqual, + failUnlessEqual, + failUnlessRaises, + id, + run, + setUp, + shortDescription +

+

Inherited from unittest.TestCase (private): + _exc_info +

+

Inherited from object: + __delattr__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from common_imports.HelperTestCase: + assertFalse +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.usedoctest-module.html b/doc/html/api/lxml.usedoctest-module.html new file mode 100644 index 0000000..cdd0e5a --- /dev/null +++ b/doc/html/api/lxml.usedoctest-module.html @@ -0,0 +1,122 @@ + + + + + lxml.usedoctest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module usedoctest + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module usedoctest

source code

+

Doctest module for XML comparison.

+

Usage:

+
+>>> import lxml.usedoctest
+>>> # now do your XML doctests ...
+
+

See lxml.doctestcompare

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/lxml.usedoctest-pysrc.html b/doc/html/api/lxml.usedoctest-pysrc.html new file mode 100644 index 0000000..3fcf25c --- /dev/null +++ b/doc/html/api/lxml.usedoctest-pysrc.html @@ -0,0 +1,134 @@ + + + + + lxml.usedoctest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package lxml :: + Module usedoctest + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module lxml.usedoctest

+
+ 1  """Doctest module for XML comparison. 
+ 2   
+ 3  Usage:: 
+ 4   
+ 5     >>> import lxml.usedoctest 
+ 6     >>> # now do your XML doctests ... 
+ 7   
+ 8  See `lxml.doctestcompare` 
+ 9  """ 
+10   
+11  from lxml import doctestcompare 
+12   
+13  doctestcompare.temp_install(del_module=__name__) 
+14   
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/module-tree.html b/doc/html/api/module-tree.html new file mode 100644 index 0000000..b2c512f --- /dev/null +++ b/doc/html/api/module-tree.html @@ -0,0 +1,170 @@ + + + + + Module Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
+ [ Module Hierarchy + | Class Hierarchy ] +

+

Module Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/redirect.html b/doc/html/api/redirect.html new file mode 100644 index 0000000..9ce68b1 --- /dev/null +++ b/doc/html/api/redirect.html @@ -0,0 +1,38 @@ +Epydoc Redirect Page + + + + + + + + +

Epydoc Auto-redirect page

+ +

When javascript is enabled, this page will redirect URLs of +the form redirect.html#dotted.name to the +documentation for the object with the given fully-qualified +dotted name.

+

 

+ + + + + diff --git a/doc/html/api/str-class.html b/doc/html/api/str-class.html new file mode 100644 index 0000000..174ed6d --- /dev/null +++ b/doc/html/api/str-class.html @@ -0,0 +1,1989 @@ + + + + + str + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + str :: + Class str + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class str

+
+object --+    
+         |    
+basestring --+
+             |
+            str
+
+ +
Known Subclasses:
+
+ +
+ +
+

str(object) -> string

+

Return a nice string representation of the object. +If the argument is a string, the return value is the same object.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__add__(x, + y)
+ x+y
+ + +
+ +
+   + + + + + + +
__contains__(x, + y)
+ y in x
+ + +
+ +
+   + + + + + + +
__eq__(x, + y)
+ x==y
+ + +
+ +
+   + + + + + + +
__ge__(x, + y)
+ x>=y
+ + +
+ +
+   + + + + + + +
__getattribute__(...)
+ x.__getattribute__('name') <==> x.name
+ + +
+ +
+   + + + + + + +
__getitem__(x, + y)
+ x[y]
+ + +
+ +
+   + + + + + + +
__getnewargs__(...) + + +
+ +
+   + + + + + + +
__getslice__(x, + i, + j)
+ x[i:j]
+ + +
+ +
+   + + + + + + +
__gt__(x, + y)
+ x>y
+ + +
+ +
+   + + + + + + +
__hash__(x)
+ hash(x)
+ + +
+ +
+   + + + + + + +
__le__(x, + y)
+ x<=y
+ + +
+ +
+   + + + + + + +
__len__(x)
+ len(x)
+ + +
+ +
+   + + + + + + +
__lt__(x, + y)
+ x<y
+ + +
+ +
+   + + + + + + +
__mod__(x, + y)
+ x%y
+ + +
+ +
+   + + + + + + +
__mul__(x, + n)
+ x*n
+ + +
+ +
+   + + + + + + +
__ne__(x, + y)
+ x!=y
+ + +
+ +
+ a new object with type S, a subtype of T + + + + + + +
__new__(T, + S, + ...) + + +
+ +
+   + + + + + + +
__repr__(x)
+ repr(x)
+ + +
+ +
+   + + + + + + +
__rmod__(x, + y)
+ y%x
+ + +
+ +
+   + + + + + + +
__rmul__(x, + n)
+ n*x
+ + +
+ +
+   + + + + + + +
__str__(x)
+ str(x)
+ + +
+ +
+ string + + + + + + +
capitalize(S)
+ Return a copy of the string S with only its first character +capitalized.
+ + +
+ +
+ string + + + + + + +
center(S, + width, + fillchar=...)
+ Return S centered in a string of length width.
+ + +
+ +
+ int + + + + + + +
count(S, + sub, + start=..., + end=...)
+ Return the number of non-overlapping occurrences of substring sub in +string S[start:end].
+ + +
+ +
+ object + + + + + + +
decode(S, + encoding=..., + errors=...)
+ Decodes S using the codec registered for encoding.
+ + +
+ +
+ object + + + + + + +
encode(S, + encoding=..., + errors=...)
+ Encodes S using the codec registered for encoding.
+ + +
+ +
+ bool + + + + + + +
endswith(S, + suffix, + start=..., + end=...)
+ Return True if S ends with the specified suffix, False otherwise.
+ + +
+ +
+ string + + + + + + +
expandtabs(S, + tabsize=...)
+ Return a copy of S where all tab characters are expanded using spaces.
+ + +
+ +
+ int + + + + + + +
find(S, + sub, + start=... , + end=...)
+ Return the lowest index in S where substring sub is found, +such that sub is contained within s[start:end].
+ + +
+ +
+ int + + + + + + +
index(S, + sub, + start=... , + end=...)
+ Like S.find() but raise ValueError when the substring is not found.
+ + +
+ +
+ bool + + + + + + +
isalnum(S)
+ Return True if all characters in S are alphanumeric +and there is at least one character in S, False otherwise.
+ + +
+ +
+ bool + + + + + + +
isalpha(S)
+ Return True if all characters in S are alphabetic +and there is at least one character in S, False otherwise.
+ + +
+ +
+ bool + + + + + + +
isdigit(S)
+ Return True if all characters in S are digits +and there is at least one character in S, False otherwise.
+ + +
+ +
+ bool + + + + + + +
islower(S)
+ Return True if all cased characters in S are lowercase and there is +at least one cased character in S, False otherwise.
+ + +
+ +
+ bool + + + + + + +
isspace(S)
+ Return True if all characters in S are whitespace +and there is at least one character in S, False otherwise.
+ + +
+ +
+ bool + + + + + + +
istitle(S)
+ Return True if S is a titlecased string and there is at least one +character in S, i.e.
+ + +
+ +
+ bool + + + + + + +
isupper(S)
+ Return True if all cased characters in S are uppercase and there is +at least one cased character in S, False otherwise.
+ + +
+ +
+ string + + + + + + +
join(S, + sequence)
+ Return a string which is the concatenation of the strings in the +sequence.
+ + +
+ +
+ string + + + + + + +
ljust(S, + width, + fillchar=...)
+ Return S left justified in a string of length width.
+ + +
+ +
+ string + + + + + + +
lower(S)
+ Return a copy of the string S converted to lowercase.
+ + +
+ +
+ string or unicode + + + + + + +
lstrip(S, + chars=...)
+ Return a copy of the string S with leading whitespace removed.
+ + +
+ +
+ (head, sep, tail) + + + + + + +
partition(S, + sep)
+ Searches for the separator sep in S, and returns the part before it, +the separator itself, and the part after it.
+ + +
+ +
+   + + + + + + +
replace(...)
+ S.replace (old, new[, count]) -> string
+ + +
+ +
+ int + + + + + + +
rfind(S, + sub, + start=... , + end=...)
+ Return the highest index in S where substring sub is found, +such that sub is contained within s[start:end].
+ + +
+ +
+ int + + + + + + +
rindex(S, + sub, + start=... , + end=...)
+ Like S.rfind() but raise ValueError when the substring is not found.
+ + +
+ +
+ string + + + + + + +
rjust(S, + width, + fillchar=...)
+ Return S right justified in a string of length width.
+ + +
+ +
+ (tail, sep, head) + + + + + + +
rpartition(S, + sep)
+ Searches for the separator sep in S, starting at the end of S, and returns +the part before it, the separator itself, and the part after it.
+ + +
+ +
+ list of strings + + + + + + +
rsplit(S, + sep=... , + maxsplit=...)
+ Return a list of the words in the string S, using sep as the +delimiter string, starting at the end of the string and working +to the front.
+ + +
+ +
+ string or unicode + + + + + + +
rstrip(S, + chars=...)
+ Return a copy of the string S with trailing whitespace removed.
+ + +
+ +
+ list of strings + + + + + + +
split(S, + sep=... , + maxsplit=...)
+ Return a list of the words in the string S, using sep as the +delimiter string.
+ + +
+ +
+ list of strings + + + + + + +
splitlines(S, + keepends=...)
+ Return a list of the lines in S, breaking at line boundaries.
+ + +
+ +
+ bool + + + + + + +
startswith(S, + prefix, + start=..., + end=...)
+ Return True if S starts with the specified prefix, False otherwise.
+ + +
+ +
+ string or unicode + + + + + + +
strip(S, + chars=...)
+ Return a copy of the string S with leading and trailing +whitespace removed.
+ + +
+ +
+ string + + + + + + +
swapcase(S)
+ Return a copy of the string S with uppercase characters +converted to lowercase and vice versa.
+ + +
+ +
+ string + + + + + + +
title(S)
+ Return a titlecased version of S, i.e.
+ + +
+ +
+ string + + + + + + +
translate(S, + table, + deletechars=...)
+ Return a copy of the string S, where all characters occurring +in the optional argument deletechars are removed, and the +remaining characters have been mapped through the given +translation table, which must be a string of length 256.
+ + +
+ +
+ string + + + + + + +
upper(S)
+ Return a copy of the string S converted to uppercase.
+ + +
+ +
+ string + + + + + + +
zfill(S, + width)
+ Pad a numeric string S with zeros on the left, to fill a field +of the specified width.
+ + +
+ +
+

Inherited from object: + __delattr__, + __init__, + __reduce__, + __reduce_ex__, + __setattr__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__getattribute__(...) +

+
  +
+ + x.__getattribute__('name') <==> x.name +
+
Overrides: + object.__getattribute__ +
+
+
+
+ +
+ +
+ + +
+

__getslice__(x, + i, + j) +
(Slicling operator) +

+
  +
+ +

x[i:j]

+

Use of negative indices is not supported.

+
+
+
+
+ +
+ +
+ + +
+

__hash__(x) +
(Hashing function) +

+
  +
+ + hash(x) +
+
Overrides: + object.__hash__ +
+
+
+
+ +
+ +
+ + +
+

__new__(T, + S, + ...) +

+
  +
+ + +
+
Returns: a new object with type S, a subtype of T
+
Overrides: + object.__new__ +
+
+
+
+ +
+ +
+ + +
+

__repr__(x) +
(Representation operator) +

+
  +
+ + repr(x) +
+
Overrides: + object.__repr__ +
+
+
+
+ +
+ +
+ + +
+

__str__(x) +
(Informal representation operator) +

+
  +
+ + str(x) +
+
Overrides: + object.__str__ +
+
+
+
+ +
+ +
+ + +
+

center(S, + width, + fillchar=...) +

+
  +
+ + Return S centered in a string of length width. Padding is +done using the specified fill character (default is a space) +
+
Returns: string
+
+
+
+ +
+ +
+ + +
+

count(S, + sub, + start=..., + end=...) +

+
  +
+ + Return the number of non-overlapping occurrences of substring sub in +string S[start:end]. Optional arguments start and end are interpreted +as in slice notation. +
+
Returns: int
+
+
+
+ +
+ +
+ + +
+

decode(S, + encoding=..., + errors=...) +

+
  +
+ + Decodes S using the codec registered for encoding. encoding defaults +to the default encoding. errors may be given to set a different error +handling scheme. Default is 'strict' meaning that encoding errors raise +a UnicodeDecodeError. Other possible values are 'ignore' and 'replace' +as well as any other name registerd with codecs.register_error that is +able to handle UnicodeDecodeErrors. +
+
Returns: object
+
+
+
+ +
+ +
+ + +
+

encode(S, + encoding=..., + errors=...) +

+
  +
+ + Encodes S using the codec registered for encoding. encoding defaults +to the default encoding. errors may be given to set a different error +handling scheme. Default is 'strict' meaning that encoding errors raise +a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and +'xmlcharrefreplace' as well as any other name registered with +codecs.register_error that is able to handle UnicodeEncodeErrors. +
+
Returns: object
+
+
+
+ +
+ +
+ + +
+

endswith(S, + suffix, + start=..., + end=...) +

+
  +
+ + Return True if S ends with the specified suffix, False otherwise. +With optional start, test S beginning at that position. +With optional end, stop comparing S at that position. +suffix can also be a tuple of strings to try. +
+
Returns: bool
+
+
+
+ +
+ +
+ + +
+

expandtabs(S, + tabsize=...) +

+
  +
+ + Return a copy of S where all tab characters are expanded using spaces. +If tabsize is not given, a tab size of 8 characters is assumed. +
+
Returns: string
+
+
+
+ +
+ +
+ + +
+

find(S, + sub, + start=... , + end=...) +

+
  +
+ +

Return the lowest index in S where substring sub is found, +such that sub is contained within s[start:end]. Optional +arguments start and end are interpreted as in slice notation.

+

Return -1 on failure.

+
+
Returns: int
+
+
+
+ +
+ +
+ + +
+

istitle(S) +

+
  +
+ + Return True if S is a titlecased string and there is at least one +character in S, i.e. uppercase characters may only follow uncased +characters and lowercase characters only cased ones. Return False +otherwise. +
+
Returns: bool
+
+
+
+ +
+ +
+ + +
+

join(S, + sequence) +

+
  +
+ + Return a string which is the concatenation of the strings in the +sequence. The separator between elements is S. +
+
Returns: string
+
+
+
+ +
+ +
+ + +
+

ljust(S, + width, + fillchar=...) +

+
  +
+ + Return S left justified in a string of length width. Padding is +done using the specified fill character (default is a space). +
+
Returns: string
+
+
+
+ +
+ +
+ + +
+

lstrip(S, + chars=...) +

+
  +
+ + Return a copy of the string S with leading whitespace removed. +If chars is given and not None, remove characters in chars instead. +If chars is unicode, S will be converted to unicode before stripping +
+
Returns: string or unicode
+
+
+
+ +
+ +
+ + +
+

partition(S, + sep) +

+
  +
+ + Searches for the separator sep in S, and returns the part before it, +the separator itself, and the part after it. If the separator is not +found, returns S and two empty strings. +
+
Returns: (head, sep, tail)
+
+
+
+ +
+ +
+ + +
+

replace(...) +

+
  +
+ +

S.replace (old, new[, count]) -> string

+

Return a copy of string S with all occurrences of substring +old replaced by new. If the optional argument count is +given, only the first count occurrences are replaced.

+
+
+
+
+ +
+ +
+ + +
+

rfind(S, + sub, + start=... , + end=...) +

+
  +
+ +

Return the highest index in S where substring sub is found, +such that sub is contained within s[start:end]. Optional +arguments start and end are interpreted as in slice notation.

+

Return -1 on failure.

+
+
Returns: int
+
+
+
+ +
+ +
+ + +
+

rjust(S, + width, + fillchar=...) +

+
  +
+ + Return S right justified in a string of length width. Padding is +done using the specified fill character (default is a space) +
+
Returns: string
+
+
+
+ +
+ +
+ + +
+

rpartition(S, + sep) +

+
  +
+ + Searches for the separator sep in S, starting at the end of S, and returns +the part before it, the separator itself, and the part after it. If the +separator is not found, returns two empty strings and S. +
+
Returns: (tail, sep, head)
+
+
+
+ +
+ +
+ + +
+

rsplit(S, + sep=... , + maxsplit=...) +

+
  +
+ + Return a list of the words in the string S, using sep as the +delimiter string, starting at the end of the string and working +to the front. If maxsplit is given, at most maxsplit splits are +done. If sep is not specified or is None, any whitespace string +is a separator. +
+
Returns: list of strings
+
+
+
+ +
+ +
+ + +
+

rstrip(S, + chars=...) +

+
  +
+ + Return a copy of the string S with trailing whitespace removed. +If chars is given and not None, remove characters in chars instead. +If chars is unicode, S will be converted to unicode before stripping +
+
Returns: string or unicode
+
+
+
+ +
+ +
+ + +
+

split(S, + sep=... , + maxsplit=...) +

+
  +
+ + Return a list of the words in the string S, using sep as the +delimiter string. If maxsplit is given, at most maxsplit +splits are done. If sep is not specified or is None, any +whitespace string is a separator. +
+
Returns: list of strings
+
+
+
+ +
+ +
+ + +
+

splitlines(S, + keepends=...) +

+
  +
+ + Return a list of the lines in S, breaking at line boundaries. +Line breaks are not included in the resulting list unless keepends +is given and true. +
+
Returns: list of strings
+
+
+
+ +
+ +
+ + +
+

startswith(S, + prefix, + start=..., + end=...) +

+
  +
+ + Return True if S starts with the specified prefix, False otherwise. +With optional start, test S beginning at that position. +With optional end, stop comparing S at that position. +prefix can also be a tuple of strings to try. +
+
Returns: bool
+
+
+
+ +
+ +
+ + +
+

strip(S, + chars=...) +

+
  +
+ + Return a copy of the string S with leading and trailing +whitespace removed. +If chars is given and not None, remove characters in chars instead. +If chars is unicode, S will be converted to unicode before stripping +
+
Returns: string or unicode
+
+
+
+ +
+ +
+ + +
+

title(S) +

+
  +
+ + Return a titlecased version of S, i.e. words start with uppercase +characters, all remaining cased characters have lowercase. +
+
Returns: string
+
+
+
+ +
+ +
+ + +
+

zfill(S, + width) +

+
  +
+ + Pad a numeric string S with zeros on the left, to fill a field +of the specified width. The string S is never truncated. +
+
Returns: string
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/doc/html/api/toc-elementtree.ElementTree-module.html b/doc/html/api/toc-elementtree.ElementTree-module.html new file mode 100644 index 0000000..b05c20a --- /dev/null +++ b/doc/html/api/toc-elementtree.ElementTree-module.html @@ -0,0 +1,70 @@ + + + + + ElementTree + + + + + +

Module ElementTree

+
+

Classes

+ Element
ElementTree
ParseError
QName
TreeBuilder
XMLParser
XMLTreeBuilder
_Element
_ElementInterface
_IterParseIterator
_SimpleElementPath

Functions

+ Comment
PI
ProcessingInstruction
SubElement
XML
XMLID
_encode
_escape_attrib
_escape_attrib_html
_escape_cdata
_namespaces
_raise_serialization_error
_serialize_html
_serialize_text
_serialize_xml
dump
fromstring
fromstringlist
iselement
iterparse
parse
register_namespace
tostring
tostringlist

Variables

+ HTML_EMPTY
VERSION
_namespace_map

+[hide private] + + + + diff --git a/doc/html/api/toc-everything.html b/doc/html/api/toc-everything.html new file mode 100644 index 0000000..a9e9f04 --- /dev/null +++ b/doc/html/api/toc-everything.html @@ -0,0 +1,1267 @@ + + + + + Everything + + + + + +

Everything

+
+

All Classes

+ elementtree.ElementTree.Element
elementtree.ElementTree.ElementTree
elementtree.ElementTree.ParseError
elementtree.ElementTree.QName
elementtree.ElementTree.TreeBuilder
elementtree.ElementTree.XMLParser
elementtree.ElementTree._IterParseIterator
elementtree.ElementTree._SimpleElementPath
exceptions.AssertionError
lxml.ElementInclude.FatalIncludeError
lxml.builder.ElementMaker
+ lxml.cssselect.CSSSelector
+ + + lxml.cssselect.ExpressionError
+ + + + lxml.cssselect.SelectorSyntaxError
+ + + + + + + lxml.doctestcompare.LHTMLOutputChecker
lxml.doctestcompare.LXMLOutputChecker
+ lxml.etree.AncestorsIterator
lxml.etree.AttributeBasedElementClassLookup
lxml.etree.C14NError
lxml.etree.CDATA
lxml.etree.CommentBase
lxml.etree.CustomElementClassLookup
lxml.etree.DTD
lxml.etree.DTDError
lxml.etree.DTDParseError
lxml.etree.DTDValidateError
lxml.etree.DocInfo
lxml.etree.DocumentInvalid
lxml.etree.ETCompatXMLParser
lxml.etree.ETXPath
lxml.etree.ElementBase
lxml.etree.ElementChildIterator
lxml.etree.ElementClassLookup
lxml.etree.ElementDefaultClassLookup
lxml.etree.ElementDepthFirstIterator
lxml.etree.ElementNamespaceClassLookup
lxml.etree.ElementTextIterator
lxml.etree.EntityBase
lxml.etree.Error
lxml.etree.ErrorDomains
lxml.etree.ErrorLevels
lxml.etree.ErrorTypes
lxml.etree.FallbackElementClassLookup
lxml.etree.HTMLParser
lxml.etree.LxmlError
lxml.etree.LxmlRegistryError
lxml.etree.LxmlSyntaxError
lxml.etree.NamespaceRegistryError
lxml.etree.PIBase
lxml.etree.ParseError
lxml.etree.ParserBasedElementClassLookup
lxml.etree.ParserError
lxml.etree.PyErrorLog
lxml.etree.PythonElementClassLookup
lxml.etree.QName
lxml.etree.RelaxNG
lxml.etree.RelaxNGError
lxml.etree.RelaxNGErrorTypes
lxml.etree.RelaxNGParseError
lxml.etree.RelaxNGValidateError
lxml.etree.Resolver
lxml.etree.Schematron
lxml.etree.SchematronError
lxml.etree.SchematronParseError
lxml.etree.SchematronValidateError
lxml.etree.SerialisationError
lxml.etree.SiblingsIterator
lxml.etree.TreeBuilder
lxml.etree.XInclude
lxml.etree.XIncludeError
lxml.etree.XMLParser
lxml.etree.XMLSchema
lxml.etree.XMLSchemaError
lxml.etree.XMLSchemaParseError
lxml.etree.XMLSchemaValidateError
lxml.etree.XMLSyntaxError
lxml.etree.XPath
lxml.etree.XPathDocumentEvaluator
lxml.etree.XPathElementEvaluator
lxml.etree.XPathError
lxml.etree.XPathEvalError
lxml.etree.XPathFunctionError
lxml.etree.XPathResultError
lxml.etree.XPathSyntaxError
lxml.etree.XSLT
lxml.etree.XSLTAccessControl
lxml.etree.XSLTApplyError
lxml.etree.XSLTError
lxml.etree.XSLTExtension
lxml.etree.XSLTExtensionError
lxml.etree.XSLTParseError
lxml.etree.XSLTSaveError
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lxml.etree.iterparse
lxml.etree.iterwalk
+ + + + + + + + + + + + + + + + + + + + + lxml.html.clean.Cleaner
+ + + + + + + lxml.html.formfill.DefaultErrorCreator
lxml.html.formfill.FormNotFound
lxml.html.html5parser.HTMLParser
lxml.html.html5parser.XHTMLParser
lxml.objectify.BoolElement
lxml.objectify.ElementMaker
lxml.objectify.FloatElement
lxml.objectify.IntElement
lxml.objectify.LongElement
lxml.objectify.NoneElement
lxml.objectify.NumberElement
lxml.objectify.ObjectPath
lxml.objectify.ObjectifiedDataElement
lxml.objectify.ObjectifiedElement
lxml.objectify.ObjectifyElementClassLookup
lxml.objectify.PyType
lxml.objectify.StringElement
+ lxml.sax.ElementTreeContentHandler
lxml.sax.ElementTreeProducer
lxml.sax.SaxError
lxml.tests.common_imports.HelperTestCase
lxml.tests.common_imports.LargeFileLike
lxml.tests.common_imports.LargeFileLikeUnicode
lxml.tests.common_imports.SillyFileLike
lxml.tests.test_classlookup.ClassLookupTestCase
lxml.tests.test_css.CSSTestCase
lxml.tests.test_dtd.ETreeDtdTestCase
lxml.tests.test_elementtree.CElementTreeTestCase
lxml.tests.test_elementtree.ETreeTestCase
lxml.tests.test_elementtree.ETreeTestCaseBase
lxml.tests.test_elementtree.ElementTreeTestCase
lxml.tests.test_errors.ErrorTestCase
lxml.tests.test_etree.ETreeC14NTestCase
lxml.tests.test_etree.ETreeErrorLogTest
lxml.tests.test_etree.ETreeOnlyTestCase
lxml.tests.test_etree.ETreeWriteTestCase
lxml.tests.test_etree.ETreeXIncludeTestCase
lxml.tests.test_etree.ElementIncludeTestCase
lxml.tests.test_etree.XIncludeTestCase
lxml.tests.test_htmlparser.HtmlParserTestCase
lxml.tests.test_io.ETreeIOTestCase
lxml.tests.test_io.ElementTreeIOTestCase
lxml.tests.test_io.IOTestCaseBase
lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase
lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.bluff_class
lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.default_class
lxml.tests.test_nsclasses.ETreeNamespaceClassesTestCase.maeh_class
lxml.tests.test_objectify.ObjectifyTestCase
lxml.tests.test_pyclasslookup.PyClassLookupTestCase
lxml.tests.test_relaxng.ETreeRelaxNGTestCase
lxml.tests.test_sax.ETreeSaxTestCase
lxml.tests.test_schematron.ETreeSchematronTestCase
lxml.tests.test_threading.ThreadPipelineTestCase
lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker
lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker
lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker
lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker
lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker
lxml.tests.test_threading.ThreadPipelineTestCase.Worker
lxml.tests.test_threading.ThreadingTestCase
lxml.tests.test_unicode.UnicodeTestCase
lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase
lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver
lxml.tests.test_xmlschema.ETreeXMLSchemaTestCase
lxml.tests.test_xpathevaluator.ETreeETXPathClassTestCase
lxml.tests.test_xpathevaluator.ETreeXPathClassTestCase
lxml.tests.test_xpathevaluator.ETreeXPathTestCase
lxml.tests.test_xslt.ETreeXSLTTestCase
lxml.tests.test_xslt.Py3XSLTTestCase
str

All Functions

+ + + + lxml.ElementInclude.default_loader
lxml.ElementInclude.include
lxml.builder.callable
+ + + + + + + + + + + + + + + + + + lxml.doctestcompare.install
+ + lxml.doctestcompare.temp_install
lxml.etree.Comment
lxml.etree.Element
lxml.etree.ElementTree
lxml.etree.Entity
lxml.etree.Extension
lxml.etree.FunctionNamespace
lxml.etree.HTML
lxml.etree.PI
lxml.etree.SubElement
lxml.etree.XML
lxml.etree.XMLDTDID
lxml.etree.XMLID
lxml.etree.XPathEvaluator
lxml.etree.cleanup_namespaces
lxml.etree.clear_error_log
lxml.etree.dump
lxml.etree.fromstring
lxml.etree.fromstringlist
lxml.etree.get_default_parser
lxml.etree.iselement
lxml.etree.parse
lxml.etree.parseid
lxml.etree.set_default_parser
lxml.etree.set_element_class_lookup
lxml.etree.strip_attributes
lxml.etree.strip_elements
lxml.etree.strip_tags
lxml.etree.tostring
lxml.etree.tostringlist
lxml.etree.tounicode
lxml.etree.use_global_python_log
lxml.html.Element
lxml.html.ElementSoup.parse
+ + + + + + + + lxml.html.builder.CLASS
lxml.html.builder.FOR
+ + + + lxml.html.clean.autolink
lxml.html.clean.autolink_html
lxml.html.clean.clean_html
lxml.html.clean.word_break
lxml.html.clean.word_break_html
+ + + + + + + + + + + + + + + lxml.html.diff.html_annotate
+ lxml.html.diff.htmldiff
+ + + + + + + + + + + + + + + + + lxml.html.document_fromstring
+ + + + + + + + + + + lxml.html.formfill.fill_form
lxml.html.formfill.fill_form_html
lxml.html.formfill.insert_errors
lxml.html.formfill.insert_errors_html
lxml.html.fragment_fromstring
lxml.html.fragments_fromstring
lxml.html.fromstring
+ lxml.html.html5parser.document_fromstring
lxml.html.html5parser.fragment_fromstring
lxml.html.html5parser.fragments_fromstring
lxml.html.html5parser.fromstring
lxml.html.html5parser.parse
+ + lxml.html.open_in_browser
lxml.html.parse
+ + + + lxml.html.soupparser.convert_tree
lxml.html.soupparser.fromstring
+ lxml.html.soupparser.parse
+ lxml.html.submit_form
lxml.html.tostring
+ lxml.objectify.DataElement
lxml.objectify.Element
lxml.objectify.XML
+ + + + lxml.objectify.annotate
lxml.objectify.deannotate
lxml.objectify.dump
lxml.objectify.enable_recursive_str
lxml.objectify.fromstring
lxml.objectify.getRegisteredTypes
lxml.objectify.makeparser
lxml.objectify.parse
lxml.objectify.pyannotate
lxml.objectify.pytypename
lxml.objectify.set_default_parser
lxml.objectify.set_pytype_attribute_tag
lxml.objectify.xsiannotate
+ lxml.sax.saxify
+ + + + + + lxml.tests.common_imports.canonicalize
lxml.tests.common_imports.fileInTestDir
lxml.tests.common_imports.make_doctest
lxml.tests.common_imports.make_version_tuple
lxml.tests.common_imports.unentitify
lxml.tests.test_classlookup.test_suite
lxml.tests.test_css.test_suite
lxml.tests.test_css.unique
lxml.tests.test_dtd.test_suite
lxml.tests.test_elementtree.reversed
lxml.tests.test_elementtree.test_suite
lxml.tests.test_errors.test_suite
lxml.tests.test_etree.test_suite
lxml.tests.test_htmlparser.test_suite
lxml.tests.test_io.test_suite
lxml.tests.test_nsclasses.test_suite
lxml.tests.test_objectify.test_suite
lxml.tests.test_pyclasslookup.test_suite
lxml.tests.test_relaxng.test_suite
lxml.tests.test_sax.test_suite
lxml.tests.test_schematron.test_suite
lxml.tests.test_threading.test_suite
lxml.tests.test_unicode.test_suite
lxml.tests.test_xmlschema.test_suite
lxml.tests.test_xpathevaluator.argsTest1
lxml.tests.test_xpathevaluator.argsTest2
lxml.tests.test_xpathevaluator.booleanTest
lxml.tests.test_xpathevaluator.floatTest
lxml.tests.test_xpathevaluator.resultTypesTest
lxml.tests.test_xpathevaluator.resultTypesTest2
lxml.tests.test_xpathevaluator.setTest
lxml.tests.test_xpathevaluator.setTest2
lxml.tests.test_xpathevaluator.stringTest
lxml.tests.test_xpathevaluator.tag
lxml.tests.test_xpathevaluator.test_suite
lxml.tests.test_xpathevaluator.xpath
lxml.tests.test_xslt.test_suite

All Variables

+ elementtree.ElementTree.HTML_EMPTY
elementtree.ElementTree.VERSION
elementtree.ElementTree._namespace_map
lxml.ElementInclude.XINCLUDE
lxml.ElementInclude.XINCLUDE_FALLBACK
lxml.ElementInclude.XINCLUDE_INCLUDE
lxml.builder.E
+ + + + + + + + lxml.doctestcompare.NOPARSE_MARKUP
lxml.doctestcompare.PARSE_HTML
lxml.doctestcompare.PARSE_XML
+ + + + + lxml.etree.DEBUG
lxml.etree.LIBXML_COMPILED_VERSION
lxml.etree.LIBXML_VERSION
lxml.etree.LIBXSLT_COMPILED_VERSION
lxml.etree.LIBXSLT_VERSION
lxml.etree.LXML_VERSION
lxml.etree.__pyx_capi__
+ + + + + + + + + + + + lxml.html.builder.A
lxml.html.builder.ABBR
lxml.html.builder.ACRONYM
lxml.html.builder.ADDRESS
lxml.html.builder.APPLET
lxml.html.builder.AREA
lxml.html.builder.B
lxml.html.builder.BASE
lxml.html.builder.BASEFONT
lxml.html.builder.BDO
lxml.html.builder.BIG
lxml.html.builder.BLOCKQUOTE
lxml.html.builder.BODY
lxml.html.builder.BR
lxml.html.builder.BUTTON
lxml.html.builder.CAPTION
lxml.html.builder.CENTER
lxml.html.builder.CITE
lxml.html.builder.CODE
lxml.html.builder.COL
lxml.html.builder.COLGROUP
lxml.html.builder.DD
lxml.html.builder.DEL
lxml.html.builder.DFN
lxml.html.builder.DIR
lxml.html.builder.DIV
lxml.html.builder.DL
lxml.html.builder.DT
lxml.html.builder.E
lxml.html.builder.EM
lxml.html.builder.FIELDSET
lxml.html.builder.FONT
lxml.html.builder.FORM
lxml.html.builder.FRAME
lxml.html.builder.FRAMESET
lxml.html.builder.H1
lxml.html.builder.H2
lxml.html.builder.H3
lxml.html.builder.H4
lxml.html.builder.H5
lxml.html.builder.H6
lxml.html.builder.HEAD
lxml.html.builder.HR
lxml.html.builder.HTML
lxml.html.builder.I
lxml.html.builder.IFRAME
lxml.html.builder.IMG
lxml.html.builder.INPUT
lxml.html.builder.INS
lxml.html.builder.ISINDEX
lxml.html.builder.KBD
lxml.html.builder.LABEL
lxml.html.builder.LEGEND
lxml.html.builder.LI
lxml.html.builder.LINK
lxml.html.builder.MAP
lxml.html.builder.MENU
lxml.html.builder.META
lxml.html.builder.NOFRAMES
lxml.html.builder.NOSCRIPT
lxml.html.builder.OBJECT
lxml.html.builder.OL
lxml.html.builder.OPTGROUP
lxml.html.builder.OPTION
lxml.html.builder.P
lxml.html.builder.PARAM
lxml.html.builder.PRE
lxml.html.builder.Q
lxml.html.builder.S
lxml.html.builder.SAMP
lxml.html.builder.SCRIPT
lxml.html.builder.SELECT
lxml.html.builder.SMALL
lxml.html.builder.SPAN
lxml.html.builder.STRIKE
lxml.html.builder.STRONG
lxml.html.builder.STYLE
lxml.html.builder.SUB
lxml.html.builder.SUP
lxml.html.builder.TABLE
lxml.html.builder.TBODY
lxml.html.builder.TD
lxml.html.builder.TEXTAREA
lxml.html.builder.TFOOT
lxml.html.builder.TH
lxml.html.builder.THEAD
lxml.html.builder.TITLE
lxml.html.builder.TR
lxml.html.builder.TT
lxml.html.builder.U
lxml.html.builder.UL
lxml.html.builder.VAR
+ + + + + + + + + + + + + lxml.html.clean.clean
lxml.html.defs.block_tags
lxml.html.defs.deprecated_tags
lxml.html.defs.empty_tags
lxml.html.defs.event_attrs
lxml.html.defs.font_style_tags
lxml.html.defs.form_tags
lxml.html.defs.frame_tags
lxml.html.defs.general_block_tags
lxml.html.defs.head_tags
lxml.html.defs.link_attrs
lxml.html.defs.list_tags
lxml.html.defs.nonstandard_tags
lxml.html.defs.phrase_tags
lxml.html.defs.safe_attrs
lxml.html.defs.special_inline_tags
lxml.html.defs.table_tags
lxml.html.defs.tags
lxml.html.defs.top_level_tags
+ + + + + + + + lxml.html.find_class
lxml.html.find_rel_links
+ + + + + + lxml.html.html5parser.html_parser
lxml.html.html5parser.xhtml_parser
+ lxml.html.iterlinks
lxml.html.make_links_absolute
lxml.html.resolve_base_href
lxml.html.rewrite_links
+ + lxml.objectify.E
lxml.objectify.PYTYPE_ATTRIBUTE
+ lxml.tests.common_imports.cElementTree
lxml.tests.common_imports.doctest_parser
lxml.tests.test_classlookup.this_dir
lxml.tests.test_classlookup.xml_str
lxml.tests.test_css.doc_fn
lxml.tests.test_dtd.this_dir
lxml.tests.test_elementtree.cElementTree
lxml.tests.test_elementtree.this_dir
lxml.tests.test_errors.this_dir
lxml.tests.test_etree.this_dir
lxml.tests.test_htmlparser.this_dir
lxml.tests.test_io.this_dir
lxml.tests.test_nsclasses.this_dir
lxml.tests.test_objectify.DEFAULT_NSMAP
lxml.tests.test_objectify.PYTYPE_NAMESPACE
lxml.tests.test_objectify.TREE_PYTYPE
lxml.tests.test_objectify.XML_SCHEMA_INSTANCE_NS
lxml.tests.test_objectify.XML_SCHEMA_INSTANCE_TYPE_ATTR
lxml.tests.test_objectify.XML_SCHEMA_NIL_ATTR
lxml.tests.test_objectify.XML_SCHEMA_NS
lxml.tests.test_objectify.objectclass2pytype
lxml.tests.test_objectify.objectclass2xsitype
lxml.tests.test_objectify.pytype2objclass
lxml.tests.test_objectify.this_dir
lxml.tests.test_objectify.v
lxml.tests.test_objectify.xml_str
lxml.tests.test_objectify.xsitype2objclass
lxml.tests.test_pyclasslookup.this_dir
lxml.tests.test_pyclasslookup.xml_str
lxml.tests.test_relaxng.this_dir
lxml.tests.test_sax.this_dir
lxml.tests.test_schematron.this_dir
lxml.tests.test_threading.this_dir
lxml.tests.test_unicode.ascii_uni
lxml.tests.test_unicode.invalid_tag
lxml.tests.test_unicode.klingon
lxml.tests.test_unicode.this_dir
lxml.tests.test_unicode.uni
lxml.tests.test_unicode.uxml
lxml.tests.test_xmlschema.this_dir
lxml.tests.test_xpathevaluator.SAMPLE_XML
lxml.tests.test_xpathevaluator.extension
lxml.tests.test_xpathevaluator.this_dir
lxml.tests.test_xpathevaluator.uri
lxml.tests.test_xslt.is_python3
lxml.tests.test_xslt.this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml-module.html b/doc/html/api/toc-lxml-module.html new file mode 100644 index 0000000..695b40f --- /dev/null +++ b/doc/html/api/toc-lxml-module.html @@ -0,0 +1,29 @@ + + + + + lxml + + + + + +

Module lxml

+
+
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.ElementInclude-module.html b/doc/html/api/toc-lxml.ElementInclude-module.html new file mode 100644 index 0000000..b7f6d73 --- /dev/null +++ b/doc/html/api/toc-lxml.ElementInclude-module.html @@ -0,0 +1,47 @@ + + + + + ElementInclude + + + + + +

Module ElementInclude

+
+

Classes

+ FatalIncludeError

Functions

+ + + + default_loader
include

Variables

+ XINCLUDE
XINCLUDE_FALLBACK
XINCLUDE_INCLUDE

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.builder-module.html b/doc/html/api/toc-lxml.builder-module.html new file mode 100644 index 0000000..bb4120c --- /dev/null +++ b/doc/html/api/toc-lxml.builder-module.html @@ -0,0 +1,35 @@ + + + + + builder + + + + + +

Module builder

+
+

Classes

+ ElementMaker

Functions

+ callable

Variables

+ E

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.cssselect-module.html b/doc/html/api/toc-lxml.cssselect-module.html new file mode 100644 index 0000000..a2f8561 --- /dev/null +++ b/doc/html/api/toc-lxml.cssselect-module.html @@ -0,0 +1,152 @@ + + + + + cssselect + + + + + +

Module cssselect

+
+

Classes

+
+ Attrib
+ CSSSelector
+ Class
+ + + ExpressionError
+
+ Hash
+
+ Or
+
+ Pseudo
+ SelectorSyntaxError
+ String
+
+ Symbol
+
+ Token
+ + + + +

Functions

+ + +
+ is_int
+
+ parse
+ + + + + + + + + + + + +

Variables

+ + + +
+ _el_re
+
+ _id_re
+ + +
+ ns
+
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.doctestcompare-module.html b/doc/html/api/toc-lxml.doctestcompare-module.html new file mode 100644 index 0000000..a634940 --- /dev/null +++ b/doc/html/api/toc-lxml.doctestcompare-module.html @@ -0,0 +1,69 @@ + + + + + doctestcompare + + + + + +

Module doctestcompare

+
+

Classes

+ LHTMLOutputChecker
LXMLOutputChecker
+

Functions

+ + + install
+
+ strip
+ temp_install

Variables

+ NOPARSE_MARKUP
PARSE_HTML
PARSE_XML
+ + + + +
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.etree-module.html b/doc/html/api/toc-lxml.etree-module.html new file mode 100644 index 0000000..856c04e --- /dev/null +++ b/doc/html/api/toc-lxml.etree-module.html @@ -0,0 +1,311 @@ + + + + + etree + + + + + +

Module etree

+
+

Classes

+ AncestorsIterator
AttributeBasedElementClassLookup
C14NError
CDATA
CommentBase
CustomElementClassLookup
DTD
DTDError
DTDParseError
DTDValidateError
DocInfo
DocumentInvalid
ETCompatXMLParser
ETXPath
ElementBase
ElementChildIterator
ElementClassLookup
ElementDefaultClassLookup
ElementDepthFirstIterator
ElementNamespaceClassLookup
ElementTextIterator
EntityBase
Error
ErrorDomains
ErrorLevels
ErrorTypes
FallbackElementClassLookup
HTMLParser
LxmlError
LxmlRegistryError
LxmlSyntaxError
NamespaceRegistryError
PIBase
ParseError
ParserBasedElementClassLookup
ParserError
PyErrorLog
PythonElementClassLookup
QName
RelaxNG
RelaxNGError
RelaxNGErrorTypes
RelaxNGParseError
RelaxNGValidateError
Resolver
Schematron
SchematronError
SchematronParseError
SchematronValidateError
SerialisationError
SiblingsIterator
TreeBuilder
XInclude
XIncludeError
XMLParser
XMLSchema
XMLSchemaError
XMLSchemaParseError
XMLSchemaValidateError
XMLSyntaxError
XPath
XPathDocumentEvaluator
XPathElementEvaluator
XPathError
XPathEvalError
XPathFunctionError
XPathResultError
XPathSyntaxError
XSLT
XSLTAccessControl
XSLTApplyError
XSLTError
XSLTExtension
XSLTExtensionError
XSLTParseError
XSLTSaveError
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iterparse
iterwalk

Functions

+ Comment
Element
ElementTree
Entity
Extension
FunctionNamespace
HTML
PI
ProcessingInstruction
SubElement
XML
XMLDTDID
XMLID
XPathEvaluator
cleanup_namespaces
clear_error_log
dump
fromstring
fromstringlist
get_default_parser
iselement
parse
parseid
set_default_parser
set_element_class_lookup
strip_attributes
strip_elements
strip_tags
tostring
tostringlist
tounicode
use_global_python_log

Variables

+ DEBUG
LIBXML_COMPILED_VERSION
LIBXML_VERSION
LIBXSLT_COMPILED_VERSION
LIBXSLT_VERSION
LXML_VERSION
__pyx_capi__

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html-module.html b/doc/html/api/toc-lxml.html-module.html new file mode 100644 index 0000000..ca41e20 --- /dev/null +++ b/doc/html/api/toc-lxml.html-module.html @@ -0,0 +1,182 @@ + + + + + html + + + + + +

Module html

+
+

Classes

+ + + + + + + + + + + + + + + + + + + + + +

Functions

+ Element
+ + + + +
+ _nons
+ + + document_fromstring
fragment_fromstring
fragments_fromstring
fromstring
+ + open_in_browser
parse
submit_form
tostring
+

Variables

+ + + + + + + + + + + + find_class
find_rel_links
+ iterlinks
make_links_absolute
resolve_base_href
rewrite_links
+
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.ElementSoup-module.html b/doc/html/api/toc-lxml.html.ElementSoup-module.html new file mode 100644 index 0000000..61cbe33 --- /dev/null +++ b/doc/html/api/toc-lxml.html.ElementSoup-module.html @@ -0,0 +1,36 @@ + + + + + ElementSoup + + + + + +

Module ElementSoup

+
+

Functions

+ convert_tree
parse

Variables

+ +
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.builder-module.html b/doc/html/api/toc-lxml.html.builder-module.html new file mode 100644 index 0000000..57165a4 --- /dev/null +++ b/doc/html/api/toc-lxml.html.builder-module.html @@ -0,0 +1,125 @@ + + + + + builder + + + + + +

Module builder

+
+

Functions

+ CLASS
FOR

Variables

+ A
ABBR
ACRONYM
ADDRESS
APPLET
AREA
B
BASE
BASEFONT
BDO
BIG
BLOCKQUOTE
BODY
BR
BUTTON
CAPTION
CENTER
CITE
CODE
COL
COLGROUP
DD
DEL
DFN
DIR
DIV
DL
DT
E
EM
FIELDSET
FONT
FORM
FRAME
FRAMESET
H1
H2
H3
H4
H5
H6
HEAD
HR
HTML
I
IFRAME
IMG
INPUT
INS
ISINDEX
KBD
LABEL
LEGEND
LI
LINK
MAP
MENU
META
NOFRAMES
NOSCRIPT
OBJECT
OL
OPTGROUP
OPTION
P
PARAM
PRE
Q
S
SAMP
SCRIPT
SELECT
SMALL
SPAN
STRIKE
STRONG
STYLE
SUB
SUP
TABLE
TBODY
TD
TEXTAREA
TFOOT
TH
THEAD
TITLE
TR
TT
U
UL
VAR

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.clean-module.html b/doc/html/api/toc-lxml.html.clean-module.html new file mode 100644 index 0000000..3777720 --- /dev/null +++ b/doc/html/api/toc-lxml.html.clean-module.html @@ -0,0 +1,90 @@ + + + + + clean + + + + + +

Module clean

+
+

Classes

+ Cleaner

Functions

+ + + + + autolink
autolink_html
clean_html
word_break
word_break_html

Variables

+ + + + + + + + + + + + + + clean

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.defs-module.html b/doc/html/api/toc-lxml.html.defs-module.html new file mode 100644 index 0000000..8d092ec --- /dev/null +++ b/doc/html/api/toc-lxml.html.defs-module.html @@ -0,0 +1,48 @@ + + + + + defs + + + + + +

Module defs

+
+

Variables

+ block_tags
deprecated_tags
empty_tags
event_attrs
font_style_tags
form_tags
frame_tags
general_block_tags
head_tags
link_attrs
list_tags
nonstandard_tags
phrase_tags
safe_attrs
special_inline_tags
table_tags
tags
top_level_tags

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.diff-module.html b/doc/html/api/toc-lxml.html.diff-module.html new file mode 100644 index 0000000..f63e6b0 --- /dev/null +++ b/doc/html/api/toc-lxml.html.diff-module.html @@ -0,0 +1,178 @@ + + + + + diff + + + + + +

Module diff

+
+

Classes

+ + + + + + +
+ token
+

Functions

+ + + + + + + + + + + + + + + + html_annotate
+ htmldiff
+ + + + + + + + + + + + + + + + +

Variables

+ + + + + + + + +
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.formfill-module.html b/doc/html/api/toc-lxml.html.formfill-module.html new file mode 100644 index 0000000..da33b86 --- /dev/null +++ b/doc/html/api/toc-lxml.html.formfill-module.html @@ -0,0 +1,89 @@ + + + + + formfill + + + + + +

Module formfill

+
+

Classes

+ DefaultErrorCreator
FormNotFound

Functions

+ +
+ _check
+ + + + + + + + + + fill_form
fill_form_html
insert_errors
insert_errors_html

Variables

+ + + + +
+ _tag
+ +
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.html5parser-module.html b/doc/html/api/toc-lxml.html.html5parser-module.html new file mode 100644 index 0000000..29dd2aa --- /dev/null +++ b/doc/html/api/toc-lxml.html.html5parser-module.html @@ -0,0 +1,44 @@ + + + + + html5parser + + + + + +

Module html5parser

+
+

Classes

+ HTMLParser
XHTMLParser

Functions

+ + document_fromstring
fragment_fromstring
fragments_fromstring
fromstring
parse

Variables

+ html_parser
xhtml_parser

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.soupparser-module.html b/doc/html/api/toc-lxml.html.soupparser-module.html new file mode 100644 index 0000000..a0ca247 --- /dev/null +++ b/doc/html/api/toc-lxml.html.soupparser-module.html @@ -0,0 +1,55 @@ + + + + + soupparser + + + + + +

Module soupparser

+
+

Functions

+ + + +
+ _parse
+ convert_tree
fromstring
+ parse
+

Variables

+ +
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.html.usedoctest-module.html b/doc/html/api/toc-lxml.html.usedoctest-module.html new file mode 100644 index 0000000..ee5971f --- /dev/null +++ b/doc/html/api/toc-lxml.html.usedoctest-module.html @@ -0,0 +1,29 @@ + + + + + usedoctest + + + + + +

Module usedoctest

+
+
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.objectify-module.html b/doc/html/api/toc-lxml.objectify-module.html new file mode 100644 index 0000000..ed74d03 --- /dev/null +++ b/doc/html/api/toc-lxml.objectify-module.html @@ -0,0 +1,78 @@ + + + + + objectify + + + + + +

Module objectify

+
+

Classes

+ BoolElement
ElementMaker
FloatElement
IntElement
LongElement
NoneElement
NumberElement
ObjectPath
ObjectifiedDataElement
ObjectifiedElement
ObjectifyElementClassLookup
PyType
StringElement
+

Functions

+ DataElement
Element
XML
+ + + + annotate
deannotate
dump
enable_recursive_str
fromstring
getRegisteredTypes
makeparser
parse
pyannotate
pytypename
set_default_parser
set_pytype_attribute_tag
xsiannotate

Variables

+ E
PYTYPE_ATTRIBUTE

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.pyclasslookup-module.html b/doc/html/api/toc-lxml.pyclasslookup-module.html new file mode 100644 index 0000000..66c5590 --- /dev/null +++ b/doc/html/api/toc-lxml.pyclasslookup-module.html @@ -0,0 +1,29 @@ + + + + + pyclasslookup + + + + + +

Module pyclasslookup

+
+
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.sax-module.html b/doc/html/api/toc-lxml.sax-module.html new file mode 100644 index 0000000..7684a77 --- /dev/null +++ b/doc/html/api/toc-lxml.sax-module.html @@ -0,0 +1,38 @@ + + + + + sax + + + + + +

Module sax

+
+

Classes

+ ElementTreeContentHandler
ElementTreeProducer
SaxError

Functions

+ + saxify

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests-module.html b/doc/html/api/toc-lxml.tests-module.html new file mode 100644 index 0000000..4c66376 --- /dev/null +++ b/doc/html/api/toc-lxml.tests-module.html @@ -0,0 +1,29 @@ + + + + + tests + + + + + +

Module tests

+
+
+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.common_imports-module.html b/doc/html/api/toc-lxml.tests.common_imports-module.html new file mode 100644 index 0000000..f6ac500 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.common_imports-module.html @@ -0,0 +1,65 @@ + + + + + common_imports + + + + + +

Module common_imports

+
+

Classes

+ HelperTestCase
LargeFileLike
LargeFileLikeUnicode
SillyFileLike
unicode

Functions

+
+ _bytes
+ + + + +
+ _str
+ canonicalize
fileInTestDir
make_doctest
make_version_tuple
unentitify

Variables

+ + cElementTree
doctest_parser

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_classlookup-module.html b/doc/html/api/toc-lxml.tests.test_classlookup-module.html new file mode 100644 index 0000000..5267284 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_classlookup-module.html @@ -0,0 +1,36 @@ + + + + + test_classlookup + + + + + +

Module test_classlookup

+
+

Classes

+ ClassLookupTestCase

Functions

+ test_suite

Variables

+ this_dir
xml_str

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_css-module.html b/doc/html/api/toc-lxml.tests.test_css-module.html new file mode 100644 index 0000000..251a3aa --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_css-module.html @@ -0,0 +1,36 @@ + + + + + test_css + + + + + +

Module test_css

+
+

Classes

+ CSSTestCase

Functions

+ test_suite
unique

Variables

+ doc_fn

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_dtd-module.html b/doc/html/api/toc-lxml.tests.test_dtd-module.html new file mode 100644 index 0000000..d71692f --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_dtd-module.html @@ -0,0 +1,35 @@ + + + + + test_dtd + + + + + +

Module test_dtd

+
+

Classes

+ ETreeDtdTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_elementtree-module.html b/doc/html/api/toc-lxml.tests.test_elementtree-module.html new file mode 100644 index 0000000..cad4843 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_elementtree-module.html @@ -0,0 +1,40 @@ + + + + + test_elementtree + + + + + +

Module test_elementtree

+
+

Classes

+ CElementTreeTestCase
ETreeTestCase
ETreeTestCaseBase
ElementTreeTestCase

Functions

+ reversed
test_suite

Variables

+ cElementTree
this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_errors-module.html b/doc/html/api/toc-lxml.tests.test_errors-module.html new file mode 100644 index 0000000..a5da871 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_errors-module.html @@ -0,0 +1,35 @@ + + + + + test_errors + + + + + +

Module test_errors

+
+

Classes

+ ErrorTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_etree-module.html b/doc/html/api/toc-lxml.tests.test_etree-module.html new file mode 100644 index 0000000..422c9dc --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_etree-module.html @@ -0,0 +1,41 @@ + + + + + test_etree + + + + + +

Module test_etree

+
+

Classes

+ ETreeC14NTestCase
ETreeErrorLogTest
ETreeOnlyTestCase
ETreeWriteTestCase
ETreeXIncludeTestCase
ElementIncludeTestCase
XIncludeTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_htmlparser-module.html b/doc/html/api/toc-lxml.tests.test_htmlparser-module.html new file mode 100644 index 0000000..c214706 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_htmlparser-module.html @@ -0,0 +1,35 @@ + + + + + test_htmlparser + + + + + +

Module test_htmlparser

+
+

Classes

+ HtmlParserTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_io-module.html b/doc/html/api/toc-lxml.tests.test_io-module.html new file mode 100644 index 0000000..1552c4d --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_io-module.html @@ -0,0 +1,37 @@ + + + + + test_io + + + + + +

Module test_io

+
+

Classes

+ ETreeIOTestCase
ElementTreeIOTestCase
IOTestCaseBase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_nsclasses-module.html b/doc/html/api/toc-lxml.tests.test_nsclasses-module.html new file mode 100644 index 0000000..1681ba9 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_nsclasses-module.html @@ -0,0 +1,35 @@ + + + + + test_nsclasses + + + + + +

Module test_nsclasses

+
+

Classes

+ ETreeNamespaceClassesTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_objectify-module.html b/doc/html/api/toc-lxml.tests.test_objectify-module.html new file mode 100644 index 0000000..65040d5 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_objectify-module.html @@ -0,0 +1,48 @@ + + + + + test_objectify + + + + + +

Module test_objectify

+
+

Classes

+ ObjectifyTestCase

Functions

+ test_suite

Variables

+ DEFAULT_NSMAP
PYTYPE_NAMESPACE
TREE_PYTYPE
XML_SCHEMA_INSTANCE_NS
XML_SCHEMA_INSTANCE_TYPE_ATTR
XML_SCHEMA_NIL_ATTR
XML_SCHEMA_NS
objectclass2pytype
objectclass2xsitype
pytype2objclass
this_dir
v
xml_str
xsitype2objclass

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_pyclasslookup-module.html b/doc/html/api/toc-lxml.tests.test_pyclasslookup-module.html new file mode 100644 index 0000000..0dcdd61 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_pyclasslookup-module.html @@ -0,0 +1,36 @@ + + + + + test_pyclasslookup + + + + + +

Module test_pyclasslookup

+
+

Classes

+ PyClassLookupTestCase

Functions

+ test_suite

Variables

+ this_dir
xml_str

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_relaxng-module.html b/doc/html/api/toc-lxml.tests.test_relaxng-module.html new file mode 100644 index 0000000..1421ecc --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_relaxng-module.html @@ -0,0 +1,35 @@ + + + + + test_relaxng + + + + + +

Module test_relaxng

+
+

Classes

+ ETreeRelaxNGTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_sax-module.html b/doc/html/api/toc-lxml.tests.test_sax-module.html new file mode 100644 index 0000000..ae42c25 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_sax-module.html @@ -0,0 +1,35 @@ + + + + + test_sax + + + + + +

Module test_sax

+
+

Classes

+ ETreeSaxTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_schematron-module.html b/doc/html/api/toc-lxml.tests.test_schematron-module.html new file mode 100644 index 0000000..15a3211 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_schematron-module.html @@ -0,0 +1,35 @@ + + + + + test_schematron + + + + + +

Module test_schematron

+
+

Classes

+ ETreeSchematronTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_threading-module.html b/doc/html/api/toc-lxml.tests.test_threading-module.html new file mode 100644 index 0000000..1cd834d --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_threading-module.html @@ -0,0 +1,36 @@ + + + + + test_threading + + + + + +

Module test_threading

+
+

Classes

+ ThreadPipelineTestCase
ThreadingTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_unicode-module.html b/doc/html/api/toc-lxml.tests.test_unicode-module.html new file mode 100644 index 0000000..4428d12 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_unicode-module.html @@ -0,0 +1,40 @@ + + + + + test_unicode + + + + + +

Module test_unicode

+
+

Classes

+ UnicodeTestCase

Functions

+ test_suite

Variables

+ ascii_uni
invalid_tag
klingon
this_dir
uni
uxml

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_xmlschema-module.html b/doc/html/api/toc-lxml.tests.test_xmlschema-module.html new file mode 100644 index 0000000..50fe6da --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_xmlschema-module.html @@ -0,0 +1,36 @@ + + + + + test_xmlschema + + + + + +

Module test_xmlschema

+
+

Classes

+ ETreeXMLSchemaResolversTestCase
ETreeXMLSchemaTestCase

Functions

+ test_suite

Variables

+ this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_xpathevaluator-module.html b/doc/html/api/toc-lxml.tests.test_xpathevaluator-module.html new file mode 100644 index 0000000..cc18b64 --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_xpathevaluator-module.html @@ -0,0 +1,51 @@ + + + + + test_xpathevaluator + + + + + +

Module test_xpathevaluator

+
+

Classes

+ ETreeETXPathClassTestCase
ETreeXPathClassTestCase
ETreeXPathTestCase

Functions

+ argsTest1
argsTest2
booleanTest
floatTest
resultTypesTest
resultTypesTest2
setTest
setTest2
stringTest
tag
test_suite
xpath

Variables

+ SAMPLE_XML
extension
this_dir
uri

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.tests.test_xslt-module.html b/doc/html/api/toc-lxml.tests.test_xslt-module.html new file mode 100644 index 0000000..92cad8c --- /dev/null +++ b/doc/html/api/toc-lxml.tests.test_xslt-module.html @@ -0,0 +1,37 @@ + + + + + test_xslt + + + + + +

Module test_xslt

+
+

Classes

+ ETreeXSLTTestCase
Py3XSLTTestCase

Functions

+ test_suite

Variables

+ is_python3
this_dir

+[hide private] + + + + diff --git a/doc/html/api/toc-lxml.usedoctest-module.html b/doc/html/api/toc-lxml.usedoctest-module.html new file mode 100644 index 0000000..ee5971f --- /dev/null +++ b/doc/html/api/toc-lxml.usedoctest-module.html @@ -0,0 +1,29 @@ + + + + + usedoctest + + + + + +

Module usedoctest

+
+
+[hide private] + + + + diff --git a/doc/html/api/toc.html b/doc/html/api/toc.html new file mode 100644 index 0000000..3f98c77 --- /dev/null +++ b/doc/html/api/toc.html @@ -0,0 +1,74 @@ + + + + + Table of Contents + + + + + +

Table of Contents

+
+ Everything +
+

Modules

+ elementtree.ElementTree
lxml
lxml.ElementInclude
lxml.builder
lxml.cssselect
lxml.doctestcompare
lxml.etree
lxml.html
lxml.html.ElementSoup
lxml.html.builder
lxml.html.clean
lxml.html.defs
lxml.html.diff
lxml.html.formfill
lxml.html.html5parser
lxml.html.soupparser
lxml.html.usedoctest
lxml.objectify
lxml.pyclasslookup
lxml.sax
lxml.tests
lxml.tests.common_imports
lxml.tests.test_classlookup
lxml.tests.test_css
lxml.tests.test_dtd
lxml.tests.test_elementtree
lxml.tests.test_errors
lxml.tests.test_etree
lxml.tests.test_htmlparser
lxml.tests.test_io
lxml.tests.test_nsclasses
lxml.tests.test_objectify
lxml.tests.test_pyclasslookup
lxml.tests.test_relaxng
lxml.tests.test_sax
lxml.tests.test_schematron
lxml.tests.test_threading
lxml.tests.test_unicode
lxml.tests.test_xmlschema
lxml.tests.test_xpathevaluator
lxml.tests.test_xslt
lxml.usedoctest

+ [hide private] + + + + diff --git a/doc/html/build.html b/doc/html/build.html new file mode 100644 index 0000000..5b2551f --- /dev/null +++ b/doc/html/build.html @@ -0,0 +1,299 @@ + + + + + +How to build lxml from source + + + +
+

How to build lxml from source

+ +

To build lxml from source, you need libxml2 and libxslt properly +installed, including the header files. These are likely shipped in +separate -dev or -devel packages like libxml2-dev, which +you must install before trying to build lxml. The build process also +requires setuptools. The lxml source distribution comes with a +script called ez_setup.py that can be used to install them.

+ +
+

Cython

+

The lxml.etree and lxml.objectify modules are written in Cython. +Since we distribute the Cython-generated .c files with lxml releases, +however, you do not need Cython to build lxml from the normal release +sources. We even encourage you to not install Cython for a normal +release build, as the generated C code can vary quite heavily between +Cython versions, which may or may not generate correct code for lxml. +The pre-generated release sources were tested and therefore are known +to work.

+

So, if you want a reliable build of lxml, we suggest to a) use a +source release of lxml and b) disable or uninstall Cython for the +build.

+

Only if you are interested in building lxml from a Subversion +checkout (e.g. to test a bug fix that has not been release yet) or if +want to be an lxml developer, then you do need a working Cython +installation. You can use EasyInstall to install it:

+
+easy_install Cython==0.11
+
+

lxml currently requires Cython 0.11, later release versions should +work as well.

+
+
+

Subversion

+

The lxml package is developed in a Subversion repository. You can retrieve +the current developer version by calling:

+
+svn co http://codespeak.net/svn/lxml/trunk lxml
+
+

This will create a directory lxml and download the source into it. +You can also browse the Subversion repository through the web, use +your favourite SVN client to access it, or browse the Subversion +history.

+
+
+

Setuptools

+

Usually, building lxml is done through setuptools. Do a Subversion checkout +(or download the source tar-ball and unpack it) and then type:

+
+python setup.py build
+
+

or:

+
+python setup.py bdist_egg
+
+

If you want to test lxml from the source directory, it is better to build it +in-place like this:

+
+python setup.py  build_ext -i
+
+

or, in Unix-like environments:

+
+make
+
+

If you get errors about missing header files (e.g. libxml/xmlversion.h) +then you need to make sure the development packages of both libxml2 +and libxslt are properly installed. Try passing the following option to +setup.py to make sure the right config is found:

+
+python setup.py build --with-xslt-config=/path/to/xslt-config
+
+

If this doesn't help, you may have to add the location of the header +files to the include path like:

+
+python setup.py build_ext -i  -I /usr/include/libxml2
+
+

where the file is in /usr/include/libxml2/libxml/xmlversion.h

+

To use lxml.etree in-place, you can place lxml's src directory on your +Python module search path (PYTHONPATH) and then import lxml.etree to play +with it:

+
+# cd lxml
+# PYTHONPATH=src python
+Python 2.5.1
+Type "help", "copyright", "credits" or "license" for more information.
+>>> from lxml import etree
+>>>
+
+

To recompile after changes, note that you may have to run make clean or +delete the file src/lxml/etree.c. Distutils do not automatically pick up +changes that affect files other than the main file src/lxml/etree.pyx.

+
+
+

Running the tests and reporting errors

+

The source distribution (tgz) and the Subversion repository contain a test +suite for lxml. You can run it from the top-level directory:

+
+python test.py
+
+

Note that the test script only tests the in-place build (see distutils +building above), as it searches the src directory. You can use the +following one-step command to trigger an in-place build and test it:

+
+make test
+
+

This also runs the ElementTree and cElementTree compatibility tests. To call +them separately, make sure you have lxml on your PYTHONPATH first, then run:

+
+python selftest.py
+
+

and:

+
+python selftest2.py
+
+

If the tests give failures, errors, or worse, segmentation faults, we'd really +like to know. Please contact us on the mailing list, and please specify +the version of lxml, libxml2, libxslt and Python you were using, as well as +your operating system type (Linux, Windows, MacOs, ...).

+
+
+

Building an egg

+

This is the procedure to make an lxml egg for your platform (assuming +that you have setuptools installed):

+
    +
  • Download the lxml-x.y.tar.gz release. This contains the pregenerated C so +that you can be sure you build exactly from the release sources. Unpack +them and cd into the resulting directory.
  • +
  • python setup.py build
  • +
  • If you're on a unixy platform, cd into build/lib.your.platform and strip +any .so file you find there. This reduces the size of the egg +considerably.
  • +
  • python setup.py bdist_egg
  • +
+

This will put the egg into the dist directory.

+
+
+

Building lxml on MacOS-X

+

Apple regularly ships new system releases with horribly outdated +system libraries. This is specifically the case for libxml2 and +libxslt, where the system provided versions are too old to build lxml.

+

While the Unix environment in MacOS-X makes it relatively easy to +install Unix/Linux style package management tools and new software, it +actually seems to be hard to get libraries set up for exclusive usage +that MacOS-X ships in an older version. Alternative distributions +(like macports) install their libraries in addition to the system +libraries, but the compiler and the runtime loader on MacOS still sees +the system libraries before the new libraries. This can lead to +undebuggable crashes where the newer library seems to be loaded but +the older system library is used.

+

Apple discourages static building against libraries, which would help +working around this problem. Apple does not ship static library +binaries with its system and several package management systems follow +this decision. Therefore, building static binaries requires building +the dependencies first. The setup.py script does this +automatically when you call it like this:

+
+python setup.py build --static-deps
+
+

This will download and build the latest versions of libxml2 and +libxslt from the official FTP download site. If you want to use +specific versions, or want to prevent any online access, you can +download both tar.gz release files yourself, place them into a +subdirectory libs in the lxml distribution, and call setup.py +with the desired target versions like this:

+
+python setup.py build --static-deps \
+       --libxml2-version=2.7.3 \
+       --libxslt-version=1.1.24 \
+
+

Instead of build, you can use any target, like bdist_egg if +you want to use setuptools to build an installable egg.

+

Note that this also works with EasyInstall. Since you can't pass +command line options in this case, you have to use an environment +variable instead:

+
+STATIC_DEPS=true easy_install lxml
+
+

Some machines may require an additional run with "sudo" to install the +package into the Python package directory:

+
+STATIC_DEPS=true sudo easy_install lxml
+
+
+
+

Static linking on Windows

+

Most operating systems have proper package management that makes installing +current versions of libxml2 and libxslt easy. The most famous exception is +Microsoft Windows, which entirely lacks these capabilities. It can therefore +be interesting to statically link the external libraries into lxml.etree to +avoid having to install them separately.

+

Download lxml and all required libraries to the same directory. The iconv, +libxml2, libxslt, and zlib libraries are all available from the ftp site +ftp://ftp.zlatkovic.com/pub/libxml/.

+

Your directory should now have the following files in it (although most likely +different versions):

+
+iconv-1.9.1.win32.zip
+libxml2-2.6.23.win32.zip
+libxslt-1.1.15.win32.zip
+lxml-1.0.0.tgz
+zlib-1.2.3.win32.zip
+
+

Now extract each of those files in the same directory. This should give you +something like this:

+
+iconv-1.9.1.win32/
+iconv-1.9.1.win32.zip
+libxml2-2.6.23.win32/
+libxml2-2.6.23.win32.zip
+libxslt-1.1.15.win32/
+libxslt-1.1.15.win32.zip
+lxml-1.0.0/
+lxml-1.0.0.tgz
+zlib-1.2.3.win32/
+zlib-1.2.3.win32.zip
+
+

Go to the lxml directory and edit the file setup.py. There should +be a section near the top that looks like this:

+
+STATIC_INCLUDE_DIRS = []
+STATIC_LIBRARY_DIRS = []
+STATIC_CFLAGS = []
+
+

Change this section to something like this, but take care to use the correct +version numbers:

+
+STATIC_INCLUDE_DIRS = [
+       "..\\libxml2-2.6.23.win32\\include",
+       "..\\libxslt-1.1.15.win32\\include",
+       "..\\zlib-1.2.3.win32\\include",
+       "..\\iconv-1.9.1.win32\\include"
+       ]
+
+STATIC_LIBRARY_DIRS = [
+       "..\\libxml2-2.6.23.win32\\lib",
+       "..\\libxslt-1.1.15.win32\\lib",
+       "..\\zlib-1.2.3.win32\\lib",
+       "..\\iconv-1.9.1.win32\\lib"
+       ]
+
+STATIC_CFLAGS = []
+
+

Add any CFLAGS you might consider useful to the third list. Now you +should be able to pass the --static option to setup.py and +everything should work well. Try calling:

+
+python setup.py bdist_wininst --static
+
+

This will create a windows installer in the pkg directory.

+
+
+

Building Debian packages from SVN sources

+

Andreas Pakulat proposed the following approach.

+
    +
  • apt-get source lxml
  • +
  • remove the unpacked directory
  • +
  • tar.gz the lxml SVN version and replace the orig.tar.gz that lies in the +directory
  • +
  • check md5sum of created tar.gz file and place new sum and size in dsc file
  • +
  • do dpkg-source -x lxml-[VERSION].dsc and cd into the newly created directory
  • +
  • run dch -i and add a comment like "use trunk version", this will +increase the debian version number so apt/dpkg won't get confused
  • +
  • run dpkg-buildpackage -rfakeroot -us -uc to build the package
  • +
+

In case dpkg-buildpackage tells you that some dependecies are missing, you +can either install them manually or run apt-get build-dep lxml.

+

That will give you .deb packages in the parent directory which can be +installed using dpkg -i.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/capi.html b/doc/html/capi.html new file mode 100644 index 0000000..7023e75 --- /dev/null +++ b/doc/html/capi.html @@ -0,0 +1,101 @@ + + + + + +The public C-API of lxml.etree + + + +
+

The public C-API of lxml.etree

+ +

As of version 1.1, lxml.etree provides a public C-API. This allows external +C extensions to efficiently access public functions and classes of lxml, +without going through the Python API.

+

The API is described in the file etreepublic.pxd, which is directly +c-importable by extension modules implemented in Pyrex or Cython.

+ +
+

Writing external modules in Cython

+

This is the easiest way of extending lxml at the C level. A Cython +(or Pyrex) module should start like this:

+
+# My Cython extension
+
+# import the public functions and classes of lxml.etree
+cimport etreepublic as cetree
+
+# import the lxml.etree module in Python
+cdef object etree
+from lxml import etree
+
+# initialize the access to the C-API of lxml.etree
+cetree.import_lxml__etree()
+
+

From this line on, you can access all public functions of lxml.etree +from the cetree namespace like this:

+
+# build a tag name from namespace and element name
+py_tag = cetree.namespacedNameFromNsName("http://some/url", "myelement")
+
+

Public lxml classes are easily subclassed. For example, to implement +and set a new default element class, you can write Cython code like +the following:

+
+from etreepublic cimport ElementBase
+cdef class NewElementClass(ElementBase):
+     def set_value(self, myval):
+         self.set("my_attribute", myval)
+
+etree.set_element_class_lookup(
+     etree.DefaultElementClassLookup(element=NewElementClass))
+
+
+
+

Writing external modules in C

+

If you really feel like it, you can also interface with lxml.etree straight +from C code. All you have to do is include the header file for the public +API, import the lxml.etree module and then call the import function:

+
/* My C extension */
+
+/* common includes */
+#include "Python.h"
+#include "stdio.h"
+#include "string.h"
+#include "stdarg.h"
+#include "libxml/xmlversion.h"
+#include "libxml/encoding.h"
+#include "libxml/hash.h"
+#include "libxml/tree.h"
+#include "libxml/xmlIO.h"
+#include "libxml/xmlsave.h"
+#include "libxml/globals.h"
+#include "libxml/xmlstring.h"
+
+/* lxml.etree specific includes */
+#include "lxml-version.h"
+#include "etree_defs.h"
+#include "etree.h"
+
+/* setup code */
+import_lxml__etree()
+
+

Note that including etree.h does not automatically include the +header files it requires. Note also that the above list of common +includes may not be sufficient.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/changes-2.2.3.html b/doc/html/changes-2.2.3.html new file mode 100644 index 0000000..d7da382 --- /dev/null +++ b/doc/html/changes-2.2.3.html @@ -0,0 +1,1769 @@ + + + + + + +lxml changelog + + + +
+

lxml changelog

+ +
+

2.2.3 (2009-10-30)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • The resolve_entities option did not work in the incremental feed +parser.
  • +
  • Looking up and deleting attributes without a namespace could hit a +namespaced attribute of the same name instead.
  • +
  • Late errors during calls to SubElement() (e.g. attribute related +ones) could leave a partially initialised element in the tree.
  • +
  • Modifying trees that contain parsed entity references could result +in an infinite loop.
  • +
  • ObjectifiedElement.__setattr__ created an empty-string child element when the +attribute value was rejected as a non-unicode/non-ascii string
  • +
  • Syntax errors in lxml.cssselect could result in misleading error +messages.
  • +
  • Invalid syntax in CSS expressions could lead to an infinite loop in +the parser of lxml.cssselect.
  • +
  • CSS special character escapes were not properly handled in +lxml.cssselect.
  • +
  • CSS Unicode escapes were not properly decoded in lxml.cssselect.
  • +
  • Select options in HTML forms that had no explicit value +attribute were not handled correctly. The HTML standard dictates +that their value is defined by their text content. This is now +supported by lxml.html.
  • +
  • XPath raised a TypeError when finding CDATA sections. This is now +fully supported.
  • +
  • Calling help(lxml.objectify) didn't work at the prompt.
  • +
  • The ElementMaker in lxml.objectify no longer defines the default +namespaces when annotation is disabled.
  • +
  • Feed parser failed to honout the 'recover' option on parse errors.
  • +
  • Diverting the error logging to Python's logging system was broken.
  • +
+
+
+

Other changes

+
+
+
+

2.2.2 (2009-06-21)

+
+

Features added

+
    +
  • New helper functions strip_attributes(), strip_elements(), +strip_tags() in lxml.etree to remove attributes/subtrees/tags +from a subtree.
  • +
+
+
+

Bugs fixed

+
    +
  • Namespace cleanup on subtree insertions could result in missing +namespace declarations (and potentially crashes) if the element +defining a namespace was deleted and the namespace was not used by +the top element of the inserted subtree but only in deeper subtrees.
  • +
  • Raising an exception from a parser target callback didn't always +terminate the parser.
  • +
  • Only {true, false, 1, 0} are accepted as the lexical representation for +BoolElement ({True, False, T, F, t, f} not any more), restoring lxml <= 2.0 +behaviour.
  • +
+
+
+

Other changes

+
+
+
+

2.2.1 (2009-06-02)

+
+

Features added

+
    +
  • Injecting default attributes into a document during XML Schema +validation (also at parse time).
  • +
  • Pass huge_tree parser option to disable parser security +restrictions imposed by libxml2 2.7.
  • +
+
+
+

Bugs fixed

+
    +
  • The script for statically building libxml2 and libxslt didn't work +in Py3.
  • +
  • XMLSchema() also passes invalid schema documents on to libxml2 +for parsing (which could lead to a crash before release 2.6.24).
  • +
+
+
+

Other changes

+
+
+
+

2.2 (2009-03-21)

+
+

Features added

+
    +
  • Support for standalone flag in XML declaration through +tree.docinfo.standalone and by passing standalone=True/False +on serialisation.
  • +
+
+
+

Bugs fixed

+
    +
  • Crash when parsing an XML Schema with external imports from a +filename.
  • +
+
+
+
+

2.2beta4 (2009-02-27)

+
+

Features added

+
    +
  • Support strings and instantiable Element classes as child arguments +to the constructor of custom Element classes.
  • +
  • GZip compression support for serialisation to files and file-like +objects.
  • +
+
+
+

Bugs fixed

+
    +
  • Deep-copying an ElementTree copied neither its sibling PIs and +comments nor its internal/external DTD subsets.
  • +
  • Soupparser failed on broken attributes without values.
  • +
  • Crash in XSLT when overwriting an already defined attribute using +xsl:attribute.
  • +
  • Crash bug in exception handling code under Python 3. This was due +to a problem in Cython, not lxml itself.
  • +
  • lxml.html.FormElement._name() failed for non top-level forms.
  • +
  • TAG special attribute in constructor of custom Element classes +was evaluated incorrectly.
  • +
+
+
+

Other changes

+
    +
  • Official support for Python 3.0.1.
  • +
  • Element.findtext() now returns an empty string instead of None +for Elements without text content.
  • +
+
+
+
+

2.2beta3 (2009-02-17)

+
+

Features added

+
    +
  • XSLT.strparam() class method to wrap quoted string parameters +that require escaping.
  • +
+
+
+

Bugs fixed

+
    +
  • Memory leak in XPath evaluators.
  • +
  • Crash when parsing indented XML in one thread and merging it with +other documents parsed in another thread.
  • +
  • Setting the base attribute in lxml.objectify from a unicode +string failed.
  • +
  • Fixes following changes in Python 3.0.1.
  • +
  • Minor fixes for Python 3.
  • +
+
+
+

Other changes

+
    +
  • The global error log (which is copied into the exception log) is now +local to a thread, which fixes some race conditions.
  • +
  • More robust error handling on serialisation.
  • +
+
+
+
+

2.2beta2 (2009-01-25)

+
+

Bugs fixed

+
    +
  • Potential memory leak on exception handling. This was due to a +problem in Cython, not lxml itself.
  • +
  • iter_links (and related link-rewriting functions) in +lxml.html would interpret CSS like url("link") incorrectly +(treating the quotation marks as part of the link).
  • +
  • Failing import on systems that have an io module.
  • +
+
+
+
+

2.1.5 (2009-01-06)

+
+

Bugs fixed

+
    +
  • Potential memory leak on exception handling. This was due to a +problem in Cython, not lxml itself.
  • +
  • Failing import on systems that have an io module.
  • +
+
+
+
+

2.2beta1 (2008-12-12)

+
+

Features added

+
    +
  • Allow lxml.html.diff.htmldiff to accept Element objects, not +just HTML strings.
  • +
+
+
+

Bugs fixed

+
    +
  • Crash when using an XPath evaluator in multiple threads.
  • +
  • Fixed missing whitespace before Link:... in lxml.html.diff.
  • +
+
+
+

Other changes

+
    +
  • Export lxml.html.parse.
  • +
+
+
+
+

2.1.4 (2008-12-12)

+
+

Bugs fixed

+
    +
  • Crash when using an XPath evaluator in multiple threads.
  • +
+
+
+
+

2.0.11 (2008-12-12)

+
+

Bugs fixed

+
    +
  • Crash when using an XPath evaluator in multiple threads.
  • +
+
+
+
+

2.2alpha1 (2008-11-23)

+
+

Features added

+
    +
  • Support for XSLT result tree fragments in XPath/XSLT extension +functions.
  • +
  • QName objects have new properties namespace and localname.
  • +
  • New options for exclusive C14N and C14N without comments.
  • +
  • Instantiating a custom Element classes creates a new Element.
  • +
+
+
+

Bugs fixed

+
    +
  • XSLT didn't inherit the parse options of the input document.
  • +
  • 0-bytes could slip through the API when used inside of Unicode +strings.
  • +
  • With lxml.html.clean.autolink, links with balanced parenthesis, +that end in a parenthesis, will be linked in their entirety (typical +with Wikipedia links).
  • +
+
+
+

Other changes

+
+
+
+

2.1.3 (2008-11-17)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Ref-count leaks when lxml enters a try-except statement while an +outside exception lives in sys.exc_*(). This was due to a problem in +Cython, not lxml itself.
  • +
  • Parser Unicode decoding errors could get swallowed by other +exceptions.
  • +
  • Name/import errors in some Python modules.
  • +
  • Internal DTD subsets that did not specify a system or public ID were +not serialised and did not appear in the docinfo property of +ElementTrees.
  • +
  • Fix a pre-Py3k warning when parsing from a gzip file in Py2.6.
  • +
  • Test suite fixes for libxml2 2.7.
  • +
  • Resolver.resolve_string() did not work for non-ASCII byte strings.
  • +
  • Resolver.resolve_file() was broken.
  • +
  • Overriding the parser encoding didn't work for many encodings.
  • +
+
+
+

Other changes

+
+
+
+

2.0.10 (2008-11-17)

+
+

Bugs fixed

+
    +
  • Ref-count leaks when lxml enters a try-except statement while an +outside exception lives in sys.exc_*(). This was due to a problem in +Cython, not lxml itself.
  • +
+
+
+
+

2.1.2 (2008-09-05)

+
+

Features added

+
    +
  • lxml.etree now tries to find the absolute path name of files when +parsing from a file-like object. This helps custom resolvers when +resolving relative URLs, as lixbml2 can prepend them with the path +of the source document.
  • +
+
+
+

Bugs fixed

+
    +
  • Memory problem when passing documents between threads.
  • +
  • Target parser did not honour the recover option and raised an +exception instead of calling .close() on the target.
  • +
+
+
+

Other changes

+
+
+
+

2.0.9 (2008-09-05)

+
+

Bugs fixed

+
    +
  • Memory problem when passing documents between threads.
  • +
  • Target parser did not honour the recover option and raised an +exception instead of calling .close() on the target.
  • +
+
+
+
+

2.1.1 (2008-07-24)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Crash when parsing XSLT stylesheets in a thread and using them in +another.
  • +
  • Encoding problem when including text with ElementInclude under +Python 3.
  • +
+
+
+

Other changes

+
+
+
+

2.0.8 (2008-07-24)

+
+

Features added

+
    +
  • lxml.html.rewrite_links() strips links to work around documents +with whitespace in URL attributes.
  • +
+
+
+

Bugs fixed

+
    +
  • Crash when parsing XSLT stylesheets in a thread and using them in +another.
  • +
  • CSS selector parser dropped remaining expression after a function +with parameters.
  • +
+
+
+

Other changes

+
+
+
+

2.1 (2008-07-09)

+
+

Features added

+
    +
  • Smart strings can be switched off in XPath (smart_strings +keyword option).
  • +
  • lxml.html.rewrite_links() strips links to work around documents +with whitespace in URL attributes.
  • +
+
+
+

Bugs fixed

+
    +
  • Custom resolvers were not used for XMLSchema includes/imports and +XInclude processing.
  • +
  • CSS selector parser dropped remaining expression after a function +with parameters.
  • +
+
+
+

Other changes

+
    +
  • objectify.enableRecursiveStr() was removed, use +objectify.enable_recursive_str() instead
  • +
  • Speed-up when running XSLTs on documents from other threads
  • +
+
+
+
+

2.0.7 (2008-06-20)

+
+

Features added

+
    +
  • Pickling ElementTree objects in lxml.objectify.
  • +
+
+
+

Bugs fixed

+
    +
  • Descending dot-separated classes in CSS selectors were not resolved +correctly.
  • +
  • ElementTree.parse() didn't handle target parser result.
  • +
  • Potential threading problem in XInclude.
  • +
  • Crash in Element class lookup classes when the __init__() method of +the super class is not called from Python subclasses.
  • +
+
+
+

Other changes

+
    +
  • Non-ASCII characters in attribute values are no longer escaped on +serialisation.
  • +
+
+
+
+

2.1beta3 (2008-06-19)

+
+

Features added

+
    +
  • Major overhaul of tools/xpathgrep.py script.
  • +
  • Pickling ElementTree objects in lxml.objectify.
  • +
  • Support for parsing from file-like objects that return unicode +strings.
  • +
  • New function etree.cleanup_namespaces(el) that removes unused +namespace declarations from a (sub)tree (experimental).
  • +
  • XSLT results support the buffer protocol in Python 3.
  • +
  • Polymorphic functions in lxml.html that accept either a tree or +a parsable string will return either a UTF-8 encoded byte string, a +unicode string or a tree, based on the type of the input. +Previously, the result was always a byte string or a tree.
  • +
  • Support for Python 2.6 and 3.0 beta.
  • +
  • File name handling now uses a heuristic to convert between byte +strings (usually filenames) and unicode strings (usually URLs).
  • +
  • Parsing from a plain file object frees the GIL under Python 2.x.
  • +
  • Running iterparse() on a plain file (or filename) frees the GIL +on reading under Python 2.x.
  • +
  • Conversion functions html_to_xhtml() and xhtml_to_html() in +lxml.html (experimental).
  • +
  • Most features in lxml.html work for XHTML namespaced tag names +(experimental).
  • +
+
+
+

Bugs fixed

+
    +
  • ElementTree.parse() didn't handle target parser result.
  • +
  • Crash in Element class lookup classes when the __init__() method of +the super class is not called from Python subclasses.
  • +
  • A number of problems related to unicode/byte string conversion of +filenames and error messages were fixed.
  • +
  • Building on MacOS-X now passes the "flat_namespace" option to the C +compiler, which reportedly prevents build quirks and crashes on this +platform.
  • +
  • Windows build was broken.
  • +
  • Rare crash when serialising to a file object with certain encodings.
  • +
+
+
+

Other changes

+
    +
  • Non-ASCII characters in attribute values are no longer escaped on +serialisation.
  • +
  • Passing non-ASCII byte strings or invalid unicode strings as .tag, +namespaces, etc. will result in a ValueError instead of an +AssertionError (just like the tag well-formedness check).
  • +
  • Up to several times faster attribute access (i.e. tree traversal) in +lxml.objectify.
  • +
+
+
+
+

2.0.6 (2008-05-31)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Incorrect evaluation of el.find("tag[child]").
  • +
  • Windows build was broken.
  • +
  • Moving a subtree from a document created in one thread into a +document of another thread could crash when the rest of the source +document is deleted while the subtree is still in use.
  • +
  • Rare crash when serialising to a file object with certain encodings.
  • +
+
+
+

Other changes

+
    +
  • lxml should now build without problems on MacOS-X.
  • +
+
+
+
+

2.1beta2 (2008-05-02)

+
+

Features added

+
    +
  • All parse functions in lxml.html take a parser keyword argument.
  • +
  • lxml.html has a new parser class XHTMLParser and a module +attribute xhtml_parser that provide XML parsers that are +pre-configured for the lxml.html package.
  • +
+
+
+

Bugs fixed

+
    +
  • Moving a subtree from a document created in one thread into a +document of another thread could crash when the rest of the source +document is deleted while the subtree is still in use.
  • +
  • Passing an nsmap when creating an Element will no longer strip +redundantly defined namespace URIs. This prevented the definition +of more than one prefix for a namespace on the same Element.
  • +
+
+
+

Other changes

+
    +
  • If the default namespace is redundantly defined with a prefix on the +same Element, the prefix will now be preferred for subelements and +attributes. This allows users to work around a problem in libxml2 +where attributes from the default namespace could serialise without +a prefix even when they appear on an Element with a different +namespace (i.e. they would end up in the wrong namespace).
  • +
+
+
+
+

2.0.5 (2008-05-01)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Resolving to a filename in custom resolvers didn't work.
  • +
  • lxml did not honour libxslt's second error state "STOPPED", which +let some XSLT errors pass silently.
  • +
  • Memory leak in Schematron with libxml2 >= 2.6.31.
  • +
+
+
+

Other changes

+
+
+
+

2.1beta1 (2008-04-15)

+
+

Features added

+
    +
  • Error logging in Schematron (requires libxml2 2.6.32 or later).
  • +
  • Parser option strip_cdata for normalising or keeping CDATA +sections. Defaults to True as before, thus replacing CDATA +sections by their text content.
  • +
  • CDATA() factory to wrap string content as CDATA section.
  • +
+
+
+

Bugs fixed

+
    +
  • Resolving to a filename in custom resolvers didn't work.
  • +
  • lxml did not honour libxslt's second error state "STOPPED", which +let some XSLT errors pass silently.
  • +
  • Memory leak in Schematron with libxml2 >= 2.6.31.
  • +
  • lxml.etree accepted non well-formed namespace prefix names.
  • +
+
+
+

Other changes

+
    +
  • Major cleanup in internal moveNodeToDocument() function, which +takes care of namespace cleanup when moving elements between +different namespace contexts.
  • +
  • New Elements created through the makeelement() method of an HTML +parser or through lxml.html now end up in a new HTML document +(doctype HTML 4.01 Transitional) instead of a generic XML document. +This mostly impacts the serialisation and the availability of a DTD +context.
  • +
+
+
+
+

2.0.4 (2008-04-13)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • Hanging thread in conjunction with GTK threading.
  • +
  • Crash bug in iterparse when moving elements into other documents.
  • +
  • HTML elements' .cssselect() method was broken.
  • +
  • ElementTree.find*() didn't accept QName objects.
  • +
+
+
+

Other changes

+
+
+
+

2.1alpha1 (2008-03-27)

+
+

Features added

+
    +
  • New event types 'comment' and 'pi' in iterparse().
  • +
  • XSLTAccessControl instances have a property options that +returns a dict of access configuration options.
  • +
  • Constant instances DENY_ALL and DENY_WRITE on +XSLTAccessControl class.
  • +
  • Extension elements for XSLT (experimental!)
  • +
  • Element.base property returns the xml:base or HTML base URL of +an Element.
  • +
  • docinfo.URL property is writable.
  • +
+
+
+

Bugs fixed

+
    +
  • Default encoding for plain text serialisation was different from +that of XML serialisation (UTF-8 instead of ASCII).
  • +
+
+
+

Other changes

+
    +
  • Minor API speed-ups.
  • +
  • The benchmark suite now uses tail text in the trees, which makes the +absolute numbers incomparable to previous results.
  • +
  • Generating the HTML documentation now requires Pygments, which is +used to enable syntax highlighting for the doctest examples.
  • +
+

Most long-time deprecated functions and methods were removed:

+
    +
  • etree.clearErrorLog(), use etree.clear_error_log()

    +
  • +
  • etree.useGlobalPythonLog(), use +etree.use_global_python_log()

    +
  • +
  • etree.ElementClassLookup.setFallback(), use +etree.ElementClassLookup.set_fallback()

    +
  • +
  • etree.getDefaultParser(), use etree.get_default_parser()

    +
  • +
  • etree.setDefaultParser(), use etree.set_default_parser()

    +
  • +
  • etree.setElementClassLookup(), use +etree.set_element_class_lookup()

    +

    Note that parser.setElementClassLookup() has not been removed +yet, although parser.set_element_class_lookup() should be used +instead.

    +
  • +
  • xpath_evaluator.registerNamespace(), use +xpath_evaluator.register_namespace()

    +
  • +
  • xpath_evaluator.registerNamespaces(), use +xpath_evaluator.register_namespaces()

    +
  • +
  • objectify.setPytypeAttributeTag, use +objectify.set_pytype_attribute_tag

    +
  • +
  • objectify.setDefaultParser(), use +objectify.set_default_parser()

    +
  • +
+
+
+
+

2.0.3 (2008-03-26)

+
+

Features added

+
    +
  • soupparser.parse() allows passing keyword arguments on to +BeautifulSoup.
  • +
  • fromstring() method in lxml.html.soupparser.
  • +
+
+
+

Bugs fixed

+
    +
  • lxml.html.diff didn't treat empty tags properly (e.g., +<br>).
  • +
  • Handle entity replacements correctly in target parser.
  • +
  • Crash when using iterparse() with XML Schema validation.
  • +
  • The BeautifulSoup parser (soupparser.py) did not replace entities, +which made them turn up in text content.
  • +
  • Attribute assignment of custom PyTypes in objectify could fail to +correctly serialise the value to a string.
  • +
+
+
+

Other changes

+
    +
  • lxml.html.ElementSoup was replaced by a new module +lxml.html.soupparser with a more consistent API. The old module +remains for compatibility with ElementTree's own ElementSoup module.
  • +
  • Setting the XSLT_CONFIG and XML2_CONFIG environment variables at +build time will let setup.py pick up the xml2-config and +xslt-config scripts from the supplied path name.
  • +
  • Passing --with-xml2-config=/path/to/xml2-config to setup.py will +override the xml2-config script that is used to determine the C +compiler options. The same applies for the --with-xslt-config +option.
  • +
+
+
+
+

2.0.2 (2008-02-22)

+
+

Features added

+
    +
  • Support passing base_url to file parser functions to override +the filename of the file(-like) object.
  • +
+
+
+

Bugs fixed

+
    +
  • The prefix for objectify's pytype namespace was missing from the set +of default prefixes.
  • +
  • Memory leak in Schematron (fixed only for libxml2 2.6.31+).
  • +
  • Error type names in RelaxNG were reported incorrectly.
  • +
  • Slice deletion bug fixed in objectify.
  • +
+
+
+

Other changes

+
    +
  • Enabled doctests for some Python modules (especially lxml.html).
  • +
  • Add a method argument to lxml.html.tostring() +(method="xml" for XHTML output).
  • +
  • Make it clearer that methods like lxml.html.fromstring() take a +base_url argument.
  • +
+
+
+
+

2.0.1 (2008-02-13)

+
+

Features added

+
    +
  • Child iteration in lxml.pyclasslookup.
  • +
  • Loads of new docstrings reflect the signature of functions and +methods to make them visible in API docs and help()
  • +
+
+
+

Bugs fixed

+
    +
  • The module lxml.html.builder was duplicated as +lxml.htmlbuilder
  • +
  • Form elements would return None for form.fields.keys() if there +was an unnamed input field. Now unnamed input fields are completely +ignored.
  • +
  • Setting an element slice in objectify could insert slice-overlapping +elements at the wrong position.
  • +
+
+
+

Other changes

+
    +
  • The generated API documentation was cleaned up and disburdened from +non-public classes etc.
  • +
  • The previously public module lxml.html.setmixin was renamed to +lxml.html._setmixin as it is not an official part of lxml. If +you want to use it, feel free to copy it over to your own source +base.
  • +
  • Passing --with-xslt-config=/path/to/xslt-config to setup.py will +override the xslt-config script that is used to determine the C +compiler options.
  • +
+
+
+
+

2.0 (2008-02-01)

+
+

Features added

+
    +
  • Passing the unicode type as encoding to tostring() will +serialise to unicode. The tounicode() function is now +deprecated.
  • +
  • XMLSchema() and RelaxNG() can parse from StringIO.
  • +
  • makeparser() function in lxml.objectify to create a new +parser with the usual objectify setup.
  • +
  • Plain ASCII XPath string results are no longer forced into unicode +objects as in 2.0beta1, but are returned as plain strings as before.
  • +
  • All XPath string results are 'smart' objects that have a +getparent() method to retrieve their parent Element.
  • +
  • with_tail option in serialiser functions.
  • +
  • More accurate exception messages in validator creation.
  • +
  • Parse-time XML schema validation (schema parser keyword).
  • +
  • XPath string results of the text() function and attribute +selection make their Element container accessible through a +getparent() method. As a side-effect, they are now always +unicode objects (even ASCII strings).
  • +
  • XSLT objects are usable in any thread - at the cost of a deep +copy if they were not created in that thread.
  • +
  • Invalid entity names and character references will be rejected by +the Entity() factory.
  • +
  • entity.text returns the textual representation of the entity, +e.g. &amp;.
  • +
  • New properties position and code on ParseError exception (as +in ET 1.3)
  • +
  • Rich comparison of element.attrib proxies.
  • +
  • ElementTree compatible TreeBuilder class.
  • +
  • Use default prefixes for some common XML namespaces.
  • +
  • lxml.html.clean.Cleaner now allows for a host_whitelist, and +two overridable methods: allow_embedded_url(el, url) and the +more general allow_element(el).
  • +
  • Extended slicing of Elements as in element[1:-1:2], both in +etree and in objectify
  • +
  • Resolvers can now provide a base_url keyword argument when +resolving a document as string data.
  • +
  • When using lxml.doctestcompare you can give the doctest option +NOPARSE_MARKUP (like # doctest: +NOPARSE_MARKUP) to suppress +the special checking for one test.
  • +
  • Separate feed_error_log property for the feed parser interface. +The normal parser interface and iterparse continue to use +error_log.
  • +
  • The normal parsers and the feed parser interface are now separated +and can be used concurrently on the same parser instance.
  • +
  • fromstringlist() and tostringlist() functions as in +ElementTree 1.3
  • +
  • iterparse() accepts an html boolean keyword argument for +parsing with the HTML parser (note that this interface may be +subject to change)
  • +
  • Parsers accept an encoding keyword argument that overrides the encoding +of the parsed documents.
  • +
  • New C-API function hasChild() to test for children
  • +
  • annotate() function in objectify can annotate with Python types and XSI +types in one step. Accompanied by xsiannotate() and pyannotate().
  • +
  • ET.write(), tostring() and tounicode() now accept a keyword +argument method that can be one of 'xml' (or None), 'html' or 'text' to +serialise as XML, HTML or plain text content.
  • +
  • iterfind() method on Elements returns an iterator equivalent to +findall()
  • +
  • itertext() method on Elements
  • +
  • Setting a QName object as value of the .text property or as an attribute +will resolve its prefix in the respective context
  • +
  • ElementTree-like parser target interface as described in +http://effbot.org/elementtree/elementtree-xmlparser.htm
  • +
  • ElementTree-like feed parser interface on XMLParser and HTMLParser +(feed() and close() methods)
  • +
  • Reimplemented objectify.E for better performance and improved +integration with objectify. Provides extended type support based on +registered PyTypes.
  • +
  • XSLT objects now support deep copying
  • +
  • New makeSubElement() C-API function that allows creating a new +subelement straight with text, tail and attributes.
  • +
  • XPath extension functions can now access the current context node +(context.context_node) and use a context dictionary +(context.eval_context) from the context provided in their first +parameter
  • +
  • HTML tag soup parser based on BeautifulSoup in lxml.html.ElementSoup
  • +
  • New module lxml.doctestcompare by Ian Bicking for writing simplified +doctests based on XML/HTML output. Use by importing lxml.usedoctest or +lxml.html.usedoctest from within a doctest.
  • +
  • New module lxml.cssselect by Ian Bicking for selecting Elements with CSS +selectors.
  • +
  • New package lxml.html written by Ian Bicking for advanced HTML +treatment.
  • +
  • Namespace class setup is now local to the ElementNamespaceClassLookup +instance and no longer global.
  • +
  • Schematron validation (incomplete in libxml2)
  • +
  • Additional stringify argument to objectify.PyType() takes a +conversion function to strings to support setting text values from arbitrary +types.
  • +
  • Entity support through an Entity factory and element classes. XML +parsers now have a resolve_entities keyword argument that can be set to +False to keep entities in the document.
  • +
  • column field on error log entries to accompany the line field
  • +
  • Error specific messages in XPath parsing and evaluation +NOTE: for evaluation errors, you will now get an XPathEvalError instead of +an XPathSyntaxError. To catch both, you can except on XPathError
  • +
  • The regular expression functions in XPath now support passing a node-set +instead of a string
  • +
  • Extended type annotation in objectify: new xsiannotate() function
  • +
  • EXSLT RegExp support in standard XPath (not only XSLT)
  • +
+
+
+

Bugs fixed

+
    +
  • Missing import in lxml.html.clean.
  • +
  • Some Python 2.4-isms prevented lxml from building/running under +Python 2.3.
  • +
  • XPath on ElementTrees could crash when selecting the virtual root +node of the ElementTree.
  • +
  • Compilation --without-threading was buggy in alpha5/6.
  • +
  • Memory leak in the parse() function.
  • +
  • Minor bugs in XSLT error message formatting.
  • +
  • Result document memory leak in target parser.
  • +
  • Target parser failed to report comments.
  • +
  • In the lxml.html iter_links method, links in <object> +tags weren't recognized. (Note: plugin-specific link parameters +still aren't recognized.) Also, the <embed> tag, though not +standard, is now included in lxml.html.defs.special_inline_tags.
  • +
  • Using custom resolvers on XSLT stylesheets parsed from a string +could request ill-formed URLs.
  • +
  • With lxml.doctestcompare if you do <tag xmlns="..."> in your +output, it will then be namespace-neutral (before the ellipsis was +treated as a real namespace).
  • +
  • AttributeError in feed parser on parse errors
  • +
  • XML feed parser setup problem
  • +
  • Type annotation for unicode strings in DataElement()
  • +
  • lxml failed to serialise namespace declarations of elements other than the +root node of a tree
  • +
  • Race condition in XSLT where the resolver context leaked between concurrent +XSLT calls
  • +
  • lxml.etree did not check tag/attribute names
  • +
  • The XML parser did not report undefined entities as error
  • +
  • The text in exceptions raised by XML parsers, validators and XPath +evaluators now reports the first error that occurred instead of the last
  • +
  • Passing '' as XPath namespace prefix did not raise an error
  • +
  • Thread safety in XPath evaluators
  • +
+
+
+

Other changes

+
    +
  • Exceptions carry only the part of the error log that is related to +the operation that caused the error.
  • +
  • XMLSchema() and RelaxNG() now enforce passing the source +file/filename through the file keyword argument.
  • +
  • The test suite now skips most doctests under Python 2.3.
  • +
  • make clean no longer removes the .c files (use make +realclean instead)
  • +
  • Minor performance tweaks for Element instantiation and subelement +creation
  • +
  • Various places in the XPath, XSLT and iteration APIs now require +keyword-only arguments.
  • +
  • The argument order in element.itersiblings() was changed to +match the order used in all other iteration methods. The second +argument ('preceding') is now a keyword-only argument.
  • +
  • The getiterator() method on Elements and ElementTrees was +reverted to return an iterator as it did in lxml 1.x. The ET API +specification allows it to return either a sequence or an iterator, +and it traditionally returned a sequence in ET and an iterator in +lxml. However, it is now deprecated in favour of the iter() +method, which should be used in new code wherever possible.
  • +
  • The 'pretty printed' serialisation of ElementTree objects now +inserts newlines at the root level between processing instructions, +comments and the root tag.
  • +
  • A 'pretty printed' serialisation is now terminated with a newline.
  • +
  • Second argument to lxml.etree.Extension() helper is no longer +required, third argument is now a keyword-only argument ns.
  • +
  • lxml.html.tostring takes an encoding argument.
  • +
  • The module source files were renamed to "lxml.*.pyx", such as +"lxml.etree.pyx". This was changed for consistency with the way +Pyrex commonly handles package imports. The main effect is that +classes now know about their fully qualified class name, including +the package name of their module.
  • +
  • Keyword-only arguments in some API functions, especially in the +parsers and serialisers.
  • +
  • Tag name validation in lxml.etree (and lxml.html) now distinguishes +between HTML tags and XML tags based on the parser that was used to +parse or create them. HTML tags no longer reject any non-ASCII +characters in tag names but only spaces and the special characters +<>&/"'.
  • +
  • lxml.etree now emits a warning if you use XPath with libxml2 2.6.27 +(which can crash on certain XPath errors)
  • +
  • Type annotation in objectify now preserves the already annotated type by +default to prevent loosing type information that is already there.
  • +
  • element.getiterator() returns a list, use element.iter() to retrieve +an iterator (ElementTree 1.3 compatible behaviour)
  • +
  • objectify.PyType for None is now called "NoneType"
  • +
  • el.getiterator() renamed to el.iter(), following ElementTree 1.3 - +original name is still available as alias
  • +
  • In the public C-API, findOrBuildNodeNs() was replaced by the more +generic findOrBuildNodeNsPrefix
  • +
  • Major refactoring in XPath/XSLT extension function code
  • +
  • Network access in parsers disabled by default
  • +
+
+
+
+

1.3.6 (2007-10-29)

+
+

Bugs fixed

+
    +
  • Backported decref crash fix from 2.0
  • +
  • Well hidden free-while-in-use crash bug in ObjectPath
  • +
+
+
+

Other changes

+
    +
  • The test suites now run gc.collect() in the tearDown() +methods. While this makes them take a lot longer to run, it also +makes it easier to link a specific test to garbage collection +problems that would otherwise appear in later tests.
  • +
+
+
+
+

1.3.5 (2007-10-22)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • lxml.etree could crash when adding more than 10000 namespaces to a +document
  • +
  • lxml failed to serialise namespace declarations of elements other +than the root node of a tree
  • +
+
+
+
+

1.3.4 (2007-08-30)

+
+

Features added

+
    +
  • The ElementMaker in lxml.builder now accepts the keyword arguments +namespace and nsmap to set a namespace and nsmap for the Elements it +creates.
  • +
  • The docinfo on ElementTree objects has new properties internalDTD +and externalDTD that return a DTD object for the internal or external +subset of the document respectively.
  • +
  • Serialising an ElementTree now includes any internal DTD subsets that are +part of the document, as well as comments and PIs that are siblings of the +root node.
  • +
+
+
+

Bugs fixed

+
    +
  • Parsing with the no_network option could fail
  • +
+
+
+

Other changes

+
    +
  • lxml now raises a TagNameWarning about tag names containing ':' instead of +an Error as 1.3.3 did. The reason is that a number of projects currently +misuse the previous lack of tag name validation to generate namespace +prefixes without declaring namespaces. Apart from the danger of generating +broken XML this way, it also breaks most of the namespace-aware tools in +XML, including XPath, XSLT and validation. lxml 1.3.x will continue to +support this bug with a Warning, while lxml 2.0 will be strict about +well-formed tag names (not only regarding ':').
  • +
  • Serialising an Element no longer includes its comment and PI siblings (only +ElementTree serialisation includes them).
  • +
+
+
+
+

1.3.3 (2007-07-26)

+
+

Features added

+
    +
  • ElementTree compatible parser ETCompatXMLParser strips processing +instructions and comments while parsing XML
  • +
  • Parsers now support stripping PIs (keyword argument 'remove_pis')
  • +
  • etree.fromstring() now supports parsing both HTML and XML, depending on +the parser you pass.
  • +
  • Support base_url keyword argument in HTML() and XML()
  • +
+
+
+

Bugs fixed

+
    +
  • Parsing from Python Unicode strings failed on some platforms
  • +
  • Element() did not raise an exception on tag names containing ':'
  • +
  • Element.getiterator(tag) did not accept Comment and +ProcessingInstruction as tags. It also accepts Element now.
  • +
+
+
+
+

1.3.2 (2007-07-03)

+
+

Features added

+
+
+

Bugs fixed

+
    +
  • "deallocating None" crash bug
  • +
+
+
+
+

1.3.1 (2007-07-02)

+
+

Features added

+
    +
  • objectify.DataElement now supports setting values from existing data +elements (not just plain Python types) and reuses defined namespaces etc.
  • +
  • E-factory support for lxml.objectify (objectify.E)
  • +
+
+
+

Bugs fixed

+
    +
  • Better way to prevent crashes in Element proxy cleanup code
  • +
  • objectify.DataElement didn't set up None value correctly
  • +
  • objectify.DataElement didn't check the value against the provided type hints
  • +
  • Reference-counting bug in Element.attrib.pop()
  • +
+
+
+
+

1.3 (2007-06-24)

+
+

Features added

+
    +
  • Module lxml.pyclasslookup module implements an Element class lookup +scheme that can access the entire tree in read-only mode to help determining +a suitable Element class
  • +
  • Parsers take a remove_comments keyword argument that skips over comments
  • +
  • parse() function in objectify, corresponding to XML() etc.
  • +
  • Element.addnext(el) and Element.addprevious(el) methods to support +adding processing instructions and comments around the root node
  • +
  • Element.attrib was missing clear() and pop() methods
  • +
  • Extended type annotation in objectify: cleaner annotation namespace setup +plus new deannotate() function
  • +
  • Support for custom Element class instantiation in lxml.sax: passing a +makeelement function to the ElementTreeContentHandler will reuse the +lookup context of that function
  • +
  • '.' represents empty ObjectPath (identity)
  • +
  • Element.values() to accompany the existing .keys() and .items()
  • +
  • collectAttributes() C-function to build a list of attribute +keys/values/items for a libxml2 node
  • +
  • DTD validator class (like RelaxNG and XMLSchema)
  • +
  • HTML generator helpers by Fredrik Lundh in lxml.htmlbuilder
  • +
  • ElementMaker XML generator by Fredrik Lundh in lxml.builder.E
  • +
  • Support for pickeling objectify.ObjectifiedElement objects to XML
  • +
  • update() method on Element.attrib
  • +
  • Optimised replacement for libxml2's _xmlReconsiliateNs(). This allows lxml +a better handling of namespaces when moving elements between documents.
  • +
+
+
+

Bugs fixed

+
    +
  • Removing Elements from a tree could make them loose their namespace +declarations
  • +
  • ElementInclude didn't honour base URL of original document
  • +
  • Replacing the children slice of an Element would cut off the tails of the +original children
  • +
  • Element.getiterator(tag) did not accept Comment and +ProcessingInstruction as tags
  • +
  • API functions now check incoming strings for XML conformity. Zero bytes or +low ASCII characters are no longer accepted (AssertionError).
  • +
  • XSLT parsing failed to pass resolver context on to imported documents
  • +
  • passing '' as namespace prefix in nsmap could be passed through to libxml2
  • +
  • Objectify couldn't handle prefixed XSD type names in xsi:type
  • +
  • More ET compatible behaviour when writing out XML declarations or not
  • +
  • More robust error handling in iterparse()
  • +
  • Documents lost their top-level PIs and comments on serialisation
  • +
  • lxml.sax failed on comments and PIs. Comments are now properly ignored and +PIs are copied.
  • +
  • Possible memory leaks in namespace handling when moving elements between +documents
  • +
+
+
+

Other changes

+
    +
  • major restructuring in the documentation
  • +
+
+
+
+

1.2.1 (2007-02-27)

+
+

Bugs fixed

+
    +
  • Build fixes for MS compiler
  • +
  • Item assignments to special names like element["text"] failed
  • +
  • Renamed ObjectifiedDataElement.__setText() to _setText() to make it easier +to access
  • +
  • The pattern for attribute names in ObjectPath was too restrictive
  • +
+
+
+
+

1.2 (2007-02-20)

+
+

Features added

+
    +
  • Rich comparison of QName objects
  • +
  • Support for regular expressions in benchmark selection
  • +
  • get/set emulation (not .attrib!) for attributes on processing instructions
  • +
  • ElementInclude Python module for ElementTree compatible XInclude processing +that honours custom resolvers registered with the source document
  • +
  • ElementTree.parser property holds the parser used to parse the document
  • +
  • setup.py has been refactored for greater readability and flexibility
  • +
  • --rpath flag to setup.py to induce automatic linking-in of dynamic library +runtime search paths has been renamed to --auto-rpath. This makes it +possible to pass an --rpath directly to distutils; previously this was being +shadowed.
  • +
+
+
+

Bugs fixed

+
    +
  • Element instantiation now uses locks to prevent race conditions with threads
  • +
  • ElementTree.write() did not raise an exception when the file was not writable
  • +
  • Error handling could crash under Python <= 2.4.1 - fixed by disabling thread +support in these environments
  • +
  • Element.find*() did not accept QName objects as path
  • +
+
+
+

Other changes

+
    +
  • code cleanup: redundant _NodeBase super class merged into _Element class +Note: although the impact should be zero in most cases, this change breaks +the compatibiliy of the public C-API
  • +
+
+
+
+

1.1.2 (2006-10-30)

+
+

Features added

+
    +
  • Data elements in objectify support repr(), which is now used by dump()
  • +
  • Source distribution now ships with a patched Pyrex
  • +
  • New C-API function makeElement() to create new elements with text, +tail, attributes and namespaces
  • +
  • Reuse original parser flags for XInclude
  • +
  • Simplified support for handling XSLT processing instructions
  • +
+
+
+

Bugs fixed

+
    +
  • Parser resources were not freed before the next parser run
  • +
  • Open files and XML strings returned by Python resolvers were not +closed/freed
  • +
  • Crash in the IDDict returned by XMLDTDID
  • +
  • Copying Comments and ProcessingInstructions failed
  • +
  • Memory leak for external URLs in _XSLTProcessingInstruction.parseXSL()
  • +
  • Memory leak when garbage collecting tailed root elements
  • +
  • HTML script/style content was not propagated to .text
  • +
  • Show text xincluded between text nodes correctly in .text and .tail
  • +
  • 'integer * objectify.StringElement' operation was not supported
  • +
+
+
+
+

1.1.1 (2006-09-21)

+
+

Features added

+
    +
  • XSLT profiling support (profile_run keyword)
  • +
  • countchildren() method on objectify.ObjectifiedElement
  • +
  • Support custom elements for tree nodes in lxml.objectify
  • +
+
+
+

Bugs fixed

+
    +
  • lxml.objectify failed to support long data values (e.g., "123L")
  • +
  • Error messages from XSLT did not reach XSLT.error_log
  • +
  • Factories objectify.Element() and objectify.DataElement() were missing +attrib and nsmap keyword arguments
  • +
  • Changing the default parser in lxml.objectify did not update the factories +Element() and DataElement()
  • +
  • Let lxml.objectify.Element() always generate tree elements (not data +elements)
  • +
  • Build under Windows failed ('0' bug in patched Pyrex version)
  • +
+
+
+
+

1.1 (2006-09-13)

+
+

Features added

+
    +
  • Comments and processing instructions return '<!-- coment -->' and +'<?pi-target content?>' for repr()
  • +
  • Parsers are now the preferred (and default) place where element class lookup +schemes should be registered. Namespace lookup is no longer supported by +default.
  • +
  • Support for Python 2.5 beta
  • +
  • Unlock the GIL for deep copying documents and for XPath()
  • +
  • New compact keyword argument for parsing read-only documents
  • +
  • Support for parser options in iterparse()
  • +
  • The namespace axis is supported in XPath and returns (prefix, URI) +tuples
  • +
  • The XPath expression "/" now returns an empty list instead of raising an +exception
  • +
  • XML-Object API on top of lxml (lxml.objectify)
  • +
  • Customizable Element class lookup:
      +
    • different pre-implemented lookup mechanisms
    • +
    • support for externally provided lookup functions
    • +
    +
  • +
  • Support for processing instructions (ET-like, not compatible)
  • +
  • Public C-level API for independent extension modules
  • +
  • Module level iterwalk() function as 'iterparse' for trees
  • +
  • Module level iterparse() function similar to ElementTree (see +documentation for differences)
  • +
  • Element.nsmap property returns a mapping of all namespace prefixes known at +the Element to their namespace URI
  • +
  • Reentrant threading support in RelaxNG, XMLSchema and XSLT
  • +
  • Threading support in parsers and serializers:
      +
    • All in-memory operations (tostring, parse(StringIO), etc.) free the GIL
    • +
    • File operations (on file names) free the GIL
    • +
    • Reading from file-like objects frees the GIL and reacquires it for reading
    • +
    • Serialisation to file-like objects is single-threaded (high lock overhead)
    • +
    +
  • +
  • Element iteration over XPath axes:
      +
    • Element.iterdescendants() iterates over the descendants of an element
    • +
    • Element.iterancestors() iterates over the ancestors of an element (from +parent to parent)
    • +
    • Element.itersiblings() iterates over either the following or preceding +siblings of an element
    • +
    • Element.iterchildren() iterates over the children of an element in either +direction
    • +
    • All iterators support the tag keyword argument to restrict the +generated elements
    • +
    +
  • +
  • Element.getnext() and Element.getprevious() return the direct siblings of an +element
  • +
+
+
+

Bugs fixed

+
    +
  • filenames with local 8-bit encoding were not supported
  • +
  • 1.1beta did not compile under Python 2.3
  • +
  • ignore unknown 'pyval' attribute values in objectify
  • +
  • objectify.ObjectifiedElement.addattr() failed to accept Elements and Lists
  • +
  • objectify.ObjectPath.setattr() failed to accept Elements and Lists
  • +
  • XPathSyntaxError now inherits from XPathError
  • +
  • Threading race conditions in RelaxNG and XMLSchema
  • +
  • Crash when mixing elements from XSLT results into other trees, concurrent +XSLT is only allowed when the stylesheet was parsed in the main thread
  • +
  • The EXSLT regexp:match function now works as defined (except for some +differences in the regular expression syntax)
  • +
  • Setting element.text to '' returned None on request, not the empty string
  • +
  • iterparse() could crash on long XML files
  • +
  • Creating documents no longer copies the parser for later URL resolving. For +performance reasons, only a reference is kept. Resolver updates on the +parser will now be reflected by documents that were parsed before the +change. Although this should rarely become visible, it is a behavioral +change from 1.0.
  • +
+
+
+
+

1.0.4 (2006-09-09)

+
+

Features added

+
    +
  • List-like Element.extend() method
  • +
+
+
+

Bugs fixed

+
    +
  • Crash in tail handling in Element.replace()
  • +
+
+
+
+

1.0.3 (2006-08-08)

+
+

Features added

+
    +
  • Element.replace(old, new) method to replace a subelement by another one
  • +
+
+
+

Bugs fixed

+
    +
  • Crash when mixing elements from XSLT results into other trees
  • +
  • Copying/deepcopying did not work for ElementTree objects
  • +
  • Setting an attribute to a non-string value did not raise an exception
  • +
  • Element.remove() deleted the tail text from the removed Element
  • +
+
+
+
+

1.0.2 (2006-06-27)

+
+

Features added

+
    +
  • Support for setting a custom default Element class as opposed to namespace +specific classes (which still override the default class)
  • +
+
+
+

Bugs fixed

+
    +
  • Rare exceptions in Python list functions were not handled
  • +
  • Parsing accepted unicode strings with XML encoding declaration in certain +cases
  • +
  • Parsing 8-bit encoded strings from StringIO objects raised an exception
  • +
  • Module function initThread() was removed - useless (and never worked)
  • +
  • XSLT and parser exception messages include the error line number
  • +
+
+
+
+

1.0.1 (2006-06-09)

+
+

Features added

+
    +
  • Repeated calls to Element.attrib now efficiently return the same instance
  • +
+
+
+

Bugs fixed

+
    +
  • Document deallocation could crash in certain garbage collection scenarios
  • +
  • Extension function calls in XSLT variable declarations could break the +stylesheet and crash on repeated calls
  • +
  • Deep copying Elements could loose namespaces declared in parents
  • +
  • Deep copying Elements did not copy tail
  • +
  • Parsing file(-like) objects failed to load external entities
  • +
  • Parsing 8-bit strings from file(-like) objects raised an exception
  • +
  • xsl:include failed when the stylesheet was parsed from a file-like object
  • +
  • lxml.sax.ElementTreeProducer did not call startDocument() / endDocument()
  • +
  • MSVC compiler complained about long strings (supports only 2048 bytes)
  • +
+
+
+
+

1.0 (2006-06-01)

+
+

Features added

+
    +
  • Element.getiterator() and the findall() methods support finding arbitrary +elements from a namespace (pattern {namespace}*)
  • +
  • Another speedup in tree iteration code
  • +
  • General speedup of Python Element object creation and deallocation
  • +
  • Writing C14N no longer serializes in memory (reduced memory footprint)
  • +
  • PyErrorLog for error logging through the Python logging module
  • +
  • Element.getroottree() returns an ElementTree for the root node of the +document that contains the element.
  • +
  • ElementTree.getpath(element) returns a simple, absolute XPath expression to +find the element in the tree structure
  • +
  • Error logs have a last_error attribute for convenience
  • +
  • Comment texts can be changed through the API
  • +
  • Formatted output via pretty_print keyword in serialization functions
  • +
  • XSLT can block access to file system and network via XSLTAccessControl
  • +
  • ElementTree.write() no longer serializes in memory (reduced memory +footprint)
  • +
  • Speedup of Element.findall(tag) and Element.getiterator(tag)
  • +
  • Support for writing the XML representation of Elements and ElementTrees to +Python unicode strings via etree.tounicode()
  • +
  • Support for writing XSLT results to Python unicode strings via unicode()
  • +
  • Parsing a unicode string no longer copies the string (reduced memory +footprint)
  • +
  • Parsing file-like objects reads chunks rather than the whole file (reduced +memory footprint)
  • +
  • Parsing StringIO objects from the start avoids copying the string (reduced +memory footprint)
  • +
  • Read-only 'docinfo' attribute in ElementTree class holds DOCTYPE +information, original encoding and XML version as seen by the parser
  • +
  • etree module can be compiled without libxslt by commenting out the line +include "xslt.pxi" near the end of the etree.pyx source file
  • +
  • Better error messages in parser exceptions
  • +
  • Error reporting also works in XSLT
  • +
  • Support for custom document loaders (URI resolvers) in parsers and XSLT, +resolvers are registered at parser level
  • +
  • Implementation of exslt:regexp for XSLT based on the Python 're' module, +enabled by default, can be switched off with 'regexp=False' keyword argument
  • +
  • Support for exslt extensions (libexslt) and libxslt extra functions +(node-set, document, write, output)
  • +
  • Substantial speedup in XPath.evaluate()
  • +
  • HTMLParser for parsing (broken) HTML
  • +
  • XMLDTDID function parses XML into tuple (root node, ID dict) based on xml:id +implementation of libxml2 (as opposed to ET compatible XMLID)
  • +
+
+
+

Bugs fixed

+
    +
  • Memory leak in Element.__setitem__
  • +
  • Memory leak in Element.attrib.items() and Element.attrib.values()
  • +
  • Memory leak in XPath extension functions
  • +
  • Memory leak in unicode related setup code
  • +
  • Element now raises ValueError on empty tag names
  • +
  • Namespace fixing after moving elements between documents could fail if the +source document was freed too early
  • +
  • Setting namespace-less tag names on namespaced elements ('{ns}t' -> 't') +didn't reset the namespace
  • +
  • Unknown constants from newer libxml2 versions could raise exceptions in the +error handlers
  • +
  • lxml.etree compiles much faster
  • +
  • On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail +in certain cases
  • +
  • Document reference in ElementTree objects was not updated when the root +element was moved to a different document
  • +
  • Running absolute XPath expressions on an Element now evaluates against the +root tree
  • +
  • Evaluating absolute XPath expressions (/*) on an ElementTree could fail
  • +
  • Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree +objects
  • +
  • Removed public function initThreadLogging(), replaced by more general +initThread() which fixes a number of setup problems in threads
  • +
  • Memory leak when using iconv encoders in tostring/write
  • +
  • Deep copying Elements and ElementTrees maintains the document information
  • +
  • Serialization functions raise LookupError for unknown encodings
  • +
  • Memory deallocation crash resulting from deep copying elements
  • +
  • Some ElementTree methods could crash if the root node was not initialized +(neither file nor element passed to the constructor)
  • +
  • Element/SubElement failed to set attribute namespaces from passed attrib +dictionary
  • +
  • tostring() adds an XML declaration for non-ASCII encodings
  • +
  • tostring() failed to serialize encodings that contain 0-bytes
  • +
  • ElementTree.xpath() and XPathDocumentEvaluator were not using the +ElementTree root node as reference point
  • +
  • Calling document('') in XSLT failed to return the stylesheet
  • +
+
+
+
+

0.9.2 (2006-05-10)

+
+

Features added

+
    +
  • Speedup for Element.makeelement(): the new element reuses the original +libxml2 document instead of creating a new empty one
  • +
  • Speedup for reversed() iteration over element children (Py2.4+ only)
  • +
  • ElementTree compatible QName class
  • +
  • RelaxNG and XMLSchema accept any Element, not only ElementTrees
  • +
+
+
+

Bugs fixed

+
    +
  • str(xslt_result) was broken for XSLT output other than UTF-8
  • +
  • Memory leak if write_c14n fails to write the file after conversion
  • +
  • Crash in XMLSchema and RelaxNG when passing non-schema documents
  • +
  • Memory leak in RelaxNG() when RelaxNGParseError is raised
  • +
+
+
+
+

0.9.1 (2006-03-30)

+
+

Features added

+
    +
  • lxml.sax.ElementTreeContentHandler checks closing elements and raises +SaxError on mismatch
  • +
  • lxml.sax.ElementTreeContentHandler supports namespace-less SAX events +(startElement, endElement) and defaults to empty attributes (keyword +argument)
  • +
  • Speedup for repeatedly accessing element tag names
  • +
  • Minor API performance improvements
  • +
+
+
+

Bugs fixed

+
    +
  • Memory deallocation bug when using XSLT output method "html"
  • +
  • sax.py was handling UTF-8 encoded tag names where it shouldn't
  • +
  • lxml.tests package will no longer be installed (is still in source tar)
  • +
+
+
+
+

0.9 (2006-03-20)

+
+

Features added

+
    +
  • Error logging API for libxml2 error messages
  • +
  • Various performance improvements
  • +
  • Benchmark script for lxml, ElementTree and cElementTree
  • +
  • Support for registering extension functions through new FunctionNamespace +class (see doc/extensions.txt)
  • +
  • ETXPath class for XPath expressions in ElementTree notation ('//{ns}tag')
  • +
  • Support for variables in XPath expressions (also in XPath class)
  • +
  • XPath class for compiled XPath expressions
  • +
  • XMLID module level function (ElementTree compatible)
  • +
  • XMLParser API for customized libxml2 parser configuration
  • +
  • Support for custom Element classes through new Namespace API (see +doc/namespace_extensions.txt)
  • +
  • Common exception base class LxmlError for module exceptions
  • +
  • real iterator support in iter(Element), Element.getiterator()
  • +
  • XSLT objects are callable, result trees support str()
  • +
  • Added MANIFEST.in for easier creation of RPM files.
  • +
  • 'getparent' method on elements allows navigation to an element's +parent element.
  • +
  • Python core compatible SAX tree builder and SAX event generator. See +doc/sax.txt for more information.
  • +
+
+
+

Bugs fixed

+
    +
  • Segfaults and memory leaks in various API functions of Element
  • +
  • Segfault in XSLT.tostring()
  • +
  • ElementTree objects no longer interfere, Elements can be root of different +ElementTrees at the same time
  • +
  • document('') works in XSLT documents read from files (in-memory documents +cannot support this due to libxslt deficiencies)
  • +
+
+
+
+

0.8 (2005-11-03)

+
+

Features added

+
    +
  • Support for copy.deepcopy() on elements. copy.copy() works also, but +does the same thing, and does not create a shallow copy, as that +makes no sense in the context of libxml2 trees. This means a +potential incompatibility with ElementTree, but there's more chance +that it works than if copy.copy() isn't supported at all.
  • +
  • Increased compatibility with (c)ElementTree; .parse() on ElementTree is +supported and parsing of gzipped XML files works.
  • +
  • implemented index() on elements, allowing one to find the index of a +SubElement.
  • +
+
+
+

Bugs fixed

+
    +
  • Use xslt-config instead of xml2-config to find out libxml2 +directories to take into account a case where libxslt is installed +in a different directory than libxslt.
  • +
  • Eliminate crash condition in iteration when text nodes are changed.
  • +
  • Passing 'None' to tostring() does not result in a segfault anymore, +but an AssertionError.
  • +
  • Some test fixes for Windows.
  • +
  • Raise XMLSyntaxError and XPathSyntaxError instead of plain python +syntax errors. This should be less confusing.
  • +
  • Fixed error with uncaught exception in Pyrex code.
  • +
  • Calling lxml.etree.fromstring('') throws XMLSyntaxError instead of a +segfault.
  • +
  • has_key() works on attrib. 'in' tests also work correctly on attrib.
  • +
  • INSTALL.txt was saying 2.2.16 instead of 2.6.16 as a supported +libxml2 version, as it should.
  • +
  • Passing a UTF-8 encoded string to the XML() function would fail; +fixed.
  • +
+
+
+
+

0.7 (2005-06-15)

+
+

Features added

+
    +
  • parameters (XPath expressions) can be passed to XSLT using keyword +parameters.
  • +
  • Simple XInclude support. Calling the xinclude() method on a tree +will process any XInclude statements in the document.
  • +
  • XMLSchema support. Use the XMLSchema class or the convenience +xmlschema() method on a tree to do XML Schema (XSD) validation.
  • +
  • Added convenience xslt() method on tree. This is less efficient +than the XSLT object, but makes it easier to write quick code.
  • +
  • Added convenience relaxng() method on tree. This is less efficient +than the RelaxNG object, but makes it easier to write quick code.
  • +
  • Make it possible to use XPathEvaluator with elements as well. The +XPathEvaluator in this case will retain the element so multiple +XPath queries can be made against one element efficiently. This +replaces the second argument to the .evaluate() method that existed +previously.
  • +
  • Allow registerNamespace() to be called on an XPathEvaluator, after +creation, to add additional namespaces. Also allow registerNamespaces(), +which does the same for a namespace dictionary.
  • +
  • Add 'prefix' attribute to element to be able to read prefix information. +This is entirely read-only.
  • +
  • It is possible to supply an extra nsmap keyword parameter to +the Element() and SubElement() constructors, which supplies a +prefix to namespace URI mapping. This will create namespace +prefix declarations on these elements and these prefixes will show up +in XML serialization.
  • +
+
+
+

Bugs fixed

+
    +
  • Killed yet another memory management related bug: trees created +using newDoc would not get a libxml2-level dictionary, which caused +problems when deallocating these documents later if they contained a +node that came from a document with a dictionary.
  • +
  • Moving namespaced elements between documents was problematic as +references to the original document would remain. This has been fixed +by applying xmlReconciliateNs() after each move operation.
  • +
  • Can pass None to 'dump()' without segfaults.
  • +
  • tostring() works properly for non-root elements as well.
  • +
  • Cleaned out the tostring() method so it should handle encoding +correctly.
  • +
  • Cleaned out the ElementTree.write() method so it should handle encoding +correctly. Writing directly to a file should also be faster, as there is no +need to go through a Python string in that case. Made sure the test cases +test both serializing to StringIO as well as serializing to a real file.
  • +
+
+
+
+

0.6 (2005-05-14)

+
+

Features added

+
    +
  • Changed setup.py so that library_dirs is also guessed. This should +help with compilation on the Mac OS X platform, where otherwise the +wrong library (shipping with the OS) could be picked up.
  • +
  • Tweaked setup.py so that it picks up the version from version.txt.
  • +
+
+
+

Bugs fixed

+
    +
  • Do the right thing when handling namespaced attributes.
  • +
  • fix bug where tostring() moved nodes into new documents. tostring() +had very nasty side-effects before this fix, sorry!
  • +
+
+
+
+

0.5.1 (2005-04-09)

+
    +
  • Python 2.2 compatibility fixes.
  • +
  • unicode fixes in Element() and Comment() as well as XML(); unicode +input wasn't properly being UTF-8 encoded.
  • +
+
+
+

0.5 (2005-04-08)

+

Initial public release.

+
+
+ + + diff --git a/doc/html/compatibility.html b/doc/html/compatibility.html new file mode 100644 index 0000000..6cdeaf8 --- /dev/null +++ b/doc/html/compatibility.html @@ -0,0 +1,190 @@ + + + + + +ElementTree compatibility of lxml.etree + + + +
+

ElementTree compatibility of lxml.etree

+ +

A lot of care has been taken to ensure compatibility between etree and +ElementTree. Nonetheless, some differences and incompatibilities exist:

+
    +
  • Importing etree is obviously different; etree uses a lower-case +package name, while ElementTree uses a combination of upper-case and +lower case in imports:

    +
    # etree
    +from lxml.etree import Element
    +
    +# ElementTree
    +from elementtree.ElementTree import Element
    +
    +# ElementTree in the Python 2.5 standard library
    +from xml.etree.ElementTree import Element
    +
    +

    When switching over code from ElementTree to lxml.etree, and you're using +the package name prefix 'ElementTree', you can do the following:

    +
    # instead of
    +from elementtree import ElementTree
    +# use
    +from lxml import etree as ElementTree
    +
    +
  • +
  • lxml.etree offers a lot more functionality, such as XPath, XSLT, Relax NG, +and XML Schema support, which (c)ElementTree does not offer.

    +
  • +
  • etree has a different idea about Python unicode strings than ElementTree. +In most parts of the API, ElementTree uses plain strings and unicode strings +as what they are. This includes Element.text, Element.tail and many other +places. However, the ElementTree parsers assume by default that any string +(str or unicode) contains ASCII data. They raise an exception if +strings do not match the expected encoding.

    +

    etree has the same idea about plain strings (str) as ElementTree. For +unicode strings, however, etree assumes throughout the API that they are +Python unicode encoded strings rather than byte data. This includes the +parsers. It is therefore perfectly correct to pass XML unicode data into +the etree parsers in form of Python unicode strings. It is an error, on the +other hand, if unicode strings specify an encoding in their XML declaration, +as this conflicts with the characteristic encoding of Python unicode +strings.

    +
  • +
  • ElementTree allows you to place an Element in two different trees at the +same time. Thus, this:

    +
    a = Element('a')
    +b = SubElement(a, 'b')
    +c = Element('c')
    +c.append(b)
    +
    +

    will result in the following tree a:

    +
    <a><b /></a>
    +
    +

    and the following tree c:

    +
    <c><b /></c>
    +
    +

    In lxml, this behavior is different, because lxml is built on top of a tree +that maintains parent relationships for elements (like W3C DOM). This means +an element can only exist in a single tree at the same time. Adding an +element in some tree to another tree will cause this element to be moved.

    +

    So, for tree a we will get:

    +
    <a></a>
    +
    +

    and for tree c we will get:

    +
    <c><b/></c>
    +
    +

    Unfortunately this is a rather fundamental difference in behavior, which is +hard to change. It won't affect some applications, but if you want to port +code you must unfortunately make sure that it doesn't affect yours.

    +
  • +
  • etree allows navigation to the parent of a node by the getparent() +method and to the siblings by calling getnext() and getprevious(). +This is not possible in ElementTree as the underlying tree model does not +have this information.

    +
  • +
  • When trying to set a subelement using __setitem__ that is in fact not an +Element but some other object, etree raises a TypeError, and ElementTree +raises an AssertionError. This also applies to some other places of the +API. In general, etree tries to avoid AssertionErrors in favour of being +more specific about the reason for the exception.

    +
  • +
  • When parsing fails in iterparse(), ElementTree up to version +1.2.x raises a low-level ExpatError instead of a SyntaxError +as the other parsers. Both lxml and ElementTree 1.3 raise a +ParseError for parser errors.

    +
  • +
  • The iterparse() function in lxml is implemented based on the libxml2 +parser and tree generator. This means that modifications of the document +root or the ancestors of the current element during parsing can irritate the +parser and even segfault. While this is not a problem in the Python object +structure used by ElementTree, the C tree underlying lxml suffers from it. +The golden rule for iterparse() on lxml therefore is: do not touch +anything that will have to be touched again by the parser later on. See the +lxml parser documentation on this.

    +
  • +
  • ElementTree ignores comments and processing instructions when parsing XML, +while etree will read them in and treat them as Comment or +ProcessingInstruction elements respectively. This is especially visible +where comments are found inside text content, which is then split by the +Comment element.

    +

    You can disable this behaviour by passing the boolean remove_comments +and/or remove_pis keyword arguments to the parser you use. For +convenience and to support portable code, you can also use the +etree.ETCompatXMLParser instead of the default etree.XMLParser. It +tries to provide a default setup that is as close to the ElementTree parser +as possible.

    +
  • +
  • The TreeBuilder class of lxml.etree uses a different +signature for the start() method. It accepts an additional +argument nsmap to propagate the namespace declarations of an +element in addition to its own namespace. To assure compatibility +with ElementTree (which does not support this argument), lxml checks +if the method accepts 3 arguments before calling it, and otherwise +drops the namespace mapping. This should work with most existing +ElementTree code, although there may still be conflicting cases.

    +
  • +
  • ElementTree 1.2 has a bug when serializing an empty Comment (no text +argument given) to XML, etree serializes this successfully.

    +
  • +
  • ElementTree adds whitespace around comments on serialization, lxml does +not. This means that a comment text "text" that ElementTree serializes as +"<!-- text -->" will become "<!--text-->" in lxml.

    +
  • +
  • When the string '*' is used as tag filter in the Element.getiterator() +method, ElementTree returns all elements in the tree, including comments and +processing instructions. lxml.etree only returns real Elements, i.e. tree +nodes that have a string tag name. Without a filter, both libraries iterate +over all nodes.

    +

    Note that currently only lxml.etree supports passing the Element factory +function as filter to select only Elements. Both libraries support passing +the Comment and ProcessingInstruction factories to select the +respective tree nodes.

    +
  • +
  • ElementTree merges the target of a processing instruction into PI.text, +while lxml.etree puts it into the .target property and leaves it out of +the .text property. The pi.text in ElementTree therefore +correspondents to pi.target + " " + pi.text in lxml.etree.

    +
  • +
  • Because etree is built on top of libxml2, which is namespace prefix aware, +etree preserves namespaces declarations and prefixes while ElementTree tends +to come up with its own prefixes (ns0, ns1, etc). When no namespace prefix +is given, however, etree creates ElementTree style prefixes as well.

    +
  • +
  • etree has a 'prefix' attribute (read-only) on elements giving the Element's +prefix, if this is known, and None otherwise (in case of no namespace at +all, or default namespace).

    +
  • +
  • etree further allows passing an 'nsmap' dictionary to the Element and +SubElement element factories to explicitly map namespace prefixes to +namespace URIs. These will be translated into namespace declarations on +that element. This means that in the probably rare case that you need to +construct an attribute called 'nsmap', you need to be aware that unlike in +ElementTree, you cannot pass it as a keyword argument to the Element and +SubElement factories directly.

    +
  • +
  • ElementTree allows QName objects as attribute values and resolves their +prefix on serialisation (e.g. an attribute value QName("{myns}myname") +becomes "p:myname" if "p" is the namespace prefix of "myns"). lxml.etree +also allows you to set attribute values from QName instances (and also .text +values), but it resolves their prefix immediately and stores the plain text +value. So, if prefixes are modified later on, e.g. by moving a subtree to a +different tree (which reassigns the prefix mappings), the text values will +not be updated and you might end up with an undefined prefix.

    +
  • +
  • etree elements can be copied using copy.deepcopy() and copy.copy(), +just like ElementTree's. However, copy.copy() does not create a +shallow copy where elements are shared between trees, as this makes no sense +in the context of libxml2 trees. Note that lxml can deep-copy trees +considerably faster than ElementTree, so a deep copy might still be fast +enough to replace a shallow copy in your case.

    +
  • +
+
+ + + \ No newline at end of file diff --git a/doc/html/credits.html b/doc/html/credits.html new file mode 100644 index 0000000..c0922cb --- /dev/null +++ b/doc/html/credits.html @@ -0,0 +1,74 @@ + + + + + +Credits + + + +
+

Credits

+ +
+

Main contributors

+
+
Stefan Behnel
+
main developer and maintainer
+
Martijn Faassen
+
creator of lxml and initial main developer
+
Ian Bicking
+
creator and maintainer of lxml.html
+
Holger Joukl
+
bug reports, feedback and development on lxml.objectify
+
Sidnei da Silva
+
official MS Windows builds
+
Marc-Antoine Parent
+
XPath extension function help and patches
+
Olivier Grisel
+
improved (c)ElementTree compatibility patches, +website improvements.
+
Kasimier Buchcik
+
help with specs and libxml2
+
Florian Wagner
+
help with copy.deepcopy support, bug reporting
+
Emil Kroymann
+
help with encoding support, bug reporting
+
Paul Everitt
+
bug reporting, feedback on API design
+
Victor Ng
+
Discussions on memory management strategies, vlibxml2
+
Robert Kern
+
feedback on API design
+
Andreas Pakulat
+
rpath linking support, doc improvements
+
David Sankel
+
building statically on Windows
+
Marcin Kasperski
+
PDF documentation generation
+
+

... and lots of other people who contributed to lxml by reporting +bugs, discussing its functionality or blaming the docs for the bugs in +their code. Thank you all, user feedback and discussions form a very +important part of an Open Source project!

+
+
+

Special thanks goes to:

+
    +
  • Daniel Veillard and the libxml2 project for a great XML library.
  • +
  • Fredrik Lundh for ElementTree, its API, and the competition through +cElementTree.
  • +
  • Greg Ewing (Pyrex) and Robert Bradshaw (Cython) for the binding +technology.
  • +
  • the codespeak crew, in particular Philipp von Weitershausen and +Holger Krekel for hosting lxml on codespeak.net
  • +
+
+
+ + + \ No newline at end of file diff --git a/doc/html/cssselect.html b/doc/html/cssselect.html new file mode 100644 index 0000000..d198e6a --- /dev/null +++ b/doc/html/cssselect.html @@ -0,0 +1,102 @@ + + + + + +lxml.cssselect + + + +
+

lxml.cssselect

+ +

lxml supports a number of interesting languages for tree traversal and element +selection. The most important is obviously XPath, but there is also +ObjectPath in the lxml.objectify module. The newest child of this family +is CSS selection, which is implemented in the new lxml.cssselect module.

+ +
+

The CSSSelector class

+

The most important class in the cssselect module is CSSSelector. It +provides the same interface as the XPath class, but accepts a CSS selector +expression as input:

+
>>> from lxml.cssselect import CSSSelector
+>>> sel = CSSSelector('div.content')
+>>> sel  #doctest: +ELLIPSIS
+<CSSSelector ... for 'div.content'>
+>>> sel.css
+'div.content'
+
+

The selector actually compiles to XPath, and you can see the +expression by inspecting the object:

+
>>> sel.path
+"descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]"
+
+

To use the selector, simply call it with a document or element +object:

+
>>> from lxml.etree import fromstring
+>>> h = fromstring('''<div id="outer">
+...   <div id="inner" class="content body">
+...       text
+...   </div></div>''')
+>>> [e.get('id') for e in sel(h)]
+['inner']
+
+
+
+

CSS Selectors

+

This libraries attempts to implement CSS selectors as described in +the w3c specification. Many of +the pseudo-classes do not apply in this context, including all +dynamic pseudo-classes. +In particular these will not be available:

+
    +
  • link state: :link, :visited, :target
  • +
  • actions: :hover, :active, :focus
  • +
  • UI states: :enabled, :disabled, :indeterminate +(:checked and :unchecked are available)
  • +
+

Also, none of the psuedo-elements apply, because the selector only +returns elements and psuedo-elements select portions of text, like +::first-line.

+
+
+

Namespaces

+

In CSS you can use namespace-prefix|element, similar to +namespace-prefix:element in an XPath expression. In fact, it maps +one-to-one, and the same rules are used to map namespace prefixes to +namespace URIs.

+
+
+

Limitations

+

These applicable pseudoclasses are not yet implemented:

+
    +
  • :lang(language)
  • +
  • :root
  • +
  • *:first-of-type, *:last-of-type, *:nth-of-type, +*:nth-last-of-type, *:only-of-type. All of these work when +you specify an element type, but not with *
  • +
+

Unlike XPath you cannot provide parameters in your expressions -- all +expressions are completely static.

+

XPath has underspecified string quoting rules (there seems to be no +string quoting at all), so if you use expressions that contain +characters that requiring quoting you might have problems with the +translation from CSS to XPath.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/element_classes.html b/doc/html/element_classes.html new file mode 100644 index 0000000..eee8543 --- /dev/null +++ b/doc/html/element_classes.html @@ -0,0 +1,416 @@ + + + + + +Using custom Element classes in lxml + + + +
+

Using custom Element classes in lxml

+ +

lxml has very sophisticated support for custom Element classes. You +can provide your own classes for Elements and have lxml use them by +default for all elements generated by a specific parser, only for a +specific tag name in a specific namespace or even for an exact element +at a specific position in the tree.

+

Custom Elements must inherit from the lxml.etree.ElementBase class, which +provides the Element interface for subclasses:

+
>>> from lxml import etree
+
+>>> class honk(etree.ElementBase):
+...    def honking(self):
+...       return self.get('honking') == 'true'
+...    honking = property(honking)
+
+

This defines a new Element class honk with a property honking.

+

The following document describes how you can make lxml.etree use these +custom Element classes.

+ +
+

Background on Element proxies

+

Being based on libxml2, lxml.etree holds the entire XML tree in a C +structure. To communicate with Python code, it creates Python proxy +objects for the XML elements on demand.

+
+proxies.png +
+

The mapping between C elements and Python Element classes is +completely configurable. When you ask lxml.etree for an Element by +using its API, it will instantiate your classes for you. All you have +to do is tell lxml which class to use for which kind of Element. This +is done through a class lookup scheme, as described in the sections +below.

+
+
+

Element initialization

+

There is one thing to know up front. Element classes must not have +an __init___ or __new__ method. There should not be any +internal state either, except for the data stored in the underlying +XML tree. Element instances are created and garbage collected at +need, so there is no way to predict when and how often a proxy is +created for them. Even worse, when the __init__ method is called, +the object is not even initialized yet to represent the XML tag, so +there is not much use in providing an __init__ method in +subclasses.

+

Most use cases will not require any class initialisation, so you can content +yourself with skipping to the next section for now. However, if you really +need to set up your element class on instantiation, there is one possible way +to do so. ElementBase classes have an _init() method that can be +overridden. It can be used to modify the XML tree, e.g. to construct special +children or verify and update attributes.

+

The semantics of _init() are as follows:

+
    +
  • It is called once on Element class instantiation time. That is, +when a Python representation of the element is created by lxml. At +that time, the element object is completely initialized to represent +a specific XML element within the tree.
  • +
  • The method has complete access to the XML tree. Modifications can be done +in exactly the same way as anywhere else in the program.
  • +
  • Python representations of elements may be created multiple times during the +lifetime of an XML element in the underlying C tree. The _init() code +provided by subclasses must take special care by itself that multiple +executions either are harmless or that they are prevented by some kind of +flag in the XML tree. The latter can be achieved by modifying an attribute +value or by removing or adding a specific child node and then verifying this +before running through the init process.
  • +
  • Any exceptions raised in _init() will be propagated throught the API +call that lead to the creation of the Element. So be careful with the code +you write here as its exceptions may turn up in various unexpected places.
  • +
+
+
+

Setting up a class lookup scheme

+

The first thing to do when deploying custom element classes is to register a +class lookup scheme on a parser. lxml.etree provides quite a number of +different schemes that also support class lookup based on namespaces or +attribute values. Most lookups support fallback chaining, which allows the +next lookup mechanism to take over when the previous one fails to find a +class.

+

For example, setting the honk Element as a default element class +for a parser works as follows:

+
>>> parser_lookup = etree.ElementDefaultClassLookup(element=honk)
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(parser_lookup)
+
+

There is one drawback of the parser based scheme: the Element() factory +does not know about your specialised parser and creates a new document that +deploys the default parser:

+
>>> el = etree.Element("root")
+>>> print(isinstance(el, honk))
+False
+
+

You should therefore avoid using this factory function in code that +uses custom classes. The makeelement() method of parsers provides +a simple replacement:

+
>>> el = parser.makeelement("root")
+>>> print(isinstance(el, honk))
+True
+
+

If you use a parser at the module level, you can easily redirect a module +level Element() factory to the parser method by adding code like this:

+
>>> module_level_parser = etree.XMLParser()
+>>> Element = module_level_parser.makeelement
+
+

While the XML() and HTML() factories also depend on the default +parser, you can pass them a different parser as second argument:

+
>>> element = etree.XML("<test/>")
+>>> print(isinstance(element, honk))
+False
+
+>>> element = etree.XML("<test/>", parser)
+>>> print(isinstance(element, honk))
+True
+
+

Whenever you create a document with a parser, it will inherit the lookup +scheme and all subsequent element instantiations for this document will use +it:

+
>>> element = etree.fromstring("<test/>", parser)
+>>> print(isinstance(element, honk))
+True
+>>> el = etree.SubElement(element, "subel")
+>>> print(isinstance(el, honk))
+True
+
+

For testing code in the Python interpreter and for small projects, you +may also consider setting a lookup scheme on the default parser. To +avoid interfering with other modules, however, it is usually a better +idea to use a dedicated parser for each module (or a parser pool when +using threads) and then register the required lookup scheme only for +this parser.

+
+

Default class lookup

+

This is the most simple lookup mechanism. It always returns the default +element class. Consequently, no further fallbacks are supported, but this +scheme is a nice fallback for other custom lookup mechanisms.

+

Usage:

+
>>> lookup = etree.ElementDefaultClassLookup()
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(lookup)
+
+

Note that the default for new parsers is to use the global fallback, which is +also the default lookup (if not configured otherwise).

+

To change the default element implementation, you can pass your new class to +the constructor. While it accepts classes for element, comment and +pi nodes, most use cases will only override the element class:

+
>>> el = parser.makeelement("myelement")
+>>> print(isinstance(el, honk))
+False
+
+>>> lookup = etree.ElementDefaultClassLookup(element=honk)
+>>> parser.set_element_class_lookup(lookup)
+
+>>> el = parser.makeelement("myelement")
+>>> print(isinstance(el, honk))
+True
+>>> el.honking
+False
+>>> el = parser.makeelement("myelement", honking='true')
+>>> etree.tostring(el)
+b'<myelement honking="true"/>'
+>>> el.honking
+True
+
+
+
+

Namespace class lookup

+

This is an advanced lookup mechanism that supports namespace/tag-name specific +element classes. You can select it by calling:

+
>>> lookup = etree.ElementNamespaceClassLookup()
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(lookup)
+
+

See the separate section on implementing namespaces below to learn how to +make use of it.

+

This scheme supports a fallback mechanism that is used in the case where the +namespace is not found or no class was registered for the element name. +Normally, the default class lookup is used here. To change it, pass the +desired fallback lookup scheme to the constructor:

+
>>> fallback = etree.ElementDefaultClassLookup(element=honk)
+>>> lookup = etree.ElementNamespaceClassLookup(fallback)
+>>> parser.set_element_class_lookup(lookup)
+
+
+
+

Attribute based lookup

+

This scheme uses a mapping from attribute values to classes. An attribute +name is set at initialisation time and is then used to find the corresponding +value in a dictionary. It is set up as follows:

+
>>> id_class_mapping = {'1234' : honk} # maps attribute values to classes
+
+>>> lookup = etree.AttributeBasedElementClassLookup(
+...                                      'id', id_class_mapping)
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(lookup)
+
+

This class uses its fallback if the attribute is not found or its value is not +in the mapping. Normally, the default class lookup is used here. If you want +to use the namespace lookup, for example, you can use this code:

+
>>> fallback = etree.ElementNamespaceClassLookup()
+>>> lookup = etree.AttributeBasedElementClassLookup(
+...                       'id', id_class_mapping, fallback)
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(lookup)
+
+
+
+

Custom element class lookup

+

This is the most customisable way of finding element classes on a per-element +basis. It allows you to implement a custom lookup scheme in a subclass:

+
>>> class MyLookup(etree.CustomElementClassLookup):
+...     def lookup(self, node_type, document, namespace, name):
+...         return honk # be a bit more selective here ...
+
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(MyLookup())
+
+

The .lookup() method must return either None (which triggers the +fallback mechanism) or a subclass of lxml.etree.ElementBase. It +can take any decision it wants based on the node type (one of +"element", "comment", "PI", "entity"), the XML document of the +element, or its namespace or tag name.

+
+
+

Tree based element class lookup in Python

+

Taking more elaborate decisions than allowed by the custom scheme is +difficult to achieve in pure Python, as it results in a +chicken-and-egg problem. It would require access to the tree - before +the elements in the tree have been instantiated as Python Element +proxies.

+

Luckily, there is a way to do this. The PythonElementClassLookup +works similar to the custom lookup scheme:

+
>>> class MyLookup(etree.PythonElementClassLookup):
+...     def lookup(self, document, element):
+...         return MyElementClass # defined elsewhere
+
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(MyLookup())
+
+

As before, the first argument to the lookup() method is the opaque +document instance that contains the Element. The second arguments is a +lightweight Element proxy implementation that is only valid during the lookup. +Do not try to keep a reference to it. Once the lookup is finished, the proxy +will become invalid. You will get an AssertionError if you access any of +the properties or methods outside the scope of the lookup call where they were +instantiated.

+

During the lookup, the element object behaves mostly like a normal Element +instance. It provides the properties tag, text, tail etc. and +supports indexing, slicing and the getchildren(), getparent() +etc. methods. It does not support iteration, nor does it support any kind +of modification. All of its properties are read-only and it cannot be removed +or inserted into other trees. You can use it as a starting point to freely +traverse the tree and collect any kind of information that its elements +provide. Once you have taken the decision which class to use for this +element, you can simply return it and have lxml take care of cleaning up the +instantiated proxy classes.

+

Sidenote: this lookup scheme originally lived in a separate module called +lxml.pyclasslookup.

+
+
+
+

Generating XML with custom classes

+

Up to lxml 2.1, you could not instantiate proxy classes yourself. +Only lxml.etree could do that when creating an object representation +of an existing XML element. Since lxml 2.2, however, instantiating +this class will simply create a new Element:

+
>>> el = honk(honking = 'true')
+>>> el.tag
+'honk'
+>>> el.honking
+True
+
+

Note, however, that the proxy you create here will be garbage +collected just like any other proxy. You can therefore not count on +lxml.etree using the same class that you instantiated when you access +this Element a second time after letting its reference go. You should +therefore always use a corresponding class lookup scheme that returns +your Element proxy classes for the elements that they create. The +ElementNamespaceClassLookup is generally a good match.

+

You can use custom Element classes to quickly create XML fragments:

+
>>> class hale(etree.ElementBase): pass
+>>> class bopp(etree.ElementBase): pass
+
+>>> el = hale( "some ", honk(honking = 'true'), bopp, " text" )
+
+>>> print(etree.tostring(el, encoding=unicode))
+<hale>some <honk honking="true"/><bopp/> text</hale>
+
+
+
+

Implementing namespaces

+

lxml allows you to implement namespaces, in a rather literal sense. After +setting up the namespace class lookup mechanism as described above, you can +build a new element namespace (or retrieve an existing one) by calling the +get_namespace(uri) method of the lookup:

+
>>> lookup = etree.ElementNamespaceClassLookup()
+>>> parser = etree.XMLParser()
+>>> parser.set_element_class_lookup(lookup)
+
+>>> namespace = lookup.get_namespace('http://hui.de/honk')
+
+

and then register the new element type with that namespace, say, under the tag +name honk:

+
>>> namespace['honk'] = honk
+
+

If you have many Element classes declared in one module, and they are +all named like the elements they create, you can simply use +namespace.update(vars()) at the end of your module to declare them +automatically. The implementation is smart enough to ignore +everything that is not an Element class.

+

After this, you create and use your XML elements through the normal API of +lxml:

+
>>> xml = '<honk xmlns="http://hui.de/honk" honking="true"/>'
+>>> honk_element = etree.XML(xml, parser)
+>>> print(honk_element.honking)
+True
+
+

The same works when creating elements by hand:

+
>>> honk_element = parser.makeelement('{http://hui.de/honk}honk',
+...                                   honking='true')
+>>> print(honk_element.honking)
+True
+
+

Essentially, what this allows you to do, is to give Elements a custom API +based on their namespace and tag name.

+

A somewhat related topic are extension functions which use a similar +mechanism for registering extension functions in XPath and XSLT.

+

In the setup example above, we associated the honk Element class +only with the 'honk' element. If an XML tree contains different +elements in the same namespace, they do not pick up the same +implementation:

+
>>> xml = '<honk xmlns="http://hui.de/honk" honking="true"><bla/></honk>'
+>>> honk_element = etree.XML(xml, parser)
+>>> print(honk_element.honking)
+True
+>>> print(honk_element[0].honking)
+...
+AttributeError: 'lxml.etree._Element' object has no attribute 'honking'
+
+

You can therefore provide one implementation per element name in each +namespace and have lxml select the right one on the fly. If you want one +element implementation per namespace (ignoring the element name) or prefer +having a common class for most elements except a few, you can specify a +default implementation for an entire namespace by registering that class with +the empty element name (None).

+

You may consider following an object oriented approach here. If you build a +class hierarchy of element classes, you can also implement a base class for a +namespace that is used if no specific element class is provided. Again, you +can just pass None as an element name:

+
>>> class HonkNSElement(etree.ElementBase):
+...    def honk(self):
+...       return "HONK"
+>>> namespace[None] = HonkNSElement # default Element for namespace
+
+>>> class HonkElement(HonkNSElement):
+...    def honking(self):
+...       return self.get('honking') == 'true'
+...    honking = property(honking)
+>>> namespace['honk'] = HonkElement # Element for specific tag
+
+

Now you can rely on lxml to always return objects of type HonkNSElement or its +subclasses for elements of this namespace:

+
>>> xml = '<honk xmlns="http://hui.de/honk" honking="true"><bla/></honk>'
+>>> honk_element = etree.XML(xml, parser)
+
+>>> print(type(honk_element))
+<class 'HonkElement'>
+>>> print(type(honk_element[0]))
+<class 'HonkNSElement'>
+
+>>> print(honk_element.honking)
+True
+>>> print(honk_element.honk())
+HONK
+
+>>> print(honk_element[0].honk())
+HONK
+>>> print(honk_element[0].honking)
+...
+AttributeError: 'HonkNSElement' object has no attribute 'honking'
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/elementsoup.html b/doc/html/elementsoup.html new file mode 100644 index 0000000..d77c1d0 --- /dev/null +++ b/doc/html/elementsoup.html @@ -0,0 +1,176 @@ + + + + + +BeautifulSoup Parser + + + +
+

BeautifulSoup Parser

+ +

BeautifulSoup is a Python package that parses broken HTML, just like +lxml supports it based on the parser of libxml2. BeautifulSoup uses a +different parsing approach. It is not a real HTML parser but uses +regular expressions to dive through tag soup. It is therefore more +forgiving in some cases and less good in others. It is not uncommon +that lxml/libxml2 parses and fixes broken HTML better, but +BeautifulSoup has superiour support for encoding detection. It +very much depends on the input which parser works better.

+

To prevent users from having to choose their parser library in +advance, lxml can interface to the parsing capabilities of +BeautifulSoup through the lxml.html.soupparser module. It +provides three main functions: fromstring() and parse() to +parse a string or file using BeautifulSoup into an lxml.html +document, and convert_tree() to convert an existing BeautifulSoup +tree into a list of top-level Elements.

+ +
+

Parsing with the soupparser

+

The functions fromstring() and parse() behave as known from +ElementTree. The first returns a root Element, the latter returns an +ElementTree.

+

There is also a legacy module called lxml.html.ElementSoup, which +mimics the interface provided by ElementTree's own ElementSoup +module. Note that the soupparser module was added in lxml 2.0.3. +Previous versions of lxml 2.0.x only have the ElementSoup module.

+

Here is a document full of tag soup, similar to, but not quite like, HTML:

+
>>> tag_soup = '<meta><head><title>Hello</head<body onload=crash()>Hi all<p>'
+
+

all you need to do is pass it to the fromstring() function:

+
>>> from lxml.html.soupparser import fromstring
+>>> root = fromstring(tag_soup)
+
+

To see what we have here, you can serialise it:

+
>>> from lxml.etree import tostring
+>>> print tostring(root, pretty_print=True),
+<html>
+  <meta/>
+  <head>
+    <title>Hello</title>
+  </head>
+  <body onload="crash()">Hi all<p/></body>
+</html>
+
+

Not quite what you'd expect from an HTML page, but, well, it was broken +already, right? BeautifulSoup did its best, and so now it's a tree.

+

To control which Element implementation is used, you can pass a +makeelement factory function to parse() and fromstring(). +By default, this is based on the HTML parser defined in lxml.html.

+

For a quick comparison, libxml2 2.6.32 parses the same tag soup as +follows. The main difference is that libxml2 tries harder to adhere +to the structure of an HTML document and moves misplaced tags where +they (likely) belong. Note, however, that the result can vary between +parser versions.

+
<html>
+  <head>
+    <meta/>
+    <title>Hello</title>
+  </head>
+  <body>
+    <p>Hi all</p>
+    <p/>
+  </body>
+</html>
+
+
+
+

Entity handling

+

By default, the BeautifulSoup parser also replaces the entities it +finds by their character equivalent.

+
>>> tag_soup = '<body>&copy;&euro;&#45;&#245;&#445;<p>'
+>>> body = fromstring(tag_soup).find('.//body')
+>>> body.text
+u'\xa9\u20ac-\xf5\u01bd'
+
+

If you want them back on the way out, you can just serialise with the +default encoding, which is 'US-ASCII'.

+
>>> tostring(body)
+'<body>&#169;&#8364;-&#245;&#445;<p/></body>'
+
+>>> tostring(body, method="html")
+'<body>&#169;&#8364;-&#245;&#445;<p></p></body>'
+
+

Any other encoding will output the respective byte sequences.

+
>>> tostring(body, encoding="utf-8")
+'<body>\xc2\xa9\xe2\x82\xac-\xc3\xb5\xc6\xbd<p/></body>'
+
+>>> tostring(body, method="html", encoding="utf-8")
+'<body>\xc2\xa9\xe2\x82\xac-\xc3\xb5\xc6\xbd<p></p></body>'
+
+>>> tostring(body, encoding=unicode)
+u'<body>\xa9\u20ac-\xf5\u01bd<p/></body>'
+
+>>> tostring(body, method="html", encoding=unicode)
+u'<body>\xa9\u20ac-\xf5\u01bd<p></p></body>'
+
+
+
+

Using soupparser as a fallback

+

The downside of using this parser is that it is much slower than +the HTML parser of lxml. So if performance matters, you might want to +consider using soupparser only as a fallback for certain cases.

+

One common problem of lxml's parser is that it might not get the +encoding right in cases where the document contains a <meta> tag +at the wrong place. In this case, you can exploit the fact that lxml +serialises much faster than most other HTML libraries for Python. +Just serialise the document to unicode and if that gives you an +exception, re-parse it with BeautifulSoup to see if that works +better.

+
>>> tag_soup = '''\
+... <meta http-equiv="Content-Type"
+...       content="text/html;charset=utf-8" />
+... <html>
+...   <head>
+...     <title>Hello W\xc3\xb6rld!</title>
+...   </head>
+...   <body>Hi all</body>
+... </html>'''
+
+>>> import lxml.html
+>>> import lxml.html.soupparser
+
+>>> root = lxml.html.fromstring(tag_soup)
+>>> try:
+...     ignore = tostring(root, encoding=unicode)
+... except UnicodeDecodeError:
+...     root = lxml.html.soupparser.fromstring(tag_soup)
+
+
+
+

Using only the encoding detection

+

If you prefer a 'real' (and fast) HTML parser instead of the regular +expression based one in BeautifulSoup, you can still benefit from +BeautifulSoup's support for encoding detection in the +UnicodeDammit class.

+
>>> from BeautifulSoup import UnicodeDammit
+
+>>> def decode_html(html_string):
+...     converted = UnicodeDammit(html_string, isHTML=True)
+...     if not converted.unicode:
+...         raise UnicodeDecodeError(
+...             "Failed to detect encoding, tried [%s]",
+...             ', '.join(converted.triedEncodings))
+...     # print converted.originalEncoding
+...     return converted.unicode
+
+>>> root = lxml.html.fromstring(decode_html(tag_soup))
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/extensions.html b/doc/html/extensions.html new file mode 100644 index 0000000..712cde5 --- /dev/null +++ b/doc/html/extensions.html @@ -0,0 +1,494 @@ + + + + + +Python extensions for XPath and XSLT + + + +
+

Python extensions for XPath and XSLT

+ +

This document describes how to use Python extension functions in XPath +and XSLT like this:

+
<xsl:value-of select="f:myPythonFunction(.//sometag)" />
+
+

and extension elements in XSLT as in the following example:

+
<xsl:template match="*">
+    <my:python-extension>
+        <some-content />
+    </my:python-extension>
+</xsl:template>
+
+ +
+

XPath Extension functions

+

Here is how an extension function looks like. As the first argument, +it always receives a context object (see below). The other arguments +are provided by the respective call in the XPath expression, one in +the following examples. Any number of arguments is allowed:

+
>>> def hello(dummy, a):
+...    return "Hello %s" % a
+>>> def ola(dummy, a):
+...    return "Ola %s" % a
+>>> def loadsofargs(dummy, *args):
+...    return "Got %d arguments." % len(args)
+
+
+

The FunctionNamespace

+

In order to use a function in XPath or XSLT, it needs to have a +(namespaced) name by which it can be called during evaluation. This +is done using the FunctionNamespace class. For simplicity, we choose +the empty namespace (None):

+
>>> from lxml import etree
+>>> ns = etree.FunctionNamespace(None)
+>>> ns['hello'] = hello
+>>> ns['countargs'] = loadsofargs
+
+

This registers the function hello with the name hello in the default +namespace (None), and the function loadsofargs with the name countargs. +Now we're going to create a document that we can run XPath expressions +against:

+
>>> root = etree.XML('<a><b>Haegar</b></a>')
+>>> doc = etree.ElementTree(root)
+
+

Done. Now we can have XPath expressions call our new function:

+
>>> print(root.xpath("hello('world')"))
+Hello world
+>>> print(root.xpath('hello(local-name(*))'))
+Hello b
+>>> print(root.xpath('hello(string(b))'))
+Hello Haegar
+>>> print(root.xpath('countargs(., b, ./*)'))
+Got 3 arguments.
+
+

Note how we call both a Python function (hello) and an XPath built-in +function (string) in exactly the same way. Normally, however, you would +want to separate the two in different namespaces. The FunctionNamespace class +allows you to do this:

+
>>> ns = etree.FunctionNamespace('http://mydomain.org/myfunctions')
+>>> ns['hello'] = hello
+>>> prefixmap = {'f' : 'http://mydomain.org/myfunctions'}
+>>> print(root.xpath('f:hello(local-name(*))', namespaces=prefixmap))
+Hello b
+
+
+
+

Global prefix assignment

+

In the last example, you had to specify a prefix for the function namespace. +If you always use the same prefix for a function namespace, you can also +register it with the namespace:

+
>>> ns = etree.FunctionNamespace('http://mydomain.org/myother/functions')
+>>> ns.prefix = 'es'
+>>> ns['hello'] = ola
+>>> print(root.xpath('es:hello(local-name(*))'))
+Ola b
+
+

This is a global assignment, so take care not to assign the same prefix to +more than one namespace. The resulting behaviour in that case is completely +undefined. It is always a good idea to consistently use the same meaningful +prefix for each namespace throughout your application.

+

The prefix assignment only works with functions and FunctionNamespace objects, +not with the general Namespace object that registers element classes. The +reasoning is that elements in lxml do not care about prefixes anyway, so it +would rather complicate things than be of any help.

+
+
+

The XPath context

+

Functions get a context object as first parameter. In lxml 1.x, this value +was None, but since lxml 2.0 it provides two properties: eval_context and +context_node. The context node is the Element where the current function +is called:

+
>>> def print_tag(context, nodes):
+...     print("%s: %s" % (context.context_node.tag, [ n.tag for n in nodes ]))
+
+>>> ns = etree.FunctionNamespace('http://mydomain.org/printtag')
+>>> ns.prefix = "pt"
+>>> ns["print_tag"] = print_tag
+
+>>> ignore = root.xpath("//*[pt:print_tag(.//*)]")
+a: ['b']
+b: []
+
+

The eval_context is a dictionary that is local to the evaluation. It +allows functions to keep state:

+
>>> def print_context(context):
+...     context.eval_context[context.context_node.tag] = "done"
+...     entries = list(context.eval_context.items())
+...     entries.sort()
+...     print(entries)
+>>> ns["print_context"] = print_context
+
+>>> ignore = root.xpath("//*[pt:print_context()]")
+[('a', 'done')]
+[('a', 'done'), ('b', 'done')]
+
+
+
+

Evaluators and XSLT

+

Extension functions work for all ways of evaluating XPath expressions and for +XSL transformations:

+
>>> e = etree.XPathEvaluator(doc)
+>>> print(e('es:hello(local-name(/a))'))
+Ola a
+
+>>> namespaces = {'f' : 'http://mydomain.org/myfunctions'}
+>>> e = etree.XPathEvaluator(doc, namespaces=namespaces)
+>>> print(e('f:hello(local-name(/a))'))
+Hello a
+
+>>> xslt = etree.XSLT(etree.XML('''
+...   <stylesheet version="1.0"
+...          xmlns="http://www.w3.org/1999/XSL/Transform"
+...          xmlns:es="http://mydomain.org/myother/functions">
+...     <output method="text" encoding="ASCII"/>
+...     <template match="/">
+...       <value-of select="es:hello(string(//b))"/>
+...     </template>
+...   </stylesheet>
+... '''))
+>>> print(xslt(doc))
+Ola Haegar
+
+

It is also possible to register namespaces with a single evaluator after its +creation. While the following example involves no functions, the idea should +still be clear:

+
>>> f = StringIO('<a xmlns="http://mydomain.org/myfunctions" />')
+>>> ns_doc = etree.parse(f)
+>>> e = etree.XPathEvaluator(ns_doc)
+>>> e('/a')
+[]
+
+

This returns nothing, as we did not ask for the right namespace. When we +register the namespace with the evaluator, however, we can access it via a +prefix:

+
>>> e.register_namespace('foo', 'http://mydomain.org/myfunctions')
+>>> e('/foo:a')[0].tag
+'{http://mydomain.org/myfunctions}a'
+
+

Note that this prefix mapping is only known to this evaluator, as opposed to +the global mapping of the FunctionNamespace objects:

+
>>> e2 = etree.XPathEvaluator(ns_doc)
+>>> e2('/foo:a')
+...
+lxml.etree.XPathEvalError: Undefined namespace prefix
+
+
+
+

Evaluator-local extensions

+

Apart from the global registration of extension functions, there is also a way +of making extensions known to a single Evaluator or XSLT. All evaluators and +the XSLT object accept a keyword argument extensions in their constructor. +The value is a dictionary mapping (namespace, name) tuples to functions:

+
>>> extensions = {('local-ns', 'local-hello') : hello}
+>>> namespaces = {'l' : 'local-ns'}
+
+>>> e = etree.XPathEvaluator(doc, namespaces=namespaces, extensions=extensions)
+>>> print(e('l:local-hello(string(b))'))
+Hello Haegar
+
+

For larger numbers of extension functions, you can define classes or modules +and use the Extension helper:

+
>>> class MyExt:
+...     def function1(self, _, arg):
+...         return '1'+arg
+...     def function2(self, _, arg):
+...         return '2'+arg
+...     def function3(self, _, arg):
+...         return '3'+arg
+
+>>> ext_module = MyExt()
+>>> functions = ('function1', 'function2')
+>>> extensions = etree.Extension( ext_module, functions, ns='local-ns' )
+
+>>> e = etree.XPathEvaluator(doc, namespaces=namespaces, extensions=extensions)
+>>> print(e('l:function1(string(b))'))
+1Haegar
+
+

The optional second argument to Extension can either be be a +sequence of names to select from the module, a dictionary that +explicitly maps function names to their XPath alter-ego or None +(explicitly passed) to take all available functions under their +original name (if their name does not start with '_').

+

The additional ns keyword argument takes a namespace URI or +None (also if left out) for the default namespace. The following +examples will therefore all do the same thing:

+
>>> functions = ('function1', 'function2', 'function3')
+>>> extensions = etree.Extension( ext_module, functions )
+>>> e = etree.XPathEvaluator(doc, extensions=extensions)
+>>> print(e('function1(function2(function3(string(b))))'))
+123Haegar
+
+>>> extensions = etree.Extension( ext_module, functions, ns=None )
+>>> e = etree.XPathEvaluator(doc, extensions=extensions)
+>>> print(e('function1(function2(function3(string(b))))'))
+123Haegar
+
+>>> extensions = etree.Extension(ext_module)
+>>> e = etree.XPathEvaluator(doc, extensions=extensions)
+>>> print(e('function1(function2(function3(string(b))))'))
+123Haegar
+
+>>> functions = {
+...     'function1' : 'function1',
+...     'function2' : 'function2',
+...     'function3' : 'function3'
+...     }
+>>> extensions = etree.Extension(ext_module, functions)
+>>> e = etree.XPathEvaluator(doc, extensions=extensions)
+>>> print(e('function1(function2(function3(string(b))))'))
+123Haegar
+
+

For convenience, you can also pass a sequence of extensions:

+
>>> extensions1 = etree.Extension(ext_module)
+>>> extensions2 = etree.Extension(ext_module, ns='local-ns')
+>>> e = etree.XPathEvaluator(doc, extensions=[extensions1, extensions2],
+...                          namespaces=namespaces)
+>>> print(e('function1(l:function2(function3(string(b))))'))
+123Haegar
+
+
+
+

What to return from a function

+

Extension functions can return any data type for which there is an XPath +equivalent (see the documentation on XPath return values). This includes +numbers, boolean values, elements and lists of elements. Note that integers +will also be returned as floats:

+
>>> def returnsFloat(_):
+...    return 1.7
+>>> def returnsInteger(_):
+...    return 1
+>>> def returnsBool(_):
+...    return True
+>>> def returnFirstNode(_, nodes):
+...    return nodes[0]
+
+>>> ns = etree.FunctionNamespace(None)
+>>> ns['float'] = returnsFloat
+>>> ns['int']   = returnsInteger
+>>> ns['bool']  = returnsBool
+>>> ns['first'] = returnFirstNode
+
+>>> e = etree.XPathEvaluator(doc)
+>>> e("float()")
+1.7
+>>> e("int()")
+1.0
+>>> int( e("int()") )
+1
+>>> e("bool()")
+True
+>>> e("count(first(//b))")
+1.0
+
+

As the last example shows, you can pass the results of functions back into +the XPath expression. Elements and sequences of elements are treated as +XPath node-sets:

+
>>> def returnsNodeSet(_):
+...     results1 = etree.Element('results1')
+...     etree.SubElement(results1, 'result').text = "Alpha"
+...     etree.SubElement(results1, 'result').text = "Beta"
+...
+...     results2 = etree.Element('results2')
+...     etree.SubElement(results2, 'result').text = "Gamma"
+...     etree.SubElement(results2, 'result').text = "Delta"
+...
+...     results3 = etree.SubElement(results2, 'subresult')
+...     return [results1, results2, results3]
+
+>>> ns['new-node-set'] = returnsNodeSet
+
+>>> e = etree.XPathEvaluator(doc)
+
+>>> r = e("new-node-set()/result")
+>>> print([ t.text for t in r ])
+['Alpha', 'Beta', 'Gamma', 'Delta']
+
+>>> r = e("new-node-set()")
+>>> print([ t.tag for t in r ])
+['results1', 'results2', 'subresult']
+>>> print([ len(t) for t in r ])
+[2, 3, 0]
+>>> r[0][0].text
+'Alpha'
+
+>>> etree.tostring(r[0])
+b'<results1><result>Alpha</result><result>Beta</result></results1>'
+
+>>> etree.tostring(r[1])
+b'<results2><result>Gamma</result><result>Delta</result><subresult/></results2>'
+
+>>> etree.tostring(r[2])
+b'<subresult/>'
+
+

The current implementation deep-copies newly created elements in node-sets. +Only the elements and their children are passed on, no outlying parents or +tail texts will be available in the result. This also means that in the above +example, the subresult elements in results2 and results3 are no longer +identical within the node-set, they belong to independent trees:

+
>>> print("%s - %s" % (r[1][-1].tag, r[2].tag))
+subresult - subresult
+>>> print(r[1][-1] == r[2])
+False
+>>> print(r[1][-1].getparent().tag)
+results2
+>>> print(r[2].getparent())
+None
+
+

This is an implementation detail that you should be aware of, but you should +avoid relying on it in your code. Note that elements taken from the source +document (the most common case) do not suffer from this restriction. They +will always be passed unchanged.

+
+
+
+

XSLT extension elements

+

Just like the XPath extension functions described above, lxml supports +custom extension elements in XSLT. This means, you can write XSLT +code like this:

+
<xsl:template match="*">
+    <my:python-extension>
+        <some-content />
+    </my:python-extension>
+</xsl:template>
+
+

And then you can implement the element in Python like this:

+
>>> class MyExtElement(etree.XSLTExtension):
+...     def execute(self, context, self_node, input_node, output_parent):
+...         print("Hello from XSLT!")
+...         output_parent.text = "I did it!"
+...         # just copy own content input to output
+...         output_parent.extend( list(self_node) )
+
+

The arguments passed to the .execute() method are

+
+
context
+
The opaque evaluation context. You need this when calling back +into the XSLT processor.
+
self_node
+
A read-only Element object that represents the extension element +in the stylesheet.
+
input_node
+
The current context Element in the input document (also read-only).
+
output_parent
+
The current insertion point in the output document. You can +append elements or set the text value (not the tail). Apart from +that, the Element is read-only.
+
+
+

Declaring extension elements

+

In XSLT, extension elements can be used like any other XSLT element, +except that they must be declared as extensions using the standard +XSLT extension-element-prefixes option:

+
>>> xslt_ext_tree = etree.XML('''
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+...     xmlns:my="testns"
+...     extension-element-prefixes="my">
+...     <xsl:template match="/">
+...         <foo><my:ext><child>XYZ</child></my:ext></foo>
+...     </xsl:template>
+...     <xsl:template match="child">
+...         <CHILD>--xyz--</CHILD>
+...     </xsl:template>
+... </xsl:stylesheet>''')
+
+

To register the extension, add its namespace and name to the extension +mapping of the XSLT object:

+
>>> my_extension = MyExtElement()
+>>> extensions = { ('testns', 'ext') : my_extension }
+>>> transform = etree.XSLT(xslt_ext_tree, extensions = extensions)
+
+

Note how we pass an instance here, not the class of the extension. +Now we can run the transformation and see how our extension is +called:

+
>>> root = etree.XML('<dummy/>')
+>>> result = transform(root)
+Hello from XSLT!
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>I did it!<child>XYZ</child></foo>\n'
+
+
+
+

Applying XSL templates

+

XSLT extensions are a very powerful feature that allows you to +interact directly with the XSLT processor. You have full read-only +access to the input document and the stylesheet, and you can even call +back into the XSLT processor to process templates. Here is an example +that passes an Element into the .apply_templates() method of the +XSLTExtension instance:

+
>>> class MyExtElement(etree.XSLTExtension):
+...     def execute(self, context, self_node, input_node, output_parent):
+...         child = self_node[0]
+...         results = self.apply_templates(context, child)
+...         output_parent.append(results[0])
+
+>>> my_extension = MyExtElement()
+>>> extensions = { ('testns', 'ext') : my_extension }
+>>> transform = etree.XSLT(xslt_ext_tree, extensions = extensions)
+
+>>> root = etree.XML('<dummy/>')
+>>> result = transform(root)
+>>> str(result)
+'<?xml version="1.0"?>\n<foo><CHILD>--xyz--</CHILD></foo>\n'
+
+

Note how we applied the templates to a child of the extension element +itself, i.e. to an element inside the stylesheet instead of an element +of the input document.

+
+
+

Working with read-only elements

+

There is one important thing to keep in mind: all Elements that the +execute() method gets to deal with are read-only Elements, so you +cannot modify them. They also will not easily work in the API. For +example, you cannot pass them to the tostring() function or wrap +them in an ElementTree.

+

What you can do, however, is to deepcopy them to make them normal +Elements, and then modify them using the normal etree API. So this +will work:

+
>>> from copy import deepcopy
+>>> class MyExtElement(etree.XSLTExtension):
+...     def execute(self, context, self_node, input_node, output_parent):
+...         child = deepcopy(self_node[0])
+...         child.text = "NEW TEXT"
+...         output_parent.append(child)
+
+>>> my_extension = MyExtElement()
+>>> extensions = { ('testns', 'ext') : my_extension }
+>>> transform = etree.XSLT(xslt_ext_tree, extensions = extensions)
+
+>>> root = etree.XML('<dummy/>')
+>>> result = transform(root)
+>>> str(result)
+'<?xml version="1.0"?>\n<foo><child>NEW TEXT</child></foo>\n'
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/html5parser.html b/doc/html/html5parser.html new file mode 100644 index 0000000..3899436 --- /dev/null +++ b/doc/html/html5parser.html @@ -0,0 +1,81 @@ + + + + + +html5lib Parser + + + +
+

html5lib Parser

+ +

html5lib is a Python package that implements the HTML5 parsing algorithm +which is heavily influenced by current browsers and based on the WHATWG +HTML5 specification.

+

lxml can benefit from the parsing capabilities of html5lib through +the lxml.html.html5parser module. It provides a similar interface +to the lxml.html module by providing fromstring(), +parse(), document_fromstring(), fragment_fromstring() and +fragments_fromstring() that work like the regular html parsing +functions.

+
+

Differences to regular HTML parsing

+

There are a few differences in the returned tree to the regular HTML +parsing functions from lxml.html. html5lib normalizes some elements +and element structures to a common format. For example even if a tables +does not have a tbody html5lib will inject one automatically:

+
>>> from lxml.html import tostring, html5parser
+>>> tostring(html5parser.fromstring("<table><td>foo"))
+'<table><tbody><tr><td>foo</td></tr></tbody></table>'
+
+

Also the parameters the functions accept are different.

+
+
+

Function Reference

+
+
parse(filename_url_or_file):
+
Parses the named file or url, or if the object has a .read() +method, parses from that.
+
document_fromstring(html, guess_charset=True):
+

Parses a document from the given string. This always creates a +correct HTML document, which means the parent node is <html>, +and there is a body and possibly a head.

+

If a bytestring is passed and guess_charset is true the chardet +library (if installed) will guess the charset if ambiguities exist.

+
+
fragment_fromstring(string, create_parent=False, guess_charset=False):
+

Returns an HTML fragment from a string. The fragment must contain +just a single element, unless create_parent is given; +e.g,. fragment_fromstring(string, create_parent='div') will +wrap the element in a <div>. If create_parent is true the +default parent tag (div) is used.

+

If a bytestring is passed and guess_charset is true the chardet +library (if installed) will guess the charset if ambiguities exist.

+
+
fragments_fromstring(string, no_leading_text=False, parser=None):
+

Returns a list of the elements found in the fragment. The first item in +the list may be a string. If no_leading_text is true, then it will +be an error if there is leading text, and it will always be a list of +only elements.

+

If a bytestring is passed and guess_charset is true the chardet +library (if installed) will guess the charset if ambiguities exist.

+
+
fromstring(string):
+
Returns document_fromstring or fragment_fromstring, based +on whether the string looks like a full document, or just a +fragment.
+
+

Additionally all parsing functions accept an parser keyword argument +that can be set to a custom parser instance. To create custom parsers +you can subclass the HTMLParser and XHTMLParser from the same +module. Note that these are the parser classes provided by html5lib.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..958c971 --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,195 @@ + + + + + +lxml - Processing XML and HTML with Python + + + + + +
+

lxml

+ + +

lxml is the most feature-rich +and easy-to-use library +for working with XML and HTML +in the Python language.

+
+

Introduction

+

lxml is a Pythonic binding for the libxml2 and libxslt libraries. It is +unique in that it combines the speed and feature completeness of these +libraries with the simplicity of a native Python API, mostly compatible but +superior to the well-known ElementTree API. See the introduction for more +information about background and goals. Some common questions are answered in +the FAQ.

+
+
+

Documentation

+

The complete lxml documentation is available for download as PDF +documentation. The HTML documentation from this web site is part of +the normal source download.

+ +

lxml.etree follows the ElementTree API as much as possible, building it on +top of the native libxml2 tree. If you are new to ElementTree, start with the +lxml.etree Tutorial. See also the ElementTree compatibility overview and +the benchmark results comparing lxml to the original ElementTree and +cElementTree implementations.

+

Right after the lxml.etree Tutorial and the ElementTree documentation, the +most important place to look is the lxml.etree specific API documentation. +It describes how lxml extends the ElementTree API to expose libxml2 and +libxslt specific functionality, such as XPath, Relax NG, XML Schema, +XSLT, and c14n. Python code can be called from XPath expressions and +XSLT stylesheets through the use of extension functions. lxml also offers +a SAX compliant API, that works with the SAX support in the standard +library.

+

There is a separate module lxml.objectify that implements a data-binding +API on top of lxml.etree. See the objectify and etree FAQ entry for a +comparison.

+

In addition to the ElementTree API, lxml also features a sophisticated API for +custom element classes. This is a simple way to write arbitrary XML driven +APIs on top of lxml. As of version 1.1, lxml.etree has a new C-level API +that can be used to efficiently extend lxml.etree in external C modules, +including custom element class support.

+
+
+

Download

+

The best way to download lxml is to visit lxml at the Python Package +Index (PyPI). It has the source that compiles on various platforms. +The source distribution is signed with this key. Binary builds for +MS Windows usually become available through PyPI a few days after a +source release. If you can't wait, consider trying a less recent +release version first.

+

The latest version is lxml 2.2.3, released 2009-10-30 +(changes for 2.2.3). Older versions are listed below.

+

Please take a look at the installation instructions!

+

This complete web site (including the generated API documentation) is +part of the source distribution, so if you want to download the +documentation for offline use, take the source archive and copy the +doc/html directory out of the source tree.

+

It's also possible to check out the latest development version of lxml +from svn directly, using a command like this:

+
+svn co http://codespeak.net/svn/lxml/trunk lxml
+
+

You can also browse the Subversion repository through the web, or +take a look at the Subversion history. Please read how to build lxml +from source first. The latest CHANGES of the developer version +are also accessible. You can check there if a bug you found has been +fixed or a feature you want has been implemented in the latest trunk +version.

+
+
+

Mailing list

+

Questions? Suggestions? Code to contribute? We have a mailing list.

+

You can search the archive with Gmane or Google.

+
+
+

Bug tracker

+

lxml uses the launchpad bug tracker. If you are sure you found a bug in +lxml, please file a bug report there. If you are not sure whether some +unexpected behaviour of lxml is a bug or not, please ask on the mailing +list first. Do not forget to search the archive (e.g. with Gmane)!

+
+
+

License

+

The lxml library is shipped under a BSD license. libxml2 and libxslt2 +itself are shipped under the MIT license. There should therefore be no +obstacle to using lxml in your codebase.

+
+
+

Old Versions

+

See the web sites of lxml 1.3, +2.0, 2.1 and the current in-development +version.

+ +
+
+ + + \ No newline at end of file diff --git a/doc/html/installation.html b/doc/html/installation.html new file mode 100644 index 0000000..025aa02 --- /dev/null +++ b/doc/html/installation.html @@ -0,0 +1,85 @@ + + + + + +Installing lxml + + + +
+

Installing lxml

+ +
+

Requirements

+

You need Python 2.3 or later.

+

You need libxml2 and libxslt, in particular:

+ +

Newer versions generally contain less bugs and are therefore +recommended. XML Schema support is also still worked on in libxml2, +so newer versions will give you better complience with the W3C spec.

+
+
+

Installation

+

If you have easy_install, you can run the following as super-user (or +administrator):

+
+easy_install lxml
+
+

This has been reported to work on Linux, MacOS-X 10.4 and Windows, as long as +libxml2 and libxslt are properly installed (including development packages, +i.e. header files, etc.).

+
+
+

Building lxml from sources

+

If you want to build lxml from SVN you should read how to build lxml +from source (or the file doc/build.txt in the source tree). +Building from Subversion sources or from modified distribution sources +requires Cython to translate the lxml sources into C code. The +source distribution ships with pre-generated C source files, so you do +not need Cython installed to build from release sources.

+

If you have read these instructions and still cannot manage to install lxml, +you can check the archives of the mailing list to see if your problem is +known or otherwise send a mail to the list.

+
+
+
+
+

MS Windows

+

For MS Windows, the binary egg distribution of lxml is statically +built against the libraries, i.e. it already includes them. There is +no need to install the external libraries if you use an official lxml +build from PyPI.

+

If you want to upgrade the libraries and/or compile lxml from sources, you +should install a binary distribution of libxml2 and libxslt. You need both +libxml2 and libxslt, as well as iconv and zlib.

+
+
+

MacOS-X

+

The system libraries of libxml2 and libxslt installed under MacOS-X +tend to be rather outdated. In any case, they are older than the +required versions for lxml 2.x, so you will have a hard time getting +lxml to work without installing newer libraries.

+

A number of users reported success with updated libraries (e.g. using +fink or macports), but needed to set the runtime environment variable +DYLD_LIBRARY_PATH to the directory where fink keeps the libraries. +See the FAQ entry on MacOS-X for more information.

+

A macport of lxml is available. Try port install py25-lxml.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/intro.html b/doc/html/intro.html new file mode 100644 index 0000000..6efbb6f --- /dev/null +++ b/doc/html/intro.html @@ -0,0 +1,73 @@ + + + + + +Why lxml? + + + +
+

Why lxml?

+ +
+

Contents

+ +
+
+

Motto

+

"the thrills without the strangeness"

+

To explain the motto:

+

"Programming with libxml2 is like the thrilling embrace of an exotic stranger. +It seems to have the potential to fulfill your wildest dreams, but there's a +nagging voice somewhere in your head warning you that you're about to get +screwed in the worst way." (a quote by Mark Pilgrim)

+

Mark Pilgrim was describing in particular the experience a Python programmer +has when dealing with libxml2. The default Python bindings of libxml2 are +fast, thrilling, powerful, and your code might fail in some horrible way that +you really shouldn't have to worry about when writing Python code. lxml +combines the power of libxml2 with the ease of use of Python.

+
+
+

Aims

+

The C libraries libxml2 and libxslt have huge benefits:

+
    +
  • Standards-compliant XML support.
  • +
  • Support for (broken) HTML.
  • +
  • Full-featured.
  • +
  • Actively maintained by XML experts.
  • +
  • fast. fast! FAST!
  • +
+

These libraries already ship with Python bindings, but these Python bindings +mimic the C-level interface. This yields a number of problems:

+
    +
  • very low level and C-ish (not Pythonic).
  • +
  • underdocumented and huge, you get lost in them.
  • +
  • UTF-8 in API, instead of Python unicode strings.
  • +
  • Can easily cause segfaults from Python.
  • +
  • Require manual memory management!
  • +
+

lxml is a new Python binding for libxml2 and libxslt, completely independent +from these existing Python bindings. Its aims:

+
    +
  • Pythonic API.
  • +
  • Documented.
  • +
  • Use Python unicode strings in API.
  • +
  • Safe (no segfaults).
  • +
  • No manual memory management!
  • +
+

lxml aims to provide a Pythonic API by following as much as possible the +ElementTree API. We're trying to avoid inventing too many new APIs, or you +having to learn new things -- XML is complicated enough.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/lxml-source-howto.html b/doc/html/lxml-source-howto.html new file mode 100644 index 0000000..f81a20a --- /dev/null +++ b/doc/html/lxml-source-howto.html @@ -0,0 +1,277 @@ + + + + + +How to read the source of lxml + + + + + + +
+

How to read the source of lxml

+ +++ + + + +
Author:Stefan Behnel
+

This document describes how to read the source code of lxml and how +to start working on it. You might also be interested in the companion +document that describes how to build lxml from sources.

+ +
+

What is Cython?

+

Cython is the language that lxml is written in. It is a very +Python-like language that was specifically designed for writing Python +extension modules.

+

The reason why Cython (or actually its predecessor Pyrex at the time) +was chosen as an implementation language for lxml, is that it makes it +very easy to interface with both the Python world and external C code. +Cython generates all the necessary glue code for the Python API, +including Python types, calling conventions and reference counting. +On the other side of the table, calling into C code is not more than +declaring the signature of the function and maybe some variables as +being C types, pointers or structs, and then calling it. The rest of +the code is just plain Python code.

+

The Cython language is so close to Python that the Cython compiler can +actually compile many, many Python programs to C without major +modifications. But the real speed gains of a C compilation come from +type annotations that were added to the language and that allow Cython +to generate very efficient C code.

+

Even if you are not familiar with Cython, you should keep in mind that +a slow implementation of a feature is better than none. So, if you +want to contribute and have an idea what code you want to write, feel +free to start with a pure Python implementation. Chances are, if you +get the change officially accepted and integrated, others will take +the time to optimise it so that it runs fast in Cython.

+
+
+

Where to start?

+

First of all, read how to build lxml from sources to learn how to +retrieve the source code from the Subversion repository and how to +build it. The source code lives in the subdirectory src of the +checkout.

+

The main extension modules in lxml are lxml.etree and +lxml.objectify. All main modules have the file extension +.pyx, which shows the descendence from Pyrex. As usual in Python, +the main files start with a short description and a couple of imports. +Cython distinguishes between the run-time import statement (as +known from Python) and the compile-time cimport statement, which +imports C declarations, either from external libraries or from other +Cython modules.

+
+

Concepts

+

lxml's tree API is based on proxy objects. That means, every Element +object (or rather _Element object) is a proxy for a libxml2 node +structure. The class declaration is (mainly):

+
+cdef class _Element:
+    cdef _Document _doc
+    cdef xmlNode* _c_node
+
+

It is a naming convention that C variables and C level class members +that are passed into libxml2 start with a prefixed c_ (commonly +libxml2 struct pointers), and that C level class members are prefixed +with an underscore. So you will often see names like c_doc for an +xmlDoc* variable (or c_node for an xmlNode*), or the above +_c_node for a class member that points to an xmlNode struct +(or _c_doc for an xmlDoc*).

+

It is important to know that every proxy in lxml has a factory +function that properly sets up C level members. Proxy objects must +never be instantiated outside of that factory. For example, to +instantiate an _Element object or its subclasses, you must always call +its factory function:

+
+cdef xmlNode* c_node
+cdef _Document doc
+cdef _Element element
+...
+element = _elementFactory(doc, c_node)
+
+

A good place to see how this factory is used are the Element methods +getparent(), getnext() and getprevious().

+
+
+

The documentation

+

An important part of lxml is the documentation that lives in the +doc directory. It describes a large part of the API and comprises +a lot of example code in the form of doctests.

+

The documentation is written in the ReStructured Text format, a +very powerful text markup language that looks almost like plain text. +It is part of the docutils package.

+

The project web site of lxml is completely generated from these text +documents. Even the side menu is just collected from the table of +contents that the ReST processor writes into each HTML page. +Obviously, we use lxml for this.

+

The easiest way to generate the HTML pages is by calling:

+
+make html
+
+

This will call the script doc/mkhtml.py to run the ReST processor +on the files. After generating an HTML page the script parses it back +in to build the side menu, and injects the complete menu into each +page at the very end.

+

Running the make command will also generate the API documentation +if you have epydoc installed. The epydoc package will import and +introspect the extension modules and also introspect and parse the +Python modules of lxml. The aggregated information will then be +written out into an HTML documentation site.

+
+
+
+

lxml.etree

+

The main module, lxml.etree, is in the file lxml.etree.pyx. It +implements the main functions and types of the ElementTree API, as +well as all the factory functions for proxies. It is the best place +to start if you want to find out how a specific feature is +implemented.

+

At the very end of the file, it contains a series of include +statements that merge the rest of the implementation into the +generated C code. Yes, you read right: no importing, no source file +namespacing, just plain good old include and a huge C code result of +more than 100,000 lines that we throw right into the C compiler.

+

The main include files are:

+
+
apihelpers.pxi
+
Private C helper functions. Except for the factory functions, +most of the little functions that are used all over the place are +defined here. This includes things like reading out the text +content of a libxml2 tree node, checking input from the API level, +creating a new Element node or handling attribute values. If you +want to work on the lxml code, you should keep these functions in +the back of your head, as they will definitely make your life +easier.
+
classlookup.pxi
+
Element class lookup mechanisms. The main API and engines for +those who want to define custom Element classes and inject them +into lxml.
+
docloader.pxi
+
Support for custom document loaders. Base class and registry for +custom document resolvers.
+
extensions.pxi
+
Infrastructure for extension functions in XPath/XSLT, including +XPath value conversion and function registration.
+
iterparse.pxi
+
Incremental XML parsing. An iterator class that builds iterparse +events while parsing.
+
nsclasses.pxi
+
Namespace implementation and registry. The registry and engine +for Element classes that use the ElementNamespaceClassLookup +scheme.
+
parser.pxi
+
Parsers for XML and HTML. This is the main parser engine. It's +the reason why you can parse a document from various sources in +two lines of Python code. It's definitely not the right place to +start reading lxml's soure code.
+
parsertarget.pxi
+
An ElementTree compatible parser target implementation based on +the SAX2 interface of libxml2.
+
proxy.pxi
+
Very low-level functions for memory allocation/deallocation +and Element proxy handling. Ignoring this for the beginning +will safe your head from exploding.
+
public-api.pxi
+
The set of C functions that are exported to other extension +modules at the C level. For example, lxml.objectify makes use +of these. See the C-level API documentation.
+
readonlytree.pxi
+
A separate read-only implementation of the Element API. This is +used in places where non-intrusive access to a tree is required, +such as the PythonElementClassLookup or XSLT extension +elements.
+
saxparser.pxi
+
SAX-like parser interfaces as known from ElementTree's TreeBuilder.
+
serializer.pxi
+
XML output functions. Basically everything that creates byte +sequences from XML trees.
+
xinclude.pxi
+
XInclude support.
+
xmlerror.pxi
+

Error log handling. All error messages that libxml2 generates +internally walk through the code in this file to end up in lxml's +Python level error logs.

+

At the end of the file, you will find a long list of named error +codes. It is generated from the libxml2 HTML documentation (using +lxml, of course). See the script update-error-constants.py +for this.

+
+
xmlid.pxi
+
XMLID and IDDict, a dictionary-like way to find Elements by their +XML-ID attribute.
+
xpath.pxi
+
XPath evaluators.
+
xslt.pxi
+
XSL transformations, including the XSLT class, document lookup +handling and access control.
+
+

The different schema languages (DTD, RelaxNG, XML Schema and +Schematron) are implemented in the following include files:

+
    +
  • dtd.pxi
  • +
  • relaxng.pxi
  • +
  • schematron.pxi
  • +
  • xmlschema.pxi
  • +
+
+
+

Python modules

+

The lxml package also contains a number of pure Python modules:

+
+
builder.py
+
The E-factory and the ElementBuilder class. These provide a +simple interface to XML tree generation.
+
cssselect.py
+
A CSS selector implementation based on XPath. The main class is +called CSSSelector.
+
doctestcompare.py
+
A relaxed comparison scheme for XML/HTML markup in doctest.
+
ElementInclude.py
+
XInclude-like document inclusion, compatible with ElementTree.
+
_elementpath.py
+
XPath-like path language, compatible with ElementTree.
+
sax.py
+
SAX2 compatible interfaces to copy lxml trees from/to SAX compatible +tools.
+
usedoctest.py
+
Wrapper module for doctestcompare.py that simplifies its usage +from inside a doctest.
+
+
+
+

lxml.objectify

+

A Cython implemented extension module that uses the public C-API of +lxml.etree. It provides a Python object-like interface to XML trees. +The implementation resides in the file lxml.objectify.pyx.

+
+
+

lxml.html

+

A specialised toolkit for HTML handling, based on lxml.etree. This is +implemented in pure Python.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/lxml2.html b/doc/html/lxml2.html new file mode 100644 index 0000000..dd73f56 --- /dev/null +++ b/doc/html/lxml2.html @@ -0,0 +1,242 @@ + + + + + +What's new in lxml 2.0? + + + +
+

What's new in lxml 2.0?

+ + +

During the development of the lxml 1.x series, a couple of quirks were +discovered in the design that made the API less obvious and its future +extensions harder than necessary. lxml 2.0 is a soft evolution of lxml 1.x +towards a simpler, more consistent and more powerful API - with some major +extensions. Wherever possible, lxml 1.3 comes close to the semantics of lxml +2.0, so that migrating should be easier for code that currently runs with 1.3.

+

One of the important internal changes was the switch from the Pyrex +compiler to Cython, which provides better optimisation and improved +support for newer Python language features. This allows the code of +lxml to become more Python-like again, while the performance improves +as Cython continues its own development. The code simplification, +which will continue throughout the 2.x series, will hopefully make it +even easier for users to contribute.

+
+

Changes in etree and objectify

+

A graduation towards a more consistent API cannot go without a certain amount +of incompatible changes. The following is a list of those differences that +applications need to take into account when migrating from lxml 1.x to lxml +2.0.

+
+

Incompatible changes

+
    +
  • lxml 0.9 introduced a feature called namespace implementation. The +global Namespace factory was added to register custom element classes +and have lxml.etree look them up automatically. However, the later +development of further class lookup mechanisms made it appear less and less +adequate to register this mapping at a global level, so lxml 1.1 first +removed the namespace based lookup from the default setup and lxml 2.0 +finally removes the global namespace registry completely. As all other +lookup mechanisms, the namespace lookup is now local to a parser, including +the registry itself. Applications that use a module-level parser can easily +map its get_namespace() method to a global Namespace function to +mimic the old behaviour.
  • +
  • Some API functions now require passing options as keyword arguments, +as opposed to positional arguments. This restriction was introduced +to make the API usage independent of future extensions such as the +addition of new positional arguments. Users should not rely on the +position of an optional argument in function signatures and instead +pass it explicitly named. This also improves code readability - it +is common good practice to pass options in a consistent way +independent of their position, so many people may not even notice +the change in their code. Another important reason is compatibility +with cElementTree, which also enforces keyword-only arguments in a +couple of places.
  • +
  • XML tag names are validated when creating an Element. This does not +apply to HTML tags, where only HTML special characters are +forbidden. The distinction is made by the SubElement() factory, +which tests if the tree it works on is an HTML tree, and by the +.makeelement() methods of parsers, which behave differently for +the XMLParser() and the HTMLParser().
  • +
  • XPath now raises exceptions specific to the part of the execution that +failed: XPathSyntaxError for parser errors and XPathEvalError for +errors that occurred during the evaluation. Note that the distinction only +works for the XPath() class. The other two evaluators only have a +single evaluation call that includes the parsing step, and will therefore +only raise an XPathEvalError. Applications can catch both exceptions +through the common base class XPathError (which also exists in earlier +lxml versions).
  • +
  • Network access in parsers is now disabled by default, i.e. the +no_network option defaults to True. Due to a somewhat 'interesting' +implementation in libxml2, this does not affect the first document (i.e. the +URL that is parsed), but only subsequent documents, such as a DTD when +parsing with validation. This means that you will have to check the URL you +pass, instead of relying on lxml to prevent any access to external +resources. As this can be helpful in some use cases, lxml does not work +around it.
  • +
  • The type annotations in lxml.objectify (the pytype attribute) now use +NoneType for the None value as this is the correct Python type name. +Previously, lxml 1.x used a lower case none.
  • +
  • Another change in objectify regards the way it deals with ambiguous types. +Previously, setting a value like the string "3" through normal attribute +access would let it come back as an integer when reading the object +attribute. lxml 2.0 prevents this by always setting the pytype +attribute to the type the user passed in, so "3" will come back as a +string, while the number 3 will come back as a number. To remove the +type annotation on serialisation, you can use the deannotate() function.
  • +
  • The C-API function findOrBuildNodeNs() was replaced by the more generic +findOrBuildNodeNsPrefix() that accepts an additional default prefix.
  • +
+
+
+

Enhancements

+

Most of the enhancements of lxml 2.0 were made under the hood. Most people +won't even notice them, but they make the maintenance of lxml easier and thus +facilitate further enhancements and an improved integration between lxml's +features.

+
    +
  • lxml.objectify now has its own implementation of the E factory. It uses +the built-in type lookup mechanism of lxml.objectify, thus removing the need +for an additional type registry mechanism (as previously available through +the typemap parameter).
  • +
  • XML entities are supported through the Entity() factory, an Entity +element class and a parser option resolve_entities that allows to keep +entities in the element tree when set to False. Also, the parser will now +report undefined entities as errors if it needs to resolve them (which is +still the default, as in lxml 1.x).
  • +
  • A major part of the XPath code was rewritten and can now benefit from a +bigger overlap with the XSLT code. The main benefits are improved thread +safety in the XPath evaluators and Python RegExp support in standard XPath.
  • +
  • The string results of an XPath evaluation have become 'smart' string +subclasses. Formerly, there was no easy way to find out where a +string originated from. In lxml 2.0, you can call its +getparent() method to find the Element that carries it. This +works for attributes (//@attribute) and for text() nodes, +i.e. Element text and tails. Strings that were constructed in the +path expression, e.g. by the string() function or extension +functions, will return None as their parent.
  • +
  • Setting a QName object as value of the .text property or as +an attribute value will resolve its prefix in the respective context
  • +
  • Following ElementTree 1.3, the iterfind() method supports +efficient iteration based on XPath-like expressions.
  • +
+

The parsers also received some major enhancements:

+
    +
  • iterparse() can parse HTML when passing the boolean html +keyword.
  • +
  • Parse time XML Schema validation by passing an +XMLSchema object to the schema keyword argument of a parser.
  • +
  • Support for a target object that implements ElementTree's +TreeBuilder interface.
  • +
  • The encoding keyword allows overriding the document encoding.
  • +
+
+
+

Deprecation

+

The following functions and methods are now deprecated. They are +still available in lxml 2.0 and will be removed in lxml 2.1:

+
    +
  • The tounicode() function was replaced by the call +tostring(encoding=unicode).

    +
  • +
  • CamelCaseNamed module functions and methods were renamed to their +underscore equivalents to follow PEP 8 in naming.

    +
      +
    • etree.clearErrorLog(), use etree.clear_error_log()

      +
    • +
    • etree.useGlobalPythonLog(), use +etree.use_global_python_log()

      +
    • +
    • etree.ElementClassLookup.setFallback(), use +etree.ElementClassLookup.set_fallback()

      +
    • +
    • etree.getDefaultParser(), use etree.get_default_parser()

      +
    • +
    • etree.setDefaultParser(), use etree.set_default_parser()

      +
    • +
    • etree.setElementClassLookup(), use +etree.set_element_class_lookup()

      +
    • +
    • XMLParser.setElementClassLookup(), use .set_element_class_lookup()

      +
    • +
    • HTMLParser.setElementClassLookup(), use .set_element_class_lookup()

      +

      Note that parser.setElementClassLookup() has not been removed +yet, although parser.set_element_class_lookup() should be used +instead.

      +
    • +
    • xpath_evaluator.registerNamespace(), use +xpath_evaluator.register_namespace()

      +
    • +
    • xpath_evaluator.registerNamespaces(), use +xpath_evaluator.register_namespaces()

      +
    • +
    • objectify.setPytypeAttributeTag, use +objectify.set_pytype_attribute_tag

      +
    • +
    • objectify.setDefaultParser(), use +objectify.set_default_parser()

      +
    • +
    +
  • +
  • The .getiterator() method on Elements and ElementTrees was +renamed to .iter() to follow ElementTree 1.3.

    +
  • +
+
+
+
+

New modules

+

The most visible changes in lxml 2.0 regard the new modules that were added.

+
+

lxml.usedoctest

+

A very useful module for doctests based on XML or HTML is +lxml.doctestcompare. It provides a relaxed comparison mechanism +for XML and HTML in doctests. Using it for XML comparisons is as +simple as:

+
>>> import lxml.usedoctest
+
+

and for HTML comparisons:

+
>>> import lxml.html.usedoctest
+
+
+
+

lxml.html

+

The largest new package that was added to lxml 2.0 is lxml.html. It +contains various tools and modules for HTML handling. The major features +include support for cleaning up HTML (removing unwanted content), a readable +HTML diff and various tools for working with links.

+
+
+

lxml.cssselect

+

The Cascading Stylesheet Language (CSS) has a very short and generic path +language for pointing at elements in XML/HTML trees (CSS selectors). The module +lxml.cssselect provides an implementation based on XPath.

+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/lxmlhtml.html b/doc/html/lxmlhtml.html new file mode 100644 index 0000000..4bb3a51 --- /dev/null +++ b/doc/html/lxmlhtml.html @@ -0,0 +1,676 @@ + + + + + +lxml.html + + + + +
+

lxml.html

+ +++ + + + +
Author:Ian Bicking
+

Since version 2.0, lxml comes with a dedicated package for dealing +with HTML: lxml.html. It provides a special Element API for HTML +elements, as well as a number of utilities for common tasks.

+ +

The main API is based on the lxml.etree API, and thus, on the ElementTree +API.

+
+

Parsing HTML

+
+

Parsing HTML fragments

+

There are several functions available to parse HTML:

+
+
parse(filename_url_or_file):
+

Parses the named file or url, or if the object has a .read() +method, parses from that.

+

If you give a URL, or if the object has a .geturl() method (as +file-like objects from urllib.urlopen() have), then that URL +is used as the base URL. You can also provide an explicit +base_url keyword argument.

+
+
document_fromstring(string):
+
Parses a document from the given string. This always creates a +correct HTML document, which means the parent node is <html>, +and there is a body and possibly a head.
+
fragment_fromstring(string, create_parent=False):
+
Returns an HTML fragment from a string. The fragment must contain +just a single element, unless create_parent is given; +e.g,. fragment_fromstring(string, create_parent='div') will +wrap the element in a <div>.
+
fragments_fromstring(string):
+
Returns a list of the elements found in the fragment.
+
fromstring(string):
+
Returns document_fromstring or fragment_fromstring, based +on whether the string looks like a full document, or just a +fragment.
+
+
+
+

Really broken pages

+

The normal HTML parser is capable of handling broken HTML, but for +pages that are far enough from HTML to call them 'tag soup', it may +still fail to parse the page. A way to deal with this is +ElementSoup, which deploys the well-known BeautifulSoup parser to +build an lxml HTML tree.

+
+
+
+

HTML Element Methods

+

HTML elements have all the methods that come with ElementTree, but +also include some extra methods:

+
+
.drop_tree():
+
Drops the element and all its children. Unlike +el.getparent().remove(el) this does not remove the tail +text; with drop_tree the tail text is merged with the previous +element.
+
.drop_tag():
+
Drops the tag, but keeps its children and text.
+
.find_class(class_name):
+
Returns a list of all the elements with the given CSS class name. +Note that class names are space separated in HTML, so +doc.find_class_name('highlight') will find an element like +<div class="sidebar highlight">. Class names are case +sensitive.
+
.find_rel_links(rel):
+
Returns a list of all the <a rel="{rel}"> elements. E.g., +doc.find_rel_links('tag') returns all the links marked as +tags.
+
.get_element_by_id(id, default=None):
+
Return the element with the given id, or the default if +none is found. If there are multiple elements with the same id +(which there shouldn't be, but there often is), this returns only +the first.
+
.text_content():
+
Returns the text content of the element, including the text +content of its children, with no markup.
+
.cssselect(expr):
+
Select elements from this element and its children, using a CSS +selector expression. (Note that .xpath(expr) is also +available as on all lxml elements.)
+
.label:
+
Returns the corresponding <label> element for this element, if +any exists (None if there is none). Label elements have a +label.for_element attribute that points back to the element.
+
.base_url:
+
The base URL for this element, if one was saved from the parsing. +This attribute is not settable. Is None when no base URL was +saved.
+
+
+
+

Running HTML doctests

+

One of the interesting modules in the lxml.html package deals with +doctests. It can be hard to compare two HTML pages for equality, as +whitespace differences aren't meaningful and the structural formatting +can differ. This is even more a problem in doctests, where output is +tested for equality and small differences in whitespace or the order +of attributes can let a test fail. And given the verbosity of +tag-based languages, it may take more than a quick look to find the +actual differences in the doctest output.

+

Luckily, lxml provides the lxml.doctestcompare module that +supports relaxed comparison of XML and HTML pages and provides a +readable diff in the output when a test fails. The HTML comparison is +most easily used by importing the usedoctest module in a doctest:

+
>>> import lxml.html.usedoctest
+
+

Now, if you have a HTML document and want to compare it to an expected result +document in a doctest, you can do the following:

+
>>> import lxml.html
+>>> html = lxml.html.fromstring('''\
+...    <html><body onload="" color="white">
+...      <p>Hi  !</p>
+...    </body></html>
+... ''')
+
+>>> print lxml.html.tostring(html)
+<html><body onload="" color="white"><p>Hi !</p></body></html>
+
+>>> print lxml.html.tostring(html)
+<html> <body color="white" onload=""> <p>Hi    !</p> </body> </html>
+
+>>> print lxml.html.tostring(html)
+<html>
+  <body color="white" onload="">
+    <p>Hi !</p>
+  </body>
+</html>
+
+

In documentation, you would likely prefer the pretty printed HTML output, as +it is the most readable. However, the three documents are equivalent from the +point of view of an HTML tool, so the doctest will silently accept any of the +above. This allows you to concentrate on readability in your doctests, even +if the real output is a straight ugly HTML one-liner.

+

Note that there is also an lxml.usedoctest module which you can +import for XML comparisons. The HTML parser notably ignores +namespaces and some other XMLisms.

+
+
+

Creating HTML with the E-factory

+

lxml.html comes with a predefined HTML vocabulary for the E-factory, +originally written by Fredrik Lundh. This allows you to quickly generate HTML +pages and fragments:

+
>>> from lxml.html import builder as E
+>>> from lxml.html import usedoctest
+>>> html = E.HTML(
+...   E.HEAD(
+...     E.LINK(rel="stylesheet", href="great.css", type="text/css"),
+...     E.TITLE("Best Page Ever")
+...   ),
+...   E.BODY(
+...     E.H1(E.CLASS("heading"), "Top News"),
+...     E.P("World News only on this page", style="font-size: 200%"),
+...     "Ah, and here's some more text, by the way.",
+...     lxml.html.fromstring("<p>... and this is a parsed fragment ...</p>")
+...   )
+... )
+
+>>> print lxml.html.tostring(html)
+<html>
+  <head>
+    <link href="great.css" rel="stylesheet" type="text/css">
+    <title>Best Page Ever</title>
+  </head>
+  <body>
+    <h1 class="heading">Top News</h1>
+    <p style="font-size: 200%">World News only on this page</p>
+    Ah, and here's some more text, by the way.
+    <p>... and this is a parsed fragment ...</p>
+  </body>
+</html>
+
+

Note that you should use lxml.html.tostring and not +lxml.tostring. lxml.tostring(doc) will return the XML +representation of the document, which is not valid HTML. In +particular, things like <script src="..."></script> will be +serialized as <script src="..." />, which completely confuses +browsers.

+
+

Viewing your HTML

+

A handy method for viewing your HTML: +lxml.html.open_in_browser(lxml_doc) will write the document to +disk and open it in a browser (with the webbrowser module).

+
+
+ +
+

Forms

+

Any <form> elements in a document are available through +the list doc.forms (e.g., doc.forms[0]). Form, input, select, +and textarea elements each have special methods.

+

Input elements (including <select> and <textarea>) have these +attributes:

+
+
.name:
+
The name of the element.
+
.value:
+

The value of an input, the content of a textarea, the selected +option(s) of a select. This attribute can be set.

+

In the case of a select that takes multiple options (<select +multiple>) this will be a set of the selected options; you can +add or remove items to select and unselect the options.

+
+
+

Select attributes:

+
+
.value_options:
+
For select elements, this is all the possible values (the values +of all the options).
+
.multiple:
+
For select elements, true if this is a <select multiple> +element.
+
+

Input attributes:

+
+
.type:
+
The type attribute in <input> elements.
+
.checkable:
+
True if this can be checked (i.e., true for type=radio and +type=checkbox).
+
.checked:
+
If this element is checkable, the checked state. Raises +AttributeError on non-checkable inputs.
+
+

The form itself has these attributes:

+
+
.inputs:
+
A dictionary-like object that can be used to access input elements +by name. When there are multiple input elements with the same +name, this returns list-like structures that can also be used to +access the options and their values as a group.
+
.fields:
+

A dictionary-like object used to access values by their name. +form.inputs returns elements, this only returns values. +Setting values in this dictionary will effect the form inputs. +Basically form.fields[x] is equivalent to +form.inputs[x].value and form.fields[x] = y is equivalent +to form.inputs[x].value = y. (Note that sometimes +form.inputs[x] returns a compound object, but these objects +also have .value attributes.)

+

If you set this attribute, it is equivalent to +form.fields.clear(); form.fields.update(new_value)

+
+
.form_values():
+
Returns a list of [(name, value), ...], suitable to be passed +to urllib.urlencode() for form submission.
+
.action:
+
The action attribute. This is resolved to an absolute URL if +possible.
+
.method:
+
The method attribute, which defaults to GET.
+
+
+

Form Filling Example

+

Note that you can change any of these attributes (values, method, +action, etc) and then serialize the form to see the updated values. +You can, for instance, do:

+
>>> from lxml.html import fromstring, tostring
+>>> form_page = fromstring('''<html><body><form>
+...   Your name: <input type="text" name="name"> <br>
+...   Your phone: <input type="text" name="phone"> <br>
+...   Your favorite pets: <br>
+...   Dogs: <input type="checkbox" name="interest" value="dogs"> <br>
+...   Cats: <input type="checkbox" name="interest" value="cats"> <br>
+...   Llamas: <input type="checkbox" name="interest" value="llamas"> <br>
+...   <input type="submit"></form></body></html>''')
+>>> form = form_page.forms[0]
+>>> form.fields = dict(
+...     name='John Smith',
+...     phone='555-555-3949',
+...     interest=set(['cats', 'llamas']))
+>>> print tostring(form)
+<html>
+  <body>
+    <form>
+    Your name:
+      <input name="name" type="text" value="John Smith">
+      <br>Your phone:
+      <input name="phone" type="text" value="555-555-3949">
+      <br>Your favorite pets:
+      <br>Dogs:
+      <input name="interest" type="checkbox" value="dogs">
+      <br>Cats:
+      <input checked name="interest" type="checkbox" value="cats">
+      <br>Llamas:
+      <input checked name="interest" type="checkbox" value="llamas">
+      <br>
+      <input type="submit">
+    </form>
+  </body>
+</html>
+
+
+
+

Form Submission

+

You can submit a form with lxml.html.submit_form(form_element). +This will return a file-like object (the result of +urllib.urlopen()).

+

If you have extra input values you want to pass you can use the +keyword argument extra_values, like extra_values={'submit': +'Yes!'}. This is the only way to get submit values into the form, +as there is no state of "submitted" for these elements.

+

You can pass in an alternate opener with the open_http keyword +argument, which is a function with the signature open_http(method, +url, values).

+

Example:

+
>>> from lxml.html import parse, submit_form
+>>> page = parse('http://tinyurl.com').getroot()
+>>> page.forms[1].fields['url'] = 'http://codespeak.net/lxml/'
+>>> result = parse(submit_form(page.forms[1])).getroot()
+>>> [a.attrib['href'] for a in result.xpath("//a[@target='_blank']")]
+['http://tinyurl.com/2xae8s', 'http://preview.tinyurl.com/2xae8s']
+
+
+
+
+

Cleaning up HTML

+

The module lxml.html.clean provides a Cleaner class for cleaning up +HTML pages. It supports removing embedded or script content, special tags, +CSS style annotations and much more.

+

Say, you have an evil web page from an untrusted source that contains lots of +content that upsets browsers and tries to run evil code on the client side:

+
>>> html = '''\
+... <html>
+...  <head>
+...    <script type="text/javascript" src="evil-site"></script>
+...    <link rel="alternate" type="text/rss" src="evil-rss">
+...    <style>
+...      body {background-image: url(javascript:do_evil)};
+...      div {color: expression(evil)};
+...    </style>
+...  </head>
+...  <body onload="evil_function()">
+...    <!-- I am interpreted for EVIL! -->
+...    <a href="javascript:evil_function()">a link</a>
+...    <a href="#" onclick="evil_function()">another link</a>
+...    <p onclick="evil_function()">a paragraph</p>
+...    <div style="display: none">secret EVIL!</div>
+...    <object> of EVIL! </object>
+...    <iframe src="evil-site"></iframe>
+...    <form action="evil-site">
+...      Password: <input type="password" name="password">
+...    </form>
+...    <blink>annoying EVIL!</blink>
+...    <a href="evil-site">spam spam SPAM!</a>
+...    <image src="evil!">
+...  </body>
+... </html>'''
+
+

To remove the all suspicious content from this unparsed document, use the +clean_html function:

+
>>> from lxml.html.clean import clean_html
+
+>>> print clean_html(html)
+<html>
+  <body>
+    <div>
+      <style>/* deleted */</style>
+      <a href="">a link</a>
+      <a href="#">another link</a>
+      <p>a paragraph</p>
+      <div>secret EVIL!</div>
+      of EVIL!
+      Password:
+      annoying EVIL!
+      <a href="evil-site">spam spam SPAM!</a>
+      <img src="evil!">
+    </div>
+  </body>
+</html>
+
+

The Cleaner class supports several keyword arguments to control exactly +which content is removed:

+
>>> from lxml.html.clean import Cleaner
+
+>>> cleaner = Cleaner(page_structure=False, links=False)
+>>> print cleaner.clean_html(html)
+<html>
+  <head>
+    <link rel="alternate" src="evil-rss" type="text/rss">
+    <style>/* deleted */</style>
+  </head>
+  <body>
+    <a href="">a link</a>
+    <a href="#">another link</a>
+    <p>a paragraph</p>
+    <div>secret EVIL!</div>
+    of EVIL!
+    Password:
+    annoying EVIL!
+    <a href="evil-site">spam spam SPAM!</a>
+    <img src="evil!">
+  </body>
+</html>
+
+>>> cleaner = Cleaner(style=True, links=True, add_nofollow=True,
+...                   page_structure=False, safe_attrs_only=False)
+
+>>> print cleaner.clean_html(html)
+<html>
+  <head>
+  </head>
+  <body>
+    <a href="">a link</a>
+    <a href="#">another link</a>
+    <p>a paragraph</p>
+    <div>secret EVIL!</div>
+    of EVIL!
+    Password:
+    annoying EVIL!
+    <a href="evil-site" rel="nofollow">spam spam SPAM!</a>
+    <img src="evil!">
+  </body>
+</html>
+
+

You can also whitelist some otherwise dangerous content with +Cleaner(host_whitelist=['www.youtube.com']), which would allow +embedded media from YouTube, while still filtering out embedded media +from other sites.

+

See the docstring of Cleaner for the details of what can be +cleaned.

+ +
+

wordwrap

+

You can also wrap long words in your html:

+
+word_break(doc, max_width=40, ...)
+
+word_break_html(html, ...)
+
+

This finds any long words in the text of the document and inserts +&#8203; in the document (which is the Unicode zero-width space).

+

This avoids the elements <pre>, <textarea>, and <code>. +You can control this with avoid_elements=['textarea', ...].

+

It also avoids elements with the CSS class nobreak. You can +control this with avoid_classes=['code', ...].

+

Lastly you can control the character that is inserted with +break_character=u'\u200b'. However, you cannot insert markup, +only text.

+

word_break_html(html) parses the HTML document and returns a +string.

+
+
+
+

HTML Diff

+

The module lxml.html.diff offers some ways to visualize +differences in HTML documents. These differences are content +oriented. That is, changes in markup are largely ignored; only +changes in the content itself are highlighted.

+

There are two ways to view differences: htmldiff and +html_annotate. One shows differences with <ins> and +<del>, while the other annotates a set of changes similar to svn +blame. Both these functions operate on text, and work best with +content fragments (only what goes in <body>), not complete +documents.

+

Example of htmldiff:

+
>>> from lxml.html.diff import htmldiff, html_annotate
+>>> doc1 = '''<p>Here is some text.</p>'''
+>>> doc2 = '''<p>Here is <b>a lot</b> of <i>text</i>.</p>'''
+>>> doc3 = '''<p>Here is <b>a little</b> <i>text</i>.</p>'''
+>>> print htmldiff(doc1, doc2)
+<p>Here is <ins><b>a lot</b> of <i>text</i>.</ins> <del>some text.</del> </p>
+>>> print html_annotate([(doc1, 'author1'), (doc2, 'author2'),
+...                      (doc3, 'author3')])
+<p><span title="author1">Here is</span>
+   <b><span title="author2">a</span>
+   <span title="author3">little</span></b>
+   <i><span title="author2">text</span></i>
+   <span title="author2">.</span></p>
+
+

As you can see, it is imperfect as such things tend to be. On larger +tracts of text with larger edits it will generally do better.

+

The html_annotate function can also take an optional second +argument, markup. This is a function like markup(text, +version) that returns the given text marked up with the given +version. The default version, the output of which you see in the +example, looks like:

+
def default_markup(text, version):
+    return '<span title="%s">%s</span>' % (
+        cgi.escape(unicode(version), 1), text)
+
+
+
+

Examples

+
+

Microformat Example

+

This example parses the hCard +microformat.

+

First we get the page:

+
>>> import urllib
+>>> from lxml.html import fromstring
+>>> url = 'http://microformats.org/'
+>>> content = urllib.urlopen(url).read()
+>>> doc = fromstring(content)
+>>> doc.make_links_absolute(url)
+
+

Then we create some objects to put the information in:

+
>>> class Card(object):
+...     def __init__(self, **kw):
+...         for name, value in kw:
+...             setattr(self, name, value)
+>>> class Phone(object):
+...     def __init__(self, phone, types=()):
+...         self.phone, self.types = phone, types
+
+

And some generally handy functions for microformats:

+
>>> def get_text(el, class_name):
+...     els = el.find_class(class_name)
+...     if els:
+...         return els[0].text_content()
+...     else:
+...         return ''
+>>> def get_value(el):
+...     return get_text(el, 'value') or el.text_content()
+>>> def get_all_texts(el, class_name):
+...     return [e.text_content() for e in els.find_class(class_name)]
+>>> def parse_addresses(el):
+...     # Ideally this would parse street, etc.
+...     return el.find_class('adr')
+
+

Then the parsing:

+
>>> for el in doc.find_class('hcard'):
+...     card = Card()
+...     card.el = el
+...     card.fn = get_text(el, 'fn')
+...     card.tels = []
+...     for tel_el in card.find_class('tel'):
+...         card.tels.append(Phone(get_value(tel_el),
+...                                get_all_texts(tel_el, 'type')))
+...     card.addresses = parse_addresses(el)
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/objectify.html b/doc/html/objectify.html new file mode 100644 index 0000000..083f45f --- /dev/null +++ b/doc/html/objectify.html @@ -0,0 +1,1149 @@ + + + + + +lxml.objectify + + + + +
+

lxml.objectify

+ +++ + + + +
Authors:Stefan Behnel +
Holger Joukl
+

lxml supports an alternative API similar to the Amara bindery or +gnosis.xml.objectify through a custom Element implementation. The main idea +is to hide the usage of XML behind normal Python objects, sometimes referred +to as data-binding. It allows you to use XML as if you were dealing with a +normal Python object hierarchy.

+

Accessing the children of an XML element deploys object attribute access. If +there are multiple children with the same name, slicing and indexing can be +used. Python data types are extracted from XML content automatically and made +available to the normal Python operators.

+ +

To set up and use objectify, you need both the lxml.etree +module and lxml.objectify:

+
>>> from lxml import etree
+>>> from lxml import objectify
+
+

The objectify API is very different from the ElementTree API. If it +is used, it should not be mixed with other element implementations +(such as trees parsed with lxml.etree), to avoid non-obvious +behaviour.

+

The benchmark page has some hints on performance optimisation of +code using lxml.objectify.

+

To make the doctests in this document look a little nicer, we also use +this:

+
>>> import lxml.usedoctest
+
+

Imported from within a doctest, this relieves us from caring about the exact +formatting of XML output.

+
+

The lxml.objectify API

+

In lxml.objectify, element trees provide an API that models the behaviour +of normal Python object trees as closely as possible.

+
+

Creating objectify trees

+

As with lxml.etree, you can either create an objectify tree by +parsing an XML document or by building one from scratch. To parse a +document, just use the parse() or fromstring() functions of +the module:

+
>>> fileobject = StringIO('<test/>')
+
+>>> tree = objectify.parse(fileobject)
+>>> print(isinstance(tree.getroot(), objectify.ObjectifiedElement))
+True
+
+>>> root = objectify.fromstring('<test/>')
+>>> print(isinstance(root, objectify.ObjectifiedElement))
+True
+
+

To build a new tree in memory, objectify replicates the standard +factory function Element() from lxml.etree:

+
>>> obj_el = objectify.Element("new")
+>>> print(isinstance(obj_el, objectify.ObjectifiedElement))
+True
+
+

After creating such an Element, you can use the usual API of +lxml.etree to add SubElements to the tree:

+
>>> child = etree.SubElement(obj_el, "newchild", attr="value")
+
+

New subelements will automatically inherit the objectify behaviour +from their tree. However, all independent elements that you create +through the Element() factory of lxml.etree (instead of objectify) +will not support the objectify API by themselves:

+
>>> subel = etree.SubElement(obj_el, "sub")
+>>> print(isinstance(subel, objectify.ObjectifiedElement))
+True
+
+>>> independent_el = etree.Element("new")
+>>> print(isinstance(independent_el, objectify.ObjectifiedElement))
+False
+
+
+
+

Element access through object attributes

+

The main idea behind the objectify API is to hide XML element access +behind the usual object attribute access pattern. Asking an element for an +attribute will return the sequence of children with corresponding tag names:

+
>>> root = objectify.Element("root")
+>>> b = etree.SubElement(root, "b")
+>>> print(root.b[0].tag)
+b
+>>> root.index(root.b[0])
+0
+>>> b = etree.SubElement(root, "b")
+>>> print(root.b[0].tag)
+b
+>>> print(root.b[1].tag)
+b
+>>> root.index(root.b[1])
+1
+
+

For convenience, you can omit the index '0' to access the first child:

+
>>> print(root.b.tag)
+b
+>>> root.index(root.b)
+0
+>>> del root.b
+
+

Iteration and slicing also obey the requested tag:

+
>>> x1 = etree.SubElement(root, "x")
+>>> x2 = etree.SubElement(root, "x")
+>>> x3 = etree.SubElement(root, "x")
+
+>>> [ el.tag for el in root.x ]
+['x', 'x', 'x']
+
+>>> [ el.tag for el in root.x[1:3] ]
+['x', 'x']
+
+>>> [ el.tag for el in root.x[-1:] ]
+['x']
+
+>>> del root.x[1:2]
+>>> [ el.tag for el in root.x ]
+['x', 'x']
+
+

If you want to iterate over all children or need to provide a specific +namespace for the tag, use the iterchildren() method. Like the other +methods for iteration, it supports an optional tag keyword argument:

+
>>> [ el.tag for el in root.iterchildren() ]
+['b', 'x', 'x']
+
+>>> [ el.tag for el in root.iterchildren(tag='b') ]
+['b']
+
+>>> [ el.tag for el in root.b ]
+['b']
+
+

XML attributes are accessed as in the normal ElementTree API:

+
>>> c = etree.SubElement(root, "c", myattr="someval")
+>>> print(root.c.get("myattr"))
+someval
+
+>>> root.c.set("c", "oh-oh")
+>>> print(root.c.get("c"))
+oh-oh
+
+

In addition to the normal ElementTree API for appending elements to trees, +subtrees can also be added by assigning them to object attributes. In this +case, the subtree is automatically deep copied and the tag name of its root is +updated to match the attribute name:

+
>>> el = objectify.Element("yet_another_child")
+>>> root.new_child = el
+>>> print(root.new_child.tag)
+new_child
+>>> print(el.tag)
+yet_another_child
+
+>>> root.y = [ objectify.Element("y"), objectify.Element("y") ]
+>>> [ el.tag for el in root.y ]
+['y', 'y']
+
+

The latter is a short form for operations on the full slice:

+
>>> root.y[:] = [ objectify.Element("y") ]
+>>> [ el.tag for el in root.y ]
+['y']
+
+

You can also replace children that way:

+
>>> child1 = etree.SubElement(root, "child")
+>>> child2 = etree.SubElement(root, "child")
+>>> child3 = etree.SubElement(root, "child")
+
+>>> el = objectify.Element("new_child")
+>>> subel = etree.SubElement(el, "sub")
+
+>>> root.child = el
+>>> print(root.child.sub.tag)
+sub
+
+>>> root.child[2] = el
+>>> print(root.child[2].sub.tag)
+sub
+
+

Note that special care must be taken when changing the tag name of an element:

+
>>> print(root.b.tag)
+b
+>>> root.b.tag = "notB"
+>>> root.b
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: b
+>>> print(root.notB.tag)
+notB
+
+
+
+

Tree generation with the E-factory

+

To simplify the generation of trees even further, you can use the E-factory:

+
>>> E = objectify.E
+>>> root = E.root(
+...   E.a(5),
+...   E.b(6.1),
+...   E.c(True),
+...   E.d("how", tell="me")
+... )
+
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns:py="http://codespeak.net/lxml/objectify/pytype">
+  <a py:pytype="int">5</a>
+  <b py:pytype="float">6.1</b>
+  <c py:pytype="bool">true</c>
+  <d py:pytype="str" tell="me">how</d>
+</root>
+
+

This allows you to write up a specific language in tags:

+
>>> ROOT = objectify.E.root
+>>> TITLE = objectify.E.title
+>>> HOWMANY = getattr(objectify.E, "how-many")
+
+>>> root = ROOT(
+...   TITLE("The title"),
+...   HOWMANY(5)
+... )
+
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns:py="http://codespeak.net/lxml/objectify/pytype">
+  <title py:pytype="str">The title</title>
+  <how-many py:pytype="int">5</how-many>
+</root>
+
+

objectify.E is an instance of objectify.ElementMaker. By default, it +creates pytype annotated Elements without a namespace. You can switch off the +pytype annotation by passing False to the annotate keyword argument of the +constructor. You can also pass a default namespace and an nsmap:

+
>>> myE = objectify.ElementMaker(annotate=False,
+...           namespace="http://my/ns", nsmap={None : "http://my/ns"})
+
+>>> root = myE.root( myE.someint(2) )
+
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns="http://my/ns">
+  <someint>2</someint>
+</root>
+
+
+
+

Namespace handling

+

During tag lookups, namespaces are handled mostly behind the scenes. +If you access a child of an Element without specifying a namespace, +the lookup will use the namespace of the parent:

+
>>> root = objectify.Element("{http://ns/}root")
+>>> b = etree.SubElement(root, "{http://ns/}b")
+>>> c = etree.SubElement(root, "{http://other/}c")
+
+>>> print(root.b.tag)
+{http://ns/}b
+
+

Note that the SubElement() factory of lxml.etree does not +inherit any namespaces when creating a new subelement. Element +creation must be explicit about the namespace, and is simplified +through the E-factory as described above.

+

Lookups, however, inherit namespaces implicitly:

+
>>> print(root.b.tag)
+{http://ns/}b
+
+>>> print(root.c)
+Traceback (most recent call last):
+    ...
+AttributeError: no such child: {http://ns/}c
+
+

To access an element in a different namespace than its parent, you can +use getattr():

+
>>> c = getattr(root, "{http://other/}c")
+>>> print(c.tag)
+{http://other/}c
+
+

For convenience, there is also a quick way through item access:

+
>>> c = root["{http://other/}c"]
+>>> print(c.tag)
+{http://other/}c
+
+

The same approach must be used to access children with tag names that are not +valid Python identifiers:

+
>>> el = etree.SubElement(root, "{http://ns/}tag-name")
+>>> print(root["tag-name"].tag)
+{http://ns/}tag-name
+
+>>> new_el = objectify.Element("{http://ns/}new-element")
+>>> el = etree.SubElement(new_el, "{http://ns/}child")
+>>> el = etree.SubElement(new_el, "{http://ns/}child")
+>>> el = etree.SubElement(new_el, "{http://ns/}child")
+
+>>> root["tag-name"] = [ new_el, new_el ]
+>>> print(len(root["tag-name"]))
+2
+>>> print(root["tag-name"].tag)
+{http://ns/}tag-name
+
+>>> print(len(root["tag-name"].child))
+3
+>>> print(root["tag-name"].child.tag)
+{http://ns/}child
+>>> print(root["tag-name"][1].child.tag)
+{http://ns/}child
+
+

or for names that have a special meaning in lxml.objectify:

+
>>> root = objectify.XML("<root><text>TEXT</text></root>")
+
+>>> print(root.text.text)
+Traceback (most recent call last):
+  ...
+AttributeError: 'NoneType' object has no attribute 'text'
+
+>>> print(root["text"].text)
+TEXT
+
+
+
+
+

Asserting a Schema

+

When dealing with XML documents from different sources, you will often +require them to follow a common schema. In lxml.objectify, this +directly translates to enforcing a specific object tree, i.e. expected +object attributes are ensured to be there and to have the expected +type. This can easily be achieved through XML Schema validation at +parse time. Also see the documentation on validation on this +topic.

+

First of all, we need a parser that knows our schema, so let's say we +parse the schema from a file-like object (or file or filename):

+
>>> f = StringIO('''\
+...   <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+...     <xsd:element name="a" type="AType"/>
+...     <xsd:complexType name="AType">
+...       <xsd:sequence>
+...         <xsd:element name="b" type="xsd:string" />
+...       </xsd:sequence>
+...     </xsd:complexType>
+...   </xsd:schema>
+... ''')
+>>> schema = etree.XMLSchema(file=f)
+
+

When creating the validating parser, we must make sure it returns +objectify trees. This is best done with the makeparser() +function:

+
>>> parser = objectify.makeparser(schema = schema)
+
+

Now we can use it to parse a valid document:

+
>>> xml = "<a><b>test</b></a>"
+>>> a = objectify.fromstring(xml, parser)
+
+>>> print(a.b)
+test
+
+

Or an invalid document:

+
>>> xml = "<a><b>test</b><c/></a>"
+>>> a = objectify.fromstring(xml, parser)
+Traceback (most recent call last):
+lxml.etree.XMLSyntaxError: Element 'c': This element is not expected.
+
+

Note that the same works for parse-time DTD validation, except that +DTDs do not support any data types by design.

+
+
+

ObjectPath

+

For both convenience and speed, objectify supports its own path language, +represented by the ObjectPath class:

+
>>> root = objectify.Element("{http://ns/}root")
+>>> b1 = etree.SubElement(root, "{http://ns/}b")
+>>> c  = etree.SubElement(b1,   "{http://ns/}c")
+>>> b2 = etree.SubElement(root, "{http://ns/}b")
+>>> d  = etree.SubElement(root, "{http://other/}d")
+
+>>> path = objectify.ObjectPath("root.b.c")
+>>> print(path)
+root.b.c
+>>> path.hasattr(root)
+True
+>>> print(path.find(root).tag)
+{http://ns/}c
+
+>>> find = objectify.ObjectPath("root.b.c")
+>>> print(find(root).tag)
+{http://ns/}c
+
+>>> find = objectify.ObjectPath("root.{http://other/}d")
+>>> print(find(root).tag)
+{http://other/}d
+
+>>> find = objectify.ObjectPath("root.{not}there")
+>>> print(find(root).tag)
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: {not}there
+
+>>> find = objectify.ObjectPath("{not}there")
+>>> print(find(root).tag)
+Traceback (most recent call last):
+  ...
+ValueError: root element does not match: need {not}there, got {http://ns/}root
+
+>>> find = objectify.ObjectPath("root.b[1]")
+>>> print(find(root).tag)
+{http://ns/}b
+
+>>> find = objectify.ObjectPath("root.{http://ns/}b[1]")
+>>> print(find(root).tag)
+{http://ns/}b
+
+

Apart from strings, ObjectPath also accepts lists of path segments:

+
>>> find = objectify.ObjectPath(['root', 'b', 'c'])
+>>> print(find(root).tag)
+{http://ns/}c
+
+>>> find = objectify.ObjectPath(['root', '{http://ns/}b[1]'])
+>>> print(find(root).tag)
+{http://ns/}b
+
+

You can also use relative paths starting with a '.' to ignore the actual root +element and only inherit its namespace:

+
>>> find = objectify.ObjectPath(".b[1]")
+>>> print(find(root).tag)
+{http://ns/}b
+
+>>> find = objectify.ObjectPath(['', 'b[1]'])
+>>> print(find(root).tag)
+{http://ns/}b
+
+>>> find = objectify.ObjectPath(".unknown[1]")
+>>> print(find(root).tag)
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: {http://ns/}unknown
+
+>>> find = objectify.ObjectPath(".{http://other/}unknown[1]")
+>>> print(find(root).tag)
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: {http://other/}unknown
+
+

For convenience, a single dot represents the empty ObjectPath (identity):

+
>>> find = objectify.ObjectPath(".")
+>>> print(find(root).tag)
+{http://ns/}root
+
+

ObjectPath objects can be used to manipulate trees:

+
>>> root = objectify.Element("{http://ns/}root")
+
+>>> path = objectify.ObjectPath(".some.child.{http://other/}unknown")
+>>> path.hasattr(root)
+False
+>>> path.find(root)
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: {http://ns/}some
+
+>>> path.setattr(root, "my value") # creates children as necessary
+>>> path.hasattr(root)
+True
+>>> print(path.find(root).text)
+my value
+>>> print(root.some.child["{http://other/}unknown"].text)
+my value
+
+>>> print(len( path.find(root) ))
+1
+>>> path.addattr(root, "my new value")
+>>> print(len( path.find(root) ))
+2
+>>> [ el.text for el in path.find(root) ]
+['my value', 'my new value']
+
+

As with attribute assignment, setattr() accepts lists:

+
>>> path.setattr(root, ["v1", "v2", "v3"])
+>>> [ el.text for el in path.find(root) ]
+['v1', 'v2', 'v3']
+
+

Note, however, that indexing is only supported in this context if the children +exist. Indexing of non existing children will not extend or create a list of +such children but raise an exception:

+
>>> path = objectify.ObjectPath(".{non}existing[1]")
+>>> path.setattr(root, "my value")
+Traceback (most recent call last):
+  ...
+TypeError: creating indexed path attributes is not supported
+
+

It is worth noting that ObjectPath does not depend on the objectify module +or the ObjectifiedElement implementation. It can also be used in combination +with Elements from the normal lxml.etree API.

+
+
+

Python data types

+

The objectify module knows about Python data types and tries its best to let +element content behave like them. For example, they support the normal math +operators:

+
>>> root = objectify.fromstring(
+...             "<root><a>5</a><b>11</b><c>true</c><d>hoi</d></root>")
+>>> root.a + root.b
+16
+>>> root.a += root.b
+>>> print(root.a)
+16
+
+>>> root.a = 2
+>>> print(root.a + 2)
+4
+>>> print(1 + root.a)
+3
+
+>>> print(root.c)
+True
+>>> root.c = False
+>>> if not root.c:
+...     print("false!")
+false!
+
+>>> print(root.d + " test !")
+hoi test !
+>>> root.d = "%s - %s"
+>>> print(root.d % (1234, 12345))
+1234 - 12345
+
+

However, data elements continue to provide the objectify API. This means that +sequence operations such as len(), slicing and indexing (e.g. of strings) +cannot behave as the Python types. Like all other tree elements, they show +the normal slicing behaviour of objectify elements:

+
>>> root = objectify.fromstring("<root><a>test</a><b>toast</b></root>")
+>>> print(root.a + ' me') # behaves like a string, right?
+test me
+>>> len(root.a) # but there's only one 'a' element!
+1
+>>> [ a.tag for a in root.a ]
+['a']
+>>> print(root.a[0].tag)
+a
+
+>>> print(root.a)
+test
+>>> [ str(a) for a in root.a[:1] ]
+['test']
+
+

If you need to run sequence operations on data types, you must ask the API for +the real Python value. The string value is always available through the +normal ElementTree .text attribute. Additionally, all data classes +provide a .pyval attribute that returns the value as plain Python type:

+
>>> root = objectify.fromstring("<root><a>test</a><b>5</b></root>")
+>>> root.a.text
+'test'
+>>> root.a.pyval
+'test'
+
+>>> root.b.text
+'5'
+>>> root.b.pyval
+5
+
+

Note, however, that both attributes are read-only in objectify. If you want +to change values, just assign them directly to the attribute:

+
>>> root.a.text  = "25"
+Traceback (most recent call last):
+  ...
+TypeError: attribute 'text' of 'StringElement' objects is not writable
+
+>>> root.a.pyval = 25
+Traceback (most recent call last):
+  ...
+TypeError: attribute 'pyval' of 'StringElement' objects is not writable
+
+>>> root.a = 25
+>>> print(root.a)
+25
+>>> print(root.a.pyval)
+25
+
+

In other words, objectify data elements behave like immutable Python +types. You can replace them, but not modify them.

+
+

Recursive tree dump

+

To see the data types that are currently used, you can call the module level +dump() function that returns a recursive string representation for +elements:

+
>>> root = objectify.fromstring("""
+... <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+...   <a attr1="foo" attr2="bar">1</a>
+...   <a>1.2</a>
+...   <b>1</b>
+...   <b>true</b>
+...   <c>what?</c>
+...   <d xsi:nil="true"/>
+... </root>
+... """)
+
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 1 [IntElement]
+      * attr1 = 'foo'
+      * attr2 = 'bar'
+    a = 1.2 [FloatElement]
+    b = 1 [IntElement]
+    b = True [BoolElement]
+    c = 'what?' [StringElement]
+    d = None [NoneElement]
+      * xsi:nil = 'true'
+
+

You can freely switch between different types for the same child:

+
>>> root = objectify.fromstring("<root><a>5</a></root>")
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 5 [IntElement]
+
+>>> root.a = 'nice string!'
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 'nice string!' [StringElement]
+      * py:pytype = 'str'
+
+>>> root.a = True
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = True [BoolElement]
+      * py:pytype = 'bool'
+
+>>> root.a = [1, 2, 3]
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 1 [IntElement]
+      * py:pytype = 'int'
+    a = 2 [IntElement]
+      * py:pytype = 'int'
+    a = 3 [IntElement]
+      * py:pytype = 'int'
+
+>>> root.a = (1, 2, 3)
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 1 [IntElement]
+      * py:pytype = 'int'
+    a = 2 [IntElement]
+      * py:pytype = 'int'
+    a = 3 [IntElement]
+      * py:pytype = 'int'
+
+
+
+

Recursive string representation of elements

+

Normally, elements use the standard string representation for str() that is +provided by lxml.etree. You can enable a pretty-print representation for +objectify elements like this:

+
>>> objectify.enable_recursive_str()
+
+>>> root = objectify.fromstring("""
+... <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+...   <a attr1="foo" attr2="bar">1</a>
+...   <a>1.2</a>
+...   <b>1</b>
+...   <b>true</b>
+...   <c>what?</c>
+...   <d xsi:nil="true"/>
+... </root>
+... """)
+
+>>> print(str(root))
+root = None [ObjectifiedElement]
+    a = 1 [IntElement]
+      * attr1 = 'foo'
+      * attr2 = 'bar'
+    a = 1.2 [FloatElement]
+    b = 1 [IntElement]
+    b = True [BoolElement]
+    c = 'what?' [StringElement]
+    d = None [NoneElement]
+      * xsi:nil = 'true'
+
+

This behaviour can be switched off in the same way:

+
>>> objectify.enable_recursive_str(False)
+
+
+
+
+

How data types are matched

+

Objectify uses two different types of Elements. Structural Elements (or tree +Elements) represent the object tree structure. Data Elements represent the +data containers at the leafs. You can explicitly create tree Elements with +the objectify.Element() factory and data Elements with the +objectify.DataElement() factory.

+

When Element objects are created, lxml.objectify must determine which +implementation class to use for them. This is relatively easy for tree +Elements and less so for data Elements. The algorithm is as follows:

+
    +
  1. If an element has children, use the default tree class.
  2. +
  3. If an element is defined as xsi:nil, use the NoneElement class.
  4. +
  5. If a "Python type hint" attribute is given, use this to determine the element +class, see below.
  6. +
  7. If an XML Schema xsi:type hint is given, use this to determine the element +class, see below.
  8. +
  9. Try to determine the element class from the text content type by trial and +error.
  10. +
  11. If the element is a root node then use the default tree class.
  12. +
  13. Otherwise, use the default class for empty data classes.
  14. +
+

You can change the default classes for tree Elements and empty data Elements +at setup time. The ObjectifyElementClassLookup() call accepts two keyword +arguments, tree_class and empty_data_class, that determine the Element +classes used in these cases. By default, tree_class is a class called +ObjectifiedElement and empty_data_class is a StringElement.

+
+

Type annotations

+

The "type hint" mechanism deploys an XML attribute defined as +lxml.objectify.PYTYPE_ATTRIBUTE. It may contain any of the following +string values: int, long, float, str, unicode, NoneType:

+
>>> print(objectify.PYTYPE_ATTRIBUTE)
+{http://codespeak.net/lxml/objectify/pytype}pytype
+>>> ns, name = objectify.PYTYPE_ATTRIBUTE[1:].split('}')
+
+>>> root = objectify.fromstring("""\
+... <root xmlns:py='%s'>
+...   <a py:pytype='str'>5</a>
+...   <b py:pytype='int'>5</b>
+...   <c py:pytype='NoneType' />
+... </root>
+... """ % ns)
+
+>>> print(root.a + 10)
+510
+>>> print(root.b + 10)
+15
+>>> print(root.c)
+None
+
+

Note that you can change the name and namespace used for this +attribute through the set_pytype_attribute_tag(tag) module +function, in case your application ever needs to. There is also a +utility function annotate() that recursively generates this +attribute for the elements of a tree:

+
>>> root = objectify.fromstring("<root><a>test</a><b>5</b></root>")
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 'test' [StringElement]
+    b = 5 [IntElement]
+
+>>> objectify.annotate(root)
+
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 'test' [StringElement]
+      * py:pytype = 'str'
+    b = 5 [IntElement]
+      * py:pytype = 'int'
+
+
+
+

XML Schema datatype annotation

+

A second way of specifying data type information uses XML Schema types as +element annotations. Objectify knows those that can be mapped to normal +Python types:

+
>>> root = objectify.fromstring('''\
+...    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+...          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+...      <d xsi:type="xsd:double">5</d>
+...      <i xsi:type="xsd:int"   >5</i>
+...      <s xsi:type="xsd:string">5</s>
+...    </root>
+...    ''')
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    d = 5.0 [FloatElement]
+      * xsi:type = 'xsd:double'
+    i = 5 [IntElement]
+      * xsi:type = 'xsd:int'
+    s = '5' [StringElement]
+      * xsi:type = 'xsd:string'
+
+

Again, there is a utility function xsiannotate() that recursively +generates the "xsi:type" attribute for the elements of a tree:

+
>>> root = objectify.fromstring('''\
+...    <root><a>test</a><b>5</b><c>true</c></root>
+...    ''')
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 'test' [StringElement]
+    b = 5 [IntElement]
+    c = True [BoolElement]
+
+>>> objectify.xsiannotate(root)
+
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    a = 'test' [StringElement]
+      * xsi:type = 'xsd:string'
+    b = 5 [IntElement]
+      * xsi:type = 'xsd:integer'
+    c = True [BoolElement]
+      * xsi:type = 'xsd:boolean'
+
+

Note, however, that xsiannotate() will always use the first XML Schema +datatype that is defined for any given Python type, see also +Defining additional data classes.

+

The utility function deannotate() can be used to get rid of 'py:pytype' +and/or 'xsi:type' information:

+
>>> root = objectify.fromstring('''\
+... <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+...       xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+...   <d xsi:type="xsd:double">5</d>
+...   <i xsi:type="xsd:int"   >5</i>
+...   <s xsi:type="xsd:string">5</s>
+... </root>''')
+>>> objectify.annotate(root)
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    d = 5.0 [FloatElement]
+      * xsi:type = 'xsd:double'
+      * py:pytype = 'float'
+    i = 5 [IntElement]
+      * xsi:type = 'xsd:int'
+      * py:pytype = 'int'
+    s = '5' [StringElement]
+      * xsi:type = 'xsd:string'
+      * py:pytype = 'str'
+>>> objectify.deannotate(root)
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    d = 5 [IntElement]
+    i = 5 [IntElement]
+    s = 5 [IntElement]
+
+

You can control which type attributes should be de-annotated with the keyword +arguments 'pytype' (default: True) and 'xsi' (default: True). +deannotate() can also remove 'xsi:nil' attributes by setting 'xsi_nil=True' +(default: False):

+
>>> root = objectify.fromstring('''\
+... <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+...       xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+...   <d xsi:type="xsd:double">5</d>
+...   <i xsi:type="xsd:int"   >5</i>
+...   <s xsi:type="xsd:string">5</s>
+...   <n xsi:nil="true"/>
+... </root>''')
+>>> objectify.annotate(root)
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    d = 5.0 [FloatElement]
+      * xsi:type = 'xsd:double'
+      * py:pytype = 'float'
+    i = 5 [IntElement]
+      * xsi:type = 'xsd:int'
+      * py:pytype = 'int'
+    s = '5' [StringElement]
+      * xsi:type = 'xsd:string'
+      * py:pytype = 'str'
+    n = None [NoneElement]
+      * xsi:nil = 'true'
+      * py:pytype = 'NoneType'
+>>> objectify.deannotate(root, xsi_nil=True)
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    d = 5 [IntElement]
+    i = 5 [IntElement]
+    s = 5 [IntElement]
+    n = u'' [StringElement]
+
+
+
+

The DataElement factory

+

For convenience, the DataElement() factory creates an Element with a +Python value in one step. You can pass the required Python type name or the +XSI type name:

+
>>> root = objectify.Element("root")
+>>> root.x = objectify.DataElement(5, _pytype="int")
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    x = 5 [IntElement]
+      * py:pytype = 'int'
+
+>>> root.x = objectify.DataElement(5, _pytype="str", myattr="someval")
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    x = '5' [StringElement]
+      * py:pytype = 'str'
+      * myattr = 'someval'
+
+>>> root.x = objectify.DataElement(5, _xsi="integer")
+>>> print(objectify.dump(root))
+root = None [ObjectifiedElement]
+    x = 5 [IntElement]
+      * py:pytype = 'int'
+      * xsi:type = 'xsd:integer'
+
+

XML Schema types reside in the XML schema namespace thus DataElement() +tries to correctly prefix the xsi:type attribute value for you:

+
>>> root = objectify.Element("root")
+>>> root.s = objectify.DataElement(5, _xsi="string")
+
+>>> objectify.deannotate(root, xsi=False)
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns:py="http://codespeak.net/lxml/objectify/pytype" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <s xsi:type="xsd:string">5</s>
+</root>
+
+

DataElement() uses a default nsmap to set these prefixes:

+
>>> el = objectify.DataElement('5', _xsi='string')
+>>> namespaces = list(el.nsmap.items())
+>>> namespaces.sort()
+>>> for prefix, namespace in namespaces:
+...     print("%s - %s" % (prefix, namespace))
+py - http://codespeak.net/lxml/objectify/pytype
+xsd - http://www.w3.org/2001/XMLSchema
+xsi - http://www.w3.org/2001/XMLSchema-instance
+
+>>> print(el.get("{http://www.w3.org/2001/XMLSchema-instance}type"))
+xsd:string
+
+

While you can set custom namespace prefixes, it is necessary to provide valid +namespace information if you choose to do so:

+
>>> el = objectify.DataElement('5', _xsi='foo:string',
+...          nsmap={'foo': 'http://www.w3.org/2001/XMLSchema'})
+>>> namespaces = list(el.nsmap.items())
+>>> namespaces.sort()
+>>> for prefix, namespace in namespaces:
+...     print("%s - %s" % (prefix, namespace))
+foo - http://www.w3.org/2001/XMLSchema
+py - http://codespeak.net/lxml/objectify/pytype
+xsi - http://www.w3.org/2001/XMLSchema-instance
+
+>>> print(el.get("{http://www.w3.org/2001/XMLSchema-instance}type"))
+foo:string
+
+

Note how lxml chose a default prefix for the XML Schema Instance +namespace. We can override it as in the following example:

+
>>> el = objectify.DataElement('5', _xsi='foo:string',
+...          nsmap={'foo': 'http://www.w3.org/2001/XMLSchema',
+...                 'myxsi': 'http://www.w3.org/2001/XMLSchema-instance'})
+>>> namespaces = list(el.nsmap.items())
+>>> namespaces.sort()
+>>> for prefix, namespace in namespaces:
+...     print("%s - %s" % (prefix, namespace))
+foo - http://www.w3.org/2001/XMLSchema
+myxsi - http://www.w3.org/2001/XMLSchema-instance
+py - http://codespeak.net/lxml/objectify/pytype
+
+>>> print(el.get("{http://www.w3.org/2001/XMLSchema-instance}type"))
+foo:string
+
+

Care must be taken if different namespace prefixes have been used for the same +namespace. Namespace information gets merged to avoid duplicate definitions +when adding a new sub-element to a tree, but this mechanism does not adapt the +prefixes of attribute values:

+
>>> root = objectify.fromstring("""<root xmlns:schema="http://www.w3.org/2001/XMLSchema"/>""")
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns:schema="http://www.w3.org/2001/XMLSchema"/>
+
+>>> s = objectify.DataElement("17", _xsi="string")
+>>> print(etree.tostring(s, pretty_print=True))
+<value xmlns:py="http://codespeak.net/lxml/objectify/pytype" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" py:pytype="str" xsi:type="xsd:string">17</value>
+
+>>> root.s = s
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns:schema="http://www.w3.org/2001/XMLSchema">
+  <s xmlns:py="http://codespeak.net/lxml/objectify/pytype" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" py:pytype="str" xsi:type="xsd:string">17</s>
+</root>
+
+

It is your responsibility to fix the prefixes of attribute values if you +choose to deviate from the standard prefixes. A convenient way to do this for +xsi:type attributes is to use the xsiannotate() utility:

+
>>> objectify.xsiannotate(root)
+>>> print(etree.tostring(root, pretty_print=True))
+<root xmlns:schema="http://www.w3.org/2001/XMLSchema">
+  <s xmlns:py="http://codespeak.net/lxml/objectify/pytype" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" py:pytype="str" xsi:type="schema:string">17</s>
+</root>
+
+

Of course, it is discouraged to use different prefixes for one and the same +namespace when building up an objectify tree.

+
+
+

Defining additional data classes

+

You can plug additional data classes into objectify that will be used in +exactly the same way as the predefined types. Data classes can either inherit +from ObjectifiedDataElement directly or from one of the specialised +classes like NumberElement or BoolElement. The numeric types require +an initial call to the NumberElement method self._setValueParser(function) +to set their type conversion function (string -> numeric Python type). This +call should be placed into the element _init() method.

+

The registration of data classes uses the PyType class:

+
>>> class ChristmasDate(objectify.ObjectifiedDataElement):
+...     def call_santa(self):
+...         print("Ho ho ho!")
+
+>>> def checkChristmasDate(date_string):
+...     if not date_string.startswith('24.12.'):
+...         raise ValueError # or TypeError
+
+>>> xmas_type = objectify.PyType('date', checkChristmasDate, ChristmasDate)
+
+

The PyType constructor takes a string type name, an (optional) callable type +check and the custom data class. If a type check is provided it must accept a +string as argument and raise ValueError or TypeError if it cannot handle the +string value.

+

PyTypes are used if an element carries a py:pytype attribute denoting its +data type or, in absence of such an attribute, if the given type check callable +does not raise a ValueError/TypeError exception when applied to the element +text.

+

If you want, you can also register this type under an XML Schema type name:

+
>>> xmas_type.xmlSchemaTypes = ("date",)
+
+

XML Schema types will be considered if the element has an xsi:type +attribute that specifies its data type. The line above binds the XSD type +date to the newly defined Python type. Note that this must be done before +the next step, which is to register the type. Then you can use it:

+
>>> xmas_type.register()
+
+>>> root = objectify.fromstring(
+...             "<root><a>24.12.2000</a><b>12.24.2000</b></root>")
+>>> root.a.call_santa()
+Ho ho ho!
+>>> root.b.call_santa()
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: call_santa
+
+

If you need to specify dependencies between the type check functions, you can +pass a sequence of type names through the before and after keyword +arguments of the register() method. The PyType will then try to register +itself before or after the respective types, as long as they are currently +registered. Note that this only impacts the currently registered types at the +time of registration. Types that are registered later on will not care about +the dependencies of already registered types.

+

If you provide XML Schema type information, this will override the type check +function defined above:

+
>>> root = objectify.fromstring('''\
+...    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+...      <a xsi:type="date">12.24.2000</a>
+...    </root>
+...    ''')
+>>> print(root.a)
+12.24.2000
+>>> root.a.call_santa()
+Ho ho ho!
+
+

To unregister a type, call its unregister() method:

+
>>> root.a.call_santa()
+Ho ho ho!
+>>> xmas_type.unregister()
+>>> root.a.call_santa()
+Traceback (most recent call last):
+  ...
+AttributeError: no such child: call_santa
+
+

Be aware, though, that this does not immediately apply to elements to which +there already is a Python reference. Their Python class will only be changed +after all references are gone and the Python object is garbage collected.

+
+
+

Advanced element class lookup

+

In some cases, the normal data class setup is not enough. Being based +on lxml.etree, however, lxml.objectify supports very +fine-grained control over the Element classes used in a tree. All you +have to do is configure a different class lookup mechanism (or +write one yourself).

+

The first step for the setup is to create a new parser that builds +objectify documents. The objectify API is meant for data-centric XML +(as opposed to document XML with mixed content). Therefore, we +configure the parser to let it remove whitespace-only text from the +parsed document if it is not enclosed by an XML element. Note that +this alters the document infoset, so if you consider the removed +spaces as data in your specific use case, you should go with a normal +parser and just set the element class lookup. Most applications, +however, will work fine with the following setup:

+
>>> parser = objectify.makeparser(remove_blank_text=True)
+
+

What this does internally, is:

+
>>> parser = etree.XMLParser(remove_blank_text=True)
+
+>>> lookup = objectify.ObjectifyElementClassLookup()
+>>> parser.set_element_class_lookup(lookup)
+
+

If you want to change the lookup scheme, say, to get additional +support for namespace specific classes, you can register the +objectify lookup as a fallback of the namespace lookup. In this case, +however, you have to take care that the namespace classes inherit from +objectify.ObjectifiedElement, not only from the normal +lxml.etree.ElementBase, so that they support the objectify +API. The above setup code then becomes:

+
>>> lookup = etree.ElementNamespaceClassLookup(
+...                   objectify.ObjectifyElementClassLookup() )
+>>> parser.set_element_class_lookup(lookup)
+
+

See the documentation on class lookup schemes for more information.

+
+
+
+

What is different from lxml.etree?

+

Such a different Element API obviously implies some side effects to the normal +behaviour of the rest of the API.

+
    +
  • len(<element>) returns the sibling count, not the number of children of +<element>. You can retrieve the number of children with the +countchildren() method.
  • +
  • Iteration over elements does not yield the children, but the siblings. You +can access all children with the iterchildren() method on elements or +retrieve a list by calling the getchildren() method.
  • +
  • The find, findall and findtext methods require a different implementation +based on ETXPath. In lxml.etree, they use a Python implementation based +on the original iteration scheme. This has the disadvantage that they may +not be 100% backwards compatible, and the additional advantage that they now +support any XPath expression.
  • +
+
+
+ + + \ No newline at end of file diff --git a/doc/html/parsing.html b/doc/html/parsing.html new file mode 100644 index 0000000..4cdaba6 --- /dev/null +++ b/doc/html/parsing.html @@ -0,0 +1,621 @@ + + + + + +Parsing XML and HTML with lxml + + + +
+

Parsing XML and HTML with lxml

+ +

lxml provides a very simple and powerful API for parsing XML and HTML. It +supports one-step parsing as well as step-by-step parsing using an +event-driven API (currently only for XML).

+ +

The usual setup procedure:

+
>>> from lxml import etree
+
+
+

Parsers

+

Parsers are represented by parser objects. There is support for parsing both +XML and (broken) HTML. Note that XHTML is best parsed as XML, parsing it with +the HTML parser can lead to unexpected results. Here is a simple example for +parsing XML from an in-memory string:

+
>>> xml = '<a xmlns="test"><b xmlns="test"/></a>'
+
+>>> root = etree.fromstring(xml)
+>>> etree.tostring(root)
+b'<a xmlns="test"><b xmlns="test"/></a>'
+
+

To read from a file or file-like object, you can use the parse() function, +which returns an ElementTree object:

+
>>> tree = etree.parse(StringIO(xml))
+>>> etree.tostring(tree.getroot())
+b'<a xmlns="test"><b xmlns="test"/></a>'
+
+

Note how the parse() function reads from a file-like object here. If +parsing is done from a real file, it is more common (and also somewhat more +efficient) to pass a filename:

+
>>> tree = etree.parse("doc/test.xml")
+
+

lxml can parse from a local file, an HTTP URL or an FTP URL. It also +auto-detects and reads gzip-compressed XML files (.gz).

+

If you want to parse from memory and still provide a base URL for the document +(e.g. to support relative paths in an XInclude), you can pass the base_url +keyword argument:

+
>>> root = etree.fromstring(xml, base_url="http://where.it/is/from.xml")
+
+
+

Parser options

+

The parsers accept a number of setup options as keyword arguments. The above +example is easily extended to clean up namespaces during parsing:

+
>>> parser = etree.XMLParser(ns_clean=True)
+>>> tree   = etree.parse(StringIO(xml), parser)
+>>> etree.tostring(tree.getroot())
+b'<a xmlns="test"><b/></a>'
+
+

The keyword arguments in the constructor are mainly based on the libxml2 +parser configuration. A DTD will also be loaded if validation or attribute +default values are requested.

+

Available boolean keyword arguments:

+
    +
  • attribute_defaults - read the DTD (if referenced by the document) and add +the default attributes from it
  • +
  • dtd_validation - validate while parsing (if a DTD was referenced)
  • +
  • load_dtd - load and parse the DTD while parsing (no validation is performed)
  • +
  • no_network - prevent network access when looking up external +documents (on by default)
  • +
  • ns_clean - try to clean up redundant namespace declarations
  • +
  • recover - try hard to parse through broken XML
  • +
  • remove_blank_text - discard blank text nodes between tags
  • +
  • remove_comments - discard comments
  • +
  • remove_pis - discard processing instructions
  • +
  • strip_cdata - replace CDATA sections by normal text content (on by +default)
  • +
  • resolve_entities - replace entities by their text value (on by +default)
  • +
  • huge_tree - disable security restrictions and support very deep trees +and very long text content (only affects libxml2 2.7+)
  • +
  • compact - use compact storage for short text content (on by default)
  • +
+
+
+

Error log

+

Parsers have an error_log property that lists the errors of the +last parser run:

+
>>> parser = etree.XMLParser()
+>>> print(len(parser.error_log))
+0
+
+>>> tree = etree.XML("<root></b>", parser)
+Traceback (most recent call last):
+  ...
+lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: root line 1 and b, line 1, column 11
+
+>>> print(len(parser.error_log))
+1
+
+>>> error = parser.error_log[0]
+>>> print(error.message)
+Opening and ending tag mismatch: root line 1 and b
+>>> print(error.line)
+1
+>>> print(error.column)
+11
+
+
+
+

Parsing HTML

+

HTML parsing is similarly simple. The parsers have a recover +keyword argument that the HTMLParser sets by default. It lets libxml2 +try its best to return a valid HTML tree with all content it can +manage to parse. It will not raise an exception on parser errors. +You should use libxml2 version 2.6.21 or newer to take advantage of +this feature.

+
>>> broken_html = "<html><head><title>test<body><h1>page title</h3>"
+
+>>> parser = etree.HTMLParser()
+>>> tree   = etree.parse(StringIO(broken_html), parser)
+
+>>> result = etree.tostring(tree.getroot(),
+...                         pretty_print=True, method="html")
+>>> print(result)
+<html>
+  <head>
+    <title>test</title>
+  </head>
+  <body>
+    <h1>page title</h1>
+  </body>
+</html>
+
+

Lxml has an HTML function, similar to the XML shortcut known from +ElementTree:

+
>>> html = etree.HTML(broken_html)
+>>> result = etree.tostring(html, pretty_print=True, method="html")
+>>> print(result)
+<html>
+  <head>
+    <title>test</title>
+  </head>
+  <body>
+    <h1>page title</h1>
+  </body>
+</html>
+
+

The support for parsing broken HTML depends entirely on libxml2's recovery +algorithm. It is not the fault of lxml if you find documents that are so +heavily broken that the parser cannot handle them. There is also no guarantee +that the resulting tree will contain all data from the original document. The +parser may have to drop seriously broken parts when struggling to keep +parsing. Especially misplaced meta tags can suffer from this, which may lead +to encoding problems.

+

Note that the result is a valid HTML tree, but it may not be a +well-formed XML tree. For example, XML forbids double hyphens in +comments, which the HTML parser will happily accept in recovery mode. +Therefore, if your goal is to serialise an HTML document as an +XML/XHTML document after parsing, you may have to apply some manual +preprocessing first.

+
+
+

Doctype information

+

The use of the libxml2 parsers makes some additional information available at +the API level. Currently, ElementTree objects can access the DOCTYPE +information provided by a parsed document, as well as the XML version and the +original encoding:

+
>>> pub_id  = "-//W3C//DTD XHTML 1.0 Transitional//EN"
+>>> sys_url = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+>>> doctype_string = '<!DOCTYPE html PUBLIC "%s" "%s">' % (pub_id, sys_url)
+>>> xml_header = '<?xml version="1.0" encoding="ascii"?>'
+>>> xhtml = xml_header + doctype_string + '<html><body></body></html>'
+
+>>> tree = etree.parse(StringIO(xhtml))
+>>> docinfo = tree.docinfo
+>>> print(docinfo.public_id)
+-//W3C//DTD XHTML 1.0 Transitional//EN
+>>> print(docinfo.system_url)
+http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
+>>> docinfo.doctype == doctype_string
+True
+
+>>> print(docinfo.xml_version)
+1.0
+>>> print(docinfo.encoding)
+ascii
+
+
+
+
+

The target parser interface

+

As in ElementTree, and similar to a SAX event handler, you can pass +a target object to the parser:

+
>>> class EchoTarget:
+...     def start(self, tag, attrib):
+...         print("start %s %s" % (tag, attrib))
+...     def end(self, tag):
+...         print("end %s" % tag)
+...     def data(self, data):
+...         print("data %r" % data)
+...     def comment(self, text):
+...         print("comment %s" % text)
+...     def close(self):
+...         print("close")
+...         return "closed!"
+
+>>> parser = etree.XMLParser(target = EchoTarget())
+
+>>> result = etree.XML("<element>some<!--comment-->text</element>",
+...                    parser)
+start element {}
+data u'some'
+comment comment
+data u'text'
+end element
+close
+
+>>> print(result)
+closed!
+
+

It is important for the .close() method to reset the parser target +to a usable state, so that you can reuse the parser as often as you +like:

+
>>> result = etree.XML("<element>some<!--comment-->text</element>",
+...                    parser)
+start element {}
+data u'some'
+comment comment
+data u'text'
+end element
+close
+
+>>> print(result)
+closed!
+
+

Note that the parser does not build a tree when using a parser +target. The result of the parser run is whatever the target object +returns from its .close() method. If you want to return an XML +tree here, you have to create it programmatically in the target +object. An example for a parser target that builds a tree is the +TreeBuilder.

+
+
+>>> parser = etree.XMLParser(target = etree.TreeBuilder())
+
+
+>>> result = etree.XML("<element>some<!--comment-->text</element>",
+...                    parser)
+
+
+>>> print(result.tag)
+element
+>>> print(result[0].text)
+comment
+
+
+
+
+

The feed parser interface

+

Since lxml 2.0, the parsers have a feed parser interface that is +compatible to the ElementTree parsers. You can use it to feed data +into the parser in a controlled step-by-step way.

+

In lxml.etree, you can use both interfaces to a parser at the same +time: the parse() or XML() functions, and the feed parser +interface. Both are independent and will not conflict (except if used +in conjunction with a parser target object as described above).

+

To start parsing with a feed parser, just call its feed() method +to feed it some data.

+
>>> parser = etree.XMLParser()
+
+>>> for data in ('<?xml versio', 'n="1.0"?', '><roo', 't><a', '/></root>'):
+...     parser.feed(data)
+
+

When you are done parsing, you must call the close() method to +retrieve the root Element of the parse result document, and to unlock the +parser:

+
>>> root = parser.close()
+
+>>> print(root.tag)
+root
+>>> print(root[0].tag)
+a
+
+

If you do not call close(), the parser will stay locked and +subsequent feeds will keep appending data, usually resulting in a non +well-formed document and an unexpected parser error. So make sure you +always close the parser after use, also in the exception case.

+

Another way of achieving the same step-by-step parsing is by writing your own +file-like object that returns a chunk of data on each read() call. Where +the feed parser interface allows you to actively pass data chunks into the +parser, a file-like object passively responds to read() requests of the +parser itself. Depending on the data source, either way may be more natural.

+

Note that the feed parser has its own error log called +feed_error_log. Errors in the feed parser do not show up in the +normal error_log and vice versa.

+

You can also combine the feed parser interface with the target parser:

+
>>> parser = etree.XMLParser(target = EchoTarget())
+
+>>> parser.feed("<eleme")
+>>> parser.feed("nt>some text</elem")
+start element {}
+data u'some text'
+>>> parser.feed("ent>")
+end element
+
+>>> result = parser.close()
+close
+>>> print(result)
+closed!
+
+

Again, this prevents the automatic creation of an XML tree and leaves +all the event handling to the target object. The close() method +of the parser forwards the return value of the target's close() +method.

+
+
+

iterparse and iterwalk

+

As known from ElementTree, the iterparse() utility function +returns an iterator that generates parser events for an XML file (or +file-like object), while building the tree. The values are tuples +(event-type, object). The event types supported by ElementTree +and lxml.etree are the strings 'start', 'end', 'start-ns' and +'end-ns'.

+

The 'start' and 'end' events represent opening and closing elements. +They are accompanied by the respective Element instance. By default, +only 'end' events are generated:

+
>>> xml = '''\
+... <root>
+...   <element key='value'>text</element>
+...   <element>text</element>tail
+...   <empty-element xmlns="http://testns/" />
+... </root>
+... '''
+
+>>> context = etree.iterparse(StringIO(xml))
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+end: element
+end: element
+end: {http://testns/}empty-element
+end: root
+
+

The resulting tree is available through the root property of the iterator:

+
>>> context.root.tag
+'root'
+
+

The other event types can be activated with the events keyword argument:

+
>>> events = ("start", "end")
+>>> context = etree.iterparse(StringIO(xml), events=events)
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+start: root
+start: element
+end: element
+start: element
+end: element
+start: {http://testns/}empty-element
+end: {http://testns/}empty-element
+end: root
+
+

The 'start-ns' and 'end-ns' events notify about namespace +declarations. They do not come with Elements. Instead, the value of +the 'start-ns' event is a tuple (prefix, namespaceURI) that +designates the beginning of a prefix-namespace mapping. The +corresponding end-ns event does not have a value (None). It is +common practice to use a list as namespace stack and pop the last +entry on the 'end-ns' event.

+
>>> print(xml[:-1])
+<root>
+  <element key='value'>text</element>
+  <element>text</element>tail
+  <empty-element xmlns="http://testns/" />
+</root>
+
+>>> events = ("start", "end", "start-ns", "end-ns")
+>>> context = etree.iterparse(StringIO(xml), events=events)
+>>> for action, elem in context:
+...     if action in ('start', 'end'):
+...         print("%s: %s" % (action, elem.tag))
+...     elif action == 'start-ns':
+...         print("%s: %s" % (action, elem))
+...     else:
+...         print(action)
+start: root
+start: element
+end: element
+start: element
+end: element
+start-ns: ('', 'http://testns/')
+start: {http://testns/}empty-element
+end: {http://testns/}empty-element
+end-ns
+end: root
+
+
+

Selective tag events

+

As an extension over ElementTree, lxml.etree accepts a tag keyword +argument just like element.iter(tag). This restricts events to a +specific tag or namespace:

+
>>> context = etree.iterparse(StringIO(xml), tag="element")
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+end: element
+end: element
+
+>>> events = ("start", "end")
+>>> context = etree.iterparse(
+...             StringIO(xml), events=events, tag="{http://testns/}*")
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+start: {http://testns/}empty-element
+end: {http://testns/}empty-element
+
+
+
+

Comments and PIs

+

As an extension over ElementTree, the iterparse() function in +lxml.etree also supports the event types 'comment' and 'pi' for the +respective XML structures.

+
>>> commented_xml = '''\
+... <?some pi ?>
+... <!-- a comment -->
+... <root>
+...   <element key='value'>text</element>
+...   <!-- another comment -->
+...   <element>text</element>tail
+...   <empty-element xmlns="http://testns/" />
+... </root>
+... '''
+
+>>> events = ("start", "end", "comment", "pi")
+>>> context = etree.iterparse(StringIO(commented_xml), events=events)
+>>> for action, elem in context:
+...     if action in ('start', 'end'):
+...         print("%s: %s" % (action, elem.tag))
+...     elif action == 'pi':
+...         print("%s: -%s=%s-" % (action, elem.target, elem.text))
+...     else: # 'comment'
+...         print("%s: -%s-" % (action, elem.text))
+pi: -some=pi -
+comment: - a comment -
+start: root
+start: element
+end: element
+comment: - another comment -
+start: element
+end: element
+start: {http://testns/}empty-element
+end: {http://testns/}empty-element
+end: root
+
+>>> print(context.root.tag)
+root
+
+
+
+

Modifying the tree

+

You can modify the element and its descendants when handling the 'end' event. +To save memory, for example, you can remove subtrees that are no longer +needed:

+
>>> context = etree.iterparse(StringIO(xml))
+>>> for action, elem in context:
+...     print(len(elem))
+...     elem.clear()
+0
+0
+0
+3
+>>> context.root.getchildren()
+[]
+
+

WARNING: During the 'start' event, the descendants and following siblings +are not yet available and should not be accessed. During the 'end' event, the +element and its descendants can be freely modified, but its following siblings +should not be accessed. During either of the two events, you must not +modify or move the ancestors (parents) of the current element. You should +also avoid moving or discarding the element itself. The golden rule is: do +not touch anything that will have to be touched again by the parser later on.

+

If you have elements with a long list of children in your XML file and want to +save more memory during parsing, you can clean up the preceding siblings of +the current element:

+
>>> for event, element in etree.iterparse(StringIO(xml)):
+...     # ... do something with the element
+...     element.clear()                 # clean up children
+...     while element.getprevious() is not None:
+...         del element.getparent()[0]  # clean up preceding siblings
+
+

The while loop deletes multiple siblings in a row. This is only necessary +if you skipped over some of them using the tag keyword argument. +Otherwise, a simple if should do. The more selective your tag is, +however, the more thought you will have to put into finding the right way to +clean up the elements that were skipped. Therefore, it is sometimes easier to +traverse all elements and do the tag selection by hand in the event handler +code.

+
+
+

iterwalk

+

A second extension over ElementTree is the iterwalk() function. It +behaves exactly like iterparse(), but works on Elements and ElementTrees:

+
>>> root = etree.XML(xml)
+>>> context = etree.iterwalk(
+...             root, events=("start", "end"), tag="element")
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+start: element
+end: element
+start: element
+end: element
+
+>>> f = StringIO(xml)
+>>> context = etree.iterparse(
+...             f, events=("start", "end"), tag="element")
+
+>>> for action, elem in context:
+...     print("%s: %s" % (action, elem.tag))
+start: element
+end: element
+start: element
+end: element
+
+
+
+
+

Python unicode strings

+

lxml.etree has broader support for Python unicode strings than the ElementTree +library. First of all, where ElementTree would raise an exception, the +parsers in lxml.etree can handle unicode strings straight away. This is most +helpful for XML snippets embedded in source code using the XML() +function:

+
>>> uxml = u'<test> \uf8d1 + \uf8d2 </test>'
+>>> uxml
+u'<test> \uf8d1 + \uf8d2 </test>'
+>>> root = etree.XML(uxml)
+
+

This requires, however, that unicode strings do not specify a conflicting +encoding themselves and thus lie about their real encoding:

+
>>> etree.XML( u'<?xml version="1.0" encoding="ASCII"?>\n' + uxml )
+Traceback (most recent call last):
+  ...
+ValueError: Unicode strings with encoding declaration are not supported.
+
+

Similarly, you will get errors when you try the same with HTML data in a +unicode string that specifies a charset in a meta tag of the header. You +should generally avoid converting XML/HTML data to unicode before passing it +into the parsers. It is both slower and error prone.

+
+

Serialising to Unicode strings

+

To serialize the result, you would normally use the tostring() +module function, which serializes to plain ASCII by default or a +number of other byte encodings if asked for:

+
>>> etree.tostring(root)
+b'<test> &#63697; + &#63698; </test>'
+
+>>> etree.tostring(root, encoding='UTF-8', xml_declaration=False)
+b'<test> \xef\xa3\x91 + \xef\xa3\x92 </test>'
+
+

As an extension, lxml.etree recognises the unicode type as an argument to the +encoding parameter to build a Python unicode representation of a tree:

+
>>> etree.tostring(root, encoding=unicode)
+u'<test> \uf8d1 + \uf8d2 </test>'
+
+>>> el = etree.Element("test")
+>>> etree.tostring(el, encoding=unicode)
+u'<test/>'
+
+>>> subel = etree.SubElement(el, "subtest")
+>>> etree.tostring(el, encoding=unicode)
+u'<test><subtest/></test>'
+
+>>> tree = etree.ElementTree(el)
+>>> etree.tostring(tree, encoding=unicode)
+u'<test><subtest/></test>'
+
+

The result of tostring(encoding=unicode) can be treated like any +other Python unicode string and then passed back into the parsers. +However, if you want to save the result to a file or pass it over the +network, you should use write() or tostring() with a byte +encoding (typically UTF-8) to serialize the XML. The main reason is +that unicode strings returned by tostring(encoding=unicode) are +not byte streams and they never have an XML declaration to specify +their encoding. These strings are most likely not parsable by other +XML libraries.

+

For normal byte encodings, the tostring() function automatically +adds a declaration as needed that reflects the encoding of the +returned string. This makes it possible for other parsers to +correctly parse the XML byte stream. Note that using tostring() +with UTF-8 is also considerably faster in most cases.

+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/performance.html b/doc/html/performance.html new file mode 100644 index 0000000..137de89 --- /dev/null +++ b/doc/html/performance.html @@ -0,0 +1,719 @@ + + + + + +Benchmarks and Speed + + + + + + +
+

Benchmarks and Speed

+ +++ + + + +
Author:Stefan Behnel
+

lxml.etree is a very fast XML library. Most of this is due to the +speed of libxml2, e.g. the parser and serialiser, or the XPath engine. +Other areas of lxml were specifically written for high performance in +high-level operations, such as the tree iterators.

+

On the other hand, the simplicity of lxml sometimes hides internal +operations that are more costly than the API suggests. If you are not +aware of these cases, lxml may not always perform as you expect. A +common example in the Python world is the Python list type. New users +often expect it to be a linked list, while it actually is implemented +as an array, which results in a completely different complexity for +common operations.

+

Similarly, the tree model of libxml2 is more complex than what lxml's +ElementTree API projects into Python space, so some operations may +show unexpected performance. Rest assured that most lxml users will +not notice this in real life, as lxml is very fast in absolute +numbers. It is definitely fast enough for most applications, so lxml +is probably somewhere between 'fast enough' and 'the best choice' for +yours. Read some messages from happy users to see what we mean.

+

This text describes where lxml.etree (abbreviated to 'lxe') excels, gives +hints on some performance traps and compares the overall performance to the +original ElementTree (ET) and cElementTree (cET) libraries by Fredrik Lundh. +The cElementTree library is a fast C-implementation of the original +ElementTree.

+ +
+

General notes

+

First thing to say: there is an overhead involved in having a DOM-like C +library mimic the ElementTree API. As opposed to ElementTree, lxml has to +generate Python representations of tree nodes on the fly when asked for them, +and the internal tree structure of libxml2 results in a higher maintenance +overhead than the simpler top-down structure of ElementTree. What this means +is: the more of your code runs in Python, the less you can benefit from the +speed of lxml and libxml2. Note, however, that this is true for most +performance critical Python applications. No one would implement fourier +transformations in pure Python when you can use NumPy.

+

The up side then is that lxml provides powerful tools like tree iterators, +XPath and XSLT, that can handle complex operations at the speed of C. Their +pythonic API in lxml makes them so flexible that most applications can easily +benefit from them.

+
+
+

How to read the timings

+

The statements made here are backed by the (micro-)benchmark scripts +bench_etree.py, bench_xpath.py and bench_objectify.py that come with +the lxml source distribution. They are distributed under the same BSD license +as lxml itself, and the lxml project would like to promote them as a general +benchmarking suite for all ElementTree implementations. New benchmarks are +very easy to add as tiny test methods, so if you write a performance test for +a specific part of the API yourself, please consider sending it to the lxml +mailing list.

+

The timings cited below compare lxml 2.2 (with libxml2 2.7.3) to the +February 2009 SVN versions of ElementTree (1.3alpha2) and cElementTree +(1.0.6). They were run single-threaded on a 1.8GHz Intel Core Duo +machine under Ubuntu Linux 8.10 (Intrepid). The C libraries were +compiled with the same platform specific optimisation flags. The +Python interpreter (2.6.1) was manually compiled for the platform. +Note that many of the following ElementTree timings are therefore +better then what a normal Python installation with the standard +library (c)ElementTree modules would yield.

+

The scripts run a number of simple tests on the different libraries, using +different XML tree configurations: different tree sizes (T1-4), with or +without attributes (-/A), with or without ASCII string or unicode text +(-/S/U), and either against a tree or its serialised XML form (T/X). In the +result extracts cited below, T1 refers to a 3-level tree with many children at +the third level, T2 is swapped around to have many children below the root +element, T3 is a deep tree with few children at each level and T4 is a small +tree, slightly broader than deep. If repetition is involved, this usually +means running the benchmark in a loop over all children of the tree root, +otherwise, the operation is run on the root node (C/R).

+

As an example, the character code (SATR T1) states that the benchmark was +running for tree T1, with plain string text (S) and attributes (A). It was +run against the root element (R) in the tree structure of the data (T).

+

Note that very small operations are repeated in integer loops to make them +measurable. It is therefore not always possible to compare the absolute +timings of, say, a single access benchmark (which usually loops) and a 'get +all in one step' benchmark, which already takes enough time to be measurable +and is therefore measured as is. An example is the index access to a single +child, which cannot be compared to the timings for getchildren(). Take a +look at the concrete benchmarks in the scripts to understand how the numbers +compare.

+
+
+

Parsing and Serialising

+

Serialisation is an area where lxml excels. The reason is that it +executes entirely at the C level, without any interaction with Python +code. The results are rather impressive, especially for UTF-8, which +is native to libxml2. While 20 to 40 times faster than (c)ElementTree +1.2 (which is part of the standard library since Python 2.5), lxml is +still more than 7 times as fast as the much improved ElementTree 1.3:

+
+lxe: tostring_utf16  (SATR T1)   22.4042 msec/pass
+cET: tostring_utf16  (SATR T1)  184.5090 msec/pass
+ET : tostring_utf16  (SATR T1)  182.4350 msec/pass
+
+lxe: tostring_utf16  (UATR T1)   23.1769 msec/pass
+cET: tostring_utf16  (UATR T1)  188.6780 msec/pass
+ET : tostring_utf16  (UATR T1)  186.7781 msec/pass
+
+lxe: tostring_utf16  (S-TR T2)   21.8501 msec/pass
+cET: tostring_utf16  (S-TR T2)  200.0139 msec/pass
+ET : tostring_utf16  (S-TR T2)  190.8720 msec/pass
+
+lxe: tostring_utf8   (S-TR T2)   17.1690 msec/pass
+cET: tostring_utf8   (S-TR T2)  192.3709 msec/pass
+ET : tostring_utf8   (S-TR T2)  189.7140 msec/pass
+
+lxe: tostring_utf8   (U-TR T3)    4.9832 msec/pass
+cET: tostring_utf8   (U-TR T3)   60.2911 msec/pass
+ET : tostring_utf8   (U-TR T3)   57.8101 msec/pass
+
+

The same applies to plain text serialisation. Note that cElementTree +does not currently support this, as it is a new feature in ET 1.3 and +lxml.etree 2.0:

+
+lxe: tostring_text_ascii     (S-TR T1)    4.3709 msec/pass
+ET : tostring_text_ascii     (S-TR T1)   83.9939 msec/pass
+
+lxe: tostring_text_ascii     (S-TR T3)    1.3590 msec/pass
+ET : tostring_text_ascii     (S-TR T3)   26.6340 msec/pass
+
+lxe: tostring_text_utf16     (S-TR T1)    6.2978 msec/pass
+ET : tostring_text_utf16     (S-TR T1)   84.7399 msec/pass
+
+lxe: tostring_text_utf16     (U-TR T1)    7.7510 msec/pass
+ET : tostring_text_utf16     (U-TR T1)   79.9279 msec/pass
+
+

Unlike ElementTree, the tostring() function in lxml also supports +serialisation to a Python unicode string object:

+
+lxe: tostring_text_unicode   (S-TR T1)    4.6940 msec/pass
+lxe: tostring_text_unicode   (U-TR T1)    6.3069 msec/pass
+lxe: tostring_text_unicode   (S-TR T3)    1.3652 msec/pass
+lxe: tostring_text_unicode   (U-TR T3)    2.0702 msec/pass
+
+

For parsing, on the other hand, the advantage is clearly with +cElementTree. The (c)ET libraries use a very thin layer on top of the +expat parser, which is known to be extremely fast:

+
+lxe: parse_stringIO  (SAXR T1)   50.0100 msec/pass
+cET: parse_stringIO  (SAXR T1)   19.3238 msec/pass
+ET : parse_stringIO  (SAXR T1)  318.2330 msec/pass
+
+lxe: parse_stringIO  (S-XR T3)    6.1851 msec/pass
+cET: parse_stringIO  (S-XR T3)    5.7080 msec/pass
+ET : parse_stringIO  (S-XR T3)   83.5931 msec/pass
+
+lxe: parse_stringIO  (UAXR T3)   34.4319 msec/pass
+cET: parse_stringIO  (UAXR T3)   28.8520 msec/pass
+ET : parse_stringIO  (UAXR T3)  164.5968 msec/pass
+
+

While about as fast for smaller documents, the expat parser allows cET +to be up to 2 times faster than lxml on plain parser performance for +large input documents. Similar timings can be observed for the +iterparse() function:

+
+lxe: iterparse_stringIO  (SAXR T1)   57.8308 msec/pass
+cET: iterparse_stringIO  (SAXR T1)   23.8140 msec/pass
+ET : iterparse_stringIO  (SAXR T1)  349.5209 msec/pass
+
+lxe: iterparse_stringIO  (UAXR T3)   37.2162 msec/pass
+cET: iterparse_stringIO  (UAXR T3)   30.2329 msec/pass
+ET : iterparse_stringIO  (UAXR T3)  171.4060 msec/pass
+
+

However, if you benchmark the complete round-trip of a serialise-parse +cycle, the numbers will look similar to these:

+
+lxe: write_utf8_parse_stringIO  (S-TR T1)   60.2388 msec/pass
+cET: write_utf8_parse_stringIO  (S-TR T1)  314.9750 msec/pass
+ET : write_utf8_parse_stringIO  (S-TR T1)  616.4260 msec/pass
+
+lxe: write_utf8_parse_stringIO  (UATR T2)   71.7540 msec/pass
+cET: write_utf8_parse_stringIO  (UATR T2)  364.4099 msec/pass
+ET : write_utf8_parse_stringIO  (UATR T2)  684.5109 msec/pass
+
+lxe: write_utf8_parse_stringIO  (S-TR T3)   10.7441 msec/pass
+cET: write_utf8_parse_stringIO  (S-TR T3)  103.3869 msec/pass
+ET : write_utf8_parse_stringIO  (S-TR T3)  179.5921 msec/pass
+
+lxe: write_utf8_parse_stringIO  (SATR T4)    1.1981 msec/pass
+cET: write_utf8_parse_stringIO  (SATR T4)    7.0901 msec/pass
+ET : write_utf8_parse_stringIO  (SATR T4)   10.4899 msec/pass
+
+

For applications that require a high parser throughput of large files, +and that do little to no serialization, cET is the best choice. Also +for iterparse applications that extract small amounts of data or +aggregate information from large XML data sets that do not fit into +memory. If it comes to round-trip performance, however, lxml tends to +be multiple times faster in total. So, whenever the input documents +are not considerably larger than the output, lxml is the clear winner.

+

Regarding HTML parsing, Ian Bicking has done some benchmarking on +lxml's HTML parser, comparing it to a number of other famous HTML +parser tools for Python. lxml wins this contest by quite a length. +To give an idea, the numbers suggest that lxml.html can run a couple +of parse-serialise cycles in the time that other tools need for +parsing alone. The comparison even shows some very favourable results +regarding memory consumption.

+

Liza Daly has written an article that presents a couple of tweaks to +get the most out of lxml's parser for very large XML documents. She +quite favourably positions lxml.etree as a tool for +high-performance XML parsing.

+

Finally, xml.com has a couple of publications about XML parser +performance. Farwick and Hafner have written two interesting articles +that compare the parser of libxml2 to some major Java based XML +parsers. One deals with event-driven parser performance, the other +one presents benchmark results comparing DOM parsers. Both +comparisons suggest that libxml2's parser performance is largely +superiour to all commonly used Java parsers in almost all cases. Note +that the C parser benchmark results are based on xmlbench, which uses +a simpler setup for libxml2 than lxml does.

+
+
+

The ElementTree API

+

Since all three libraries implement the same API, their performance is +easy to compare in this area. A major disadvantage for lxml's +performance is the different tree model that underlies libxml2. It +allows lxml to provide parent pointers for elements and full XPath +support, but also increases the overhead of tree building and +restructuring. This can be seen from the tree setup times of the +benchmark (given in seconds):

+
+lxe:       --     S-     U-     -A     SA     UA
+     T1: 0.0502 0.0572 0.0613 0.0494 0.0575 0.0615
+     T2: 0.0602 0.0691 0.0747 0.0651 0.0745 0.0796
+     T3: 0.0145 0.0157 0.0176 0.0392 0.0411 0.0415
+     T4: 0.0003 0.0003 0.0003 0.0008 0.0008 0.0008
+cET:       --     S-     U-     -A     SA     UA
+     T1: 0.0092 0.0094 0.0094 0.0094 0.0096 0.0093
+     T2: 0.0152 0.0151 0.0152 0.0156 0.0154 0.0154
+     T3: 0.0079 0.0080 0.0079 0.0106 0.0107 0.0134
+     T4: 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001
+ET :       --     S-     U-     -A     SA     UA
+     T1: 0.1017 0.1715 0.1962 0.1080 0.2470 0.1049
+     T2: 0.3130 0.3324 0.1130 0.3897 0.1158 0.4246
+     T3: 0.0341 0.0323 0.0338 0.0358 0.3965 0.0359
+     T4: 0.0006 0.0005 0.0006 0.0006 0.0007 0.0006
+
+

While lxml is still a lot faster than ET in most cases, cET can be up +to five times faster than lxml here. One of the reasons is that lxml +must encode incoming string data and tag names into UTF-8, and +additionally discard the created Python elements after their use, when +they are no longer referenced. ET and cET represent the tree itself +through these objects, which reduces the overhead in creating them.

+
+

Child access

+

The same reason makes operations like collecting children as in +list(element) more costly in lxml. Where ET and cET can quickly +create a shallow copy of their list of children, lxml has to create a +Python object for each child and collect them in a list:

+
+lxe: root_list_children        (--TR T1)    0.0148 msec/pass
+cET: root_list_children        (--TR T1)    0.0050 msec/pass
+ET : root_list_children        (--TR T1)    0.0219 msec/pass
+
+lxe: root_list_children        (--TR T2)    0.1719 msec/pass
+cET: root_list_children        (--TR T2)    0.0260 msec/pass
+ET : root_list_children        (--TR T2)    0.3390 msec/pass
+
+

This handicap is also visible when accessing single children:

+
+lxe: first_child               (--TR T2)    0.1879 msec/pass
+cET: first_child               (--TR T2)    0.1760 msec/pass
+ET : first_child               (--TR T2)    0.8099 msec/pass
+
+lxe: last_child                (--TR T1)    0.1910 msec/pass
+cET: last_child                (--TR T1)    0.1872 msec/pass
+ET : last_child                (--TR T1)    0.8099 msec/pass
+
+

... unless you also add the time to find a child index in a bigger +list. ET and cET use Python lists here, which are based on arrays. +The data structure used by libxml2 is a linked tree, and thus, a +linked list of children:

+
+lxe: middle_child              (--TR T1)    0.2189 msec/pass
+cET: middle_child              (--TR T1)    0.1779 msec/pass
+ET : middle_child              (--TR T1)    0.8030 msec/pass
+
+lxe: middle_child              (--TR T2)    2.4071 msec/pass
+cET: middle_child              (--TR T2)    0.1781 msec/pass
+ET : middle_child              (--TR T2)    0.8039 msec/pass
+
+
+
+

Element creation

+

As opposed to ET, libxml2 has a notion of documents that each element must be +in. This results in a major performance difference for creating independent +Elements that end up in independently created documents:

+
+lxe: create_elements           (--TC T2)    2.1949 msec/pass
+cET: create_elements           (--TC T2)    0.1941 msec/pass
+ET : create_elements           (--TC T2)    1.2760 msec/pass
+
+

Therefore, it is always preferable to create Elements for the document they +are supposed to end up in, either as SubElements of an Element or using the +explicit Element.makeelement() call:

+
+lxe: makeelement               (--TC T2)    1.8370 msec/pass
+cET: makeelement               (--TC T2)    0.3200 msec/pass
+ET : makeelement               (--TC T2)    1.5380 msec/pass
+
+lxe: create_subelements        (--TC T2)    1.6761 msec/pass
+cET: create_subelements        (--TC T2)    0.2329 msec/pass
+ET : create_subelements        (--TC T2)    3.0999 msec/pass
+
+

So, if the main performance bottleneck of an application is creating large XML +trees in memory through calls to Element and SubElement, cET is the best +choice. Note, however, that the serialisation performance may even out this +advantage, especially for smaller trees and trees with many attributes.

+
+
+

Merging different sources

+

A critical action for lxml is moving elements between document contexts. It +requires lxml to do recursive adaptations throughout the moved tree structure.

+

The following benchmark appends all root children of the second tree to the +root of the first tree:

+
+lxe: append_from_document      (--TR T1,T2)    3.4299 msec/pass
+cET: append_from_document      (--TR T1,T2)    0.2639 msec/pass
+ET : append_from_document      (--TR T1,T2)    1.1489 msec/pass
+
+lxe: append_from_document      (--TR T3,T4)    0.0429 msec/pass
+cET: append_from_document      (--TR T3,T4)    0.0169 msec/pass
+ET : append_from_document      (--TR T3,T4)    0.0780 msec/pass
+
+

Although these are fairly small numbers compared to parsing, this easily shows +the different performance classes for lxml and (c)ET. Where the latter do not +have to care about parent pointers and tree structures, lxml has to deep +traverse the appended tree. The performance difference therefore increases +with the size of the tree that is moved.

+

This difference is not always as visible, but applies to most parts of the +API, like inserting newly created elements:

+
+lxe: insert_from_document      (--TR T1,T2)    6.1119 msec/pass
+cET: insert_from_document      (--TR T1,T2)    0.4129 msec/pass
+ET : insert_from_document      (--TR T1,T2)    1.4160 msec/pass
+
+

or replacing the child slice by a newly created element:

+
+lxe: replace_children_element  (--TC T1)    0.1769 msec/pass
+cET: replace_children_element  (--TC T1)    0.0250 msec/pass
+ET : replace_children_element  (--TC T1)    0.1538 msec/pass
+
+

as opposed to replacing the slice with an existing element from the +same document:

+
+lxe: replace_children          (--TC T1)    0.0169 msec/pass
+cET: replace_children          (--TC T1)    0.0119 msec/pass
+ET : replace_children          (--TC T1)    0.0758 msec/pass
+
+

While these numbers are too small to provide a major performance +impact in practice, you should keep this difference in mind when you +merge very large trees.

+
+
+

deepcopy

+

Deep copying a tree is fast in lxml:

+
+lxe: deepcopy_all              (--TR T1)   10.0670 msec/pass
+cET: deepcopy_all              (--TR T1)  115.8700 msec/pass
+ET : deepcopy_all              (--TR T1)  866.8201 msec/pass
+
+lxe: deepcopy_all              (-ATR T2)   12.4321 msec/pass
+cET: deepcopy_all              (-ATR T2)  130.1000 msec/pass
+ET : deepcopy_all              (-ATR T2)  901.1638 msec/pass
+
+lxe: deepcopy_all              (S-TR T3)    2.6951 msec/pass
+cET: deepcopy_all              (S-TR T3)   28.9950 msec/pass
+ET : deepcopy_all              (S-TR T3)  218.7109 msec/pass
+
+

So, for example, if you have a database-like scenario where you parse in a +large tree and then search and copy independent subtrees from it for further +processing, lxml is by far the best choice here.

+
+
+

Tree traversal

+

Another area where lxml is very fast is iteration for tree traversal. If your +algorithms can benefit from step-by-step traversal of the XML tree and +especially if few elements are of interest or the target element tag name is +known, lxml is a good choice:

+
+lxe: getiterator_all      (--TR T1)    4.7209 msec/pass
+cET: getiterator_all      (--TR T1)   45.8400 msec/pass
+ET : getiterator_all      (--TR T1)   22.9480 msec/pass
+
+lxe: getiterator_islice   (--TR T2)    0.0398 msec/pass
+cET: getiterator_islice   (--TR T2)    0.3798 msec/pass
+ET : getiterator_islice   (--TR T2)    0.1900 msec/pass
+
+lxe: getiterator_tag      (--TR T2)    0.0160 msec/pass
+cET: getiterator_tag      (--TR T2)    0.8149 msec/pass
+ET : getiterator_tag      (--TR T2)    0.3560 msec/pass
+
+lxe: getiterator_tag_all  (--TR T2)    0.6580 msec/pass
+cET: getiterator_tag_all  (--TR T2)   46.3769 msec/pass
+ET : getiterator_tag_all  (--TR T2)   20.3989 msec/pass
+
+

This translates directly into similar timings for Element.findall():

+
+lxe: findall              (--TR T2)    6.7198 msec/pass
+cET: findall              (--TR T2)   51.2750 msec/pass
+ET : findall              (--TR T2)   26.9110 msec/pass
+
+lxe: findall              (--TR T3)    1.4520 msec/pass
+cET: findall              (--TR T3)   14.2760 msec/pass
+ET : findall              (--TR T3)    8.4310 msec/pass
+
+lxe: findall_tag          (--TR T2)    0.7401 msec/pass
+cET: findall_tag          (--TR T2)   46.5961 msec/pass
+ET : findall_tag          (--TR T2)   20.3760 msec/pass
+
+lxe: findall_tag          (--TR T3)    0.3331 msec/pass
+cET: findall_tag          (--TR T3)   11.5960 msec/pass
+ET : findall_tag          (--TR T3)    5.4510 msec/pass
+
+

Note that all three libraries currently use the same Python +implementation for .findall(), except for their native tree +iterator (element.iter()).

+
+
+
+

XPath

+

The following timings are based on the benchmark script bench_xpath.py.

+

This part of lxml does not have an equivalent in ElementTree. However, lxml +provides more than one way of accessing it and you should take care which part +of the lxml API you use. The most straight forward way is to call the +xpath() method on an Element or ElementTree:

+
+lxe: xpath_method         (--TC T1)    1.5750 msec/pass
+lxe: xpath_method         (--TC T2)   20.9570 msec/pass
+lxe: xpath_method         (--TC T3)    0.1199 msec/pass
+lxe: xpath_method         (--TC T4)    1.0121 msec/pass
+
+

This is well suited for testing and when the XPath expressions are as diverse +as the trees they are called on. However, if you have a single XPath +expression that you want to apply to a larger number of different elements, +the XPath class is the most efficient way to do it:

+
+lxe: xpath_class          (--TC T1)    0.6301 msec/pass
+lxe: xpath_class          (--TC T2)    2.6128 msec/pass
+lxe: xpath_class          (--TC T3)    0.0498 msec/pass
+lxe: xpath_class          (--TC T4)    0.1400 msec/pass
+
+

Note that this still allows you to use variables in the expression, so you can +parse it once and then adapt it through variables at call time. In other +cases, where you have a fixed Element or ElementTree and want to run different +expressions on it, you should consider the XPathEvaluator:

+
+lxe: xpath_element        (--TR T1)    0.2739 msec/pass
+lxe: xpath_element        (--TR T2)   10.8800 msec/pass
+lxe: xpath_element        (--TR T3)    0.0660 msec/pass
+lxe: xpath_element        (--TR T4)    0.2739 msec/pass
+
+

While it looks slightly slower, creating an XPath object for each of the +expressions generates a much higher overhead here:

+
+lxe: xpath_class_repeat   (--TC T1)    1.5399 msec/pass
+lxe: xpath_class_repeat   (--TC T2)   20.5159 msec/pass
+lxe: xpath_class_repeat   (--TC T3)    0.1178 msec/pass
+lxe: xpath_class_repeat   (--TC T4)    0.9880 msec/pass
+
+
+
+

A longer example

+

... based on lxml 1.3.

+

A while ago, Uche Ogbuji posted a benchmark proposal that would +read in a 3MB XML version of the Old Testament of the Bible and +look for the word begat in all verses. Apparently, it is contained +in 120 out of almost 24000 verses. This is easy to implement in +ElementTree using findall(). However, the fastest and most memory +friendly way to do this is obviously iterparse(), as most of the +data is not of any interest.

+

Now, Uche's original proposal was more or less the following:

+
def bench_ET():
+    tree = ElementTree.parse("ot.xml")
+    result = []
+    for v in tree.findall("//v"):
+        text = v.text
+        if 'begat' in text:
+            result.append(text)
+    return len(result)
+
+

which takes about one second on my machine today. The faster iterparse() +variant looks like this:

+
def bench_ET_iterparse():
+    result = []
+    for event, v in ElementTree.iterparse("ot.xml"):
+        if v.tag == 'v':
+            text = v.text
+            if 'begat' in text:
+                result.append(text)
+        v.clear()
+    return len(result)
+
+

The improvement is about 10%. At the time I first tried (early 2006), lxml +didn't have iterparse() support, but the findall() variant was already +faster than ElementTree. This changes immediately when you switch to +cElementTree. The latter only needs 0.17 seconds to do the trick today and +only some impressive 0.10 seconds when running the iterparse version. And +even back then, it was quite a bit faster than what lxml could achieve.

+

Since then, lxml has matured a lot and has gotten much faster. The iterparse +variant now runs in 0.14 seconds, and if you remove the v.clear(), it is +even a little faster (which isn't the case for cElementTree).

+

One of the many great tools in lxml is XPath, a swiss army knife for finding +things in XML documents. It is possible to move the whole thing to a pure +XPath implementation, which looks like this:

+
def bench_lxml_xpath_all():
+    tree = etree.parse("ot.xml")
+    result = tree.xpath("//v[contains(., 'begat')]/text()")
+    return len(result)
+
+

This runs in about 0.13 seconds and is about the shortest possible +implementation (in lines of Python code) that I could come up with. Now, this +is already a rather complex XPath expression compared to the simple "//v" +ElementPath expression we started with. Since this is also valid XPath, let's +try this instead:

+
def bench_lxml_xpath():
+    tree = etree.parse("ot.xml")
+    result = []
+    for v in tree.xpath("//v"):
+        text = v.text
+        if 'begat' in text:
+            result.append(text)
+    return len(result)
+
+

This gets us down to 0.12 seconds, thus showing that a generic XPath +evaluation engine cannot always compete with a simpler, tailored solution. +However, since this is not much different from the original findall variant, +we can remove the complexity of the XPath call completely and just go with +what we had in the beginning. Under lxml, this runs in the same 0.12 seconds.

+

But there is one thing left to try. We can replace the simple ElementPath +expression with a native tree iterator:

+
def bench_lxml_getiterator():
+    tree = etree.parse("ot.xml")
+    result = []
+    for v in tree.getiterator("v"):
+        text = v.text
+        if 'begat' in text:
+            result.append(text)
+    return len(result)
+
+

This implements the same thing, just without the overhead of parsing and +evaluating a path expression. And this makes it another bit faster, down to +0.11 seconds. For comparison, cElementTree runs this version in 0.17 seconds.

+

So, what have we learned?

+
    +
  • Python code is not slow. The pure XPath solution was not even as fast as +the first shot Python implementation. In general, a few more lines in +Python make things more readable, which is much more important than the last +5% of performance.
  • +
  • It's important to know the available options - and it's worth starting with +the most simple one. In this case, a programmer would then probably have +started with getiterator("v") or iterparse(). Either of them would +already have been the most efficient, depending on which library is used.
  • +
  • It's important to know your tool. lxml and cElementTree are both very fast +libraries, but they do not have the same performance characteristics. The +fastest solution in one library can be comparatively slow in the other. If +you optimise, optimise for the specific target platform.
  • +
  • It's not always worth optimising. After all that hassle we got from 0.12 +seconds for the initial implementation to 0.11 seconds. Switching over to +cElementTree and writing an iterparse() based version would have given +us 0.10 seconds - not a big difference for 3MB of XML.
  • +
  • Take care what operation is really dominating in your use case. If we split +up the operations, we can see that lxml is slightly slower than cElementTree +on parse() (both about 0.06 seconds), but more visibly slower on +iterparse(): 0.07 versus 0.10 seconds. However, tree iteration in lxml +is increadibly fast, so it can be better to parse the whole tree and then +iterate over it rather than using iterparse() to do both in one step. +Or, you can just wait for the lxml developers to optimise iterparse in one +of the next releases...
  • +
+
+
+

lxml.objectify

+

The following timings are based on the benchmark script bench_objectify.py.

+

Objectify is a data-binding API for XML based on lxml.etree, that was added in +version 1.1. It uses standard Python attribute access to traverse the XML +tree. It also features ObjectPath, a fast path language based on the same +meme.

+

Just like lxml.etree, lxml.objectify creates Python representations of +elements on the fly. To save memory, the normal Python garbage collection +mechanisms will discard them when their last reference is gone. In cases +where deeply nested elements are frequently accessed through the objectify +API, the create-discard cycles can become a bottleneck, as elements have to be +instantiated over and over again.

+
+

ObjectPath

+

ObjectPath can be used to speed up the access to elements that are deep in the +tree. It avoids step-by-step Python element instantiations along the path, +which can substantially improve the access time:

+
+lxe: attribute                  (--TR T1)    6.9990 msec/pass
+lxe: attribute                  (--TR T2)   29.2060 msec/pass
+lxe: attribute                  (--TR T4)    6.9048 msec/pass
+
+lxe: objectpath                 (--TR T1)    3.5410 msec/pass
+lxe: objectpath                 (--TR T2)   24.9801 msec/pass
+lxe: objectpath                 (--TR T4)    3.5069 msec/pass
+
+lxe: attributes_deep            (--TR T1)   16.9580 msec/pass
+lxe: attributes_deep            (--TR T2)   39.8140 msec/pass
+lxe: attributes_deep            (--TR T4)   16.9699 msec/pass
+
+lxe: objectpath_deep            (--TR T1)    9.4180 msec/pass
+lxe: objectpath_deep            (--TR T2)   31.7512 msec/pass
+lxe: objectpath_deep            (--TR T4)    9.4421 msec/pass
+
+

Note, however, that parsing ObjectPath expressions is not for free either, so +this is most effective for frequently accessing the same element.

+
+
+

Caching Elements

+

A way to improve the normal attribute access time is static instantiation of +the Python objects, thus trading memory for speed. Just create a cache +dictionary and run:

+
cache[root] = list(root.iter())
+
+

after parsing and:

+
del cache[root]
+
+

when you are done with the tree. This will keep the Python element +representations of all elements alive and thus avoid the overhead of repeated +Python object creation. You can also consider using filters or generator +expressions to be more selective. By choosing the right trees (or even +subtrees and elements) to cache, you can trade memory usage against access +speed:

+
+lxe: attribute_cached           (--TR T1)    5.1420 msec/pass
+lxe: attribute_cached           (--TR T2)   27.0739 msec/pass
+lxe: attribute_cached           (--TR T4)    5.1429 msec/pass
+
+lxe: attributes_deep_cached     (--TR T1)    7.0908 msec/pass
+lxe: attributes_deep_cached     (--TR T2)   29.5591 msec/pass
+lxe: attributes_deep_cached     (--TR T4)    7.1721 msec/pass
+
+lxe: objectpath_deep_cached     (--TR T1)    2.2731 msec/pass
+lxe: objectpath_deep_cached     (--TR T2)   23.1631 msec/pass
+lxe: objectpath_deep_cached     (--TR T4)    2.3179 msec/pass
+
+

Things to note: you cannot currently use weakref.WeakKeyDictionary objects +for this as lxml's element objects do not support weak references (which are +costly in terms of memory). Also note that new element objects that you add +to these trees will not turn up in the cache automatically and will therefore +still be garbage collected when all their Python references are gone, so this +is most effective for largely immutable trees. You should consider using a +set instead of a list in this case and add new elements by hand.

+
+
+

Further optimisations

+

Here are some more things to try if optimisation is required:

+
    +
  • A lot of time is usually spent in tree traversal to find the addressed +elements in the tree. If you often work in subtrees, do what you would also +do with deep Python objects: assign the parent of the subtree to a variable +or pass it into functions instead of starting at the root. This allows +accessing its descendents more directly.
  • +
  • Try assigning data values directly to attributes instead of passing them +through DataElement.
  • +
  • If you use custom data types that are costly to parse, try running +objectify.annotate() over read-only trees to speed up the attribute type +inference on read access.
  • +
+

Note that none of these measures is guaranteed to speed up your application. +As usual, you should prefer readable code over premature optimisations and +profile your expected use cases before bothering to apply optimisations at +random.

+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/proxies.png b/doc/html/proxies.png new file mode 100644 index 0000000..c00ccbc Binary files /dev/null and b/doc/html/proxies.png differ diff --git a/doc/html/pubkey.asc b/doc/html/pubkey.asc new file mode 100644 index 0000000..f72804c --- /dev/null +++ b/doc/html/pubkey.asc @@ -0,0 +1,36 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.2 (GNU/Linux) + +mQGiBEQf3JQRBACciSqxoX0q3VurkRENVVtG/pVqtFh/d2CohbVJlLCrO4s7nnPj +CTfZFt6tmykZjsLJl24XpEJt0O/C0jLcaBqvXVgVvRXHz4DjEYYuQF4LPthhI4MA +4T7ExptX4lU5g3BVJ46vPU8uRBbbxarBRas9rYewgnrYKWpZZCa7yMq+9wCgnyyR +Si4E3viLwi77jda135nA6vcD/iqu8zIl9/dFuUcOvxJrhrm+UdY72puZ1TVczSAH +GOqMjrKkfyHlaJh/ZzWENpTZIfOdVhy7Chvva18vH4Wz7jKj5UeIpRrBvjAD28r3 +Y3W5bfsnpPkvDOyU1vqBsw4q+/250GXEX0JqV2Rbf5yLVgEZPdGrswO460dr4UVS +8RS0BACYTmyrz57AugHc5tRkqNw6o7ux2deOT0c3AbUcOWtOocGumCsUf+M1nOrc +VWkeBWTv4HIIiecWYY/KwIemTthQGjxywaZDxOlBT0BOL/+vfYTq/plZULXr+g90 +rSe82+kLl9N5onkBDJKeDIcJDzRoxIRPV1i0Om/5JBI4jmUnv7QnU3RlZmFuIEJl +aG5lbCA8c2NvZGVyQHVzZXJzLmJlcmxpb3MuZGU+iF8EExECACAFAkQiqKYCGwMG +CwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRANPVNpCNOgHi+2AJ0a0JH8iP3RqrOL +JefvHz1dSl3MxACYo7Ma6CeIgsGnyaSSdNOmNVXn+IhGBBARAgAGBQJEIqk0AAoJ +ELO5mMzzmgZbmCcAoKZ2En1IlsxBpaPPxgWYrUOWfc6hAKCBWODMMOYptCBkSrjg +m3gsrjHgYbQsU3RlZmFuIEJlaG5lbCA8c2NvZGVyQHVzZXJzLnNvdXJjZWZvcmdl +Lm5ldD6IYAQTEQIAIAUCRB/clAIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJ +EA09U2kI06Aen2YAn0hvuDs+Gslq9vPRFFbsFNJI40PmAJ0chjiiEy0xV5C+n6YX +XFuldRDILYhGBBARAgAGBQJEIp4AAAoJELO5mMzzmgZbgKQAn3pWrmFdj8YaEyuR +tEjKVZJDQ6ZVAJ0Y1igwADT40BPra+G/xiLa3YbCrrkCDQREH9ynEAgAiR4/0r0d +doViNECfSLClllu5K0Bo1SEiMtvVNC3sJYgVzBddD8Xn8UAdjyAgmaL5FC2FsNQu +RxxKkNlHNYCq8ZSWtZaL2MQ+SyMUyHv6VXVCGuSW0COpzbx58u+SZpjyESJ1kaZc +73SaIw6kv/dVQHjurwmlo1lg3dLZ3PG08WGCYUMqkkv2K+J7+puzE2Cjo31gTq4s +LYDCV26wjVQ6BqT2EcHQhVEjh0xq5ugc908cr/2FQAKkTifEbF+OVBGWiFMGgri+ +6+G54/BV/RakpvNCFYBiZHn/M9mQaWt7XoTmnEQ1ldq5KNlRhkqnQRF/NK5VpGcQ +29As28aqpZTECwADBgf/WlRvBRI1Q1eIv2falEv7C6sOxqc3kr5z1uUBTRG5v9t6 +ff9k/J4oC6cnQx00GK3ZR8ija6bl8zwu+0m0M3rW49Krb1rsiT7r4ahOZ7p9RRro +oG3NbUJYgMG10D1nxpaioYqa/m+PpILJM0wfYZZEuX0xkZcOB24yb+J7EIcGR09T +mMd5sXtdTU+w/p7Xi2cP61uQ8qixyHBH8E06qgW2JtVFV9rGn7CNUOvkNaUBRnY5 +QxhdkvKJRx7voOLYWZFUBIWgto+6vmTgKmc2Ho6qddzME9UgwUNcknRgm0cf6Cxr +6zPtxZl8a6KemjQcK7kARSmMNCDkqp/Pohe519A5vYhJBBgRAgAJBQJEH9ynAhsM +AAoJEA09U2kI06Aesv4AnjiVQVLzqnNS/64vvMMP1UARY3HtAJ90YxNGhRNIhWYL +UU16oJlGD/9M1Q== +=gWy2 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/doc/html/resolvers.html b/doc/html/resolvers.html new file mode 100644 index 0000000..a609615 --- /dev/null +++ b/doc/html/resolvers.html @@ -0,0 +1,223 @@ + + + + + +Document loading and URL resolving + + + +
+

Document loading and URL resolving

+ + +

Lxml has support for custom document loaders in both the parsers and XSL +transformations. These so-called resolvers are subclasses of the +etree.Resolver class.

+
+

URI Resolvers

+

Here is an example of a custom resolver:

+
>>> from lxml import etree
+
+>>> class DTDResolver(etree.Resolver):
+...     def resolve(self, url, id, context):
+...         print("Resolving URL '%s'" % url)
+...         return self.resolve_string(
+...             '<!ENTITY myentity "[resolved text: %s]">' % url, context)
+
+

This defines a resolver that always returns a dynamically generated DTD +fragment defining an entity. The url argument passes the system URL of +the requested document, the id argument is the public ID. Note that any +of these may be None. The context object is not normally used by client code.

+

Resolving is based on three methods of the Resolver object that build internal +representations of the result document. The following methods exist:

+
    +
  • resolve_string takes a parsable string as result document
  • +
  • resolve_filename takes a filename
  • +
  • resolve_file takes an open file-like object that has at least a read() method
  • +
  • resolve_empty resolves into an empty document
  • +
+

The resolve() method may choose to return None, in which case the next +registered resolver (or the default resolver) is consulted. Resolving always +terminates if resolve() returns the result of any of the above +resolve_*() methods.

+

Resolvers are registered local to a parser:

+
>>> parser = etree.XMLParser(load_dtd=True)
+>>> parser.resolvers.add( DTDResolver() )
+
+

Note that we instantiate a parser that loads the DTD. This is not done by the +default parser, which does no validation. When we use this parser to parse a +document that requires resolving a URL, it will call our custom resolver:

+
>>> xml = '<!DOCTYPE doc SYSTEM "MissingDTD.dtd"><doc>&myentity;</doc>'
+>>> tree = etree.parse(StringIO(xml), parser)
+Resolving URL 'MissingDTD.dtd'
+>>> root = tree.getroot()
+>>> print(root.text)
+[resolved text: MissingDTD.dtd]
+
+

The entity in the document was correctly resolved by the generated DTD +fragment.

+
+
+

Document loading in context

+

XML documents memorise their initial parser (and its resolvers) during their +life-time. This means that a lookup process related to a document will use +the resolvers of the document's parser. We can demonstrate this with a +resolver that only responds to a specific prefix:

+
>>> class PrefixResolver(etree.Resolver):
+...     def __init__(self, prefix):
+...         self.prefix = prefix
+...         self.result_xml = '''\
+...              <xsl:stylesheet
+...                     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...                <test xmlns="testNS">%s-TEST</test>
+...              </xsl:stylesheet>
+...              ''' % prefix
+...     def resolve(self, url, pubid, context):
+...         if url.startswith(self.prefix):
+...             print("Resolved url %s as prefix %s" % (url, self.prefix))
+...             return self.resolve_string(self.result_xml, context)
+
+

We demonstrate this in XSLT and use the following stylesheet as an example:

+
>>> xml_text = """\
+... <xsl:stylesheet version="1.0"
+...    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...   <xsl:include href="honk:test"/>
+...   <xsl:template match="/">
+...     <test>
+...       <xsl:value-of select="document('hoi:test')/*/*/text()"/>
+...     </test>
+...   </xsl:template>
+... </xsl:stylesheet>
+... """
+
+

Note that it needs to resolve two URIs: honk:test when compiling the XSLT +document (i.e. when resolving xsl:import and xsl:include elements) and +hoi:test at transformation time, when calls to the document function +are resolved. If we now register different resolvers with two different +parsers, we can parse our document twice in different resolver contexts:

+
>>> hoi_parser = etree.XMLParser()
+>>> normal_doc = etree.parse(StringIO(xml_text), hoi_parser)
+
+>>> hoi_parser.resolvers.add( PrefixResolver("hoi") )
+>>> hoi_doc = etree.parse(StringIO(xml_text), hoi_parser)
+
+>>> honk_parser = etree.XMLParser()
+>>> honk_parser.resolvers.add( PrefixResolver("honk") )
+>>> honk_doc = etree.parse(StringIO(xml_text), honk_parser)
+
+

These contexts are important for the further behaviour of the documents. They +memorise their original parser so that the correct set of resolvers is used in +subsequent lookups. To compile the stylesheet, XSLT must resolve the +honk:test URI in the xsl:include element. The hoi resolver cannot +do that:

+
>>> transform = etree.XSLT(normal_doc)
+Traceback (most recent call last):
+  ...
+lxml.etree.XSLTParseError: Cannot resolve URI honk:test
+
+>>> transform = etree.XSLT(hoi_doc)
+Traceback (most recent call last):
+  ...
+lxml.etree.XSLTParseError: Cannot resolve URI honk:test
+
+

However, if we use the honk resolver associated with the respective +document, everything works fine:

+
>>> transform = etree.XSLT(honk_doc)
+Resolved url honk:test as prefix honk
+
+

Running the transform accesses the same parser context again, but since it now +needs to resolve the hoi URI in the call to the document function, its +honk resolver will fail to do so:

+
>>> result = transform(normal_doc)
+Traceback (most recent call last):
+  ...
+lxml.etree.XSLTApplyError: Cannot resolve URI hoi:test
+
+>>> result = transform(hoi_doc)
+Traceback (most recent call last):
+  ...
+lxml.etree.XSLTApplyError: Cannot resolve URI hoi:test
+
+>>> result = transform(honk_doc)
+Traceback (most recent call last):
+  ...
+lxml.etree.XSLTApplyError: Cannot resolve URI hoi:test
+
+

This can only be solved by adding a hoi resolver to the original parser:

+
>>> honk_parser.resolvers.add( PrefixResolver("hoi") )
+>>> result = transform(honk_doc)
+Resolved url hoi:test as prefix hoi
+>>> print(str(result)[:-1])
+<?xml version="1.0"?>
+<test>hoi-TEST</test>
+
+

We can see that the hoi resolver was called to generate a document that +was then inserted into the result document by the XSLT transformation. Note +that this is completely independent of the XML file you transform, as the URI +is resolved from within the stylesheet context:

+
>>> result = transform(normal_doc)
+Resolved url hoi:test as prefix hoi
+>>> print(str(result)[:-1])
+<?xml version="1.0"?>
+<test>hoi-TEST</test>
+
+

It may be seen as a matter of taste what resolvers the generated document +inherits. For XSLT, the output document inherits the resolvers of the input +document and not those of the stylesheet. Therefore, the last result does not +inherit any resolvers at all.

+
+
+

I/O access control in XSLT

+

By default, XSLT supports all extension functions from libxslt and libexslt as +well as Python regular expressions through EXSLT. Some extensions enable +style sheets to read and write files on the local file system.

+

XSLT has a mechanism to control the access to certain I/O operations during +the transformation process. This is most interesting where XSL scripts come +from potentially insecure sources and must be prevented from modifying the +local file system. Note, however, that there is no way to keep them from +eating up your precious CPU time, so this should not stop you from thinking +about what XSLT you execute.

+

Access control is configured using the XSLTAccessControl class. It can be +called with a number of keyword arguments that allow or deny specific +operations:

+
>>> transform = etree.XSLT(honk_doc)
+Resolved url honk:test as prefix honk
+>>> result = transform(normal_doc)
+Resolved url hoi:test as prefix hoi
+
+>>> ac = etree.XSLTAccessControl(read_network=False)
+>>> transform = etree.XSLT(honk_doc, access_control=ac)
+Resolved url honk:test as prefix honk
+>>> result = transform(normal_doc)
+Traceback (most recent call last):
+  ...
+lxml.etree.XSLTApplyError: xsltLoadDocument: read rights for hoi:test denied
+
+

There are a few things to keep in mind:

+
    +
  • XSL parsing (xsl:import, etc.) is not affected by this mechanism
  • +
  • read_file=False does not imply write_file=False, all controls are +independent.
  • +
  • read_file only applies to files in the file system. Any other scheme +for URLs is controlled by the *_network keywords.
  • +
  • If you need more fine-grained control than switching access on and off, you +should consider writing a custom document loader that returns empty +documents or raises exceptions if access is denied.
  • +
+
+
+ + + \ No newline at end of file diff --git a/doc/html/sax.html b/doc/html/sax.html new file mode 100644 index 0000000..f4457f1 --- /dev/null +++ b/doc/html/sax.html @@ -0,0 +1,115 @@ + + + + + +Sax support + + + +
+

Sax support

+ +

In this document we'll describe lxml's SAX support. lxml has support for +producing SAX events for an ElementTree or Element. lxml can also turn SAX +events into an ElementTree. The SAX API used by lxml is compatible with that +in the Python core (xml.sax), so is useful for interfacing lxml with code that +uses the Python core SAX facilities.

+ +
+

Building a tree from SAX events

+

First of all, lxml has support for building a new tree given SAX events. To +do this, we use the special SAX content handler defined by lxml named +lxml.sax.ElementTreeContentHandler:

+
>>> import lxml.sax
+>>> handler = lxml.sax.ElementTreeContentHandler()
+
+

Now let's fire some SAX events at it:

+
>>> handler.startElementNS((None, 'a'), 'a', {})
+>>> handler.startElementNS((None, 'b'), 'b', {(None, 'foo'): 'bar'})
+>>> handler.characters('Hello world')
+>>> handler.endElementNS((None, 'b'), 'b')
+>>> handler.endElementNS((None, 'a'), 'a')
+
+

This constructs an equivalent tree. You can access it through the etree +property of the handler:

+
>>> tree = handler.etree
+>>> lxml.etree.tostring(tree.getroot())
+b'<a><b foo="bar">Hello world</b></a>'
+
+

By passing a makeelement function the constructor of +ElementTreeContentHandler, e.g. the one of a parser you configured, you +can determine which element class lookup scheme should be used.

+
+
+

Producing SAX events from an ElementTree or Element

+

Let's make a tree we can generate SAX events for:

+
>>> f = StringIO('<a><b>Text</b></a>')
+>>> tree = lxml.etree.parse(f)
+
+

To see whether the correct SAX events are produced, we'll write a custom +content handler.:

+
>>> from xml.sax.handler import ContentHandler
+>>> class MyContentHandler(ContentHandler):
+...     def __init__(self):
+...         self.a_amount = 0
+...         self.b_amount = 0
+...         self.text = None
+...
+...     def startElementNS(self, name, qname, attributes):
+...         uri, localname = name
+...         if localname == 'a':
+...             self.a_amount += 1
+...         if localname == 'b':
+...             self.b_amount += 1
+...
+...     def characters(self, data):
+...         self.text = data
+
+

Note that it only defines the startElementNS() method and not startElement(). +The SAX event generator in lxml.sax currently only supports namespace-aware +processing.

+

To test the content handler, we can produce SAX events from the tree:

+
>>> handler = MyContentHandler()
+>>> lxml.sax.saxify(tree, handler)
+
+

This is what we expect:

+
>>> handler.a_amount
+1
+>>> handler.b_amount
+1
+>>> handler.text
+'Text'
+
+
+
+

Interfacing with pulldom/minidom

+

lxml.sax is a simple way to interface with the standard XML support in the +Python library. Note, however, that this is a one-way solution, as Python's +DOM implementation connot generate SAX events from a DOM tree.

+

You can use xml.dom.pulldom to build a minidom from lxml:

+
>>> from xml.dom.pulldom import SAX2DOM
+>>> handler = SAX2DOM()
+>>> lxml.sax.saxify(tree, handler)
+
+

PullDOM makes the result available through the document attribute:

+
>>> dom = handler.document
+>>> print(dom.firstChild.localName)
+a
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/style.css b/doc/html/style.css new file mode 100644 index 0000000..0b1ba88 --- /dev/null +++ b/doc/html/style.css @@ -0,0 +1,320 @@ +body { + font: 13px Arial, Verdana, Helvetica, sans-serif; + text-align: center; +} + +@media screen { + body { + padding: 1em 1em 1em 21em; + } + + div.document, div.footer { + width: 45em; + background-color: white; + } +} + +@media print { + div.document, div.footer { + width: auto; + padding-left: 0px; + } + + div.sidemenu { + display: none; + } +} + +div.document, div.footer { + margin: 1em auto 1em auto; + color: #222; +} + +div.document { + text-align: left; +} + +div.footer { + text-align: center; + font-size: 70%; +} + +/*** TOC ***/ + +div.contents.topic ul { + margin-top: 0px; +} + +div.contents.topic ul > li { + text-decoration: none; + line-height: 1.2em; +} + +div.contents.topic > p > a { + text-decoration: none; +} + +/*** side menu ***/ + +div.sidemenu { + position: absolute; + top: 0px; + left: 0px; + width: 24em; + font-size: 10px; + text-align: left; + border-right: groove gray; + border-bottom: groove gray; + padding-right: 1ex; + background: #FFFAFA url(tagpython.png) no-repeat top right; +} + +html > body div.sidemenu { + /* ignored by IE -> everyone else knows 'fixed', right? */ + position: fixed; +} + +div.sidemenu span.section.title { + line-height: 1.2em; + font-size: 130%; +} + +div.sidemenu ul.menu.current li { + color: #CC0000; +} + +div.sidemenu ul.menu.current > li > a { + color: #CC0000; +} + +div.sidemenu ul.menu.current ul.submenu { + display: block; +} + +div.sidemenu ul.menu.foreign ul.submenu li { + padding-top: 2px; + padding-bottom: 2px; +} + +div.sidemenu ul.menu.foreign li.menu:hover ul.submenu { + display: block; + position: absolute; + border: groove #990000; + padding: 1ex 1ex 1ex 3ex; + margin-top: 0px; + margin-left: 4em; + margin-right: -20em; + color: #990000; + background-color: white; +} + +div.sidemenu ul.submenu { + display: none; +} + +div.sidemenu ul { + line-height: 1em; + margin: 1ex; + padding-left: 1em; +} + +/*** headings ***/ + +h1.title { + background: url(http://codespeak.net/img/codespeak1b.png) no-repeat; + padding: 20px 0 0 180px; + height: 60px; + font-size: 200%; +} + +h1.title, h1 a, h2 a, h3 a { + color: #666; + font-weight: bold; + font-family: Helvetica, sans-serif; +} + +@media screen { + div.section > h1:before { + margin-left: -2ex; + color: #CC0000; + content: "\00BB" " "; + } +} + +h1 { + font-size: 150%; +} + +h2 { + font-size: 130%; +} + +h3 { + font-size: 110%; +} + +/*** content ***/ + +a, a:visited { + background-color: transparent; + font-weight: bold; + color: Black; + text-decoration: none; +} + +p a:active, ul a:active { + color: Red; +} + +p a:hover, ul a:hover { + text-decoration: underline; +} + +p { + /*margin: 0.5em 0em 1em 0em;*/ + text-align: justify; + line-height: 1.5em; + margin: 0.5em 0em 0em 0em; +} + +th.docinfo-name { + padding-left: 3ex; + text-align: right; + font-weight: bold; +} + +hr { + clear: both; + height: 1px; + color: #8CACBB; + background-color: transparent; +} + +dt { + line-height: 1.5em; + margin-left: 1em; +} + +dt:before { + content: "\00BB" " "; +} + +ul { + line-height: 1.5em; + margin-left: 1em; +} + +ol { + line-height: 1.5em; + margin-left: 0em; +} + +blockquote { + font-family: Times, "Times New Roman", serif; + font-style: italic; +} + +div.eyecatcher, p.eyecatcher { + font-family: Times, "Times New Roman", serif; + text-align: center; + font-size: 140%; + line-height: 1.2em; + margin-left: 9em; + margin-right: 9em; +} + +div.pagequote { + position: absolute; + top: 0px; + right: 0px; + padding: 10px 10px 0 0; + text-align: right; + font-size: 80%; + color: #990000; +} + +div.pagequote .reference { + font-size: 140%; +} + +html > .pagequote { + /* ignored by IE -> everyone else knows 'fixed', right? */ + position: fixed; +} + +code { + color: Black; + background-color: #f0f0f0; + font-family: "Courier New", Courier, monospace; +} + +pre { + padding: 0.5em; + border: 1px solid #8cacbb; + color: Black; + background-color: #f0f0f0; + font-family: "Courier New", Courier, monospace; +} + +/* Syntax highlighting */ + +.syntax { background: #f0f0f0; } +.syntax .c { color: #60a0b0; font-style: italic } /* Comment */ +.syntax .err { border: 1px solid #FF0000 } /* Error */ +.syntax .k { color: #007020; font-weight: bold } /* Keyword */ +.syntax .o { color: #666666 } /* Operator */ +.syntax .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */ +.syntax .cp { color: #007020 } /* Comment.Preproc */ +.syntax .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */ +.syntax .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */ +.syntax .gd { color: #A00000 } /* Generic.Deleted */ +.syntax .ge { font-style: italic } /* Generic.Emph */ +.syntax .gr { color: #FF0000 } /* Generic.Error */ +.syntax .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.syntax .gi { color: #00A000 } /* Generic.Inserted */ +.syntax .go { color: #404040 } /* Generic.Output */ +.syntax .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.syntax .gs { font-weight: bold } /* Generic.Strong */ +.syntax .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.syntax .gt { color: #0040D0 } /* Generic.Traceback */ +.syntax .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.syntax .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.syntax .kp { color: #007020 } /* Keyword.Pseudo */ +.syntax .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.syntax .kt { color: #902000 } /* Keyword.Type */ +.syntax .m { color: #40a070 } /* Literal.Number */ +.syntax .s { color: #4070a0 } /* Literal.String */ +.syntax .na { color: #4070a0 } /* Name.Attribute */ +.syntax .nb { color: #007020 } /* Name.Builtin */ +.syntax .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.syntax .no { color: #60add5 } /* Name.Constant */ +.syntax .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.syntax .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.syntax .ne { color: #007020 } /* Name.Exception */ +.syntax .nf { color: #06287e } /* Name.Function */ +.syntax .nl { color: #002070; font-weight: bold } /* Name.Label */ +.syntax .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.syntax .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.syntax .nv { color: #bb60d5 } /* Name.Variable */ +.syntax .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ +.syntax .mf { color: #40a070 } /* Literal.Number.Float */ +.syntax .mh { color: #40a070 } /* Literal.Number.Hex */ +.syntax .mi { color: #40a070 } /* Literal.Number.Integer */ +.syntax .mo { color: #40a070 } /* Literal.Number.Oct */ +.syntax .sb { color: #4070a0 } /* Literal.String.Backtick */ +.syntax .sc { color: #4070a0 } /* Literal.String.Char */ +.syntax .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.syntax .s2 { color: #4070a0 } /* Literal.String.Double */ +.syntax .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.syntax .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.syntax .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.syntax .sx { color: #c65d09 } /* Literal.String.Other */ +.syntax .sr { color: #235388 } /* Literal.String.Regex */ +.syntax .s1 { color: #4070a0 } /* Literal.String.Single */ +.syntax .ss { color: #517918 } /* Literal.String.Symbol */ +.syntax .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.syntax .vc { color: #bb60d5 } /* Name.Variable.Class */ +.syntax .vg { color: #bb60d5 } /* Name.Variable.Global */ +.syntax .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.syntax .il { color: #40a070 } /* Literal.Number.Integer.Long */ diff --git a/doc/html/tagpython-big.png b/doc/html/tagpython-big.png new file mode 100644 index 0000000..8eeb96a Binary files /dev/null and b/doc/html/tagpython-big.png differ diff --git a/doc/html/tagpython.png b/doc/html/tagpython.png new file mode 100644 index 0000000..2a630df Binary files /dev/null and b/doc/html/tagpython.png differ diff --git a/doc/html/tutorial.html b/doc/html/tutorial.html new file mode 100644 index 0000000..06c9230 --- /dev/null +++ b/doc/html/tutorial.html @@ -0,0 +1,947 @@ + + + + + +The lxml.etree Tutorial + + + + + + +
+

The lxml.etree Tutorial

+ +++ + + + +
Author:Stefan Behnel
+

This tutorial briefly overviews the main concepts of the ElementTree API as +implemented by lxml.etree, and some simple enhancements that make your +life as a programmer easier.

+

For a complete reference of the API, see the generated API +documentation.

+ +

A common way to import lxml.etree is as follows:

+
>>> from lxml import etree
+
+

If your code only uses the ElementTree API and does not rely on any +functionality that is specific to lxml.etree, you can also use (any part +of) the following import chain as a fall-back to the original ElementTree:

+
try:
+  from lxml import etree
+  print("running with lxml.etree")
+except ImportError:
+  try:
+    # Python 2.5
+    import xml.etree.cElementTree as etree
+    print("running with cElementTree on Python 2.5+")
+  except ImportError:
+    try:
+      # Python 2.5
+      import xml.etree.ElementTree as etree
+      print("running with ElementTree on Python 2.5+")
+    except ImportError:
+      try:
+        # normal cElementTree install
+        import cElementTree as etree
+        print("running with cElementTree")
+      except ImportError:
+        try:
+          # normal ElementTree install
+          import elementtree.ElementTree as etree
+          print("running with ElementTree")
+        except ImportError:
+          print("Failed to import ElementTree from any known place")
+
+

To aid in writing portable code, this tutorial makes it clear in the examples +which part of the presented API is an extension of lxml.etree over the +original ElementTree API, as defined by Fredrik Lundh's ElementTree +library.

+
+

The Element class

+

An Element is the main container object for the ElementTree API. Most of +the XML tree functionality is accessed through this class. Elements are +easily created through the Element factory:

+
>>> root = etree.Element("root")
+
+

The XML tag name of elements is accessed through the tag property:

+
>>> print(root.tag)
+root
+
+

Elements are organised in an XML tree structure. To create child elements and +add them to a parent element, you can use the append() method:

+
>>> root.append( etree.Element("child1") )
+
+

However, this is so common that there is a shorter and much more efficient way +to do this: the SubElement factory. It accepts the same arguments as the +Element factory, but additionally requires the parent as first argument:

+
>>> child2 = etree.SubElement(root, "child2")
+>>> child3 = etree.SubElement(root, "child3")
+
+

To see that this is really XML, you can serialise the tree you have created:

+
>>> print(etree.tostring(root, pretty_print=True))
+<root>
+  <child1/>
+  <child2/>
+  <child3/>
+</root>
+
+
+

Elements are lists

+

To make the access to these subelements as easy and straight forward as +possible, elements behave like normal Python lists:

+
>>> child = root[0]
+>>> print(child.tag)
+child1
+
+>>> print(len(root))
+3
+
+>>> root.index(root[1]) # lxml.etree only!
+1
+
+>>> children = list(root)
+
+>>> for child in root:
+...     print(child.tag)
+child1
+child2
+child3
+
+>>> root.insert(0, etree.Element("child0"))
+>>> start = root[:1]
+>>> end   = root[-1:]
+
+>>> print(start[0].tag)
+child0
+>>> print(end[0].tag)
+child3
+
+>>> root[0] = root[-1] # this moves the element!
+>>> for child in root:
+...     print(child.tag)
+child3
+child1
+child2
+
+

Prior to ElementTree 1.3 and lxml 2.0, you could also check the truth value of +an Element to see if it has children, i.e. if the list of children is empty. +This is no longer supported as people tend to find it surprising that a +non-None reference to an existing Element can evaluate to False. Instead, use +len(element), which is both more explicit and less error prone.

+

Note in the examples that the last element was moved to a different position +in the last example. This is a difference from the original ElementTree (and +from lists), where elements can sit in multiple positions of any number of +trees. In lxml.etree, elements can only sit in one position of one tree at a +time.

+

If you want to copy an element to a different position, consider creating an +independent deep copy using the copy module from Python's standard +library:

+
>>> from copy import deepcopy
+
+>>> element = etree.Element("neu")
+>>> element.append( deepcopy(root[1]) )
+
+>>> print(element[0].tag)
+child1
+>>> print([ c.tag for c in root ])
+['child3', 'child1', 'child2']
+
+

The way up in the tree is provided through the getparent() method:

+
>>> root is root[0].getparent()  # lxml.etree only!
+True
+
+

The siblings (or neighbours) of an element are accessed as next and previous +elements:

+
>>> root[0] is root[1].getprevious() # lxml.etree only!
+True
+>>> root[1] is root[0].getnext() # lxml.etree only!
+True
+
+
+
+

Elements carry attributes

+

XML elements support attributes. You can create them directly in the Element +factory:

+
>>> root = etree.Element("root", interesting="totally")
+>>> etree.tostring(root)
+b'<root interesting="totally"/>'
+
+

Fast and direct access to these attributes is provided by the set() and +get() methods of elements:

+
>>> print(root.get("interesting"))
+totally
+
+>>> root.set("interesting", "somewhat")
+>>> print(root.get("interesting"))
+somewhat
+
+

However, a very convenient way of dealing with them is through the dictionary +interface of the attrib property:

+
>>> attributes = root.attrib
+
+>>> print(attributes["interesting"])
+somewhat
+
+>>> print(attributes.get("hello"))
+None
+
+>>> attributes["hello"] = "Guten Tag"
+>>> print(attributes.get("hello"))
+Guten Tag
+>>> print(root.get("hello"))
+Guten Tag
+
+
+
+

Elements contain text

+

Elements can contain text:

+
>>> root = etree.Element("root")
+>>> root.text = "TEXT"
+
+>>> print(root.text)
+TEXT
+
+>>> etree.tostring(root)
+b'<root>TEXT</root>'
+
+

In many XML documents (data-centric documents), this is the only place where +text can be found. It is encapsulated by a leaf tag at the very bottom of the +tree hierarchy.

+

However, if XML is used for tagged text documents such as (X)HTML, text can +also appear between different elements, right in the middle of the tree:

+
<html><body>Hello<br/>World</body></html>
+
+

Here, the <br/> tag is surrounded by text. This is often referred to as +document-style or mixed-content XML. Elements support this through their +tail property. It contains the text that directly follows the element, up +to the next element in the XML tree:

+
>>> html = etree.Element("html")
+>>> body = etree.SubElement(html, "body")
+>>> body.text = "TEXT"
+
+>>> etree.tostring(html)
+b'<html><body>TEXT</body></html>'
+
+>>> br = etree.SubElement(body, "br")
+>>> etree.tostring(html)
+b'<html><body>TEXT<br/></body></html>'
+
+>>> br.tail = "TAIL"
+>>> etree.tostring(html)
+b'<html><body>TEXT<br/>TAIL</body></html>'
+
+

The two properties .text and .tail are enough to represent any +text content in an XML document. This way, the ElementTree API does +not require any special text nodes in addition to the Element +class, that tend to get in the way fairly often (as you might know +from classic DOM APIs).

+

However, there are cases where the tail text also gets in the way. +For example, when you serialise an Element from within the tree, you +do not always want its tail text in the result (although you would +still want the tail text of its children). For this purpose, the +tostring() function accepts the keyword argument with_tail:

+
>>> etree.tostring(br)
+b'<br/>TAIL'
+>>> etree.tostring(br, with_tail=False) # lxml.etree only!
+b'<br/>'
+
+

If you want to read only the text, i.e. without any intermediate +tags, you have to recursively concatenate all text and tail +attributes in the correct order. Again, the tostring() function +comes to the rescue, this time using the method keyword:

+
>>> etree.tostring(html, method="text")
+b'TEXTTAIL'
+
+
+
+

Using XPath to find text

+

Another way to extract the text content of a tree is XPath, which +also allows you to extract the separate text chunks into a list:

+
>>> print(html.xpath("string()")) # lxml.etree only!
+TEXTTAIL
+>>> print(html.xpath("//text()")) # lxml.etree only!
+['TEXT', 'TAIL']
+
+

If you want to use this more often, you can wrap it in a function:

+
>>> build_text_list = etree.XPath("//text()") # lxml.etree only!
+>>> print(build_text_list(html))
+['TEXT', 'TAIL']
+
+

Note that a string result returned by XPath is a special 'smart' +object that knows about its origins. You can ask it where it came +from through its getparent() method, just as you would with +Elements:

+
>>> texts = build_text_list(html)
+>>> print(texts[0])
+TEXT
+>>> parent = texts[0].getparent()
+>>> print(parent.tag)
+body
+
+>>> print(texts[1])
+TAIL
+>>> print(texts[1].getparent().tag)
+br
+
+

You can also find out if it's normal text content or tail text:

+
>>> print(texts[0].is_text)
+True
+>>> print(texts[1].is_text)
+False
+>>> print(texts[1].is_tail)
+True
+
+

While this works for the results of the text() function, lxml will +not tell you the origin of a string value that was constructed by the +XPath functions string() or concat():

+
>>> stringify = etree.XPath("string()")
+>>> print(stringify(html))
+TEXTTAIL
+>>> print(stringify(html).getparent())
+None
+
+
+
+

Tree iteration

+

For problems like the above, where you want to recursively traverse the tree +and do something with its elements, tree iteration is a very convenient +solution. Elements provide a tree iterator for this purpose. It yields +elements in document order, i.e. in the order their tags would appear if you +serialised the tree to XML:

+
>>> root = etree.Element("root")
+>>> etree.SubElement(root, "child").text = "Child 1"
+>>> etree.SubElement(root, "child").text = "Child 2"
+>>> etree.SubElement(root, "another").text = "Child 3"
+
+>>> print(etree.tostring(root, pretty_print=True))
+<root>
+  <child>Child 1</child>
+  <child>Child 2</child>
+  <another>Child 3</another>
+</root>
+
+>>> for element in root.iter():
+...     print("%s - %s" % (element.tag, element.text))
+root - None
+child - Child 1
+child - Child 2
+another - Child 3
+
+

If you know you are only interested in a single tag, you can pass its name to +iter() to have it filter for you:

+
>>> for element in root.iter("child"):
+...     print("%s - %s" % (element.tag, element.text))
+child - Child 1
+child - Child 2
+
+

By default, iteration yields all nodes in the tree, including +ProcessingInstructions, Comments and Entity instances. If you want to +make sure only Element objects are returned, you can pass the +Element factory as tag parameter:

+
>>> root.append(etree.Entity("#234"))
+>>> root.append(etree.Comment("some comment"))
+
+>>> for element in root.iter():
+...     if isinstance(element.tag, basestring):
+...         print("%s - %s" % (element.tag, element.text))
+...     else:
+...         print("SPECIAL: %s - %s" % (element, element.text))
+root - None
+child - Child 1
+child - Child 2
+another - Child 3
+SPECIAL: &#234; - &#234;
+SPECIAL: <!--some comment--> - some comment
+
+>>> for element in root.iter(tag=etree.Element):
+...     print("%s - %s" % (element.tag, element.text))
+root - None
+child - Child 1
+child - Child 2
+another - Child 3
+
+>>> for element in root.iter(tag=etree.Entity):
+...     print(element.text)
+&#234;
+
+

In lxml.etree, elements provide further iterators for all directions in the +tree: children, parents (or rather ancestors) and siblings.

+
+
+

Serialisation

+

Serialisation commonly uses the tostring() function that returns a +string, or the ElementTree.write() method that writes to a file, a +file-like object, or a URL (via FTP PUT or HTTP POST). Both calls accept +the same keyword arguments like pretty_print for formatted output +or encoding to select a specific output encoding other than plain +ASCII:

+
>>> root = etree.XML('<root><a><b/></a></root>')
+
+>>> etree.tostring(root)
+b'<root><a><b/></a></root>'
+
+>>> print(etree.tostring(root, xml_declaration=True))
+<?xml version='1.0' encoding='ASCII'?>
+<root><a><b/></a></root>
+
+>>> print(etree.tostring(root, encoding='iso-8859-1'))
+<?xml version='1.0' encoding='iso-8859-1'?>
+<root><a><b/></a></root>
+
+>>> print(etree.tostring(root, pretty_print=True))
+<root>
+  <a>
+    <b/>
+  </a>
+</root>
+
+

Note that pretty printing appends a newline at the end.

+

Since lxml 2.0 (and ElementTree 1.3), the serialisation functions can +do more than XML serialisation. You can serialise to HTML or extract +the text content by passing the method keyword:

+
>>> root = etree.XML(
+...    '<html><head/><body><p>Hello<br/>World</p></body></html>')
+
+>>> etree.tostring(root) # default: method = 'xml'
+b'<html><head/><body><p>Hello<br/>World</p></body></html>'
+
+>>> etree.tostring(root, method='xml') # same as above
+b'<html><head/><body><p>Hello<br/>World</p></body></html>'
+
+>>> etree.tostring(root, method='html')
+b'<html><head></head><body><p>Hello<br>World</p></body></html>'
+
+>>> print(etree.tostring(root, method='html', pretty_print=True))
+<html>
+<head></head>
+<body><p>Hello<br>World</p></body>
+</html>
+
+>>> etree.tostring(root, method='text')
+b'HelloWorld'
+
+

As for XML serialisation, the default encoding for plain text +serialisation is ASCII:

+
>>> br = root.find('.//br')
+>>> br.tail = u'W\xf6rld'
+
+>>> etree.tostring(root, method='text')  # doctest: +ELLIPSIS
+Traceback (most recent call last):
+  ...
+UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' ...
+
+>>> etree.tostring(root, method='text', encoding="UTF-8")
+b'HelloW\xc3\xb6rld'
+
+

Here, serialising to a Python unicode string instead of a byte string +might become handy. Just pass the unicode type as encoding:

+
>>> etree.tostring(root, encoding=unicode, method='text')
+u'HelloW\xf6rld'
+
+

The W3C has a good article about the Unicode character set and +character encodings.

+
+
+
+

The ElementTree class

+

An ElementTree is mainly a document wrapper around a tree with a +root node. It provides a couple of methods for parsing, serialisation +and general document handling. One of the bigger differences is that +it serialises as a complete document, as opposed to a single +Element. This includes top-level processing instructions and +comments, as well as a DOCTYPE and other DTD content in the document:

+
>>> tree = etree.parse(StringIO('''\
+... <?xml version="1.0"?>
+... <!DOCTYPE root SYSTEM "test" [ <!ENTITY tasty "eggs"> ]>
+... <root>
+...   <a>&tasty;</a>
+... </root>
+... '''))
+
+>>> print(tree.docinfo.doctype)
+<!DOCTYPE root SYSTEM "test">
+
+>>> # lxml 1.3.4 and later
+>>> print(etree.tostring(tree))
+<!DOCTYPE root SYSTEM "test" [
+<!ENTITY tasty "eggs">
+]>
+<root>
+  <a>eggs</a>
+</root>
+
+>>> # lxml 1.3.4 and later
+>>> print(etree.tostring(etree.ElementTree(tree.getroot())))
+<!DOCTYPE root SYSTEM "test" [
+<!ENTITY tasty "eggs">
+]>
+<root>
+  <a>eggs</a>
+</root>
+
+>>> # ElementTree and lxml <= 1.3.3
+>>> print(etree.tostring(tree.getroot()))
+<root>
+  <a>eggs</a>
+</root>
+
+

Note that this has changed in lxml 1.3.4 to match the behaviour of +lxml 2.0. Before, the examples were serialised without DTD content, +which made lxml loose DTD information in an input-output cycle.

+
+
+

Parsing from strings and files

+

lxml.etree supports parsing XML in a number of ways and from all +important sources, namely strings, files, URLs (http/ftp) and +file-like objects. The main parse functions are fromstring() and +parse(), both called with the source as first argument. By +default, they use the standard parser, but you can always pass a +different parser as second argument.

+
+

The fromstring() function

+

The fromstring() function is the easiest way to parse a string:

+
>>> some_xml_data = "<root>data</root>"
+
+>>> root = etree.fromstring(some_xml_data)
+>>> print(root.tag)
+root
+>>> etree.tostring(root)
+b'<root>data</root>'
+
+
+
+

The XML() function

+

The XML() function behaves like the fromstring() function, but is +commonly used to write XML literals right into the source:

+
>>> root = etree.XML("<root>data</root>")
+>>> print(root.tag)
+root
+>>> etree.tostring(root)
+b'<root>data</root>'
+
+
+
+

The parse() function

+

The parse() function is used to parse from files and file-like objects:

+
>>> some_file_like = StringIO("<root>data</root>")
+
+>>> tree = etree.parse(some_file_like)
+
+>>> etree.tostring(tree)
+b'<root>data</root>'
+
+

Note that parse() returns an ElementTree object, not an Element object as +the string parser functions:

+
>>> root = tree.getroot()
+>>> print(root.tag)
+root
+>>> etree.tostring(root)
+b'<root>data</root>'
+
+

The reasoning behind this difference is that parse() returns a +complete document from a file, while the string parsing functions are +commonly used to parse XML fragments.

+

The parse() function supports any of the following sources:

+
    +
  • an open file object
  • +
  • a file-like object that has a .read(byte_count) method returning +a byte string on each call
  • +
  • a filename string
  • +
  • an HTTP or FTP URL string
  • +
+

Note that passing a filename or URL is usually faster than passing an +open file.

+
+
+

Parser objects

+

By default, lxml.etree uses a standard parser with a default setup. If +you want to configure the parser, you can create a you instance:

+
>>> parser = etree.XMLParser(remove_blank_text=True) # lxml.etree only!
+
+

This creates a parser that removes empty text between tags while parsing, +which can reduce the size of the tree and avoid dangling tail text if you know +that whitespace-only content is not meaningful for your data. An example:

+
>>> root = etree.XML("<root>  <a/>   <b>  </b>     </root>", parser)
+
+>>> etree.tostring(root)
+b'<root><a/><b>  </b></root>'
+
+

Note that the whitespace content inside the <b> tag was not removed, as +content at leaf elements tends to be data content (even if blank). You can +easily remove it in an additional step by traversing the tree:

+
>>> for element in root.iter("*"):
+...     if element.text is not None and not element.text.strip():
+...         element.text = None
+
+>>> etree.tostring(root)
+b'<root><a/><b/></root>'
+
+

See help(etree.XMLParser) to find out about the available parser options.

+
+
+

Incremental parsing

+

lxml.etree provides two ways for incremental step-by-step parsing. One is +through file-like objects, where it calls the read() method repeatedly. +This is best used where the data arrives from a source like urllib or any +other file-like object that can provide data on request. Note that the parser +will block and wait until data becomes available in this case:

+
>>> class DataSource:
+...     data = [ b"<roo", b"t><", b"a/", b"><", b"/root>" ]
+...     def read(self, requested_size):
+...         try:
+...             return self.data.pop(0)
+...         except IndexError:
+...             return b''
+
+>>> tree = etree.parse(DataSource())
+
+>>> etree.tostring(tree)
+b'<root><a/></root>'
+
+

The second way is through a feed parser interface, given by the feed(data) +and close() methods:

+
>>> parser = etree.XMLParser()
+
+>>> parser.feed("<roo")
+>>> parser.feed("t><")
+>>> parser.feed("a/")
+>>> parser.feed("><")
+>>> parser.feed("/root>")
+
+>>> root = parser.close()
+
+>>> etree.tostring(root)
+b'<root><a/></root>'
+
+

Here, you can interrupt the parsing process at any time and continue it later +on with another call to the feed() method. This comes in handy if you +want to avoid blocking calls to the parser, e.g. in frameworks like Twisted, +or whenever data comes in slowly or in chunks and you want to do other things +while waiting for the next chunk.

+

After calling the close() method (or when an exception was raised +by the parser), you can reuse the parser by calling its feed() +method again:

+
>>> parser.feed("<root/>")
+>>> root = parser.close()
+>>> etree.tostring(root)
+b'<root/>'
+
+
+
+

Event-driven parsing

+

Sometimes, all you need from a document is a small fraction somewhere deep +inside the tree, so parsing the whole tree into memory, traversing it and +dropping it can be too much overhead. lxml.etree supports this use case +with two event-driven parser interfaces, one that generates parser events +while building the tree (iterparse), and one that does not build the tree +at all, and instead calls feedback methods on a target object in a SAX-like +fashion.

+

Here is a simple iterparse() example:

+
>>> some_file_like = StringIO("<root><a>data</a></root>")
+
+>>> for event, element in etree.iterparse(some_file_like):
+...     print("%s, %4s, %s" % (event, element.tag, element.text))
+end,    a, data
+end, root, None
+
+

By default, iterparse() only generates events when it is done parsing an +element, but you can control this through the events keyword argument:

+
>>> some_file_like = StringIO("<root><a>data</a></root>")
+
+>>> for event, element in etree.iterparse(some_file_like,
+...                                       events=("start", "end")):
+...     print("%5s, %4s, %s" % (event, element.tag, element.text))
+start, root, None
+start,    a, data
+  end,    a, data
+  end, root, None
+
+

Note that the text, tail and children of an Element are not necessarily there +yet when receiving the start event. Only the end event guarantees +that the Element has been parsed completely.

+

It also allows to .clear() or modify the content of an Element to +save memory. So if you parse a large tree and you want to keep memory +usage small, you should clean up parts of the tree that you no longer +need:

+
>>> some_file_like = StringIO(
+...     "<root><a><b>data</b></a><a><b/></a></root>")
+
+>>> for event, element in etree.iterparse(some_file_like):
+...     if element.tag == 'b':
+...         print(element.text)
+...     elif element.tag == 'a':
+...         print("** cleaning up the subtree")
+...         element.clear()
+data
+** cleaning up the subtree
+None
+** cleaning up the subtree
+
+

If memory is a real bottleneck, or if building the tree is not desired at all, +the target parser interface of lxml.etree can be used. It creates +SAX-like events by calling the methods of a target object. By implementing +some or all of these methods, you can control which events are generated:

+
>>> class ParserTarget:
+...     events = []
+...     close_count = 0
+...     def start(self, tag, attrib):
+...         self.events.append(("start", tag, attrib))
+...     def close(self):
+...         events, self.events = self.events, []
+...         self.close_count += 1
+...         return events
+
+>>> parser_target = ParserTarget()
+
+>>> parser = etree.XMLParser(target=parser_target)
+>>> events = etree.fromstring('<root test="true"/>', parser)
+
+>>> print(parser_target.close_count)
+1
+
+>>> for event in events:
+...     print('event: %s - tag: %s' % (event[0], event[1]))
+...     for attr, value in event[2].items():
+...         print(' * %s = %s' % (attr, value))
+event: start - tag: root
+ * test = true
+
+

You can reuse the parser and its target as often as you like, so you +should take care that the .close() methods really resets the +target to a usable state (also in the case of an error!).

+
>>> events = etree.fromstring('<root test="true"/>', parser)
+>>> print(parser_target.close_count)
+2
+>>> events = etree.fromstring('<root test="true"/>', parser)
+>>> print(parser_target.close_count)
+3
+>>> events = etree.fromstring('<root test="true"/>', parser)
+>>> print(parser_target.close_count)
+4
+
+>>> for event in events:
+...     print('event: %s - tag: %s' % (event[0], event[1]))
+...     for attr, value in event[2].items():
+...         print(' * %s = %s' % (attr, value))
+event: start - tag: root
+ * test = true
+
+
+
+
+

Namespaces

+

The ElementTree API avoids namespace prefixes wherever possible and deploys +the real namespaces instead:

+
>>> xhtml = etree.Element("{http://www.w3.org/1999/xhtml}html")
+>>> body = etree.SubElement(xhtml, "{http://www.w3.org/1999/xhtml}body")
+>>> body.text = "Hello World"
+
+>>> print(etree.tostring(xhtml, pretty_print=True))
+<html:html xmlns:html="http://www.w3.org/1999/xhtml">
+  <html:body>Hello World</html:body>
+</html:html>
+
+

As you can see, prefixes only become important when you serialise the result. +However, the above code becomes somewhat verbose due to the lengthy namespace +names. And retyping or copying a string over and over again is error prone. +It is therefore common practice to store a namespace URI in a global variable. +To adapt the namespace prefixes for serialisation, you can also pass a mapping +to the Element factory, e.g. to define the default namespace:

+
>>> XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"
+>>> XHTML = "{%s}" % XHTML_NAMESPACE
+
+>>> NSMAP = {None : XHTML_NAMESPACE} # the default namespace (no prefix)
+
+>>> xhtml = etree.Element(XHTML + "html", nsmap=NSMAP) # lxml only!
+>>> body = etree.SubElement(xhtml, XHTML + "body")
+>>> body.text = "Hello World"
+
+>>> print(etree.tostring(xhtml, pretty_print=True))
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <body>Hello World</body>
+</html>
+
+

Namespaces on attributes work alike:

+
>>> body.set(XHTML + "bgcolor", "#CCFFAA")
+
+>>> print(etree.tostring(xhtml, pretty_print=True))
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <body bgcolor="#CCFFAA">Hello World</body>
+</html>
+
+>>> print(body.get("bgcolor"))
+None
+>>> body.get(XHTML + "bgcolor")
+'#CCFFAA'
+
+

You can also use XPath in this way:

+
>>> find_xhtml_body = etree.ETXPath(      # lxml only !
+...     "//{%s}body" % XHTML_NAMESPACE)
+>>> results = find_xhtml_body(xhtml)
+
+>>> print(results[0].tag)
+{http://www.w3.org/1999/xhtml}body
+
+
+
+

The E-factory

+

The E-factory provides a simple and compact syntax for generating XML and +HTML:

+
>>> from lxml.builder import E
+
+>>> def CLASS(*args): # class is a reserved word in Python
+...     return {"class":' '.join(args)}
+
+>>> html = page = (
+...   E.html(       # create an Element called "html"
+...     E.head(
+...       E.title("This is a sample document")
+...     ),
+...     E.body(
+...       E.h1("Hello!", CLASS("title")),
+...       E.p("This is a paragraph with ", E.b("bold"), " text in it!"),
+...       E.p("This is another paragraph, with a", "\n      ",
+...         E.a("link", href="http://www.python.org"), "."),
+...       E.p("Here are some reservered characters: <spam&egg>."),
+...       etree.XML("<p>And finally an embedded XHTML fragment.</p>"),
+...     )
+...   )
+... )
+
+>>> print(etree.tostring(page, pretty_print=True))
+<html>
+  <head>
+    <title>This is a sample document</title>
+  </head>
+  <body>
+    <h1 class="title">Hello!</h1>
+    <p>This is a paragraph with <b>bold</b> text in it!</p>
+    <p>This is another paragraph, with a
+      <a href="http://www.python.org">link</a>.</p>
+    <p>Here are some reservered characters: &lt;spam&amp;egg&gt;.</p>
+    <p>And finally an embedded XHTML fragment.</p>
+  </body>
+</html>
+
+

The Element creation based on attribute access makes it easy to build up a +simple vocabulary for an XML language:

+
>>> from lxml.builder import ElementMaker # lxml only !
+
+>>> E = ElementMaker(namespace="http://my.de/fault/namespace",
+...                  nsmap={'p' : "http://my.de/fault/namespace"})
+
+>>> DOC = E.doc
+>>> TITLE = E.title
+>>> SECTION = E.section
+>>> PAR = E.par
+
+>>> my_doc = DOC(
+...   TITLE("The dog and the hog"),
+...   SECTION(
+...     TITLE("The dog"),
+...     PAR("Once upon a time, ..."),
+...     PAR("And then ...")
+...   ),
+...   SECTION(
+...     TITLE("The hog"),
+...     PAR("Sooner or later ...")
+...   )
+... )
+
+>>> print(etree.tostring(my_doc, pretty_print=True))
+<p:doc xmlns:p="http://my.de/fault/namespace">
+  <p:title>The dog and the hog</p:title>
+  <p:section>
+    <p:title>The dog</p:title>
+    <p:par>Once upon a time, ...</p:par>
+    <p:par>And then ...</p:par>
+  </p:section>
+  <p:section>
+    <p:title>The hog</p:title>
+    <p:par>Sooner or later ...</p:par>
+  </p:section>
+</p:doc>
+
+

One such example is the module lxml.html.builder, which provides a +vocabulary for HTML.

+
+
+

ElementPath

+

The ElementTree library comes with a simple XPath-like path language +called ElementPath. The main difference is that you can use the +{namespace}tag notation in ElementPath expressions. However, +advanced features like value comparison and functions are not +available.

+

In addition to a full XPath implementation, lxml.etree supports the +ElementPath language in the same way ElementTree does, even using +(almost) the same implementation. The API provides four methods here +that you can find on Elements and ElementTrees:

+
    +
  • iterfind() iterates over all Elements that match the path +expression
  • +
  • findall() returns a list of matching Elements
  • +
  • find() efficiently returns only the first match
  • +
  • findtext() returns the .text content of the first match
  • +
+

Here are some examples:

+
>>> root = etree.XML("<root><a x='123'>aText<b/><c/><b/></a></root>")
+
+

Find a child of an Element:

+
>>> print(root.find("b"))
+None
+>>> print(root.find("a").tag)
+a
+
+

Find an Element anywhere in the tree:

+
>>> print(root.find(".//b").tag)
+b
+>>> [ b.tag for b in root.iterfind(".//b") ]
+['b', 'b']
+
+

Find Elements with a certain attribute:

+
>>> print(root.findall(".//a[@x]")[0].tag)
+a
+>>> print(root.findall(".//a[@y]"))
+[]
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/validation.html b/doc/html/validation.html new file mode 100644 index 0000000..44cd5f4 --- /dev/null +++ b/doc/html/validation.html @@ -0,0 +1,319 @@ + + + + + +Validation with lxml + + + +
+

Validation with lxml

+ +

Apart from the built-in DTD support in parsers, lxml currently supports three +schema languages: DTD, Relax NG and XML Schema. All three provide +identical APIs in lxml, represented by validator classes with the obvious +names.

+

There is also initial support for Schematron. However, it does not currently +support error reporting in the validation phase due to insufficiencies in the +implementation as of libxml2 2.6.30.

+ +

The usual setup procedure:

+
>>> from lxml import etree
+
+
+

Validation at parse time

+

The parser in lxml can do on-the-fly validation of a document against +a DTD or an XML schema. The DTD is retrieved automatically based on +the DOCTYPE of the parsed document. All you have to do is use a +parser that has DTD validation enabled:

+
>>> parser = etree.XMLParser(dtd_validation=True)
+
+

Obviously, a request for validation enables the DTD loading feature. +There are two other options that enable loading the DTD, but that do +not perform any validation. The first is the load_dtd keyword +option, which simply loads the DTD into the parser and makes it +available to the document as external subset. You can retrieve the +DTD from the parsed document using the docinfo property of the +result ElementTree object. The internal subset is available as +internalDTD, the external subset is provided as externalDTD.

+

The third way way to activate DTD loading is with the +attribute_defaults option, which loads the DTD and weaves +attribute default values into the document. Again, no validation is +performed unless explicitly requested.

+

XML schema is supported in a similar way, but requires an explicit +schema to be provided:

+
>>> schema_root = etree.XML('''\
+...   <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+...     <xsd:element name="a" type="xsd:integer"/>
+...   </xsd:schema>
+... ''')
+>>> schema = etree.XMLSchema(schema_root)
+
+>>> parser = etree.XMLParser(schema = schema)
+>>> root = etree.fromstring("<a>5</a>", parser)
+
+

If the validation fails (be it for a DTD or an XML schema), the parser +will raise an exception:

+
>>> root = etree.fromstring("<a>no int</a>", parser)
+Traceback (most recent call last):
+lxml.etree.XMLSyntaxError: Element 'a': 'no int' is not a valid value of the atomic type 'xs:integer'.
+
+

If you want the parser to succeed regardless of the outcome of the +validation, you should use a non validating parser and run the +validation separately after parsing the document.

+
+
+

DTD

+

As described above, the parser support for DTDs depends on internal or +external subsets of the XML file. This means that the XML file itself +must either contain a DTD or must reference a DTD to make this work. +If you want to validate an XML document against a DTD that is not +referenced by the document itself, you can use the DTD class.

+

To use the DTD class, you must first pass a filename or file-like object +into the constructor to parse a DTD:

+
>>> f = StringIO("<!ELEMENT b EMPTY>")
+>>> dtd = etree.DTD(f)
+
+

Now you can use it to validate documents:

+
>>> root = etree.XML("<b/>")
+>>> print(dtd.validate(root))
+True
+
+>>> root = etree.XML("<b><a/></b>")
+>>> print(dtd.validate(root))
+False
+
+

The reason for the validation failure can be found in the error log:

+
>>> print(dtd.error_log.filter_from_errors()[0])
+<string>:1:0:ERROR:VALID:DTD_NOT_EMPTY: Element b was declared EMPTY this one has content
+
+

As an alternative to parsing from a file, you can use the +external_id keyword argument to parse from a catalog. The +following example reads the DocBook DTD in version 4.2, if available +in the system catalog:

+
dtd = etree.DTD(external_id = "-//OASIS//DTD DocBook XML V4.2//EN")
+
+
+
+

RelaxNG

+

The RelaxNG class takes an ElementTree object to construct a Relax NG +validator:

+
>>> f = StringIO('''\
+... <element name="a" xmlns="http://relaxng.org/ns/structure/1.0">
+...  <zeroOrMore>
+...     <element name="b">
+...       <text />
+...     </element>
+...  </zeroOrMore>
+... </element>
+... ''')
+>>> relaxng_doc = etree.parse(f)
+>>> relaxng = etree.RelaxNG(relaxng_doc)
+
+

Alternatively, pass a filename to the file keyword argument to parse from +a file. This also enables correct handling of include files from within the +RelaxNG parser.

+

You can then validate some ElementTree document against the schema. You'll get +back True if the document is valid against the Relax NG schema, and False if +not:

+
>>> valid = StringIO('<a><b></b></a>')
+>>> doc = etree.parse(valid)
+>>> relaxng.validate(doc)
+True
+
+>>> invalid = StringIO('<a><c></c></a>')
+>>> doc2 = etree.parse(invalid)
+>>> relaxng.validate(doc2)
+False
+
+

Calling the schema object has the same effect as calling its validate +method. This is sometimes used in conditional statements:

+
>>> invalid = StringIO('<a><c></c></a>')
+>>> doc2 = etree.parse(invalid)
+>>> if not relaxng(doc2):
+...     print("invalid!")
+invalid!
+
+

If you prefer getting an exception when validating, you can use the +assert_ or assertValid methods:

+
>>> relaxng.assertValid(doc2)
+Traceback (most recent call last):
+  ...
+lxml.etree.DocumentInvalid: Did not expect element c there, line 1
+
+>>> relaxng.assert_(doc2)
+Traceback (most recent call last):
+  ...
+AssertionError: Did not expect element c there, line 1
+
+

If you want to find out why the validation failed in the second case, you can +look up the error log of the validation process and check it for relevant +messages:

+
>>> log = relaxng.error_log
+>>> print(log.last_error)
+<string>:1:0:ERROR:RELAXNGV:RELAXNG_ERR_ELEMWRONG: Did not expect element c there
+
+

You can see that the error (ERROR) happened during RelaxNG validation +(RELAXNGV). The message then tells you what went wrong. You can also +look at the error domain and its type directly:

+
>>> error = log.last_error
+>>> print(error.domain_name)
+RELAXNGV
+>>> print(error.type_name)
+RELAXNG_ERR_ELEMWRONG
+
+

Note that this error log is local to the RelaxNG object. It will only +contain log entries that appeared during the validation.

+

Similar to XSLT, there's also a less efficient but easier shortcut method to +do one-shot RelaxNG validation:

+
>>> doc.relaxng(relaxng_doc)
+True
+>>> doc2.relaxng(relaxng_doc)
+False
+
+

libxml2 does not currently support the RelaxNG Compact Syntax. +However, the trang translator can convert the compact syntax to the +XML syntax, which can then be used with lxml.

+
+
+

XMLSchema

+

lxml.etree also has XML Schema (XSD) support, using the class +lxml.etree.XMLSchema. The API is very similar to the Relax NG and DTD +classes. Pass an ElementTree object to construct a XMLSchema validator:

+
>>> f = StringIO('''\
+... <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+... <xsd:element name="a" type="AType"/>
+... <xsd:complexType name="AType">
+...   <xsd:sequence>
+...     <xsd:element name="b" type="xsd:string" />
+...   </xsd:sequence>
+... </xsd:complexType>
+... </xsd:schema>
+... ''')
+>>> xmlschema_doc = etree.parse(f)
+>>> xmlschema = etree.XMLSchema(xmlschema_doc)
+
+

You can then validate some ElementTree document with this. Like with RelaxNG, +you'll get back true if the document is valid against the XML schema, and +false if not:

+
>>> valid = StringIO('<a><b></b></a>')
+>>> doc = etree.parse(valid)
+>>> xmlschema.validate(doc)
+True
+
+>>> invalid = StringIO('<a><c></c></a>')
+>>> doc2 = etree.parse(invalid)
+>>> xmlschema.validate(doc2)
+False
+
+

Calling the schema object has the same effect as calling its validate method. +This is sometimes used in conditional statements:

+
>>> invalid = StringIO('<a><c></c></a>')
+>>> doc2 = etree.parse(invalid)
+>>> if not xmlschema(doc2):
+...     print("invalid!")
+invalid!
+
+

If you prefer getting an exception when validating, you can use the +assert_ or assertValid methods:

+
>>> xmlschema.assertValid(doc2)
+Traceback (most recent call last):
+  ...
+lxml.etree.DocumentInvalid: Element 'c': This element is not expected. Expected is ( b )., line 1
+
+>>> xmlschema.assert_(doc2)
+Traceback (most recent call last):
+  ...
+AssertionError: Element 'c': This element is not expected. Expected is ( b )., line 1
+
+

Error reporting works as for the RelaxNG class:

+
>>> log = xmlschema.error_log
+>>> error = log.last_error
+>>> print(error.domain_name)
+SCHEMASV
+>>> print(error.type_name)
+SCHEMAV_ELEMENT_CONTENT
+
+

If you were to print this log entry, you would get something like the +following. Note that the error message depends on the libxml2 version in +use:

+
+<string>:1:ERROR::SCHEMAV_ELEMENT_CONTENT: Element 'c': This element is not expected. Expected is ( b ).
+
+

Similar to XSLT and RelaxNG, there's also a less efficient but easier shortcut +method to do XML Schema validation:

+
>>> doc.xmlschema(xmlschema_doc)
+True
+>>> doc2.xmlschema(xmlschema_doc)
+False
+
+
+
+

Schematron

+

Since version 2.0, lxml.etree features Schematron support, using the +class lxml.etree.Schematron. It requires at least libxml2 2.6.21 to +work. The API is the same as for the other validators. Pass an +ElementTree object to construct a Schematron validator:

+
>>> f = StringIO('''\
+... <schema xmlns="http://www.ascc.net/xml/schematron" >
+...   <pattern name="Sum equals 100%.">
+...     <rule context="Total">
+...       <assert test="sum(//Percent)=100">Sum is not 100%.</assert>
+...     </rule>
+...   </pattern>
+... </schema>
+... ''')
+
+>>> sct_doc = etree.parse(f)
+>>> schematron = etree.Schematron(sct_doc)
+
+

You can then validate some ElementTree document with this. Like with RelaxNG, +you'll get back true if the document is valid against the schema, and false if +not:

+
>>> valid = StringIO('''\
+... <Total>
+...   <Percent>20</Percent>
+...   <Percent>30</Percent>
+...   <Percent>50</Percent>
+... </Total>
+... ''')
+
+>>> doc = etree.parse(valid)
+>>> schematron.validate(doc)
+True
+
+>>> etree.SubElement(doc.getroot(), "Percent").text = "10"
+
+>>> schematron.validate(doc)
+False
+
+

Calling the schema object has the same effect as calling its validate method. +This is sometimes used in conditional statements:

+
>>> is_valid = etree.Schematron(sct_doc)
+
+>>> if not is_valid(doc):
+...     print("invalid!")
+invalid!
+
+

Note that libxml2 restricts error reporting to the parsing step (when creating +the Schematron instance). There is not currently any support for error +reporting during validation.

+
+
+ + + \ No newline at end of file diff --git a/doc/html/xpathxslt.html b/doc/html/xpathxslt.html new file mode 100644 index 0000000..cea8a41 --- /dev/null +++ b/doc/html/xpathxslt.html @@ -0,0 +1,515 @@ + + + + + +XPath and XSLT with lxml + + + +
+

XPath and XSLT with lxml

+ +

lxml supports XPath 1.0, XSLT 1.0 and the EXSLT extensions through +libxml2 and libxslt in a standards compliant way.

+ +

The usual setup procedure:

+
>>> from lxml import etree
+
+
+

XPath

+

lxml.etree supports the simple path syntax of the find, findall and +findtext methods on ElementTree and Element, as known from the original +ElementTree library (ElementPath). As an lxml specific extension, these +classes also provide an xpath() method that supports expressions in the +complete XPath syntax, as well as custom extension functions.

+

There are also specialized XPath evaluator classes that are more efficient for +frequent evaluation: XPath and XPathEvaluator. See the performance +comparison to learn when to use which. Their semantics when used on +Elements and ElementTrees are the same as for the xpath() method described +here.

+
+

The xpath() method

+

For ElementTree, the xpath method performs a global XPath query against the +document (if absolute) or against the root node (if relative):

+
>>> f = StringIO('<foo><bar></bar></foo>')
+>>> tree = etree.parse(f)
+
+>>> r = tree.xpath('/foo/bar')
+>>> len(r)
+1
+>>> r[0].tag
+'bar'
+
+>>> r = tree.xpath('bar')
+>>> r[0].tag
+'bar'
+
+

When xpath() is used on an Element, the XPath expression is evaluated +against the element (if relative) or against the root tree (if absolute):

+
>>> root = tree.getroot()
+>>> r = root.xpath('bar')
+>>> r[0].tag
+'bar'
+
+>>> bar = root[0]
+>>> r = bar.xpath('/foo/bar')
+>>> r[0].tag
+'bar'
+
+>>> tree = bar.getroottree()
+>>> r = tree.xpath('/foo/bar')
+>>> r[0].tag
+'bar'
+
+

The xpath() method has support for XPath variables:

+
>>> expr = "//*[local-name() = $name]"
+
+>>> print(root.xpath(expr, name = "foo")[0].tag)
+foo
+
+>>> print(root.xpath(expr, name = "bar")[0].tag)
+bar
+
+>>> print(root.xpath("$text", text = "Hello World!"))
+Hello World!
+
+

Optionally, you can provide a namespaces keyword argument, which should be +a dictionary mapping the namespace prefixes used in the XPath expression to +namespace URIs:

+
>>> f = StringIO('''\
+... <a:foo xmlns:a="http://codespeak.net/ns/test1"
+...        xmlns:b="http://codespeak.net/ns/test2">
+...    <b:bar>Text</b:bar>
+... </a:foo>
+... ''')
+>>> doc = etree.parse(f)
+
+>>> r = doc.xpath('/t:foo/b:bar',
+...               namespaces={'t': 'http://codespeak.net/ns/test1',
+...                           'b': 'http://codespeak.net/ns/test2'})
+>>> len(r)
+1
+>>> r[0].tag
+'{http://codespeak.net/ns/test2}bar'
+>>> r[0].text
+'Text'
+
+

There is also an optional extensions argument which is used to define +custom extension functions in Python that are local to this evaluation.

+
+
+

XPath return values

+

The return value types of XPath evaluations vary, depending on the +XPath expression used:

+
    +
  • True or False, when the XPath expression has a boolean result
  • +
  • a float, when the XPath expression has a numeric result (integer or float)
  • +
  • a 'smart' string (as described below), when the XPath expression has +a string result.
  • +
  • a list of items, when the XPath expression has a list as result. +The items may include Elements (also comments and processing +instructions), strings and tuples. Text nodes and attributes in the +result are returned as 'smart' string values. Namespace +declarations are returned as tuples of strings: (prefix, URI).
  • +
+

XPath string results are 'smart' in that they provide a +getparent() method that knows their origin:

+
    +
  • for attribute values, result.getparent() returns the Element +that carries them. An example is //foo/@attribute, where the +parent would be a foo Element.
  • +
  • for the text() function (as in //text()), it returns the +Element that contains the text or tail that was returned.
  • +
+

You can distinguish between different text origins with the boolean +properties is_text, is_tail and is_attribute.

+

Note that getparent() may not always return an Element. For +example, the XPath functions string() and concat() will +construct strings that do not have an origin. For them, +getparent() will return None.

+

There are certain cases where the smart string behaviour is +undesirable. For example, it means that the tree will be kept alive +by the string, which may have a considerable memory impact in the case +that the string value is the only thing in the tree that is actually +of interest. For these cases, you can deactivate the parental +relationship using the keyword argument smart_strings.

+
+
+>>> root = etree.XML("<root><a>TEXT</a></root>")
+
+
+>>> find_text = etree.XPath("//text()")
+>>> text = find_text(root)[0]
+>>> print(text)
+TEXT
+>>> print(text.getparent().text)
+TEXT
+
+
+>>> find_text = etree.XPath("//text()", smart_strings=False)
+>>> text = find_text(root)[0]
+>>> print(text)
+TEXT
+>>> hasattr(text, 'getparent')
+False
+
+
+
+
+

Generating XPath expressions

+

ElementTree objects have a method getpath(element), which returns a +structural, absolute XPath expression to find that element:

+
>>> a  = etree.Element("a")
+>>> b  = etree.SubElement(a, "b")
+>>> c  = etree.SubElement(a, "c")
+>>> d1 = etree.SubElement(c, "d")
+>>> d2 = etree.SubElement(c, "d")
+
+>>> tree = etree.ElementTree(c)
+>>> print(tree.getpath(d2))
+/c/d[2]
+>>> tree.xpath(tree.getpath(d2)) == [d2]
+True
+
+
+
+

The XPath class

+

The XPath class compiles an XPath expression into a callable function:

+
>>> root = etree.XML("<root><a><b/></a><b/></root>")
+
+>>> find = etree.XPath("//b")
+>>> print(find(root)[0].tag)
+b
+
+

The compilation takes as much time as in the xpath() method, but it is +done only once per class instantiation. This makes it especially efficient +for repeated evaluation of the same XPath expression.

+

Just like the xpath() method, the XPath class supports XPath +variables:

+
>>> count_elements = etree.XPath("count(//*[local-name() = $name])")
+
+>>> print(count_elements(root, name = "a"))
+1.0
+>>> print(count_elements(root, name = "b"))
+2.0
+
+

This supports very efficient evaluation of modified versions of an XPath +expression, as compilation is still only required once.

+

Prefix-to-namespace mappings can be passed as second parameter:

+
>>> root = etree.XML("<root xmlns='NS'><a><b/></a><b/></root>")
+
+>>> find = etree.XPath("//n:b", namespaces={'n':'NS'})
+>>> print(find(root)[0].tag)
+{NS}b
+
+

By default, XPath supports regular expressions in the EXSLT namespace:

+
>>> regexpNS = "http://exslt.org/regular-expressions"
+>>> find = etree.XPath("//*[re:test(., '^abc$', 'i')]",
+...                    namespaces={'re':regexpNS})
+
+>>> root = etree.XML("<root><a>aB</a><b>aBc</b></root>")
+>>> print(find(root)[0].text)
+aBc
+
+

You can disable this with the boolean keyword argument regexp which +defaults to True.

+
+
+

The XPathEvaluator classes

+

lxml.etree provides two other efficient XPath evaluators that work on +ElementTrees or Elements respectively: XPathDocumentEvaluator and +XPathElementEvaluator. They are automatically selected if you use the +XPathEvaluator helper for instantiation:

+
>>> root = etree.XML("<root><a><b/></a><b/></root>")
+>>> xpatheval = etree.XPathEvaluator(root)
+
+>>> print(isinstance(xpatheval, etree.XPathElementEvaluator))
+True
+
+>>> print(xpatheval("//b")[0].tag)
+b
+
+

This class provides efficient support for evaluating different XPath +expressions on the same Element or ElementTree.

+
+
+

ETXPath

+

ElementTree supports a language named ElementPath in its find*() methods. +One of the main differences between XPath and ElementPath is that the XPath +language requires an indirection through prefixes for namespace support, +whereas ElementTree uses the Clark notation ({ns}name) to avoid prefixes +completely. The other major difference regards the capabilities of both path +languages. Where XPath supports various sophisticated ways of restricting the +result set through functions and boolean expressions, ElementPath only +supports pure path traversal without nesting or further conditions. So, while +the ElementPath syntax is self-contained and therefore easier to write and +handle, XPath is much more powerful and expressive.

+

lxml.etree bridges this gap through the class ETXPath, which accepts XPath +expressions with namespaces in Clark notation. It is identical to the +XPath class, except for the namespace notation. Normally, you would +write:

+
>>> root = etree.XML("<root xmlns='ns'><a><b/></a><b/></root>")
+
+>>> find = etree.XPath("//p:b", namespaces={'p' : 'ns'})
+>>> print(find(root)[0].tag)
+{ns}b
+
+

ETXPath allows you to change this to:

+
>>> find = etree.ETXPath("//{ns}b")
+>>> print(find(root)[0].tag)
+{ns}b
+
+
+
+

Error handling

+

lxml.etree raises exceptions when errors occur while parsing or evaluating an +XPath expression:

+
>>> find = etree.XPath("\\")
+Traceback (most recent call last):
+  ...
+lxml.etree.XPathSyntaxError: Invalid expression
+
+

lxml will also try to give you a hint what went wrong, so if you pass a more +complex expression, you may get a somewhat more specific error:

+
>>> find = etree.XPath("//*[1.1.1]")
+Traceback (most recent call last):
+  ...
+lxml.etree.XPathSyntaxError: Invalid predicate
+
+

During evaluation, lxml will emit an XPathEvalError on errors:

+
>>> find = etree.XPath("//ns:a")
+>>> find(root)
+Traceback (most recent call last):
+  ...
+lxml.etree.XPathEvalError: Undefined namespace prefix
+
+

This works for the XPath class, however, the other evaluators (including +the xpath() method) are one-shot operations that do parsing and evaluation +in one step. They therefore raise evaluation exceptions in all cases:

+
>>> root = etree.Element("test")
+>>> find = root.xpath("//*[1.1.1]")
+Traceback (most recent call last):
+  ...
+lxml.etree.XPathEvalError: Invalid predicate
+
+>>> find = root.xpath("//ns:a")
+Traceback (most recent call last):
+  ...
+lxml.etree.XPathEvalError: Undefined namespace prefix
+
+>>> find = root.xpath("\\")
+Traceback (most recent call last):
+  ...
+lxml.etree.XPathEvalError: Invalid expression
+
+

Note that lxml versions before 1.3 always raised an XPathSyntaxError for +all errors, including evaluation errors. The best way to support older +versions is to except on the superclass XPathError.

+
+
+
+

XSLT

+

lxml.etree introduces a new class, lxml.etree.XSLT. The class can be +given an ElementTree object to construct an XSLT transformer:

+
>>> f = StringIO('''\
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...     <xsl:template match="/">
+...         <foo><xsl:value-of select="/a/b/text()" /></foo>
+...     </xsl:template>
+... </xsl:stylesheet>''')
+>>> xslt_doc = etree.parse(f)
+>>> transform = etree.XSLT(xslt_doc)
+
+

You can then run the transformation on an ElementTree document by simply +calling it, and this results in another ElementTree object:

+
>>> f = StringIO('<a><b>Text</b></a>')
+>>> doc = etree.parse(f)
+>>> result_tree = transform(doc)
+
+

By default, XSLT supports all extension functions from libxslt and +libexslt as well as Python regular expressions through the EXSLT +regexp functions. Also see the documentation on custom extension +functions, XSLT extension elements and document resolvers. +There is a separate section on controlling access to external +documents and resources.

+
+

XSLT result objects

+

The result of an XSL transformation can be accessed like a normal ElementTree +document:

+
>>> f = StringIO('<a><b>Text</b></a>')
+>>> doc = etree.parse(f)
+>>> result = transform(doc)
+
+>>> result.getroot().text
+'Text'
+
+

but, as opposed to normal ElementTree objects, can also be turned into an (XML +or text) string by applying the str() function:

+
>>> str(result)
+'<?xml version="1.0"?>\n<foo>Text</foo>\n'
+
+

The result is always a plain string, encoded as requested by the +xsl:output element in the stylesheet. If you want a Python unicode string +instead, you should set this encoding to UTF-8 (unless the ASCII default +is sufficient). This allows you to call the builtin unicode() function on +the result:

+
>>> unicode(result)
+u'<?xml version="1.0"?>\n<foo>Text</foo>\n'
+
+

You can use other encodings at the cost of multiple recoding. Encodings that +are not supported by Python will result in an error:

+
>>> xslt_tree = etree.XML('''\
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...     <xsl:output encoding="UCS4"/>
+...     <xsl:template match="/">
+...         <foo><xsl:value-of select="/a/b/text()" /></foo>
+...     </xsl:template>
+... </xsl:stylesheet>''')
+>>> transform = etree.XSLT(xslt_tree)
+
+>>> result = transform(doc)
+>>> unicode(result)
+Traceback (most recent call last):
+  ...
+LookupError: unknown encoding: UCS4
+
+
+
+

Stylesheet parameters

+

It is possible to pass parameters, in the form of XPath expressions, to the +XSLT template:

+
>>> xslt_tree = etree.XML('''\
+... <xsl:stylesheet version="1.0"
+...     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+...     <xsl:param name="a" />
+...     <xsl:template match="/">
+...         <foo><xsl:value-of select="$a" /></foo>
+...     </xsl:template>
+... </xsl:stylesheet>''')
+>>> transform = etree.XSLT(xslt_tree)
+>>> f = StringIO('<a><b>Text</b></a>')
+>>> doc = etree.parse(f)
+
+

The parameters are passed as keyword parameters to the transform call. +First, let's try passing in a simple integer expression:

+
>>> result = transform(doc, a="5")
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>5</foo>\n'
+
+

You can use any valid XPath expression as parameter value:

+
>>> result = transform(doc, a="/a/b/text()")
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>Text</foo>\n'
+
+

Passing a string expression looks like this:

+
>>> result = transform(doc, a="'A'")
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>A</foo>\n'
+
+

To pass a string that (potentially) contains quotes, you can use the +.strparam() class method. Note that it does not escape the +string. Instead, it returns an opaque object that keeps the string +value.

+
>>> plain_string_value = etree.XSLT.strparam(
+...                          """ It's "Monty Python" """)
+>>> result = transform(doc, a=plain_string_value)
+>>> str(result)
+'<?xml version="1.0"?>\n<foo> It\'s "Monty Python" </foo>\n'
+
+
+
+

The xslt() tree method

+

There's also a convenience method on ElementTree objects for doing XSL +transformations. This is less efficient if you want to apply the same XSL +transformation to multiple documents, but is shorter to write for one-shot +operations, as you do not have to instantiate a stylesheet yourself:

+
>>> result = doc.xslt(xslt_tree, a="'A'")
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>A</foo>\n'
+
+

This is a shortcut for the following code:

+
>>> transform = etree.XSLT(xslt_tree)
+>>> result = transform(doc, a="'A'")
+>>> str(result)
+'<?xml version="1.0"?>\n<foo>A</foo>\n'
+
+
+
+

Dealing with stylesheet complexity

+

Some applications require a larger set of rather diverse stylesheets. +lxml.etree allows you to deal with this in a number of ways. Here are +some ideas to try.

+

The most simple way to reduce the diversity is by using XSLT +parameters that you pass at call time to configure the stylesheets. +The partial() function in the functools module of Python 2.5 +may come in handy here. It allows you to bind a set of keyword +arguments (i.e. stylesheet parameters) to a reference of a callable +stylesheet. The same works for instances of the XPath() +evaluator, obviously.

+

You may also consider creating stylesheets programmatically. Just +create an XSL tree, e.g. from a parsed template, and then add or +replace parts as you see fit. Passing an XSL tree into the XSLT() +constructor multiple times will create independent stylesheets, so +later modifications of the tree will not be reflected in the already +created stylesheets. This makes stylesheet generation very straight +forward.

+

A third thing to remember is the support for custom extension +functions and XSLT extension elements. Some things are much +easier to express in XSLT than in Python, while for others it is the +complete opposite. Finding the right mixture of Python code and XSL +code can help a great deal in keeping applications well designed and +maintainable.

+
+
+

Profiling

+

If you want to know how your stylesheet performed, pass the profile_run +keyword to the transform:

+
>>> result = transform(doc, a="/a/b/text()", profile_run=True)
+>>> profile = result.xslt_profile
+
+

The value of the xslt_profile property is an ElementTree with profiling +data about each template, similar to the following:

+
<profile>
+  <template rank="1" match="/" name="" mode="" calls="1" time="1" average="1"/>
+</profile>
+
+

Note that this is a read-only document. You must not move any of its elements +to other documents. Please deep-copy the document if you need to modify it. +If you want to free it from memory, just do:

+
>>> del result.xslt_profile
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html5parser.txt b/doc/html5parser.txt new file mode 100644 index 0000000..3c8b6ff --- /dev/null +++ b/doc/html5parser.txt @@ -0,0 +1,80 @@ +=============== +html5lib Parser +=============== + +`html5lib`_ is a Python package that implements the HTML5 parsing algorithm +which is heavily influenced by current browsers and based on the `WHATWG +HTML5 specification`_. + +.. _html5lib: http://code.google.com/p/html5lib/ +.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/ +.. _WHATWG HTML5 specification: http://www.whatwg.org/specs/web-apps/current-work/ + +lxml can benefit from the parsing capabilities of `html5lib` through +the ``lxml.html.html5parser`` module. It provides a similar interface +to the ``lxml.html`` module by providing ``fromstring()``, +``parse()``, ``document_fromstring()``, ``fragment_fromstring()`` and +``fragments_fromstring()`` that work like the regular html parsing +functions. + + +Differences to regular HTML parsing +=================================== + +There are a few differences in the returned tree to the regular HTML +parsing functions from ``lxml.html``. html5lib normalizes some elements +and element structures to a common format. For example even if a tables +does not have a `tbody` html5lib will inject one automatically: + +.. sourcecode:: pycon + + >>> from lxml.html import tostring, html5parser + >>> tostring(html5parser.fromstring("
foo")) + '
foo
' + +Also the parameters the functions accept are different. + + +Function Reference +================== + +``parse(filename_url_or_file)``: + Parses the named file or url, or if the object has a ``.read()`` + method, parses from that. + +``document_fromstring(html, guess_charset=True)``: + Parses a document from the given string. This always creates a + correct HTML document, which means the parent node is ````, + and there is a body and possibly a head. + + If a bytestring is passed and ``guess_charset`` is true the chardet + library (if installed) will guess the charset if ambiguities exist. + +``fragment_fromstring(string, create_parent=False, guess_charset=False)``: + Returns an HTML fragment from a string. The fragment must contain + just a single element, unless ``create_parent`` is given; + e.g,. ``fragment_fromstring(string, create_parent='div')`` will + wrap the element in a ``
``. If ``create_parent`` is true the + default parent tag (div) is used. + + If a bytestring is passed and ``guess_charset`` is true the chardet + library (if installed) will guess the charset if ambiguities exist. + +``fragments_fromstring(string, no_leading_text=False, parser=None)``: + Returns a list of the elements found in the fragment. The first item in + the list may be a string. If ``no_leading_text`` is true, then it will + be an error if there is leading text, and it will always be a list of + only elements. + + If a bytestring is passed and ``guess_charset`` is true the chardet + library (if installed) will guess the charset if ambiguities exist. + +``fromstring(string)``: + Returns ``document_fromstring`` or ``fragment_fromstring``, based + on whether the string looks like a full document, or just a + fragment. + +Additionally all parsing functions accept an ``parser`` keyword argument +that can be set to a custom parser instance. To create custom parsers +you can subclass the ``HTMLParser`` and ``XHTMLParser`` from the same +module. Note that these are the parser classes provided by html5lib. diff --git a/doc/intro.txt b/doc/intro.txt new file mode 100644 index 0000000..1be3f54 --- /dev/null +++ b/doc/intro.txt @@ -0,0 +1,82 @@ +Why lxml? +========= + +.. contents:: +.. + 1 Motto + 2 Aims + + +Motto +----- + +"the thrills without the strangeness" + +To explain the motto: + +"Programming with libxml2 is like the thrilling embrace of an exotic stranger. +It seems to have the potential to fulfill your wildest dreams, but there's a +nagging voice somewhere in your head warning you that you're about to get +screwed in the worst way." (`a quote by Mark Pilgrim`_) + +Mark Pilgrim was describing in particular the experience a Python programmer +has when dealing with libxml2. The default Python bindings of libxml2 are +fast, thrilling, powerful, and your code might fail in some horrible way that +you really shouldn't have to worry about when writing Python code. lxml +combines the power of libxml2 with the ease of use of Python. + +.. _`a quote by Mark Pilgrim`: http://diveintomark.org/archives/2004/02/18/libxml2 + + +Aims +---- + +The C libraries libxml2_ and libxslt_ have huge benefits: + +* Standards-compliant XML support. + +* Support for (broken) HTML. + +* Full-featured. + +* Actively maintained by XML experts. + +* fast. fast! FAST! + +.. _libxml2: http://www.xmlsoft.org + +.. _libxslt: http://xmlsoft.org/XSLT + + +These libraries already ship with Python bindings, but these Python bindings +mimic the C-level interface. This yields a number of problems: + +* very low level and C-ish (not Pythonic). + +* underdocumented and huge, you get lost in them. + +* UTF-8 in API, instead of Python unicode strings. + +* Can easily cause segfaults from Python. + +* Require manual memory management! + + +lxml is a new Python binding for libxml2 and libxslt, completely independent +from these existing Python bindings. Its aims: + +* Pythonic API. + +* Documented. + +* Use Python unicode strings in API. + +* Safe (no segfaults). + +* No manual memory management! + +lxml aims to provide a Pythonic API by following as much as possible the +`ElementTree API`_. We're trying to avoid inventing too many new APIs, or you +having to learn new things -- XML is complicated enough. + +.. _`ElementTree API`: http://effbot.org/zone/element-index.htm diff --git a/doc/licenses/BSD.txt b/doc/licenses/BSD.txt new file mode 100644 index 0000000..a76d0ed --- /dev/null +++ b/doc/licenses/BSD.txt @@ -0,0 +1,29 @@ +Copyright (c) 2004 Infrae. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. Neither the name of Infrae nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INFRAE OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/licenses/GPL.txt b/doc/licenses/GPL.txt new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/doc/licenses/GPL.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/doc/licenses/ZopePublicLicense.txt b/doc/licenses/ZopePublicLicense.txt new file mode 100644 index 0000000..44e0648 --- /dev/null +++ b/doc/licenses/ZopePublicLicense.txt @@ -0,0 +1,59 @@ +Zope Public License (ZPL) Version 2.0 +----------------------------------------------- + +This software is Copyright (c) Zope Corporation (tm) and +Contributors. All rights reserved. + +This license has been certified as open source. It has also +been designated as GPL compatible by the Free Software +Foundation (FSF). + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions in source code must retain the above + copyright notice, this list of conditions, and the following + disclaimer. + +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions, and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + +3. The name Zope Corporation (tm) must not be used to + endorse or promote products derived from this software + without prior written permission from Zope Corporation. + +4. The right to distribute this software or to use it for + any purpose does not give you the right to use Servicemarks + (sm) or Trademarks (tm) of Zope Corporation. Use of them is + covered in a separate agreement (see + http://www.zope.com/Marks). + +5. If any files are modified, you must cause the modified + files to carry prominent notices stating that you changed + the files and the date of any change. + +Disclaimer + + THIS SOFTWARE IS PROVIDED BY ZOPE CORPORATION ``AS IS'' + AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + NO EVENT SHALL ZOPE CORPORATION OR ITS CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + + +This software consists of contributions made by Zope +Corporation and many individuals on behalf of Zope +Corporation. Specific attributions are listed in the +accompanying credits file. diff --git a/doc/licenses/elementtree.txt b/doc/licenses/elementtree.txt new file mode 100644 index 0000000..dde28f1 --- /dev/null +++ b/doc/licenses/elementtree.txt @@ -0,0 +1,25 @@ +The ElementTree / XML Toys Library is + +Copyright (c) 1999-2003 by Secret Labs AB +Copyright (c) 1999-2003 by Fredrik Lundh + +By obtaining, using, and/or copying this software and/or its +associated documentation, you agree that you have read, understood, +and will comply with the following terms and conditions: + +Permission to use, copy, modify, and distribute this software and its +associated documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appears in all +copies, and that both that copyright notice and this permission notice +appear in supporting documentation, and that the name of Secret Labs +AB or the author not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR +ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/doc/lxml-source-howto.txt b/doc/lxml-source-howto.txt new file mode 100644 index 0000000..16e765a --- /dev/null +++ b/doc/lxml-source-howto.txt @@ -0,0 +1,313 @@ +============================== +How to read the source of lxml +============================== + +:Author: + Stefan Behnel + +.. meta:: + :description: How to read and work on the source code of lxml + :keywords: lxml, XML, Cython, source code, develop, comprehend, understand + +This document describes how to read the source code of lxml_ and how +to start working on it. You might also be interested in the companion +document that describes `how to build lxml from sources`_. + +.. _lxml: http://codespeak.net/lxml/ +.. _`how to build lxml from sources`: build.html +.. _`ReStructured Text`: http://docutils.sourceforge.net/rst.html +.. _epydoc: http://epydoc.sourceforge.net/ +.. _docutils: http://docutils.sourceforge.net/ +.. _`C-level API`: capi.html + +.. contents:: +.. + 1 What is Cython? + 2 Where to start? + 2.1 Concepts + 2.2 The documentation + 3 lxml.etree + 4 lxml.objectify + 5 lxml.html + + +What is Cython? +=============== + +.. _Cython: http://cython.org/ +.. _Pyrex: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ + +Cython_ is the language that lxml is written in. It is a very +Python-like language that was specifically designed for writing Python +extension modules. + +The reason why Cython (or actually its predecessor Pyrex_ at the time) +was chosen as an implementation language for lxml, is that it makes it +very easy to interface with both the Python world and external C code. +Cython generates all the necessary glue code for the Python API, +including Python types, calling conventions and reference counting. +On the other side of the table, calling into C code is not more than +declaring the signature of the function and maybe some variables as +being C types, pointers or structs, and then calling it. The rest of +the code is just plain Python code. + +The Cython language is so close to Python that the Cython compiler can +actually compile many, many Python programs to C without major +modifications. But the real speed gains of a C compilation come from +type annotations that were added to the language and that allow Cython +to generate very efficient C code. + +Even if you are not familiar with Cython, you should keep in mind that +a slow implementation of a feature is better than none. So, if you +want to contribute and have an idea what code you want to write, feel +free to start with a pure Python implementation. Chances are, if you +get the change officially accepted and integrated, others will take +the time to optimise it so that it runs fast in Cython. + + +Where to start? +=============== + +First of all, read `how to build lxml from sources`_ to learn how to +retrieve the source code from the Subversion repository and how to +build it. The source code lives in the subdirectory ``src`` of the +checkout. + +The main extension modules in lxml are ``lxml.etree`` and +``lxml.objectify``. All main modules have the file extension +``.pyx``, which shows the descendence from Pyrex. As usual in Python, +the main files start with a short description and a couple of imports. +Cython distinguishes between the run-time ``import`` statement (as +known from Python) and the compile-time ``cimport`` statement, which +imports C declarations, either from external libraries or from other +Cython modules. + + +Concepts +-------- + +lxml's tree API is based on proxy objects. That means, every Element +object (or rather ``_Element`` object) is a proxy for a libxml2 node +structure. The class declaration is (mainly):: + + cdef class _Element: + cdef _Document _doc + cdef xmlNode* _c_node + +It is a naming convention that C variables and C level class members +that are passed into libxml2 start with a prefixed ``c_`` (commonly +libxml2 struct pointers), and that C level class members are prefixed +with an underscore. So you will often see names like ``c_doc`` for an +``xmlDoc*`` variable (or ``c_node`` for an ``xmlNode*``), or the above +``_c_node`` for a class member that points to an ``xmlNode`` struct +(or ``_c_doc`` for an ``xmlDoc*``). + +It is important to know that every proxy in lxml has a factory +function that properly sets up C level members. Proxy objects must +*never* be instantiated outside of that factory. For example, to +instantiate an _Element object or its subclasses, you must always call +its factory function:: + + cdef xmlNode* c_node + cdef _Document doc + cdef _Element element + ... + element = _elementFactory(doc, c_node) + +A good place to see how this factory is used are the Element methods +``getparent()``, ``getnext()`` and ``getprevious()``. + + +The documentation +----------------- + +An important part of lxml is the documentation that lives in the +``doc`` directory. It describes a large part of the API and comprises +a lot of example code in the form of doctests. + +The documentation is written in the `ReStructured Text`_ format, a +very powerful text markup language that looks almost like plain text. +It is part of the docutils_ package. + +The project web site of lxml_ is completely generated from these text +documents. Even the side menu is just collected from the table of +contents that the ReST processor writes into each HTML page. +Obviously, we use lxml for this. + +The easiest way to generate the HTML pages is by calling:: + + make html + +This will call the script ``doc/mkhtml.py`` to run the ReST processor +on the files. After generating an HTML page the script parses it back +in to build the side menu, and injects the complete menu into each +page at the very end. + +Running the ``make`` command will also generate the API documentation +if you have epydoc_ installed. The epydoc package will import and +introspect the extension modules and also introspect and parse the +Python modules of lxml. The aggregated information will then be +written out into an HTML documentation site. + + +lxml.etree +========== + +The main module, ``lxml.etree``, is in the file `lxml.etree.pyx +`_. It +implements the main functions and types of the ElementTree API, as +well as all the factory functions for proxies. It is the best place +to start if you want to find out how a specific feature is +implemented. + +At the very end of the file, it contains a series of ``include`` +statements that merge the rest of the implementation into the +generated C code. Yes, you read right: no importing, no source file +namespacing, just plain good old include and a huge C code result of +more than 100,000 lines that we throw right into the C compiler. + +The main include files are: + +apihelpers.pxi + Private C helper functions. Except for the factory functions, + most of the little functions that are used all over the place are + defined here. This includes things like reading out the text + content of a libxml2 tree node, checking input from the API level, + creating a new Element node or handling attribute values. If you + want to work on the lxml code, you should keep these functions in + the back of your head, as they will definitely make your life + easier. + +classlookup.pxi + Element class lookup mechanisms. The main API and engines for + those who want to define custom Element classes and inject them + into lxml. + +docloader.pxi + Support for custom document loaders. Base class and registry for + custom document resolvers. + +extensions.pxi + Infrastructure for extension functions in XPath/XSLT, including + XPath value conversion and function registration. + +iterparse.pxi + Incremental XML parsing. An iterator class that builds iterparse + events while parsing. + +nsclasses.pxi + Namespace implementation and registry. The registry and engine + for Element classes that use the ElementNamespaceClassLookup + scheme. + +parser.pxi + Parsers for XML and HTML. This is the main parser engine. It's + the reason why you can parse a document from various sources in + two lines of Python code. It's definitely not the right place to + start reading lxml's soure code. + +parsertarget.pxi + An ElementTree compatible parser target implementation based on + the SAX2 interface of libxml2. + +proxy.pxi + Very low-level functions for memory allocation/deallocation + and Element proxy handling. Ignoring this for the beginning + will safe your head from exploding. + +public-api.pxi + The set of C functions that are exported to other extension + modules at the C level. For example, ``lxml.objectify`` makes use + of these. See the `C-level API` documentation. + +readonlytree.pxi + A separate read-only implementation of the Element API. This is + used in places where non-intrusive access to a tree is required, + such as the ``PythonElementClassLookup`` or XSLT extension + elements. + +saxparser.pxi + SAX-like parser interfaces as known from ElementTree's TreeBuilder. + +serializer.pxi + XML output functions. Basically everything that creates byte + sequences from XML trees. + +xinclude.pxi + XInclude support. + +xmlerror.pxi + Error log handling. All error messages that libxml2 generates + internally walk through the code in this file to end up in lxml's + Python level error logs. + + At the end of the file, you will find a long list of named error + codes. It is generated from the libxml2 HTML documentation (using + lxml, of course). See the script ``update-error-constants.py`` + for this. + +xmlid.pxi + XMLID and IDDict, a dictionary-like way to find Elements by their + XML-ID attribute. + +xpath.pxi + XPath evaluators. + +xslt.pxi + XSL transformations, including the ``XSLT`` class, document lookup + handling and access control. + +The different schema languages (DTD, RelaxNG, XML Schema and +Schematron) are implemented in the following include files: + +* dtd.pxi +* relaxng.pxi +* schematron.pxi +* xmlschema.pxi + + +Python modules +============== + +The ``lxml`` package also contains a number of pure Python modules: + +builder.py + The E-factory and the ElementBuilder class. These provide a + simple interface to XML tree generation. + +cssselect.py + A CSS selector implementation based on XPath. The main class is + called ``CSSSelector``. + +doctestcompare.py + A relaxed comparison scheme for XML/HTML markup in doctest. + +ElementInclude.py + XInclude-like document inclusion, compatible with ElementTree. + +_elementpath.py + XPath-like path language, compatible with ElementTree. + +sax.py + SAX2 compatible interfaces to copy lxml trees from/to SAX compatible + tools. + +usedoctest.py + Wrapper module for ``doctestcompare.py`` that simplifies its usage + from inside a doctest. + + +lxml.objectify +============== + +A Cython implemented extension module that uses the public C-API of +lxml.etree. It provides a Python object-like interface to XML trees. +The implementation resides in the file `lxml.objectify.pyx +`_. + + +lxml.html +========= + +A specialised toolkit for HTML handling, based on lxml.etree. This is +implemented in pure Python. diff --git a/doc/lxml.mgp b/doc/lxml.mgp new file mode 100644 index 0000000..1b2386f --- /dev/null +++ b/doc/lxml.mgp @@ -0,0 +1,122 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%deffont "standard" xfont "helvetica-medium-r" +%deffont "thick" xfont "helvetica-bold-r" +%deffont "typewriter" xfont "courier-medium-r" +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Default settings per each line numbers. +%% +%default 1 area 90 90, leftfill, size 2, fore "gray20", back "white", font "standard", hgap 0 +%default 2 size 7, vgap 10, prefix " ", ccolor "blue" +%default 3 size 2, bar "gray70", vgap 10 +%default 4 size 5, fore "gray20", vgap 30, prefix " ", font "standard" +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Default settings that are applied to TAB-indented lines. +%% +%tab 1 size 5, vgap 40, prefix " ", icon box "red" 50 +%tab 2 size 4, vgap 40, prefix " ", icon arc "yellow" 50 +%tab 3 size 3, vgap 40, prefix " ", icon delta3 "white" 40 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%page + +lxml - a sane Python wrapper for libxml + + + +%center +Martijn Faassen, Infrae +faassen@infrae.com + +%page + +The C library libxml has huge benefits + + + Standards-compliant XML support + + full-featured + + actively maintained by XML exports + + fast. fast! FAST! + +%page + +Features of libxml + + + Parsing + + Tree based (DOM-ish) XML structure + + XPath support + + XSLT support (libxslt) + + Relax NG (schema) support + + And more + +%page + +But libxml already has Python bindings! + + + very low level and C-ish (not Pythonic) + + underdocumented. huge, you get lost in them + + works with UTF-8, not native Python unicode + + can cause segfaults from Python + + have to do manual memory management! + +%page + +lxml is a new Python binding for libxml + +Aims (read: TODOS) + + Pythonic API + + Documented + + Use Python unicode strings in API + + Safe (no segfaults) + + No manual memory management! + +%page + +Tradeoffs + + + Slower because of better wrapping. + + But libxml is so fast this likely doesn't matter much. + + Not all features of libxml exposed (unless you help) + +%page + +What is there now - Proof of concept + + + Automatic destruction of documents (refcounted) + + Start of ElementTree style API for tree + +%page + +Future + + + Fix bugs, add features + + Moving into svn repository on codespeak.net + + Help! + diff --git a/doc/lxml2.txt b/doc/lxml2.txt new file mode 100644 index 0000000..07a7b8b --- /dev/null +++ b/doc/lxml2.txt @@ -0,0 +1,269 @@ +======================= +What's new in lxml 2.0? +======================= + +.. contents:: +.. + 1 Changes in etree and objectify + 1.1 Incompatible changes + 1.2 Enhancements + 1.3 Deprecation + 2 New modules + 2.1 lxml.usedoctest + 2.2 lxml.html + 2.3 lxml.cssselect + + +During the development of the lxml 1.x series, a couple of quirks were +discovered in the design that made the API less obvious and its future +extensions harder than necessary. lxml 2.0 is a soft evolution of lxml 1.x +towards a simpler, more consistent and more powerful API - with some major +extensions. Wherever possible, lxml 1.3 comes close to the semantics of lxml +2.0, so that migrating should be easier for code that currently runs with 1.3. + +One of the important internal changes was the switch from the Pyrex_ +compiler to Cython_, which provides better optimisation and improved +support for newer Python language features. This allows the code of +lxml to become more Python-like again, while the performance improves +as Cython continues its own development. The code simplification, +which will continue throughout the 2.x series, will hopefully make it +even easier for users to contribute. + +.. _Cython: http://www.cython.org/ +.. _Pyrex: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ + + +Changes in etree and objectify +============================== + +A graduation towards a more consistent API cannot go without a certain amount +of incompatible changes. The following is a list of those differences that +applications need to take into account when migrating from lxml 1.x to lxml +2.0. + +Incompatible changes +-------------------- + +* lxml 0.9 introduced a feature called `namespace implementation`_. The + global ``Namespace`` factory was added to register custom element classes + and have lxml.etree look them up automatically. However, the later + development of further class lookup mechanisms made it appear less and less + adequate to register this mapping at a global level, so lxml 1.1 first + removed the namespace based lookup from the default setup and lxml 2.0 + finally removes the global namespace registry completely. As all other + lookup mechanisms, the namespace lookup is now local to a parser, including + the registry itself. Applications that use a module-level parser can easily + map its ``get_namespace()`` method to a global ``Namespace`` function to + mimic the old behaviour. + + .. _`namespace implementation`: element_classes.html#implementing-namespaces + +* Some API functions now require passing options as keyword arguments, + as opposed to positional arguments. This restriction was introduced + to make the API usage independent of future extensions such as the + addition of new positional arguments. Users should not rely on the + position of an optional argument in function signatures and instead + pass it explicitly named. This also improves code readability - it + is common good practice to pass options in a consistent way + independent of their position, so many people may not even notice + the change in their code. Another important reason is compatibility + with cElementTree, which also enforces keyword-only arguments in a + couple of places. + +* XML tag names are validated when creating an Element. This does not + apply to HTML tags, where only HTML special characters are + forbidden. The distinction is made by the ``SubElement()`` factory, + which tests if the tree it works on is an HTML tree, and by the + ``.makeelement()`` methods of parsers, which behave differently for + the ``XMLParser()`` and the ``HTMLParser()``. + +* XPath now raises exceptions specific to the part of the execution that + failed: ``XPathSyntaxError`` for parser errors and ``XPathEvalError`` for + errors that occurred during the evaluation. Note that the distinction only + works for the ``XPath()`` class. The other two evaluators only have a + single evaluation call that includes the parsing step, and will therefore + only raise an ``XPathEvalError``. Applications can catch both exceptions + through the common base class ``XPathError`` (which also exists in earlier + lxml versions). + +* Network access in parsers is now disabled by default, i.e. the + ``no_network`` option defaults to True. Due to a somewhat 'interesting' + implementation in libxml2, this does not affect the first document (i.e. the + URL that is parsed), but only subsequent documents, such as a DTD when + parsing with validation. This means that you will have to check the URL you + pass, instead of relying on lxml to prevent *any* access to external + resources. As this can be helpful in some use cases, lxml does not work + around it. + +* The type annotations in lxml.objectify (the ``pytype`` attribute) now use + ``NoneType`` for the None value as this is the correct Python type name. + Previously, lxml 1.x used a lower case ``none``. + +* Another change in objectify regards the way it deals with ambiguous types. + Previously, setting a value like the string ``"3"`` through normal attribute + access would let it come back as an integer when reading the object + attribute. lxml 2.0 prevents this by always setting the ``pytype`` + attribute to the type the user passed in, so ``"3"`` will come back as a + string, while the number ``3`` will come back as a number. To remove the + type annotation on serialisation, you can use the ``deannotate()`` function. + +* The C-API function ``findOrBuildNodeNs()`` was replaced by the more generic + ``findOrBuildNodeNsPrefix()`` that accepts an additional default prefix. + + +Enhancements +------------ + +Most of the enhancements of lxml 2.0 were made under the hood. Most people +won't even notice them, but they make the maintenance of lxml easier and thus +facilitate further enhancements and an improved integration between lxml's +features. + +* lxml.objectify now has its own implementation of the `E factory`_. It uses + the built-in type lookup mechanism of lxml.objectify, thus removing the need + for an additional type registry mechanism (as previously available through + the ``typemap`` parameter). + +* XML entities are supported through the ``Entity()`` factory, an Entity + element class and a parser option ``resolve_entities`` that allows to keep + entities in the element tree when set to False. Also, the parser will now + report undefined entities as errors if it needs to resolve them (which is + still the default, as in lxml 1.x). + +* A major part of the XPath code was rewritten and can now benefit from a + bigger overlap with the XSLT code. The main benefits are improved thread + safety in the XPath evaluators and Python RegExp support in standard XPath. + +* The string results of an XPath evaluation have become 'smart' string + subclasses. Formerly, there was no easy way to find out where a + string originated from. In lxml 2.0, you can call its + ``getparent()`` method to `find the Element that carries it`_. This + works for attributes (``//@attribute``) and for ``text()`` nodes, + i.e. Element text and tails. Strings that were constructed in the + path expression, e.g. by the ``string()`` function or extension + functions, will return None as their parent. + +* Setting a ``QName`` object as value of the ``.text`` property or as + an attribute value will resolve its prefix in the respective context + +* Following ElementTree 1.3, the ``iterfind()`` method supports + efficient iteration based on XPath-like expressions. + +The parsers also received some major enhancements: + +* ``iterparse()`` can parse HTML when passing the boolean ``html`` + keyword. + +* Parse time XML Schema validation by passing an + XMLSchema object to the ``schema`` keyword argument of a parser. + +* Support for a ``target`` object that implements ElementTree's + `TreeBuilder interface`_. + +* The ``encoding`` keyword allows overriding the document encoding. + + +.. _`E factory`: objectify.html#tree-generation-with-the-e-factory +.. _`find the Element that carries it`: tutorial.html#using-xpath-to-find-text +.. _`TreeBuilder interface`: http://effbot.org/elementtree/elementtree-treebuilder.htm + + +Deprecation +----------- + +The following functions and methods are now deprecated. They are +still available in lxml 2.0 and will be removed in lxml 2.1: + +* The ``tounicode()`` function was replaced by the call + ``tostring(encoding=unicode)``. + +* CamelCaseNamed module functions and methods were renamed to their + underscore equivalents to follow `PEP 8`_ in naming. + + - ``etree.clearErrorLog()``, use ``etree.clear_error_log()`` + + - ``etree.useGlobalPythonLog()``, use + ``etree.use_global_python_log()`` + + - ``etree.ElementClassLookup.setFallback()``, use + ``etree.ElementClassLookup.set_fallback()`` + + - ``etree.getDefaultParser()``, use ``etree.get_default_parser()`` + + - ``etree.setDefaultParser()``, use ``etree.set_default_parser()`` + + - ``etree.setElementClassLookup()``, use + ``etree.set_element_class_lookup()`` + + - ``XMLParser.setElementClassLookup()``, use ``.set_element_class_lookup()`` + + - ``HTMLParser.setElementClassLookup()``, use ``.set_element_class_lookup()`` + + Note that ``parser.setElementClassLookup()`` has not been removed + yet, although ``parser.set_element_class_lookup()`` should be used + instead. + + - ``xpath_evaluator.registerNamespace()``, use + ``xpath_evaluator.register_namespace()`` + + - ``xpath_evaluator.registerNamespaces()``, use + ``xpath_evaluator.register_namespaces()`` + + - ``objectify.setPytypeAttributeTag``, use + ``objectify.set_pytype_attribute_tag`` + + - ``objectify.setDefaultParser()``, use + ``objectify.set_default_parser()`` + +* The ``.getiterator()`` method on Elements and ElementTrees was + renamed to ``.iter()`` to follow ElementTree 1.3. + +.. _`PEP 8`: http://www.python.org/dev/peps/pep-0008/ + + +New modules +=========== + +The most visible changes in lxml 2.0 regard the new modules that were added. + + +lxml.usedoctest +--------------- + +A very useful module for doctests based on XML or HTML is +``lxml.doctestcompare``. It provides a relaxed comparison mechanism +for XML and HTML in doctests. Using it for XML comparisons is as +simple as: + +.. sourcecode:: pycon + + >>> import lxml.usedoctest + +and for HTML comparisons: + +.. sourcecode:: pycon + + >>> import lxml.html.usedoctest + + +lxml.html +--------- + +The largest new package that was added to lxml 2.0 is `lxml.html`_. It +contains various tools and modules for HTML handling. The major features +include support for cleaning up HTML (removing unwanted content), a readable +HTML diff and various tools for working with links. + +.. _`lxml.html`: lxmlhtml.html + + +lxml.cssselect +-------------- + +The Cascading Stylesheet Language (CSS_) has a very short and generic path +language for pointing at elements in XML/HTML trees (`CSS selectors`_). The module +lxml.cssselect_ provides an implementation based on XPath. + +.. _lxml.cssselect: cssselect.html +.. _CSS: http://www.w3.org/Style/CSS/ +.. _`CSS selectors`: http://www.w3.org/TR/CSS21/selector.html diff --git a/doc/lxmlhtml.txt b/doc/lxmlhtml.txt new file mode 100644 index 0000000..7f5c95f --- /dev/null +++ b/doc/lxmlhtml.txt @@ -0,0 +1,752 @@ +========= +lxml.html +========= + +:Author: + Ian Bicking + +Since version 2.0, lxml comes with a dedicated package for dealing +with HTML: ``lxml.html``. It provides a special Element API for HTML +elements, as well as a number of utilities for common tasks. + +.. contents:: +.. + 1 Parsing HTML + 1.1 Parsing HTML fragments + 1.2 Really broken pages + 2 HTML Element Methods + 3 Running HTML doctests + 4 Creating HTML with the E-factory + 4.1 Viewing your HTML + 5 Working with links + 5.1 Functions + 6 Forms + 6.1 Form Filling Example + 6.2 Form Submission + 7 Cleaning up HTML + 7.1 autolink + 7.2 wordwrap + 8 HTML Diff + 9 Examples + 9.1 Microformat Example + +The main API is based on the `lxml.etree`_ API, and thus, on the ElementTree_ +API. + +.. _`lxml.etree`: tutorial.html +.. _ElementTree: http://effbot.org/zone/element-index.htm + + +Parsing HTML +============ + +Parsing HTML fragments +---------------------- + +There are several functions available to parse HTML: + +``parse(filename_url_or_file)``: + Parses the named file or url, or if the object has a ``.read()`` + method, parses from that. + + If you give a URL, or if the object has a ``.geturl()`` method (as + file-like objects from ``urllib.urlopen()`` have), then that URL + is used as the base URL. You can also provide an explicit + ``base_url`` keyword argument. + +``document_fromstring(string)``: + Parses a document from the given string. This always creates a + correct HTML document, which means the parent node is ````, + and there is a body and possibly a head. + +``fragment_fromstring(string, create_parent=False)``: + Returns an HTML fragment from a string. The fragment must contain + just a single element, unless ``create_parent`` is given; + e.g,. ``fragment_fromstring(string, create_parent='div')`` will + wrap the element in a ``
``. + +``fragments_fromstring(string)``: + Returns a list of the elements found in the fragment. + +``fromstring(string)``: + Returns ``document_fromstring`` or ``fragment_fromstring``, based + on whether the string looks like a full document, or just a + fragment. + +Really broken pages +------------------- + +The normal HTML parser is capable of handling broken HTML, but for +pages that are far enough from HTML to call them 'tag soup', it may +still fail to parse the page. A way to deal with this is +ElementSoup_, which deploys the well-known BeautifulSoup_ parser to +build an lxml HTML tree. + +.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/ +.. _ElementSoup: elementsoup.html + + +HTML Element Methods +==================== + +HTML elements have all the methods that come with ElementTree, but +also include some extra methods: + +``.drop_tree()``: + Drops the element and all its children. Unlike + ``el.getparent().remove(el)`` this does *not* remove the tail + text; with ``drop_tree`` the tail text is merged with the previous + element. + +``.drop_tag()``: + Drops the tag, but keeps its children and text. + +``.find_class(class_name)``: + Returns a list of all the elements with the given CSS class name. + Note that class names are space separated in HTML, so + ``doc.find_class_name('highlight')`` will find an element like + ``''')) +
A link in
+ >>> print(autolink_html(''' + ...
A link in http://bar.com
''')) +
A link in http://bar.com
+ >>> print(autolink_html(''' + ...
A link in http://foo.com or + ... http://bar.com
''')) +
A link in http://foo.com or + http://bar.com
+ +There's also a word wrapping function, that should probably be run +after autolink:: + + >>> from lxml.html.clean import word_break_html + >>> def pascii(s): + ... print(s.encode('ascii', 'xmlcharrefreplace').decode('ascii')) + >>> pascii(word_break_html( u''' + ...
Hey you + ... 12345678901234567890123456789012345678901234567890
''')) +
Hey you + 1234567890123456789012345678901234567890​1234567890
+ +Not everything is broken: + + >>> pascii(word_break_html(''' + ...
Hey you + ... 12345678901234567890123456789012345678901234567890
''')) +
Hey you + 12345678901234567890123456789012345678901234567890
+ >>> pascii(word_break_html(''' + ... text''')) + text + + diff --git a/src/lxml/html/tests/test_basic.py b/src/lxml/html/tests/test_basic.py new file mode 100644 index 0000000..fd4896a --- /dev/null +++ b/src/lxml/html/tests/test_basic.py @@ -0,0 +1,13 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest, doctest +import lxml.html + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_basic.txt')]) + suite.addTests([doctest.DocTestSuite(lxml.html)]) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/src/lxml/html/tests/test_basic.txt b/src/lxml/html/tests/test_basic.txt new file mode 100644 index 0000000..5a59d3d --- /dev/null +++ b/src/lxml/html/tests/test_basic.txt @@ -0,0 +1,101 @@ +lxml.html adds a find_class method to elements:: + + >>> from lxml.etree import Comment + >>> from lxml.html import document_fromstring, fragment_fromstring, tostring + >>> from lxml.html.clean import clean, clean_html + >>> from lxml.html import usedoctest + >>> try: unicode = __builtins__["unicode"] + ... except (KeyError, NameError): unicode = str + + >>> h = document_fromstring(''' + ... + ... + ... P1 + ... P2 + ... ''') + >>> print(tostring(h, encoding=unicode)) + + + + P1 + P2 + + + >>> print([e.text for e in h.find_class('fn')]) + ['P1'] + >>> print([e.text for e in h.find_class('vcard')]) + ['P1', 'P2'] + +Also added is a get_rel_links, which you can use to search for links +like ````:: + + >>> h = document_fromstring(''' + ... test 1 + ... + ... item 3 + ... item 4''') + >>> print([e.attrib['href'] for e in h.find_rel_links('tag')]) + ['2', '4'] + >>> print([e.attrib['href'] for e in h.find_rel_links('nofollow')]) + [] + +Another method is ``get_element_by_id`` that does what it says:: + + >>> print(tostring(fragment_fromstring(''' + ...
+ ... stuff + ...
''').get_element_by_id('test'), encoding=unicode)) + stuff + +Or to get the content of an element without the tags, use text_content():: + + >>> el = fragment_fromstring(''' + ...
This is a bold link
''') + >>> el.text_content() + 'This is a bold link' + +Or drop an element (leaving its content) or the entire tree, like:: + + >>> doc = document_fromstring(''' + ... + ... + ...
+ ... This is a test of stuff. + ...
+ ... + ...
footer
+ ... + ... ''') + >>> doc.get_element_by_id('link').drop_tag() + >>> print(tostring(doc, encoding=unicode)) + + +
+ This is a test of stuff. +
+ +
footer
+ + + >>> doc.get_element_by_id('body').drop_tree() + >>> print(tostring(doc, encoding=unicode)) + + + +
footer
+ + + +Note, however, that comment text will not be merged into the tree when you +drop the comment. Here, ``drop_tag()`` behaves exactly like ``drop_tree()``: + + >>> for comment in doc.getiterator(Comment): + ... comment.drop_tag() + >>> print(tostring(doc, encoding=unicode)) + + +
footer
+ + diff --git a/src/lxml/html/tests/test_clean.py b/src/lxml/html/tests/test_clean.py new file mode 100644 index 0000000..411b6a3 --- /dev/null +++ b/src/lxml/html/tests/test_clean.py @@ -0,0 +1,11 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest +from lxml.etree import LIBXML_VERSION + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_clean.txt')]) + if LIBXML_VERSION >= (2,6,31): + suite.addTests([make_doctest('test_clean_embed.txt')]) + return suite diff --git a/src/lxml/html/tests/test_clean.txt b/src/lxml/html/tests/test_clean.txt new file mode 100644 index 0000000..2ad4b19 --- /dev/null +++ b/src/lxml/html/tests/test_clean.txt @@ -0,0 +1,114 @@ +>>> from lxml.html import fromstring, tostring +>>> from lxml.html.clean import clean, clean_html, Cleaner +>>> from lxml.html import usedoctest + +>>> doc = ''' +... +... +... +... +... +... +... +... a link +... another link +...

a paragraph

+...
secret EVIL!
+... of EVIL! +... +...
+... Password: +...
+... spam spam SPAM! +... +... +... ''' + +>>> print(doc) + + + + + + + + + a link + another link +

a paragraph

+
secret EVIL!
+ of EVIL! + +
+ Password: +
+ spam spam SPAM! + + + + +>>> print(tostring(fromstring(doc)).decode("utf-8")) + + + + + + + + + a link + another link +

a paragraph

+
secret EVIL!
+ of EVIL! + +
+ Password: +
+ spam spam SPAM! + + + + +>>> print(Cleaner(page_structure=False, safe_attrs_only=False).clean_html(doc)) + + + + + + a link + another link +

a paragraph

+
secret EVIL!
+ of EVIL! + Password: + spam spam SPAM! + + + + +>>> print(Cleaner(style=True, links=True, add_nofollow=True, +... page_structure=False, safe_attrs_only=False).clean_html(doc)) + + + + + a link + another link +

a paragraph

+
secret EVIL!
+ of EVIL! + Password: + spam spam SPAM! + + + diff --git a/src/lxml/html/tests/test_clean_embed.txt b/src/lxml/html/tests/test_clean_embed.txt new file mode 100644 index 0000000..59a4055 --- /dev/null +++ b/src/lxml/html/tests/test_clean_embed.txt @@ -0,0 +1,39 @@ +THIS FAILS IN libxml2 2.6.29 AND 2.6.30 !! + + +>>> from lxml.html import fromstring, tostring +>>> from lxml.html.clean import clean, clean_html, Cleaner +>>> from lxml.html import usedoctest + +>>> def tostring(el): # work-around for Py3 'bytes' type +... from lxml.html import tostring +... s = tostring(el) +... if not isinstance(s, str): +... s = s.decode('UTF-8') +... return s + +>>> doc_embed = '''
+... +... +... +... +...
''' +>>> print(tostring(fromstring(doc_embed))) +
+ + + + +
+>>> print(Cleaner().clean_html(doc_embed)) +
+
+>>> print(Cleaner(host_whitelist=['www.youtube.com']).clean_html(doc_embed)) +
+ +
+>>> print(Cleaner(host_whitelist=['www.youtube.com'], whitelist_tags=None).clean_html(doc_embed)) +
+ + +
diff --git a/src/lxml/html/tests/test_diff.py b/src/lxml/html/tests/test_diff.py new file mode 100644 index 0000000..f1fba4b --- /dev/null +++ b/src/lxml/html/tests/test_diff.py @@ -0,0 +1,14 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest, doctest + +from lxml.html import diff + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_diff.txt'), + doctest.DocTestSuite(diff)]) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/src/lxml/html/tests/test_diff.txt b/src/lxml/html/tests/test_diff.txt new file mode 100644 index 0000000..ddf3b60 --- /dev/null +++ b/src/lxml/html/tests/test_diff.txt @@ -0,0 +1,227 @@ +lxml.html.diff does HTML comparisons. These are word-based comparisons. + +First, a handy function for normalizing whitespace and doing word wrapping:: + + >>> import re, textwrap + >>> def pwrapped(text): + ... text = re.sub(r'[ \n\t\r]+', ' ', text) + ... text = textwrap.fill(text) + ... print(text) + >>> def pdiff(text1, text2): + ... pwrapped(htmldiff(text1, text2)) + +Example:: + + >>> from lxml.html.diff import htmldiff, html_annotate + >>> html1 = '

This is some test text with some changes and some same stuff

' + >>> html2 = '''

This is some test textual writing with some changed stuff + ... and some same stuff

''' + >>> pdiff(html1, html2) +

This is some test textual writing with some changed + stuff text with some changes and some same stuff

+ +Style tags are largely ignored in terms of differences, though markup is not eliminated:: + + >>> html1 = '

Hi you guys

' + >>> html2 = '

Hi you guys

' + >>> pdiff(html1, html2) +

Hi you guys

+ >>> pdiff('text', '

text

') +

text

+ >>> pdiff('Hi guys !!', 'Hi guy !!') + Hi guy guys !! + >>> pdiff('Hi', 'Hi') + Hi Hi + >>> pdiff('A B C', 'A C') + A B C + >>> pdiff('A B C', 'B C') + A B C + >>> pdiff('

', '

') +

+ >>> pdiff('

Hi

', '

Bye

') +

Bye

Hi

+ >>> pdiff('

Hi Guy

', '

Bye Guy

') +

Bye Hi Guy

+ >>> pdiff('

Hey there

', '') +

Hey there

+ +Whitespace is ignored, as it's not meaningful in HTML:: + + >>> pdiff('
Hi\n\nguys
', '
Hi guy
') +
Hi guy guys
+ +Movement between paragraphs is ignored, as tag-based changes are generally ignored:: + >>> + >>> pdiff('

Hello

World

', '

Hello World

') +

Hello World

+ +As a special case, changing the href of a link is displayed, and +images are treated like words: + + >>> pdiff('search', 'search') + search Link: http://google.com + Link: http://yahoo.com + >>> pdiff('

Print this

', '

Print this

') +

Print this

+ >>> pdiff('search', 'search') + search + +A test of empty elements: + + >>> pdiff('some
text', 'some
test') + some
test

text
+ +The sixteen combinations:: + +First "insert start" (del start/middle/end/none): + + >>> pdiff('A B C', 'D B C D A B C + >>> pdiff('A B C', 'D A C') + D A B C + >>> pdiff('A B C', 'D A B') + D A B C + >>> pdiff('A B C', 'D A B C') + D A B C + +Next, "insert middle" (del start/middle/end/none): + + >>> pdiff('A B C', 'D B C') + D A B C + >>> pdiff('A B C', 'A D C') + A D B C + >>> pdiff('A B C', 'A D B') + A D B C + +This one case hits the threshold of our insensitive matching: + + >>> pdiff('A B C', 'A D B C') + A D A B C + + +Then "insert end" (del start/middle/end/none): + + >>> pdiff('A B C', 'B C D') + A B C D + >>> pdiff('A B C', 'A C D') + A B C D + >>> pdiff('A B C', 'A B D') + A B D C + >>> pdiff('A B C', 'A B C D') + A B C D + +Then no insert (del start/middle/end): + + >>> pdiff('A B C', 'B C') + A B C + >>> pdiff('A B C', 'A C') + A B C + >>> pdiff('A B C', 'A B') + A B C + + >>> pdiff('A B C', 'A B') + A B C + >>> pdiff('A B C', 'A B') + A B C + >>> pdiff('A

hey there how are you?

', 'A') + A

hey there how are you?

+ +Testing a larger document, to make sure there are not weird +unnecessary parallels found: + + >>> pdiff(''' + ...

This is a test document with many words in it that goes on + ... for a while and doesn't have anything do to with the next + ... document that we match this against

''', ''' + ...

This is another document with few similarities to the preceding + ... one, but enough that it may have overlap that could turn into + ... a confusing series of deletes and inserts. + ...

''') +

This is another document with few similarities to the + preceding one, but enough that it may have overlap that could turn + into a confusing series of deletes and inserts.

+

This is a test document with many words in it that goes on for + a while and doesn't have anything do to with the next document that we + match this against

+ + + +Annotation of content can also be done, where every bit of content is +marked up with information about where it came from. + +First, some setup; note that html_annotate is called with a sequence +of documents and the annotation associated with that document. We'll +just use indexes, but you could use author or timestamp information. + + >>> def markup(text, annotation): + ... return '%s' % (annotation, text) + >>> def panno(*docs): + ... pwrapped(html_annotate([(doc, index) for index, doc in enumerate(docs)], + ... markup=markup)) + +Now, a sequence of documents: + + >>> panno('Hello cruel world', 'Hi cruel world', 'Hi world') + Hi world + >>> panno('A similar document', 'A similar document', + ... 'A similar document here') + A similar document here + >>> panno('

P1 para

P2 para

', '

P1 para

P3 foo

') +

P1 para

P3 + foo

+ >>> panno('Hello

There World

','Hello

There Town

') + Hello

There Town

+ >>> panno('

Hello

There World','

Hello

There Town') +

Hello

There + Town + >>> panno('

Hello

There World

','

Hello

There Town

') +

Hello

There + Town

+ >>> panno('

Hi You

', + ... '

Hi You

', + ... '

Hi You

') +

Hi You

+ >>> panno('

Hey

', + ... '

Hey

') +

Hey

+ >>> panno('

Hey You

', + ... '

Hey Guy

') +

Hey Guy

+ +Internals +--------- + + +Some utility functions:: + + >>> from lxml.html.diff import fixup_ins_del_tags, split_unbalanced + >>> def pfixup(text): + ... print(fixup_ins_del_tags(text).strip()) + >>> pfixup('

some text and more text and more

') +

some text and more text and more

+ >>> pfixup('

Hi! you

') +

Hi! you

+ >>> pfixup('
Some text and

more text

') +
Some text and

more text

+ >>> pfixup(''' + ...
One tableMore stuff
''') +
One tableMore stuff
+ + +Testing split_unbalanced:: + + >>> split_unbalanced(['', 'hey', '']) + ([], ['', 'hey', ''], []) + >>> split_unbalanced(['', 'hey']) + ([''], ['hey'], []) + >>> split_unbalanced(['Hey', '', 'You', '']) + ([], ['Hey', 'You'], ['', '']) + >>> split_unbalanced(['So', '', 'Hi', '', 'There', '']) + ([], ['So', 'Hi', '', 'There', ''], ['']) + >>> split_unbalanced(['So', '', 'Hi', '', 'There']) + ([''], ['So', 'Hi', 'There'], ['']) + diff --git a/src/lxml/html/tests/test_elementsoup.py b/src/lxml/html/tests/test_elementsoup.py new file mode 100644 index 0000000..e1dbabc --- /dev/null +++ b/src/lxml/html/tests/test_elementsoup.py @@ -0,0 +1,33 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest, HelperTestCase + +try: + import BeautifulSoup + BS_INSTALLED = True +except ImportError: + BS_INSTALLED = False + +if BS_INSTALLED: + class SoupParserTestCase(HelperTestCase): + from lxml.html import soupparser + + def test_broken_attribute(self): + html = """\ + +
+ + """ + root = self.soupparser.fromstring(html) + self.assert_(root.find('.//input').get('disabled') is not None) + + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + if BS_INSTALLED: + suite.addTests([unittest.makeSuite(SoupParserTestCase)]) + suite.addTests([make_doctest('../../../../doc/elementsoup.txt')]) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/src/lxml/html/tests/test_feedparser_data.py b/src/lxml/html/tests/test_feedparser_data.py new file mode 100644 index 0000000..eaf8c29 --- /dev/null +++ b/src/lxml/html/tests/test_feedparser_data.py @@ -0,0 +1,98 @@ +import sys +import os +import re +try: + from rfc822 import Message +except ImportError: + # Python 3 + from email import message_from_file as Message +import unittest +from lxml.tests.common_imports import doctest +if sys.version_info >= (2,4): + from lxml.doctestcompare import LHTMLOutputChecker + +from lxml.html.clean import clean, Cleaner + +feed_dirs = [ + os.path.join(os.path.dirname(__file__), 'feedparser-data'), + os.path.join(os.path.dirname(__file__), 'hackers-org-data'), + ] +bar_re = re.compile(r"-----+") + +class DummyInput: + def __init__(self, **kw): + for name, value in kw.items(): + setattr(self, name, value) + +class FeedTestCase(unittest.TestCase): + + def __init__(self, filename): + self.filename = filename + unittest.TestCase.__init__(self) + + def parse(self): + f = open(self.filename, 'r') + headers = Message(f) + c = f.read() + f.close() + if not c.strip(): + c = headers.get_payload() + if not headers.keys(): + raise Exception( + "File %s has no headers" % self.filename) + self.description = headers['Description'] + self.expect = headers.get('Expect', '') + self.ignore = headers.get('Ignore') + self.options = [ + o.strip() for o in headers.get('Options', '').split(',') + if o.strip()] + parts = bar_re.split(c) + self.input = parts[0].rstrip() + '\n' + if parts[1:]: + self.expect = parts[1].rstrip() + '\n' + else: + self.expect = None + + def runTest(self): + self.parse() + if self.ignore: + # We've marked this test to be ignored. + return + kw = {} + for name in self.options: + if name.startswith('-'): + kw[name[1:]] = False + else: + kw[name] = True + if kw.get('clean', True): + transformed = Cleaner(**kw).clean_html(self.input) + else: + transformed = self.input + assert self.expect is not None, ( + "No expected output in %s" % self.filename) + checker = LHTMLOutputChecker() + if not checker.check_output(self.expect, transformed, 0): + result = checker.output_difference( + DummyInput(want=self.expect), transformed, 0) + #result += '\noptions: %s %r' % (', '.join(self.options), kw) + #result += repr(transformed) + raise Exception("\n"+result) + + def shortDescription(self): + return self.filename + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + for dir in feed_dirs: + for fn in os.listdir(dir): + fn = os.path.join(dir, fn) + if fn.endswith('.data'): + case = FeedTestCase(fn) + suite.addTests([case]) + # This is my lazy way of stopping on first error: + try: + case.runTest() + except: + break + return suite diff --git a/src/lxml/html/tests/test_formfill.py b/src/lxml/html/tests/test_formfill.py new file mode 100644 index 0000000..7893c20 --- /dev/null +++ b/src/lxml/html/tests/test_formfill.py @@ -0,0 +1,8 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_formfill.txt')]) + return suite diff --git a/src/lxml/html/tests/test_formfill.txt b/src/lxml/html/tests/test_formfill.txt new file mode 100644 index 0000000..8403353 --- /dev/null +++ b/src/lxml/html/tests/test_formfill.txt @@ -0,0 +1,100 @@ +Some basic imports: + + >>> from lxml.html import usedoctest + >>> from lxml.html.formfill import fill_form_html + +The simplest kind of filling is just filling an input with a value: + + >>> print(fill_form_html(''' + ...
''', dict(foo='bar'))) +
+ +You can also fill multiple inputs, like: + + >>> print(fill_form_html(''' + ...
+ ... + ... + ...
''', dict(foo=['bar1', 'bar2']))) +
+ + +
+ +Checkboxes can work either as boolean true/false, or be selected based +on their inclusion in a set of values:: + + >>> print(fill_form_html(''' + ...
+ ... Would you like to be spammed? + ...
+ ... Spam you'd like to receive:
+ ... Viagra spam: + ...
+ ... Stock spam: + ...
+ ... Other spam: + ...
+ ... + ...
''', dict(spam_me=True, type=['viagra', 'other']))) +
+ Would you like to be spammed? +
+ Spam you'd like to receive:
+ Viagra spam: +
+ Stock spam: +
+ Other spam: +
+ +
+ +FIXME: I need to test more of this. But I'm lazy and want to use the +coverage report for some of this. + + +This module also allows you to add error messages to the form. The errors +add an "error" class to the input fields, and any labels if the field +has a label. It also inserts an error message into the form, using a +function you can provide (or the default function). + +Example:: + + >>> from lxml.html.formfill import insert_errors_html + >>> print(insert_errors_html(''' + ...
+ ...
+ ...
+ ... + ...
+ ...
+ ... + ... + ... + ... + ...
''', { + ... 'v1': "err1", + ... 'v2': "err2", + ... 'v3': [None, "err3-2"], + ... 'v4': "err4", + ... None: 'general error', + ... '#fieldset': 'area error', + ... })) +
+
general error
+
+
area error
+
err1
+
+ +
err2
+
+
+ +
err3-2
+ +
err4
+ + +
diff --git a/src/lxml/html/tests/test_forms.py b/src/lxml/html/tests/test_forms.py new file mode 100644 index 0000000..e8b00c4 --- /dev/null +++ b/src/lxml/html/tests/test_forms.py @@ -0,0 +1,11 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_forms.txt')]) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/src/lxml/html/tests/test_forms.txt b/src/lxml/html/tests/test_forms.txt new file mode 100644 index 0000000..aa38a06 --- /dev/null +++ b/src/lxml/html/tests/test_forms.txt @@ -0,0 +1,168 @@ +>>> from lxml.html import usedoctest +>>> from lxml.html import fromstring, tostring +>>> h = fromstring(''' +...
+... +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... linksys +...
+... ''', base_url='http://example.org/form.html') +>>> h.base_url +u'http://example.org/form.html' +>>> f = h.forms[0] +>>> f.action +u'http://example.org/test' +>>> f.method +'GET' +>>> f.inputs # doctest:+NOPARSE_MARKUP + +>>> hidden = f.inputs['hidden_field'] +>>> hidden.checkable +False +>>> hidden.value +'hidden_value' +>>> hidden.value = 'new value' +>>> tostring(hidden) +b'' +>>> checkbox = f.inputs['single_checkbox'] +>>> checkbox.checkable +True +>>> checkbox.type +'checkbox' +>>> checkbox.checked +False +>>> print(checkbox.value) +None +>>> checkbox.checked = True +>>> checkbox.value +'on' +>>> tostring(checkbox) +b'' +>>> checkbox2 = f.inputs['single_checkbox2'] +>>> checkbox2.checked = True +>>> checkbox2.value +'good' +>>> group = f.inputs['check_group'] +>>> group.value # doctest:+NOPARSE_MARKUP + +>>> group.value.add('1') +>>> group.value # doctest:+NOPARSE_MARKUP + +>>> tostring(group[0]) +b'' +>>> group.value.add('doesnotexist') +Traceback (most recent call last): + ... +KeyError: "No checkbox with value 'doesnotexist'" +>>> textarea = f.inputs['textarea_field'] +>>> textarea.value +'some text' +>>> radios = f.inputs['radios'] +>>> radios[0].label.text +'value 1' +>>> radios.value +'value3' +>>> radios.value = 'value1' +>>> radios.value +'value1' +>>> tostring(radios[0]) +b'' +>>> radios.value = None +>>> tostring(radios[0]) +b'' +>>> radios.value_options +['value1', 'value2', 'value3'] +>>> select = f.inputs['select1'] +>>> print(select.value) +None +>>> select.value = "" +>>> select.value +'' +>>> select.value = 'asdf' +Traceback (most recent call last): + ... +ValueError: There is no option with the value of 'asdf' +>>> select.value_options +['No value', '', '1'] +>>> select.value = 'No value' +>>> select.value +'No value' +>>> select = f.inputs['select2'] +>>> select.value # doctest:+NOPARSE_MARKUP + +>>> select.value.update(['2', '3']) +>>> select.value.remove('3') +>>> select.value.add('asdf') +Traceback (most recent call last): + ... +ValueError: There is no option with the value 'asdf' +>>> select.value_options +['1', '2', '3'] +>>> try: from urllib import urlencode +... except ImportError: from urllib.parse import urlencode +>>> print(urlencode(f.form_values())) +hidden_field=new+value&text_field=text_value&single_checkbox=on&single_checkbox2=good&check_group=1&check_group=2&check_group=3&textarea_field=some+text&select1=No+value&select2=1&select2=2&select2=3 +>>> fields = f.fields +>>> fields # doctest:+NOPARSE_MARKUP + +>>> for name, value in fields.items(): +... print('%s: %r' % (name, value)) +textarea_field: 'some text' +radios: None +submit2: 'submit' +submit1: 'submit' +select1: 'No value' +hidden_field: 'new value' +text_field: 'text_value' +reset1: None +single_checkbox: 'on' +select2: +single_checkbox2: 'good' +check_group: + +>>> import lxml.html +>>> tree = lxml.html.fromstring(''' +... +...
+... +... +...
+... +... ''') +>>> tree # doctest: +ELLIPSIS + +>>> tree.forms[0] # doctest: +ELLIPSIS + +>>> tree.forms[0].fields # doctest: +NOPARSE_MARKUP + +>>> tree.forms[0].fields.keys() +['foo'] +>>> tree.forms[0].fields.items() +[('foo', 'bar')] +>>> tree.forms[0].fields.values() +['bar'] diff --git a/src/lxml/html/tests/test_rewritelinks.py b/src/lxml/html/tests/test_rewritelinks.py new file mode 100644 index 0000000..b465323 --- /dev/null +++ b/src/lxml/html/tests/test_rewritelinks.py @@ -0,0 +1,11 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_rewritelinks.txt')]) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/src/lxml/html/tests/test_rewritelinks.txt b/src/lxml/html/tests/test_rewritelinks.txt new file mode 100644 index 0000000..1ba2dc5 --- /dev/null +++ b/src/lxml/html/tests/test_rewritelinks.txt @@ -0,0 +1,181 @@ +We'll define a link translation function: + + >>> base_href = 'http://old/base/path.html' + >>> try: import urlparse + ... except ImportError: import urllib.parse as urlparse + >>> def relocate_href(link): + ... link = urlparse.urljoin(base_href, link) + ... if link.startswith('http://old'): + ... return 'https://new' + link[len('http://old'):] + ... else: + ... return link + +Now for content. First, to make it easier on us, we need to trim the +normalized HTML we get from these functions:: + +Some basics:: + + >>> from lxml.html import usedoctest, tostring + >>> from lxml.html import rewrite_links + >>> print(rewrite_links( + ... '
link', relocate_href)) + link + >>> print(rewrite_links( + ... '', relocate_href)) + + >>> print(rewrite_links( + ... '', relocate_href)) + + >>> print(rewrite_links('''\ + ... + ... + ... x\ + ... ''', relocate_href)) + + x + +Links in CSS are also handled:: + + >>> print(rewrite_links(''' + ... ''', relocate_href)) + + >>> print(rewrite_links(''' + ... ''', relocate_href)) + + +Those links in style attributes are also rewritten:: + + >>> print(rewrite_links(''' + ...
text
+ ... ''', relocate_href)) +
text
+ +The ```` tag is also respected (but also removed):: + + >>> print(rewrite_links(''' + ... + ... + ... + ... + ... link + ... ''', relocate_href)) + + + + link + + + +The ``iterlinks`` method (and function) gives you all the links in +the document, along with the element and attribute the link comes +from. This makes it fairly easy to see what resources the document +references or embeds (an ```` tag is a reference, an ```` tag +is something embedded). It returns a generator of ``(element, attrib, +link)``, which is awkward to test here, so we'll make a printer:: + + >>> from lxml.html import iterlinks, document_fromstring, tostring + >>> def print_iter(seq): + ... for element, attrib, link, pos in seq: + ... if pos: + ... extra = '@%s' % pos + ... else: + ... extra = '' + ... print('%s %s="%s"%s' % (element.tag, attrib, link, extra)) + >>> print_iter(iterlinks(''' + ... + ... + ... + ... + ... + ... + ... + ... + ... + ... + ...
+ ... + ... Hi world! + ...
+ ... ''')) + link href="style.css" + style None="/bg.gif"@40 + style None="/other-styles.css"@69 + script src="/js-funcs.js" + a href="/test.html" + a href="/other.html" + td style="/td-bg.png"@22 + img src="/logo.gif" + +An application of ``iterlinks()`` is ``make_links_absolute()``:: + + >>> from lxml.html import make_links_absolute + >>> print(make_links_absolute(''' + ... + ... + ... + ... + ... + ... + ... + ... + ... + ... + ...
+ ... + ... Hi world! + ...
+ ... ''', + ... base_url="http://my.little.server/url/")) + + + + + + + + + + + +
+ + Hi world! +
+ + diff --git a/src/lxml/html/tests/test_xhtml.py b/src/lxml/html/tests/test_xhtml.py new file mode 100644 index 0000000..dc34aa7 --- /dev/null +++ b/src/lxml/html/tests/test_xhtml.py @@ -0,0 +1,11 @@ +import unittest, sys +from lxml.tests.common_imports import make_doctest +import lxml.html + +def test_suite(): + suite = unittest.TestSuite() + suite.addTests([make_doctest('test_xhtml.txt')]) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/src/lxml/html/tests/test_xhtml.txt b/src/lxml/html/tests/test_xhtml.txt new file mode 100644 index 0000000..db02210 --- /dev/null +++ b/src/lxml/html/tests/test_xhtml.txt @@ -0,0 +1,30 @@ + >>> from lxml.html import document_fromstring, fragment_fromstring, tostring + +lxml.html has two parsers, one for HTML, one for XHTML: + + >>> from lxml.html import HTMLParser, XHTMLParser + >>> html = "

Hi!

" + + >>> root = document_fromstring(html, parser=HTMLParser()) + >>> print(root.tag) + html + + >>> root = document_fromstring(html, parser=XHTMLParser()) + >>> print(root.tag) + html + +There are two functions for converting between HTML and XHTML: + + >>> from lxml.html import xhtml_to_html, html_to_xhtml + + >>> doc = document_fromstring(html, parser=HTMLParser()) + >>> tostring(doc) + b'

Hi!

' + + >>> html_to_xhtml(doc) + >>> tostring(doc) + b'Hi!' + + >>> xhtml_to_html(doc) + >>> tostring(doc) + b'

Hi!

' diff --git a/src/lxml/html/tests/transform_feedparser_data.py b/src/lxml/html/tests/transform_feedparser_data.py new file mode 100644 index 0000000..a34b965 --- /dev/null +++ b/src/lxml/html/tests/transform_feedparser_data.py @@ -0,0 +1,110 @@ +""" +This takes the feedparser tests from here: + + http://feedparser.org/tests/wellformed/sanitize/ + +and rewrites them to be easier to handle (not using the internal model +of feedparser). The input format is:: + + + ... + {content} + ... + +The Expect expression is checked for +``entries[0]['content'][0]['value'] == {data}``. + +The output format is:: + + Description: {description} + Expect: {expression} (if data couldn't be parsed) + Options: + + {content, unescaped} + ---------- + {data, unescaped, if found} + +""" + +import re +import os +import traceback + +_desc_re = re.compile(r'\s*Description:\s*(.*)') +_expect_re = re.compile(r'\s*Expect:\s*(.*)') +_data_expect_re = re.compile(r"entries\[0\]\['[^']+'\](?:\[0\]\['value'\])?\s*==\s*(.*)") +_feed_data_expect_re = re.compile(r"feed\['[^']+'\]\s*==\s*(.*)") + +def parse_content(content): + match = _desc_re.search(content) + desc = match.group(1) + match = _expect_re.search(content) + expect = match.group(1) + data = None + for regex in [_data_expect_re, _feed_data_expect_re]: + match = regex.search(expect) + if match: + # Icky, but I'll trust it + data = eval(match.group(1).strip()) + break + c = None + for tag in ['content', 'summary', 'title', 'copyright', 'tagline', 'info', 'subtitle', 'fullitem', 'body', 'description', 'content:encoded']: + regex = re.compile(r"<%s.*?>(.*)" % (tag, tag), re.S) + match = regex.search(content) + if match: + c = match.group(1) + break + assert c is not None + # Seems like body isn't quoted + if tag != 'body': + c = c.replace('<', '<') + c = c.replace('&', '&') + # FIXME: I should really do more unescaping... + return { + 'Description': desc, + 'Expect': expect, + 'data': data, + 'content': c} + +def serialize_content(d): + s = '''\ +Description: %(Description)s +Expect: %(Expect)s +Options: + +%(content)s +''' % d + if d.get('data') is not None: + s += '----------\n%s' % d['data'] + return s + +def translate_file(filename): + f = open(filename, 'rb') + c = f.read() + f.close() + try: + output = serialize_content(parse_content(c)) + except: + print 'Bad data in %s:' % filename + print c + traceback.print_exc() + print '-'*60 + return + new = os.path.splitext(filename)[0] + '.data' + f = open(new, 'wb') + f.write(output) + f.close() + +def translate_all(dir): + for fn in os.listdir(dir): + fn = os.path.join(dir, fn) + if fn.endswith('.xml'): + translate_file(fn) + +if __name__ == '__main__': + import sys + translate_all(os.path.join(os.path.dirname(__file__), 'feedparser-data')) + diff --git a/src/lxml/html/usedoctest.py b/src/lxml/html/usedoctest.py new file mode 100644 index 0000000..f352a1c --- /dev/null +++ b/src/lxml/html/usedoctest.py @@ -0,0 +1,13 @@ +"""Doctest module for HTML comparison. + +Usage:: + + >>> import lxml.html.usedoctest + >>> # now do your HTML doctests ... + +See `lxml.doctestcompare`. +""" + +from lxml import doctestcompare + +doctestcompare.temp_install(html=True, del_module=__name__) diff --git a/src/lxml/htmlparser.pxd b/src/lxml/htmlparser.pxd new file mode 100644 index 0000000..488f7c6 --- /dev/null +++ b/src/lxml/htmlparser.pxd @@ -0,0 +1,47 @@ +from tree cimport xmlDoc, xmlDict +from tree cimport xmlInputReadCallback, xmlInputCloseCallback +from xmlparser cimport xmlParserCtxt, xmlSAXHandler +from xmlerror cimport xmlError + +cdef extern from "libxml/HTMLparser.h": + ctypedef enum htmlParserOption: + HTML_PARSE_NOERROR # suppress error reports + HTML_PARSE_NOWARNING # suppress warning reports + HTML_PARSE_PEDANTIC # pedantic error reporting + HTML_PARSE_NOBLANKS # remove blank nodes + HTML_PARSE_NONET # Forbid network access + # libxml2 2.6.21+ only: + HTML_PARSE_RECOVER # Relaxed parsing + HTML_PARSE_COMPACT # compact small text nodes + + cdef xmlParserCtxt* htmlCreateMemoryParserCtxt( + char* buffer, int size) nogil + cdef xmlParserCtxt* htmlCreateFileParserCtxt( + char* filename, char* encoding) nogil + cdef xmlParserCtxt* htmlCreatePushParserCtxt(xmlSAXHandler* sax, + void* user_data, + char* chunk, int size, + char* filename, int enc) nogil + cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil + cdef void htmlCtxtReset(xmlParserCtxt* ctxt) nogil + cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil + cdef int htmlParseDocument(xmlParserCtxt* ctxt) nogil + cdef int htmlParseChunk(xmlParserCtxt* ctxt, + char* chunk, int size, int terminate) nogil + + cdef xmlDoc* htmlCtxtReadFile(xmlParserCtxt* ctxt, + char* filename, char* encoding, + int options) nogil + cdef xmlDoc* htmlCtxtReadDoc(xmlParserCtxt* ctxt, + char* buffer, char* URL, char* encoding, + int options) nogil + cdef xmlDoc* htmlCtxtReadIO(xmlParserCtxt* ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void* ioctx, + char* URL, char* encoding, + int options) nogil + cdef xmlDoc* htmlCtxtReadMemory(xmlParserCtxt* ctxt, + char* buffer, int size, + char* filename, char* encoding, + int options) nogil diff --git a/src/lxml/iterparse.pxi b/src/lxml/iterparse.pxi new file mode 100644 index 0000000..761e771 --- /dev/null +++ b/src/lxml/iterparse.pxi @@ -0,0 +1,646 @@ +# iterparse -- event-driven parsing + +DEF __ITERPARSE_CHUNK_SIZE = 32768 + +ctypedef enum _IterparseEventFilter: + ITERPARSE_FILTER_START = 1 + ITERPARSE_FILTER_END = 2 + ITERPARSE_FILTER_START_NS = 4 + ITERPARSE_FILTER_END_NS = 8 + ITERPARSE_FILTER_COMMENT = 16 + ITERPARSE_FILTER_PI = 32 + +cdef int _buildIterparseEventFilter(events) except -1: + cdef int event_filter + event_filter = 0 + for event in events: + if event == u'start': + 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 + elif event == u'end-ns': + event_filter |= ITERPARSE_FILTER_END_NS + elif event == u'comment': + event_filter |= ITERPARSE_FILTER_COMMENT + elif event == u'pi': + event_filter |= ITERPARSE_FILTER_PI + else: + raise ValueError, u"invalid event name '%s'" % event + return event_filter + +cdef int _countNsDefs(xmlNode* c_node): + cdef xmlNs* c_ns + cdef int count + count = 0 + c_ns = c_node.nsDef + while c_ns is not NULL: + count = count + 1 + c_ns = c_ns.next + return count + +cdef int _appendStartNsEvents(xmlNode* c_node, list event_list): + cdef xmlNs* c_ns + cdef int count + count = 0 + c_ns = c_node.nsDef + while c_ns is not NULL: + if c_ns.prefix is NULL: + if python.IS_PYTHON3: + prefix = u'' + else: + prefix = '' + else: + 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 + return count + +cdef class _IterparseContext(_ParserContext): + cdef xmlparser.startElementNsSAX2Func _origSaxStart + cdef xmlparser.endElementNsSAX2Func _origSaxEnd + cdef xmlparser.startElementSAXFunc _origSaxStartNoNs + cdef xmlparser.endElementSAXFunc _origSaxEndNoNs + cdef xmlparser.commentSAXFunc _origSaxComment + cdef xmlparser.processingInstructionSAXFunc _origSaxPI + cdef _Element _root + cdef _Document _doc + cdef int _event_filter + cdef list _events + cdef int _event_index + cdef list _ns_stack + cdef object _pop_ns + cdef list _node_stack + cdef object _pop_node + cdef tuple _tag_tuple + cdef char* _tag_href + cdef char* _tag_name + + def __init__(self): + self._ns_stack = [] + self._pop_ns = self._ns_stack.pop + self._node_stack = [] + self._pop_node = self._node_stack.pop + self._events = [] + self._event_index = 0 + + cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt): + u"wrap original SAX2 callbacks" + cdef xmlparser.xmlSAXHandler* sax + _ParserContext._initParserContext(self, c_ctxt) + 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 \ + self._event_filter & (ITERPARSE_FILTER_START | \ + ITERPARSE_FILTER_START_NS | \ + ITERPARSE_FILTER_END_NS): + sax.startElementNs = _iterparseSaxStart + sax.startElement = _iterparseSaxStartNoNs + + self._origSaxEnd = sax.endElementNs + 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): + sax.endElementNs = _iterparseSaxEnd + sax.endElement = _iterparseSaxEndNoNs + + self._origSaxComment = sax.comment + if self._event_filter & ITERPARSE_FILTER_COMMENT: + sax.comment = _iterparseSaxComment + + self._origSaxPI = sax.processingInstruction + if self._event_filter & ITERPARSE_FILTER_PI: + sax.processingInstruction = _iterparseSaxPI + + 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 + else: + self._tag_tuple = _getNsTag(tag) + href, name = self._tag_tuple + if href is None or href == '*': + self._tag_href = NULL + else: + self._tag_href = _cstr(href) + if name is None or name == '*': + 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 + + cdef int startNode(self, xmlNode* c_node) except -1: + 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: + 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: + 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) + 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 + + cdef int endNode(self, xmlNode* c_node) except -1: + 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): + if self._event_filter & (ITERPARSE_FILTER_START | \ + ITERPARSE_FILTER_START_NS | \ + ITERPARSE_FILTER_END_NS): + node = self._pop_node() + else: + 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) + self._events.append( (u"end", node) ) + + 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: + self._events.append(event) + return 0 + + 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() + 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 + + 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 + + +cdef inline void _pushSaxStartEvent(_IterparseContext context, + xmlNode* c_node): + try: + 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: + context._c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR + context._c_ctxt.disableSAX = 1 + context._store_raised() + +cdef inline void _pushSaxEndEvent(_IterparseContext context, + xmlNode* c_node): + try: + 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 + context._store_raised() + +cdef inline void _pushSaxEvent(_IterparseContext context, + event, xmlNode* c_node): + 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 + context._c_ctxt.disableSAX = 1 + 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, + char** attributes): + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _IterparseContext context + c_ctxt = ctxt + context = <_IterparseContext>c_ctxt._private + context._origSaxStart( + ctxt, localname, prefix, URI, + nb_namespaces, namespaces, + nb_attributes, nb_defaulted, attributes) + _pushSaxStartEvent(context, c_ctxt.node) + +cdef void _iterparseSaxEnd(void* ctxt, char* localname, char* prefix, char* URI): + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _IterparseContext context + c_ctxt = ctxt + 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): + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _IterparseContext context + c_ctxt = ctxt + context = <_IterparseContext>c_ctxt._private + context._origSaxStartNoNs(ctxt, name, attributes) + _pushSaxStartEvent(context, c_ctxt.node) + +cdef void _iterparseSaxEndNoNs(void* ctxt, char* name): + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _IterparseContext context + c_ctxt = ctxt + context = <_IterparseContext>c_ctxt._private + _pushSaxEndEvent(context, c_ctxt.node) + context._origSaxEndNoNs(ctxt, name) + +cdef void _iterparseSaxComment(void* ctxt, char* text): + cdef xmlNode* c_node + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _IterparseContext context + c_ctxt = ctxt + 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) + +cdef void _iterparseSaxPI(void* ctxt, char* target, char* data): + cdef xmlNode* c_node + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _IterparseContext context + c_ctxt = ctxt + 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) + +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: + 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 + else: + 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) + +Incremental parser. + +Parses XML into a tree and generates tuples (event, element) in a +SAX-like fashion. ``event`` is any of 'start', 'end', 'start-ns', +'end-ns'. + +For 'start' and 'end', ``element`` is the Element that the parser just +found opening or closing. For 'start-ns', it is a tuple (prefix, URI) of +a new namespace declaration. For 'end-ns', it is simply None. Note that +all start and end events are guaranteed to be properly nested. + +The keyword argument ``events`` specifies a sequence of event type names +that should be generated. By default, only 'end' events will be +generated. + +The additional ``tag`` argument restricts the 'start' and 'end' events to +those elements that match the given tag. By default, events are generated +for all elements. Note that the 'start-ns' and 'end-ns' events are not +impacted by this restriction. + +The other keyword arguments in the constructor are mainly based on the +libxml2 parser configuration. A DTD will also be loaded if validation or +attribute default values are requested. + +Available boolean keyword arguments: + - attribute_defaults: read default attributes from DTD + - dtd_validation: validate (if DTD is available) + - load_dtd: use DTD for parsing + - no_network: prevent network access for related files + - remove_blank_text: discard blank text nodes + - remove_comments: discard comments + - remove_pis: discard processing instructions + - strip_cdata: replace CDATA sections by normal text content (default: True) + - compact: safe memory for short text content (default: True) + - resolve_entities: replace entities by their text value (default: True) + - huge_tree: disable security restrictions and support very deep trees + and very long text content (only affects libxml2 2.7+) + +Other keyword arguments: + - encoding: override the document encoding + - schema: an XMLSchema to validate against +""" # stupid, stupid MSVC has a 2048 bytes limit for strings!!! + cdef object _tag + cdef object _events + cdef readonly object root + cdef object _source + cdef object _buffer + cdef int (*_parse_chunk)(xmlparser.xmlParserCtxt* ctxt, + 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, + 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 + cdef int parse_options + if not hasattr(source, u'read'): + filename = _encodeFilename(source) + if not python.IS_PYTHON3: + source = filename + source = open(source, u'rb') + else: + filename = _encodeFilename(_getFilenameForFile(source)) + + self._source = source + 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' ]) + + self._events = events + self._tag = tag + + 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 | \ + xmlparser.XML_PARSE_DTDLOAD + 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 + 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: + 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 + + _BaseParser.__init__(self, parse_options, html, schema, + remove_comments, remove_pis, strip_cdata, + None, filename, encoding) + + if self._for_html: + self._parse_chunk = htmlparser.htmlParseChunk + else: + self._parse_chunk = xmlparser.xmlParseChunk + + context = <_IterparseContext>self._getPushParserContext() + __GLOBAL_PARSER_CONTEXT.initParserDict(context._c_ctxt) + + if self._default_encoding is not None: + if self._for_html: + error = _htmlCtxtResetPush( + context._c_ctxt, NULL, 0, + _cstr(self._default_encoding), self._parse_options) + else: + xmlparser.xmlCtxtUseOptions( + context._c_ctxt, self._parse_options) + error = xmlparser.xmlCtxtResetPush( + context._c_ctxt, NULL, 0, NULL, + _cstr(self._default_encoding)) + + context.prepare() + # parser will not be unlocked - no other methods supported + + property error_log: + u"""The error log of the last (or current) parser run. + """ + def __get__(self): + cdef _ParserContext context + context = self._getPushParserContext() + return context._error_log.copy() + + cdef _ParserContext _createContext(self, target): + cdef _IterparseContext context + context = _IterparseContext() + context._setEventFilter(self._events, self._tag) + return context + + def copy(self): + raise TypeError, u"iterparse parsers cannot be copied" + + def __iter__(self): + return self + + def __next__(self): + cdef _IterparseContext context + cdef xmlparser.xmlParserCtxt* pctxt + cdef cstd.FILE* c_stream + cdef char* c_data + cdef Py_ssize_t c_data_len + cdef int error, done + if self._source is None: + raise StopIteration + + context = <_IterparseContext>self._push_parser_context + if python.PyList_GET_SIZE(context._events) > context._event_index: + 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 + + del context._events[:] + pctxt = context._c_ctxt + error = done = 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) + if not python.PyString_Check(data): + self._source = None + raise TypeError, u"reading file objects must return plain strings" + c_data_len = python.PyString_GET_SIZE(data) + 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: + self._buffer = python.PyString_FromStringAndSize( + NULL, __ITERPARSE_CHUNK_SIZE) + c_data = _cstr(self._buffer) + 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): + error = 1 + elif cstd.feof(c_stream): + done = 1 + if not error: + error = self._parse_chunk( + pctxt, c_data, c_data_len, done) + if error or done: + self._buffer = None + break + + if not error and context._validator is not None: + error = not context._validator.isvalid() + if error: + self._source = None + del context._events[:] + context._assureDocGetsFreed() + _raiseParseError(pctxt, self._filename, context._error_log) + if python.PyList_GET_SIZE(context._events) == 0: + self.root = context._root + self._source = None + raise StopIteration + + context._event_index = 1 + element = python.PyList_GET_ITEM(context._events, 0) + python.Py_INCREF(element) # 'borrowed reference' from PyList_GET_ITEM + return element + + +cdef class iterwalk: + u"""iterwalk(self, element_or_tree, events=("end",), tag=None) + + A tree walker that generates events from an existing tree as if it + was parsing XML data with ``iterparse()``. + """ + cdef list _node_stack + cdef object _pop_node + cdef int _index + cdef list _events + cdef object _pop_event + cdef int _event_filter + cdef tuple _tag_tuple + cdef char* _tag_href + cdef char* _tag_name + + def __init__(self, element_or_tree, events=(u"end",), tag=None): + cdef _Element root + cdef int ns_count + root = _rootNodeOrRaise(element_or_tree) + self._event_filter = _buildIterparseEventFilter(events) + self._setTagFilter(tag) + self._node_stack = [] + self._pop_node = self._node_stack.pop + self._events = [] + self._pop_event = self._events.pop + + if self._event_filter != 0: + self._index = 0 + ns_count = self._start_node(root) + self._node_stack.append( (root, ns_count) ) + else: + self._index = -1 + + cdef void _setTagFilter(self, tag): + if tag is None or tag == u'*': + self._tag_href = NULL + self._tag_name = NULL + else: + self._tag_tuple = _getNsTag(tag) + href, name = self._tag_tuple + if href is None or href == u'*': + self._tag_href = NULL + else: + self._tag_href = _cstr(href) + if name is None or name == u'*': + 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 + + def __iter__(self): + return self + + def __next__(self): + cdef xmlNode* c_child + cdef _Element node + cdef _Element next_node + cdef int ns_count + if python.PyList_GET_SIZE(self._events): + return self._pop_event(0) + ns_count = 0 + # find next node + while self._index >= 0: + node = self._node_stack[self._index][0] + + c_child = _findChildForwards(node._c_node, 0) + if c_child is not NULL: + # try children + next_node = _elementFactory(node._doc, c_child) + else: + # back off + next_node = None + while next_node is None: + # back off through parents + self._index = self._index - 1 + node = self._end_node() + if self._index < 0: + break + next_node = node.getnext() + 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: + ns_count = _countNsDefs(next_node._c_node) + self._node_stack.append( (next_node, ns_count) ) + self._index = self._index + 1 + if python.PyList_GET_SIZE(self._events): + return self._pop_event(0) + raise StopIteration + + 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: + ns_count = _countNsDefs(node._c_node) + 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): + self._events.append( (u"start", node) ) + return ns_count + + cdef _Element _end_node(self): + 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 \ + _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: + self._events.append(event) + return node diff --git a/src/lxml/lxml.etree.c b/src/lxml/lxml.etree.c new file mode 100644 index 0000000..5a1e840 --- /dev/null +++ b/src/lxml/lxml.etree.c @@ -0,0 +1,144755 @@ +/* Generated by Cython 0.11.3 on Fri Oct 30 14:33:22 2009 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#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) +#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 PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #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 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#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 +#include +#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" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static 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; + +static char __pyx_mdoc[] = "The ``lxml.etree`` module implements the extended ElementTree API\nfor XML.\n"; + + +#ifdef 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* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#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) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_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 int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + + +static 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, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); + } + return r; +} + +#define __Pyx_DelItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_DelItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_DelItem_Generic(o, to_py_func(i))) + +static 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 INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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 = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); + return __Pyx_DelItem_Generic(o, j); + } +} + +#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 INLINE int PySet_Clear(PyObject *set) { + PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static 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 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 INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/ + +static int __Pyx_Print(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 *o); /*proto*/ + +#include "descrobject.h" +static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/ + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*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 INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static 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 PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*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*/ + +/* Type declarations */ + +typedef xmlNode *(*_node_to_node_function)(xmlNode *); + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":210 + * 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-2.2/src/lxml/apihelpers.pxi":291 + * _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-2.2/src/lxml/docloader.pxi":3 + * # Custom resolver API + * + * ctypedef enum _InputDocumentDataType: # <<<<<<<<<<<<<< + * PARSER_DATA_EMPTY + * PARSER_DATA_STRING + */ + +typedef enum { + __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-2.2/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-2.2/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 *); + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":236 + * 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-2.2/src/lxml/parser.pxi":1006 + * ############################################################ + * + * 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-2.2/src/lxml/parser.pxi":1185 + * ) + * + * 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-2.2/src/lxml/parser.pxi":1267 + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/nsclasses.pxi":186 + * 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-2.2/src/lxml/nsclasses.pxi":199 + * 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-2.2/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-2.2/src/lxml/xmlerror.pxi":105 + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2097 + * + * + * 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-2.2/src/lxml/xslt.pxi":327 + * + * + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2203 + * 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-2.2/src/lxml/docloader.pxi":101 + * 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-2.2/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-2.2/src/lxml/xpath.pxi":102 + * _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-2.2/src/lxml/xpath.pxi":224 + * + * + * 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-2.2/src/lxml/xpath.pxi":299 + * + * + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":235 + * # 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; + PyObject *_attrib; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1349 + * + * + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1418 + * 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-2.2/src/lxml/xpath.pxi":379 + * + * + * 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-2.2/src/lxml/xpath.pxi":451 + * _find_namespaces = re.compile('({[^}]+})').findall + * + * cdef class ETXPath(XPath): # <<<<<<<<<<<<<< + * u"""ETXPath(self, path, extensions=None, regexp=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-2.2/src/lxml/classlookup.pxi":148 + * + * # 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-2.2/src/lxml/classlookup.pxi":157 + * 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-2.2/src/lxml/classlookup.pxi":347 + * # 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-2.2/src/lxml/readonlytree.pxi":3 + * # read-only tree implementation + * + * cdef class _ReadOnlyElementProxy: # <<<<<<<<<<<<<< + * u"The main read-only Element proxy class (for internal use only!)." + * cdef bint _free_after_use + */ + +struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy { + PyObject_HEAD + struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *__pyx_vtab; + int _free_after_use; + xmlNode *_c_node; + PyObject *_source_proxy; + PyObject *_dependent_proxies; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":99 + * 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-2.2/src/lxml/xslt.pxi":318 + * + * + * 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-2.2/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; + struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":270 + * 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-2.2/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 +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":208 + * + * # 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-2.2/src/lxml/docloader.pxi":148 + * 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-2.2/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-2.2/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-2.2/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-2.2/src/lxml/docloader.pxi":15 + * cdef object _file + * + * 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-2.2/src/lxml/lxml.etree.pyx":1535 + * + * + * 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-2.2/src/lxml/xslt.pxi":660 + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1448 + * return u"" % 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-2.2/src/lxml/classlookup.pxi":127 + * """ + * + * 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-2.2/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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":234 + * + * # 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-2.2/src/lxml/docloader.pxi":9 + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1426 + * return u"" % 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-2.2/src/lxml/classlookup.pxi":113 + * """ + * + * 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-2.2/src/lxml/xslt.pxi":814 + * return __findStylesheetByID(doc, id=id) + * + * cdef class _XSLTProcessingInstruction(PIBase): # <<<<<<<<<<<<<< + * def parseXSL(self, parser=None): + * u"""Try to parse the stylesheet referenced by this PI and return an + */ + +struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction { + struct __pyx_obj_4lxml_5etree_PIBase __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":330 + * # 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-2.2/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_obj_4lxml_5etree__ErrorLog *_error_log; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/xmlerror.pxi":41 + * # Logging classes + * + * cdef class _LogEntry: # <<<<<<<<<<<<<< + * cdef readonly object domain + * cdef readonly object type + */ + +struct __pyx_obj_4lxml_5etree__LogEntry { + PyObject_HEAD + struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtab; + PyObject *domain; + PyObject *type; + PyObject *level; + PyObject *line; + PyObject *column; + PyObject *message; + PyObject *filename; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":259 + * ############################################################ + * + * 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-2.2/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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2390 + * 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-2.2/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-2.2/src/lxml/xmlerror.pxi":192 + * 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-2.2/src/lxml/xmlerror.pxi":312 + * 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-2.2/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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2281 + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2125 + * 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-2.2/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-2.2/src/lxml/xmlerror.pxi":362 + * self._entries.append(entry) + * + * cdef class PyErrorLog(_BaseErrorLog): # <<<<<<<<<<<<<< + * u"""PyErrorLog(self, logger_name=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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/src/lxml/iterparse.pxi":527 + * + * + * 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-2.2/src/lxml/xmlerror.pxi":342 + * 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-2.2/src/lxml/classlookup.pxi":280 + * # 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":410 + * + * + * 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-2.2/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; + struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *__pyx_vtab; + xmlSchema *_c_schema; + int _has_default_attributes; + int _add_attribute_defaults; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2194 + * 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-2.2/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-2.2/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-2.2/src/lxml/readonlytree.pxi":279 + * del sourceProxy._dependent_proxies[:] + * + * 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-2.2/src/lxml/lxml.etree.pyx":1936 + * + * + * 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-2.2/src/lxml/classlookup.pxi":199 + * # 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-2.2/src/lxml/extensions.pxi":590 + * # special str/unicode subclasses + * + * cdef class _ElementUnicodeResult(python.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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":237 + * 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":194 + * + * # class for temporary storage of Python references + * 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-2.2/src/lxml/serializer.pxi":304 + * # 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-2.2/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-2.2/src/lxml/xslt.pxi":167 + * # 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2180 + * 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-2.2/src/lxml/parser.pxi":1343 + * ) + * + * 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-2.2/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-2.2/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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2056 + * return python.PyObject_RichCompare(one, other, op) + * + * 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-2.2/src/lxml/classlookup.pxi":405 + * # 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; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2157 + * 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-2.2/src/lxml/xmlerror.pxi":351 + * _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-2.2/src/lxml/docloader.pxi":101 + * 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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":208 + * + * # 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-2.2/src/lxml/docloader.pxi":148 + * 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-2.2/src/lxml/parser.pxi":676 + * 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-2.2/src/lxml/parser.pxi":1006 + * ############################################################ + * + * 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-2.2/src/lxml/parser.pxi":1185 + * ) + * + * 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; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2097 + * + * + * 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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1349 + * + * + * 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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1448 + * return u"" % 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-2.2/src/lxml/classlookup.pxi":127 + * """ + * + * 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-2.2/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 *); +}; +static struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtabptr_4lxml_5etree__BaseContext; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 *); + 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-2.2/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_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-2.2/src/lxml/iterparse.pxi":527 + * + * + * 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-2.2/src/lxml/classlookup.pxi":157 + * 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-2.2/src/lxml/classlookup.pxi":280 + * # 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-2.2/src/lxml/xmlerror.pxi":105 + * 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-2.2/src/lxml/xmlerror.pxi":192 + * 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-2.2/src/lxml/xmlerror.pxi":312 + * 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-2.2/src/lxml/xmlerror.pxi":342 + * 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-2.2/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; +}; +static struct __pyx_vtabstruct_4lxml_5etree_iterparse *__pyx_vtabptr_4lxml_5etree_iterparse; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":259 + * ############################################################ + * + * cdef class _FileReaderContext: # <<<<<<<<<<<<<< + * cdef object _filelike + * cdef object _encoding + */ + +struct __pyx_vtabstruct_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-2.2/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-2.2/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-2.2/src/lxml/lxml.etree.pyx":1418 + * 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-2.2/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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":194 + * + * # class for temporary storage of Python references + * 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; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2125 + * 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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2180 + * 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-2.2/src/lxml/serializer.pxi":304 + * # 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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1426 + * return u"" % 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-2.2/src/lxml/classlookup.pxi":113 + * """ + * + * 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-2.2/src/lxml/xslt.pxi":270 + * 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-2.2/src/lxml/xslt.pxi":327 + * + * + * 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 *, PyObject *, 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-2.2/src/lxml/xmlerror.pxi":351 + * _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-2.2/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-2.2/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-2.2/src/lxml/nsclasses.pxi":186 + * 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-2.2/src/lxml/xmlerror.pxi":41 + * # Logging classes + * + * cdef class _LogEntry: # <<<<<<<<<<<<<< + * cdef readonly object domain + * cdef readonly object type + */ + +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-2.2/src/lxml/parser.pxi":470 + * ############################################################ + * + * 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-2.2/src/lxml/xpath.pxi":102 + * _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-2.2/src/lxml/xpath.pxi":224 + * + * + * 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-2.2/src/lxml/classlookup.pxi":99 + * 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-2.2/src/lxml/xmlschema.pxi":170 + * 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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2157 + * 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-2.2/src/lxml/classlookup.pxi":330 + * # 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-2.2/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-2.2/src/lxml/xslt.pxi":814 + * return __findStylesheetByID(doc, id=id) + * + * cdef class _XSLTProcessingInstruction(PIBase): # <<<<<<<<<<<<<< + * def parseXSL(self, parser=None): + * u"""Try to parse the stylesheet referenced by this PI and return an + */ + +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-2.2/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-2.2/src/lxml/xpath.pxi":379 + * + * + * 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-2.2/src/lxml/classlookup.pxi":347 + * # 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-2.2/src/lxml/readonlytree.pxi":3 + * # read-only tree implementation + * + * cdef class _ReadOnlyElementProxy: # <<<<<<<<<<<<<< + * u"The main read-only Element proxy class (for internal use only!)." + * cdef bint _free_after_use + */ + +struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy { + int (*_assertNode)(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *); + void (*free_after_use)(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *); + PyObject *(*getchildren)(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":279 + * del sourceProxy._dependent_proxies[:] + * + * 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-2.2/src/lxml/xpath.pxi":451 + * _find_namespaces = re.compile('({[^}]+})').findall + * + * cdef class ETXPath(XPath): # <<<<<<<<<<<<<< + * u"""ETXPath(self, path, extensions=None, regexp=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-2.2/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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/classlookup.pxi":405 + * # 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-2.2/src/lxml/xpath.pxi":299 + * + * + * 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-2.2/src/lxml/xslt.pxi":167 + * # 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; + +__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTreeType; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1535 + * + * + * 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-2.2/src/lxml/xslt.pxi":660 + * 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-2.2/src/lxml/extensions.pxi":360 + * # EXSLT regexp implementation + * + * cdef class _ExsltRegExp: # <<<<<<<<<<<<<< + * cdef dict _compile_map + * def __init__(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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2194 + * 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-2.2/src/lxml/xmlerror.pxi":362 + * self._entries.append(entry) + * + * cdef class PyErrorLog(_BaseErrorLog): # <<<<<<<<<<<<<< + * u"""PyErrorLog(self, logger_name=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; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2203 + * 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-2.2/src/lxml/nsclasses.pxi":199 + * 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-2.2/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; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":251 + * # 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 (*_setNodeNs)(struct LxmlDocument *, xmlNode *, char *); +}; +static struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtabptr_4lxml_5etree__Document; + + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/parser.pxi":1267 + * 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-2.2/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-2.2/src/lxml/parser.pxi":1343 + * ) + * + * 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; +/* Module declarations from lxml.cstd */ + +/* Module declarations from lxml.tree */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from lxml.python */ + +static PyTypeObject *__pyx_ptype_4lxml_6python_slice = 0; +static PyTypeObject *__pyx_ptype_4lxml_6python_unicode = 0; +/* Module declarations from lxml.config */ + +/* Module declarations from lxml.xmlerror */ + +/* Module declarations from lxml.xpath */ + +/* Module declarations from lxml.c14n */ + +/* 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__ReadOnlyElementProxy = 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__LxmlError = 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__XMLSyntaxError = 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_k_87 = 0; +static PyObject *__pyx_k_88 = 0; +static PyObject *__pyx_k_89 = 0; +static PyObject *__pyx_k_90 = 0; +static PyObject *__pyx_k_92 = 0; +static PyObject *__pyx_k_93 = 0; +static PyObject *__pyx_k_94 = 0; +static PyObject *__pyx_k_95 = 0; +static PyObject *__pyx_k_96 = 0; +static PyObject *__pyx_k_97 = 0; +static PyObject *__pyx_k_98 = 0; +static PyObject *__pyx_k_99 = 0; +static PyObject *__pyx_k_100 = 0; +static PyObject *__pyx_k_102 = 0; +static PyObject *__pyx_k_103 = 0; +static PyObject *__pyx_k_105 = 0; +static PyObject *__pyx_k_106 = 0; +static PyObject *__pyx_k_108 = 0; +static PyObject *__pyx_k_109 = 0; +static PyObject *__pyx_k_110 = 0; +static PyObject *__pyx_k_117 = 0; +static PyObject *__pyx_k_118 = 0; +static PyObject *__pyx_k_119 = 0; +static PyObject *__pyx_k_120 = 0; +static PyObject *__pyx_k_121 = 0; +static PyObject *__pyx_k_122 = 0; +static PyObject *__pyx_k_123 = 0; +static PyObject *__pyx_k_124 = 0; +static PyObject *__pyx_k_125 = 0; +static PyObject *__pyx_k_126 = 0; +static PyObject *__pyx_k_127 = 0; +static PyObject *__pyx_k_128 = 0; +static PyObject *__pyx_k_129 = 0; +static PyObject *__pyx_k_130 = 0; +static PyObject *__pyx_k_131 = 0; +static PyObject *__pyx_k_132 = 0; +static PyObject *__pyx_k_133 = 0; +static PyObject *__pyx_k_134 = 0; +static PyObject *__pyx_k_135 = 0; +static PyObject *__pyx_k_136 = 0; +static PyObject *__pyx_k_137 = 0; +static PyObject *__pyx_k_138 = 0; +static PyObject *__pyx_k_139 = 0; +static PyObject *__pyx_k_140 = 0; +static PyObject *__pyx_k_141 = 0; +static PyObject *__pyx_k_142 = 0; +static PyObject *__pyx_k_143 = 0; +static PyObject *__pyx_k_144 = 0; +static PyObject *__pyx_k_145 = 0; +static PyObject *__pyx_k_146 = 0; +static PyObject *__pyx_k_147 = 0; +static PyObject *__pyx_k_148 = 0; +static PyObject *__pyx_k_149 = 0; +static PyObject *__pyx_k_152 = 0; +static PyObject *__pyx_k_153 = 0; +static PyObject *__pyx_k_154 = 0; +static PyObject *__pyx_k_155 = 0; +static PyObject *__pyx_k_156 = 0; +static PyObject *__pyx_k_157 = 0; +static PyObject *__pyx_k_158 = 0; +static PyObject *__pyx_k_159 = 0; +static PyObject *__pyx_k_160 = 0; +static PyObject *__pyx_k_161 = 0; +static PyObject *__pyx_k_162 = 0; +static PyObject *__pyx_k_163 = 0; +static PyObject *__pyx_k_164 = 0; +static PyObject *__pyx_k_166 = 0; +static PyObject *__pyx_k_175 = 0; +static PyObject *__pyx_k_176 = 0; +static PyObject *__pyx_k_177 = 0; +static PyObject *__pyx_k_178 = 0; +static PyObject *__pyx_k_179 = 0; +static PyObject *__pyx_k_180 = 0; +static PyObject *__pyx_k_181 = 0; +static PyObject *__pyx_k_182 = 0; +static PyObject *__pyx_k_185 = 0; +static PyObject *__pyx_k_186 = 0; +static PyObject *__pyx_k_193 = 0; +static PyObject *__pyx_k_194 = 0; +static PyObject *__pyx_k_195 = 0; +static PyObject *__pyx_k_196 = 0; +static PyObject *__pyx_k_197 = 0; +static PyObject *__pyx_k_198 = 0; +static PyObject *__pyx_k_199 = 0; +static PyObject *__pyx_k_200 = 0; +static PyObject *__pyx_k_218 = 0; +static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int); /*proto*/ +static INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *); /*proto*/ +static INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *); /*proto*/ +static INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *, struct LxmlDocument *, xmlNode *); /*proto*/ +static INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *); /*proto*/ +static INLINE void __pyx_f_4lxml_5etree__releaseProxy(struct LxmlElement *); /*proto*/ +static INLINE void __pyx_f_4lxml_5etree__updateProxyDocument(xmlNode *, struct LxmlDocument *); /*proto*/ +static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *, xmlNode *); /*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 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 INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *, xmlDict *, xmlDict *); /*proto*/ +static INLINE void __pyx_f_4lxml_5etree_fixThreadDictNameForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/ +static INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/ +static INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/ +static void __pyx_f_4lxml_5etree_displayNode(xmlNode *, PyObject *); /*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 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 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 INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *); /*proto*/ +static 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 INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *); /*proto*/ +static INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *); /*proto*/ +static int __pyx_f_4lxml_5etree__findChildSlice(PySliceObject *, xmlNode *, xmlNode **, Py_ssize_t *, Py_ssize_t *); /*proto*/ +static int __pyx_f_4lxml_5etree__isFullSlice(PySliceObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *, Py_ssize_t); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *, Py_ssize_t); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *); /*proto*/ +static INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *); /*proto*/ +static INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *, char *, char *); /*proto*/ +static int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *, xmlNode *); /*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 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 INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *); /*proto*/ +static INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *); /*proto*/ +static 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 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__ReadOnlyElementProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *, xmlNode *); /*proto*/ +static INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *, struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *); /*proto*/ +static struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *, xmlNode *); /*proto*/ +static xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *); /*proto*/ +static 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 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 *, int, int, int, int, int); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int); /*proto*/ +static void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *, xmlNode *, 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 *, 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 INLINE void __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *); /*proto*/ +static INLINE void __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__IterparseContext *, xmlNode *); /*proto*/ +static 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 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__sortedTagList(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__filterSpecialTagNames(PyObject *, int *, int *, int *); /*proto*/ +static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *, struct LxmlDocument *, int); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *, struct LxmlDocument *, int, int); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *, xmlNode *, struct LxmlDocument *, int, int); /*proto*/ +static void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *, struct LxmlElement *, int, int); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *, xmlNode *, int); /*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 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 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) *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" +int __pyx_module_is_main_lxml__etree = 0; + +/* Implementation of lxml.etree */ +static char __pyx_k_2[] = "Returns the name of the root node as defined by the DOCTYPE."; +static char __pyx_k_3[] = "Returns the public ID of the DOCTYPE."; +static char __pyx_k_4[] = "Returns the system ID of the DOCTYPE."; +static char __pyx_k_5[] = "Returns the XML version as declared by the document."; +static char __pyx_k_6[] = "Returns the encoding name as declared by the document."; +static char __pyx_k_7[] = "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_8[] = "The source URL of the document (or None if unknown)."; +static char __pyx_k_9[] = "Returns a DOCTYPE declaration string for the document."; +static char __pyx_k_10[] = "Returns a DTD validator based on the internal subset of the document."; +static char __pyx_k_11[] = "Returns a DTD validator based on the external subset of the document."; +static char __pyx_k_12[] = "Element tag\n "; +static char __pyx_k_13[] = "Element attribute dictionary. Where possible, use get(), set(),\n keys(), values() and items() to access element attributes.\n "; +static char __pyx_k_14[] = "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_15[] = "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_16[] = "Namespace prefix or None.\n "; +static char __pyx_k_17[] = "Original line number as found by the parser or None if unknown.\n "; +static char __pyx_k_18[] = "Namespace prefix->URI mapping known in the context of this Element.\n "; +static char __pyx_k_19[] = "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_20[] = "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_21[] = "The parser that was used to parse the document in this ElementTree.\n "; +static char __pyx_k_23[] = "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_24[] = "Namespace prefix for extension functions."; +static char __pyx_k_25[] = "The error log of the last parser run.\n "; +static char __pyx_k_26[] = "The custom resolver registry of this parser."; +static char __pyx_k_27[] = "The version of the underlying XML parser."; +static char __pyx_k_30[] = "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_31[] = "The error log of the last (or current) parser run.\n "; +static char __pyx_k_32[] = "The access control configuration as a map of options."; +static char __pyx_k_33[] = "The log of errors and warnings of an XSLT execution."; +static char __pyx_k_34[] = "Return an ElementTree with profiling data for the stylesheet run.\n "; +static char __pyx_k_35[] = "The log of validation errors and warnings."; +static char __pyx_k_37[] = "restructuredtext en"; +static char __pyx_k_41[] = "UTF-8"; +static char __pyx_k_42[] = "http://www.w3.org/1999/xhtml"; +static char __pyx_k_44[] = "http://www.w3.org/1999/XSL/Transform"; +static char __pyx_k_46[] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; +static char __pyx_k_48[] = "http://schemas.xmlsoap.org/wsdl/"; +static char __pyx_k_50[] = "http://www.w3.org/2001/XMLSchema"; +static char __pyx_k_52[] = "http://www.w3.org/2001/XMLSchema-instance"; +static char __pyx_k_54[] = "http://purl.org/dc/elements/1.1/"; +static char __pyx_k_56[] = "http://codespeak.net/lxml/objectify/pytype"; +static char __pyx_k_58[] = "Main exception base class for lxml. All other exceptions inherit from\n this one.\n "; +static char __pyx_k_59[] = "Base class for all syntax errors.\n "; +static char __pyx_k_61[] = "Error during C14N serialisation.\n "; +static char __pyx_k_62[] = "[0-9]+"; +static char __pyx_k_64[] = "Unknown libxml2 version: %s"; +static char __pyx_k_68[] = "^(\\s*<\\?\\s*xml[^>]+)\\s+encoding\\s*=\\s*\"[^\"]*\"\\s*"; +static char __pyx_k_69[] = "Libxml2 error levels"; +static char __pyx_k_70[] = "Libxml2 error domains"; +static char __pyx_k_71[] = "Libxml2 error types"; +static char __pyx_k_72[] = "Libxml2 RelaxNG error types"; +static char __pyx_k_73[] = "NONE=0\nWARNING=1\nERROR=2\nFATAL=3\n"; +static char __pyx_k_74[] = "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_75[] = "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_FINISHED=77\nERR_STANDALONE_VALUE=78\n"; +static char __pyx_k_76[] = "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_77[] = "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_78[] = "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_79[] = "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_80[] = "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\nSCHEMAP_UNKNOWN_PREFIX=1767\n"; +static char __pyx_k_81[] = "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_82[] = "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\nSCHEMAP_SRC_SIMPLE_TYPE_4=3003\n"; +static char __pyx_k_83[] = "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_DEFAULT_2_2_2=3061\n"; +static char __pyx_k_84[] = "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_85[] = "I18N_NO_OUTPUT=6004\nCHECK_=6005\nCHECK_X=6006\n"; +static char __pyx_k_86[] = "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_111[] = "Base class of lxml registry errors.\n "; +static char __pyx_k_113[] = "Error registering a namespace extension.\n "; +static char __pyx_k_114[] = "Syntax error while parsing an XML document.\n\n For compatibility with ElementTree 1.3 and later.\n "; +static char __pyx_k_115[] = "Syntax error while parsing an XML document.\n "; +static char __pyx_k_116[] = "Internal lxml parser error.\n "; +static char __pyx_k_150[] = "A libxml2 error that occurred during serialisation.\n "; +static char __pyx_k_167[] = "Error during XInclude processing.\n "; +static char __pyx_k_168[] = "Base class of all XPath errors.\n "; +static char __pyx_k_169[] = "Error during XPath evaluation.\n "; +static char __pyx_k_170[] = "Internal error looking up an XPath extension function.\n "; +static char __pyx_k_171[] = "Error handling an XPath result.\n "; +static char __pyx_k_172[] = ""; +static char __pyx_k_173[] = ""; +static char __pyx_k_183[] = "(\"[^\"]*\")|('[^']*')"; +static char __pyx_k_184[] = "({[^}]+})"; +static char __pyx_k_187[] = "Base class of all XSLT errors.\n "; +static char __pyx_k_188[] = "Error parsing a stylesheet document.\n "; +static char __pyx_k_189[] = "Error running an XSL transformation.\n "; +static char __pyx_k_190[] = "Error serialising an XSLT result.\n "; +static char __pyx_k_191[] = "Error registering an XSLT extension.\n "; +static char __pyx_k_201[] = "\\s+(\\w+)\\s*=\\s*[\"']([^\"']+)[\"']"; +static char __pyx_k_202[] = "\\s+href\\s*=\\s*[\"']([^\"']+)[\"']"; +static char __pyx_k_203[] = "Validation error.\n\n Raised by all document validators when their ``assertValid(tree)``\n method fails.\n "; +static char __pyx_k_204[] = "Base class for DTD errors.\n "; +static char __pyx_k_205[] = "Error while parsing a DTD.\n "; +static char __pyx_k_206[] = "Error while validating an XML document with a DTD.\n "; +static char __pyx_k_207[] = "Base class for RelaxNG errors.\n "; +static char __pyx_k_208[] = "Error while parsing an XML document as RelaxNG.\n "; +static char __pyx_k_210[] = "Error while validating an XML document with a RelaxNG schema.\n "; +static char __pyx_k_211[] = "Base class of all XML Schema errors\n "; +static char __pyx_k_212[] = "Error while parsing an XML document as XML Schema.\n "; +static char __pyx_k_214[] = "Error while validating an XML document with an XML Schema.\n "; +static char __pyx_k_215[] = "boolean(//xs:attribute[@default or @fixed][1])"; +static char __pyx_k_217[] = "http://www.w3.org/2001/XMLSchema"; +static char __pyx_k_219[] = "Base class of all Schematron errors.\n "; +static char __pyx_k_221[] = "Error while parsing an XML document as Schematron schema.\n "; +static char __pyx_k_223[] = "Error while validating an XML document with a Schematron schema.\n "; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_100; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_neg_300; +static PyObject *__pyx_int_neg_200; +static PyObject *__pyx_int_neg_100; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_32768; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k___init__[] = "__init__"; +static PyObject *__pyx_kp___init__; +static char __pyx_k___repr__[] = "__repr__"; +static PyObject *__pyx_kp___repr__; +static char __pyx_k_copy[] = "copy"; +static PyObject *__pyx_kp_copy; +static char __pyx_k___iter__[] = "__iter__"; +static PyObject *__pyx_kp___iter__; +static char __pyx_k___getitem__[] = "__getitem__"; +static PyObject *__pyx_kp___getitem__; +static char __pyx_k___len__[] = "__len__"; +static PyObject *__pyx_kp___len__; +static char __pyx_k___contains__[] = "__contains__"; +static PyObject *__pyx_kp___contains__; +static char __pyx_k___nonzero__[] = "__nonzero__"; +static PyObject *__pyx_kp___nonzero__; +static char __pyx_k_filter_domains[] = "filter_domains"; +static PyObject *__pyx_kp_filter_domains; +static char __pyx_k_filter_types[] = "filter_types"; +static PyObject *__pyx_kp_filter_types; +static char __pyx_k_filter_levels[] = "filter_levels"; +static PyObject *__pyx_kp_filter_levels; +static char __pyx_k_filter_from_level[] = "filter_from_level"; +static PyObject *__pyx_kp_filter_from_level; +static char __pyx_k_filter_from_fatals[] = "filter_from_fatals"; +static PyObject *__pyx_kp_filter_from_fatals; +static char __pyx_k_filter_from_errors[] = "filter_from_errors"; +static PyObject *__pyx_kp_filter_from_errors; +static char __pyx_k_1[] = "filter_from_warnings"; +static PyObject *__pyx_kp_1; +static char __pyx_k_clear[] = "clear"; +static PyObject *__pyx_kp_clear; +static char __pyx_k_receive[] = "receive"; +static PyObject *__pyx_kp_receive; +static char __pyx_k_log[] = "log"; +static PyObject *__pyx_kp_log; +static char __pyx_k___dealloc__[] = "__dealloc__"; +static PyObject *__pyx_kp___dealloc__; +static char __pyx_k__init[] = "_init"; +static PyObject *__pyx_kp__init; +static char __pyx_k___setitem__[] = "__setitem__"; +static PyObject *__pyx_kp___setitem__; +static char __pyx_k___delitem__[] = "__delitem__"; +static PyObject *__pyx_kp___delitem__; +static char __pyx_k___deepcopy__[] = "__deepcopy__"; +static PyObject *__pyx_kp___deepcopy__; +static char __pyx_k___copy__[] = "__copy__"; +static PyObject *__pyx_kp___copy__; +static char __pyx_k_set[] = "set"; +static PyObject *__pyx_kp_set; +static char __pyx_k_append[] = "append"; +static PyObject *__pyx_kp_append; +static char __pyx_k_addnext[] = "addnext"; +static PyObject *__pyx_kp_addnext; +static char __pyx_k_addprevious[] = "addprevious"; +static PyObject *__pyx_kp_addprevious; +static char __pyx_k_extend[] = "extend"; +static PyObject *__pyx_kp_extend; +static char __pyx_k_insert[] = "insert"; +static PyObject *__pyx_kp_insert; +static char __pyx_k_remove[] = "remove"; +static PyObject *__pyx_kp_remove; +static char __pyx_k_replace[] = "replace"; +static PyObject *__pyx_kp_replace; +static char __pyx_k___reversed__[] = "__reversed__"; +static PyObject *__pyx_kp___reversed__; +static char __pyx_k_index[] = "index"; +static PyObject *__pyx_kp_index; +static char __pyx_k_get[] = "get"; +static PyObject *__pyx_kp_get; +static char __pyx_k_keys[] = "keys"; +static PyObject *__pyx_kp_keys; +static char __pyx_k_values[] = "values"; +static PyObject *__pyx_kp_values; +static char __pyx_k_items[] = "items"; +static PyObject *__pyx_kp_items; +static char __pyx_k_getchildren[] = "getchildren"; +static PyObject *__pyx_kp_getchildren; +static char __pyx_k_getparent[] = "getparent"; +static PyObject *__pyx_kp_getparent; +static char __pyx_k_getnext[] = "getnext"; +static PyObject *__pyx_kp_getnext; +static char __pyx_k_getprevious[] = "getprevious"; +static PyObject *__pyx_kp_getprevious; +static char __pyx_k_itersiblings[] = "itersiblings"; +static PyObject *__pyx_kp_itersiblings; +static char __pyx_k_iterancestors[] = "iterancestors"; +static PyObject *__pyx_kp_iterancestors; +static char __pyx_k_iterdescendants[] = "iterdescendants"; +static PyObject *__pyx_kp_iterdescendants; +static char __pyx_k_iterchildren[] = "iterchildren"; +static PyObject *__pyx_kp_iterchildren; +static char __pyx_k_getroottree[] = "getroottree"; +static PyObject *__pyx_kp_getroottree; +static char __pyx_k_getiterator[] = "getiterator"; +static PyObject *__pyx_kp_getiterator; +static char __pyx_k_iter[] = "iter"; +static PyObject *__pyx_kp_iter; +static char __pyx_k_itertext[] = "itertext"; +static PyObject *__pyx_kp_itertext; +static char __pyx_k_makeelement[] = "makeelement"; +static PyObject *__pyx_kp_makeelement; +static char __pyx_k_find[] = "find"; +static PyObject *__pyx_kp_find; +static char __pyx_k_findtext[] = "findtext"; +static PyObject *__pyx_kp_findtext; +static char __pyx_k_findall[] = "findall"; +static PyObject *__pyx_kp_findall; +static char __pyx_k_iterfind[] = "iterfind"; +static PyObject *__pyx_kp_iterfind; +static char __pyx_k_xpath[] = "xpath"; +static PyObject *__pyx_kp_xpath; +static char __pyx_k___str__[] = "__str__"; +static PyObject *__pyx_kp___str__; +static char __pyx_k___hash__[] = "__hash__"; +static PyObject *__pyx_kp___hash__; +static char __pyx_k___richcmp__[] = "__richcmp__"; +static PyObject *__pyx_kp___richcmp__; +static char __pyx_k_parse[] = "parse"; +static PyObject *__pyx_kp_parse; +static char __pyx_k__setroot[] = "_setroot"; +static PyObject *__pyx_kp__setroot; +static char __pyx_k_getroot[] = "getroot"; +static PyObject *__pyx_kp_getroot; +static char __pyx_k_write[] = "write"; +static PyObject *__pyx_kp_write; +static char __pyx_k_getpath[] = "getpath"; +static PyObject *__pyx_kp_getpath; +static char __pyx_k_xslt[] = "xslt"; +static PyObject *__pyx_kp_xslt; +static char __pyx_k_relaxng[] = "relaxng"; +static PyObject *__pyx_kp_relaxng; +static char __pyx_k_xmlschema[] = "xmlschema"; +static PyObject *__pyx_kp_xmlschema; +static char __pyx_k_xinclude[] = "xinclude"; +static PyObject *__pyx_kp_xinclude; +static char __pyx_k_22[] = "write_c14n"; +static PyObject *__pyx_kp_22; +static char __pyx_k_update[] = "update"; +static PyObject *__pyx_kp_update; +static char __pyx_k_pop[] = "pop"; +static PyObject *__pyx_kp_pop; +static char __pyx_k_iterkeys[] = "iterkeys"; +static PyObject *__pyx_kp_iterkeys; +static char __pyx_k_itervalues[] = "itervalues"; +static PyObject *__pyx_kp_itervalues; +static char __pyx_k_iteritems[] = "iteritems"; +static PyObject *__pyx_kp_iteritems; +static char __pyx_k_has_key[] = "has_key"; +static PyObject *__pyx_kp_has_key; +static char __pyx_k___next__[] = "__next__"; +static PyObject *__pyx_kp___next__; +static char __pyx_k___cinit__[] = "__cinit__"; +static PyObject *__pyx_kp___cinit__; +static char __pyx_k_set_fallback[] = "set_fallback"; +static PyObject *__pyx_kp_set_fallback; +static char __pyx_k_lookup[] = "lookup"; +static PyObject *__pyx_kp_lookup; +static char __pyx_k_get_namespace[] = "get_namespace"; +static PyObject *__pyx_kp_get_namespace; +static char __pyx_k_resolve[] = "resolve"; +static PyObject *__pyx_kp_resolve; +static char __pyx_k_resolve_empty[] = "resolve_empty"; +static PyObject *__pyx_kp_resolve_empty; +static char __pyx_k_resolve_string[] = "resolve_string"; +static PyObject *__pyx_kp_resolve_string; +static char __pyx_k_resolve_filename[] = "resolve_filename"; +static PyObject *__pyx_kp_resolve_filename; +static char __pyx_k_resolve_file[] = "resolve_file"; +static PyObject *__pyx_kp_resolve_file; +static char __pyx_k_add[] = "add"; +static PyObject *__pyx_kp_add; +static char __pyx_k_28[] = "setElementClassLookup"; +static PyObject *__pyx_kp_28; +static char __pyx_k_29[] = "set_element_class_lookup"; +static PyObject *__pyx_kp_29; +static char __pyx_k_feed[] = "feed"; +static PyObject *__pyx_kp_feed; +static char __pyx_k_close[] = "close"; +static PyObject *__pyx_kp_close; +static char __pyx_k_data[] = "data"; +static PyObject *__pyx_kp_data; +static char __pyx_k_start[] = "start"; +static PyObject *__pyx_kp_start; +static char __pyx_k_end[] = "end"; +static PyObject *__pyx_kp_end; +static char __pyx_k_pi[] = "pi"; +static PyObject *__pyx_kp_pi; +static char __pyx_k_comment[] = "comment"; +static PyObject *__pyx_kp_comment; +static char __pyx_k___call__[] = "__call__"; +static PyObject *__pyx_kp___call__; +static char __pyx_k_test[] = "test"; +static PyObject *__pyx_kp_test; +static char __pyx_k_match[] = "match"; +static PyObject *__pyx_kp_match; +static char __pyx_k_evaluate[] = "evaluate"; +static PyObject *__pyx_kp_evaluate; +static char __pyx_k_register_namespace[] = "register_namespace"; +static PyObject *__pyx_kp_register_namespace; +static char __pyx_k_register_namespaces[] = "register_namespaces"; +static PyObject *__pyx_kp_register_namespaces; +static char __pyx_k_DENY_ALL[] = "DENY_ALL"; +static PyObject *__pyx_kp_DENY_ALL; +static char __pyx_k_DENY_WRITE[] = "DENY_WRITE"; +static PyObject *__pyx_kp_DENY_WRITE; +static char __pyx_k_strparam[] = "strparam"; +static PyObject *__pyx_kp_strparam; +static char __pyx_k_apply[] = "apply"; +static PyObject *__pyx_kp_apply; +static char __pyx_k_tostring[] = "tostring"; +static PyObject *__pyx_kp_tostring; +static char __pyx_k___unicode__[] = "__unicode__"; +static PyObject *__pyx_kp___unicode__; +static char __pyx_k___getbuffer__[] = "__getbuffer__"; +static PyObject *__pyx_kp___getbuffer__; +static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; +static PyObject *__pyx_kp___releasebuffer__; +static char __pyx_k_parseXSL[] = "parseXSL"; +static PyObject *__pyx_kp_parseXSL; +static char __pyx_k_execute[] = "execute"; +static PyObject *__pyx_kp_execute; +static char __pyx_k_apply_templates[] = "apply_templates"; +static PyObject *__pyx_kp_apply_templates; +static char __pyx_k_validate[] = "validate"; +static PyObject *__pyx_kp_validate; +static char __pyx_k_assertValid[] = "assertValid"; +static PyObject *__pyx_kp_assertValid; +static char __pyx_k_assert_[] = "assert_"; +static PyObject *__pyx_kp_assert_; +static char __pyx_k_self[] = "self"; +static PyObject *__pyx_kp_self; +static char __pyx_k_message[] = "message"; +static PyObject *__pyx_kp_message; +static char __pyx_k_error_log[] = "error_log"; +static PyObject *__pyx_kp_error_log; +static char __pyx_k_first_error[] = "first_error"; +static PyObject *__pyx_kp_first_error; +static char __pyx_k_last_error[] = "last_error"; +static PyObject *__pyx_kp_last_error; +static char __pyx_k_entries[] = "entries"; +static PyObject *__pyx_kp_entries; +static char __pyx_k_error_type[] = "error_type"; +static PyObject *__pyx_kp_error_type; +static char __pyx_k_domains[] = "domains"; +static PyObject *__pyx_kp_domains; +static char __pyx_k_types[] = "types"; +static PyObject *__pyx_kp_types; +static char __pyx_k_levels[] = "levels"; +static PyObject *__pyx_kp_levels; +static char __pyx_k_level[] = "level"; +static PyObject *__pyx_kp_level; +static char __pyx_k_entry[] = "entry"; +static PyObject *__pyx_kp_entry; +static char __pyx_k_max_len[] = "max_len"; +static PyObject *__pyx_kp_max_len; +static char __pyx_k_logger_name[] = "logger_name"; +static PyObject *__pyx_kp_logger_name; +static char __pyx_k_log_entry[] = "log_entry"; +static PyObject *__pyx_kp_log_entry; +static char __pyx_k_tree[] = "tree"; +static PyObject *__pyx_kp_tree; +static char __pyx_k_url[] = "url"; +static PyObject *__pyx_kp_url; +static char __pyx_k_x[] = "x"; +static PyObject *__pyx_kp_x; +static char __pyx_k_value[] = "value"; +static PyObject *__pyx_kp_value; +static char __pyx_k_memo[] = "memo"; +static PyObject *__pyx_kp_memo; +static char __pyx_k_key[] = "key"; +static PyObject *__pyx_kp_key; +static char __pyx_k_element[] = "element"; +static PyObject *__pyx_kp_element; +static char __pyx_k_elements[] = "elements"; +static PyObject *__pyx_kp_elements; +static char __pyx_k_old_element[] = "old_element"; +static PyObject *__pyx_kp_old_element; +static char __pyx_k_new_element[] = "new_element"; +static PyObject *__pyx_kp_new_element; +static char __pyx_k_line[] = "line"; +static PyObject *__pyx_kp_line; +static char __pyx_k_child[] = "child"; +static PyObject *__pyx_kp_child; +static char __pyx_k_stop[] = "stop"; +static PyObject *__pyx_kp_stop; +static char __pyx_k_default[] = "default"; +static PyObject *__pyx_kp_default; +static char __pyx_k_tag[] = "tag"; +static PyObject *__pyx_kp_tag; +static char __pyx_k_preceding[] = "preceding"; +static PyObject *__pyx_kp_preceding; +static char __pyx_k_reversed[] = "reversed"; +static PyObject *__pyx_kp_reversed; +static char __pyx_k_with_tail[] = "with_tail"; +static PyObject *__pyx_kp_with_tail; +static char __pyx_k__tag[] = "_tag"; +static PyObject *__pyx_kp__tag; +static char __pyx_k_attrib[] = "attrib"; +static PyObject *__pyx_kp_attrib; +static char __pyx_k_nsmap[] = "nsmap"; +static PyObject *__pyx_kp_nsmap; +static char __pyx_k_path[] = "path"; +static PyObject *__pyx_kp_path; +static char __pyx_k__path[] = "_path"; +static PyObject *__pyx_kp__path; +static char __pyx_k_namespaces[] = "namespaces"; +static PyObject *__pyx_kp_namespaces; +static char __pyx_k_extensions[] = "extensions"; +static PyObject *__pyx_kp_extensions; +static char __pyx_k_smart_strings[] = "smart_strings"; +static PyObject *__pyx_kp_smart_strings; +static char __pyx_k_36[] = "text_or_uri_or_element"; +static PyObject *__pyx_kp_36; +static char __pyx_k_one[] = "one"; +static PyObject *__pyx_kp_one; +static char __pyx_k_other[] = "other"; +static PyObject *__pyx_kp_other; +static char __pyx_k_op[] = "op"; +static PyObject *__pyx_kp_op; +static char __pyx_k_source[] = "source"; +static PyObject *__pyx_kp_source; +static char __pyx_k_parser[] = "parser"; +static PyObject *__pyx_kp_parser; +static char __pyx_k_base_url[] = "base_url"; +static PyObject *__pyx_kp_base_url; +static char __pyx_k_root[] = "root"; +static PyObject *__pyx_kp_root; +static char __pyx_k_file[] = "file"; +static PyObject *__pyx_kp_file; +static char __pyx_k_encoding[] = "encoding"; +static PyObject *__pyx_kp_encoding; +static char __pyx_k_method[] = "method"; +static PyObject *__pyx_kp_method; +static char __pyx_k_pretty_print[] = "pretty_print"; +static PyObject *__pyx_kp_pretty_print; +static char __pyx_k_xml_declaration[] = "xml_declaration"; +static PyObject *__pyx_kp_xml_declaration; +static char __pyx_k_standalone[] = "standalone"; +static PyObject *__pyx_kp_standalone; +static char __pyx_k_compression[] = "compression"; +static PyObject *__pyx_kp_compression; +static char __pyx_k__xslt[] = "_xslt"; +static PyObject *__pyx_kp__xslt; +static char __pyx_k_access_control[] = "access_control"; +static PyObject *__pyx_kp_access_control; +static char __pyx_k_exclusive[] = "exclusive"; +static PyObject *__pyx_kp_exclusive; +static char __pyx_k_with_comments[] = "with_comments"; +static PyObject *__pyx_kp_with_comments; +static char __pyx_k_sequence_or_dict[] = "sequence_or_dict"; +static PyObject *__pyx_kp_sequence_or_dict; +static char __pyx_k_node[] = "node"; +static PyObject *__pyx_kp_node; +static char __pyx_k_inclusive[] = "inclusive"; +static PyObject *__pyx_kp_inclusive; +static char __pyx_k_text[] = "text"; +static PyObject *__pyx_kp_text; +static char __pyx_k_target[] = "target"; +static PyObject *__pyx_kp_target; +static char __pyx_k_name[] = "name"; +static PyObject *__pyx_kp_name; +static char __pyx_k__parent[] = "_parent"; +static PyObject *__pyx_kp__parent; +static char __pyx_k_strings[] = "strings"; +static PyObject *__pyx_kp_strings; +static char __pyx_k_elem[] = "elem"; +static PyObject *__pyx_kp_elem; +static char __pyx_k_element_or_tree[] = "element_or_tree"; +static PyObject *__pyx_kp_element_or_tree; +static char __pyx_k_other_element[] = "other_element"; +static PyObject *__pyx_kp_other_element; +static char __pyx_k_fallback[] = "fallback"; +static PyObject *__pyx_kp_fallback; +static char __pyx_k_entity[] = "entity"; +static PyObject *__pyx_kp_entity; +static char __pyx_k_attribute_name[] = "attribute_name"; +static PyObject *__pyx_kp_attribute_name; +static char __pyx_k_class_mapping[] = "class_mapping"; +static PyObject *__pyx_kp_class_mapping; +static char __pyx_k_type[] = "type"; +static PyObject *__pyx_kp_type; +static char __pyx_k_doc[] = "doc"; +static PyObject *__pyx_kp_doc; +static char __pyx_k_namespace[] = "namespace"; +static PyObject *__pyx_kp_namespace; +static char __pyx_k_ns_uri[] = "ns_uri"; +static PyObject *__pyx_kp_ns_uri; +static char __pyx_k_class_dict_iterable[] = "class_dict_iterable"; +static PyObject *__pyx_kp_class_dict_iterable; +static char __pyx_k_item[] = "item"; +static PyObject *__pyx_kp_item; +static char __pyx_k_prefix[] = "prefix"; +static PyObject *__pyx_kp_prefix; +static char __pyx_k_system_url[] = "system_url"; +static PyObject *__pyx_kp_system_url; +static char __pyx_k_public_id[] = "public_id"; +static PyObject *__pyx_kp_public_id; +static char __pyx_k_context[] = "context"; +static PyObject *__pyx_kp_context; +static char __pyx_k_string[] = "string"; +static PyObject *__pyx_kp_string; +static char __pyx_k_filename[] = "filename"; +static PyObject *__pyx_kp_filename; +static char __pyx_k_f[] = "f"; +static PyObject *__pyx_kp_f; +static char __pyx_k_default_resolver[] = "default_resolver"; +static PyObject *__pyx_kp_default_resolver; +static char __pyx_k_resolver[] = "resolver"; +static PyObject *__pyx_kp_resolver; +static char __pyx_k_code[] = "code"; +static PyObject *__pyx_kp_code; +static char __pyx_k_column[] = "column"; +static PyObject *__pyx_kp_column; +static char __pyx_k_filelike[] = "filelike"; +static PyObject *__pyx_kp_filelike; +static char __pyx_k_exc_context[] = "exc_context"; +static PyObject *__pyx_kp_exc_context; +static char __pyx_k_parse_options[] = "parse_options"; +static PyObject *__pyx_kp_parse_options; +static char __pyx_k_for_html[] = "for_html"; +static PyObject *__pyx_kp_for_html; +static char __pyx_k_schema[] = "schema"; +static PyObject *__pyx_kp_schema; +static char __pyx_k_remove_comments[] = "remove_comments"; +static PyObject *__pyx_kp_remove_comments; +static char __pyx_k_remove_pis[] = "remove_pis"; +static PyObject *__pyx_kp_remove_pis; +static char __pyx_k_strip_cdata[] = "strip_cdata"; +static PyObject *__pyx_kp_strip_cdata; +static char __pyx_k_attribute_defaults[] = "attribute_defaults"; +static PyObject *__pyx_kp_attribute_defaults; +static char __pyx_k_dtd_validation[] = "dtd_validation"; +static PyObject *__pyx_kp_dtd_validation; +static char __pyx_k_load_dtd[] = "load_dtd"; +static PyObject *__pyx_kp_load_dtd; +static char __pyx_k_no_network[] = "no_network"; +static PyObject *__pyx_kp_no_network; +static char __pyx_k_ns_clean[] = "ns_clean"; +static PyObject *__pyx_kp_ns_clean; +static char __pyx_k_recover[] = "recover"; +static PyObject *__pyx_kp_recover; +static char __pyx_k_huge_tree[] = "huge_tree"; +static PyObject *__pyx_kp_huge_tree; +static char __pyx_k_remove_blank_text[] = "remove_blank_text"; +static PyObject *__pyx_kp_remove_blank_text; +static char __pyx_k_resolve_entities[] = "resolve_entities"; +static PyObject *__pyx_kp_resolve_entities; +static char __pyx_k_compact[] = "compact"; +static PyObject *__pyx_kp_compact; +static char __pyx_k_element_factory[] = "element_factory"; +static PyObject *__pyx_kp_element_factory; +static char __pyx_k_attrs[] = "attrs"; +static PyObject *__pyx_kp_attrs; +static char __pyx_k_result[] = "result"; +static PyObject *__pyx_kp_result; +static char __pyx_k_events[] = "events"; +static PyObject *__pyx_kp_events; +static char __pyx_k_html[] = "html"; +static PyObject *__pyx_kp_html; +static char __pyx_k_etree[] = "etree"; +static PyObject *__pyx_kp_etree; +static char __pyx_k_id_name[] = "id_name"; +static PyObject *__pyx_kp_id_name; +static char __pyx_k_tree_or_element[] = "tree_or_element"; +static PyObject *__pyx_kp_tree_or_element; +static char __pyx_k_enable_regexp[] = "enable_regexp"; +static PyObject *__pyx_kp_enable_regexp; +static char __pyx_k_build_smart_strings[] = "build_smart_strings"; +static PyObject *__pyx_kp_build_smart_strings; +static char __pyx_k_module[] = "module"; +static PyObject *__pyx_kp_module; +static char __pyx_k_function_mapping[] = "function_mapping"; +static PyObject *__pyx_kp_function_mapping; +static char __pyx_k_ns[] = "ns"; +static PyObject *__pyx_kp_ns; +static char __pyx_k_ctxt[] = "ctxt"; +static PyObject *__pyx_kp_ctxt; +static char __pyx_k_s[] = "s"; +static PyObject *__pyx_kp_s; +static char __pyx_k_rexp[] = "rexp"; +static PyObject *__pyx_kp_rexp; +static char __pyx_k_flags[] = "flags"; +static PyObject *__pyx_kp_flags; +static char __pyx_k_replacement[] = "replacement"; +static PyObject *__pyx_kp_replacement; +static char __pyx_k_variables[] = "variables"; +static PyObject *__pyx_kp_variables; +static char __pyx_k__eval_arg[] = "_eval_arg"; +static PyObject *__pyx_kp__eval_arg; +static char __pyx_k_regexp[] = "regexp"; +static PyObject *__pyx_kp_regexp; +static char __pyx_k_uri[] = "uri"; +static PyObject *__pyx_kp_uri; +static char __pyx_k_etree_or_element[] = "etree_or_element"; +static PyObject *__pyx_kp_etree_or_element; +static char __pyx_k__etree_or_element[] = "_etree_or_element"; +static PyObject *__pyx_kp__etree_or_element; +static char __pyx_k_read_file[] = "read_file"; +static PyObject *__pyx_kp_read_file; +static char __pyx_k_write_file[] = "write_file"; +static PyObject *__pyx_kp_write_file; +static char __pyx_k_create_dir[] = "create_dir"; +static PyObject *__pyx_kp_create_dir; +static char __pyx_k_read_network[] = "read_network"; +static PyObject *__pyx_kp_read_network; +static char __pyx_k_write_network[] = "write_network"; +static PyObject *__pyx_kp_write_network; +static char __pyx_k_strval[] = "strval"; +static PyObject *__pyx_kp_strval; +static char __pyx_k_xslt_input[] = "xslt_input"; +static PyObject *__pyx_kp_xslt_input; +static char __pyx_k__input[] = "_input"; +static PyObject *__pyx_kp__input; +static char __pyx_k_profile_run[] = "profile_run"; +static PyObject *__pyx_kp_profile_run; +static char __pyx_k_result_tree[] = "result_tree"; +static PyObject *__pyx_kp_result_tree; +static char __pyx_k_buffer[] = "buffer"; +static PyObject *__pyx_kp_buffer; +static char __pyx_k_self_node[] = "self_node"; +static PyObject *__pyx_kp_self_node; +static char __pyx_k_input_node[] = "input_node"; +static PyObject *__pyx_kp_input_node; +static char __pyx_k_output_parent[] = "output_parent"; +static PyObject *__pyx_kp_output_parent; +static char __pyx_k_external_id[] = "external_id"; +static PyObject *__pyx_kp_external_id; +static char __pyx_k___docformat__[] = "__docformat__"; +static PyObject *__pyx_kp___docformat__; +static char __pyx_k___builtin__[] = "__builtin__"; +static PyObject *__pyx_kp___builtin__; +static char __pyx_k_ImportError[] = "ImportError"; +static PyObject *__pyx_kp_ImportError; +static char __pyx_k_builtins[] = "builtins"; +static PyObject *__pyx_kp_builtins; +static char __pyx_k_unicode[] = "unicode"; +static PyObject *__pyx_kp_unicode; +static char __pyx_k_AttributeError[] = "AttributeError"; +static PyObject *__pyx_kp_AttributeError; +static char __pyx_k_str[] = "str"; +static PyObject *__pyx_kp_str; +static char __pyx_k_38[] = "os.path"; +static PyObject *__pyx_kp_38; +static char __pyx_k_abspath[] = "abspath"; +static PyObject *__pyx_kp_abspath; +static char __pyx_k_io[] = "io"; +static PyObject *__pyx_kp_io; +static char __pyx_k_BytesIO[] = "BytesIO"; +static PyObject *__pyx_kp_BytesIO; +static char __pyx_k_StringIO[] = "StringIO"; +static PyObject *__pyx_kp_StringIO; +static char __pyx_k__elementpath[] = "_elementpath"; +static PyObject *__pyx_kp__elementpath; +static char __pyx_k_sys[] = "sys"; +static PyObject *__pyx_kp_sys; +static char __pyx_k_re[] = "re"; +static PyObject *__pyx_kp_re; +static char __pyx_k_gzip[] = "gzip"; +static PyObject *__pyx_kp_gzip; +static char __pyx_k_DEBUG[] = "DEBUG"; +static PyObject *__pyx_kp_DEBUG; +static char __pyx_k_39[] = "getfilesystemencoding"; +static PyObject *__pyx_kp_39; +static char __pyx_k_getdefaultencoding[] = "getdefaultencoding"; +static PyObject *__pyx_kp_getdefaultencoding; +static char __pyx_k_40[] = "ascii"; +static PyObject *__pyx_kp_40; +static char __pyx_k_encode[] = "encode"; +static PyObject *__pyx_kp_encode; +static char __pyx_k_43[] = "html"; +static PyObject *__pyx_kp_43; +static char __pyx_k_45[] = "xsl"; +static PyObject *__pyx_kp_45; +static char __pyx_k_47[] = "rdf"; +static PyObject *__pyx_kp_47; +static char __pyx_k_49[] = "wsdl"; +static PyObject *__pyx_kp_49; +static char __pyx_k_51[] = "xs"; +static PyObject *__pyx_kp_51; +static char __pyx_k_53[] = "xsi"; +static PyObject *__pyx_kp_53; +static char __pyx_k_55[] = "dc"; +static PyObject *__pyx_kp_55; +static char __pyx_k_57[] = "py"; +static PyObject *__pyx_kp_57; +static char __pyx_k_Error[] = "Error"; +static PyObject *__pyx_kp_Error; +static char __pyx_k_Exception[] = "Exception"; +static PyObject *__pyx_kp_Exception; +static char __pyx_k_LxmlError[] = "LxmlError"; +static PyObject *__pyx_kp_LxmlError; +static char __pyx_k_LxmlSyntaxError[] = "LxmlSyntaxError"; +static PyObject *__pyx_kp_LxmlSyntaxError; +static char __pyx_k_SyntaxError[] = "SyntaxError"; +static PyObject *__pyx_kp_SyntaxError; +static char __pyx_k_60[] = "C14NError"; +static PyObject *__pyx_kp_60; +static char __pyx_k_decode[] = "decode"; +static PyObject *__pyx_kp_decode; +static char __pyx_k_63[] = "ASCII"; +static PyObject *__pyx_kp_63; +static char __pyx_k_group[] = "group"; +static PyObject *__pyx_kp_group; +static char __pyx_k_65[] = "ASCII"; +static PyObject *__pyx_kp_65; +static char __pyx_k_LIBXML_VERSION[] = "LIBXML_VERSION"; +static PyObject *__pyx_kp_LIBXML_VERSION; +static char __pyx_k_66[] = "LIBXML_COMPILED_VERSION"; +static PyObject *__pyx_kp_66; +static char __pyx_k_LXML_VERSION[] = "LXML_VERSION"; +static PyObject *__pyx_kp_LXML_VERSION; +static char __pyx_k_67[] = "ASCII"; +static PyObject *__pyx_kp_67; +static char __pyx_k___version__[] = "__version__"; +static PyObject *__pyx_kp___version__; +static char __pyx_k_compile[] = "compile"; +static PyObject *__pyx_kp_compile; +static char __pyx_k_U[] = "U"; +static PyObject *__pyx_kp_U; +static char __pyx_k_sub[] = "sub"; +static PyObject *__pyx_kp_sub; +static char __pyx_k_ErrorLevels[] = "ErrorLevels"; +static PyObject *__pyx_kp_ErrorLevels; +static char __pyx_k_ErrorDomains[] = "ErrorDomains"; +static PyObject *__pyx_kp_ErrorDomains; +static char __pyx_k_ErrorTypes[] = "ErrorTypes"; +static PyObject *__pyx_kp_ErrorTypes; +static char __pyx_k_RelaxNGErrorTypes[] = "RelaxNGErrorTypes"; +static PyObject *__pyx_kp_RelaxNGErrorTypes; +static char __pyx_k_91[] = "xml"; +static PyObject *__pyx_kp_91; +static char __pyx_k_101[] = "ProcessingInstruction"; +static PyObject *__pyx_kp_101; +static char __pyx_k_PI[] = "PI"; +static PyObject *__pyx_kp_PI; +static char __pyx_k_104[] = "xml"; +static PyObject *__pyx_kp_104; +static char __pyx_k_107[] = "xml"; +static PyObject *__pyx_kp_107; +static char __pyx_k_LxmlRegistryError[] = "LxmlRegistryError"; +static PyObject *__pyx_kp_LxmlRegistryError; +static char __pyx_k_112[] = "NamespaceRegistryError"; +static PyObject *__pyx_kp_112; +static char __pyx_k_ParseError[] = "ParseError"; +static PyObject *__pyx_kp_ParseError; +static char __pyx_k_XMLSyntaxError[] = "XMLSyntaxError"; +static PyObject *__pyx_kp_XMLSyntaxError; +static char __pyx_k_ParserError[] = "ParserError"; +static PyObject *__pyx_kp_ParserError; +static char __pyx_k_inspect[] = "inspect"; +static PyObject *__pyx_kp_inspect; +static char __pyx_k_getargspec[] = "getargspec"; +static PyObject *__pyx_kp_getargspec; +static char __pyx_k__TargetParserResult[] = "_TargetParserResult"; +static PyObject *__pyx_kp__TargetParserResult; +static char __pyx_k_SerialisationError[] = "SerialisationError"; +static PyObject *__pyx_kp_SerialisationError; +static char __pyx_k_151[] = "end"; +static PyObject *__pyx_kp_151; +static char __pyx_k_165[] = "end"; +static PyObject *__pyx_kp_165; +static char __pyx_k_XIncludeError[] = "XIncludeError"; +static PyObject *__pyx_kp_XIncludeError; +static char __pyx_k_XPathError[] = "XPathError"; +static PyObject *__pyx_kp_XPathError; +static char __pyx_k_XPathEvalError[] = "XPathEvalError"; +static PyObject *__pyx_kp_XPathEvalError; +static char __pyx_k_XPathFunctionError[] = "XPathFunctionError"; +static PyObject *__pyx_kp_XPathFunctionError; +static char __pyx_k_XPathResultError[] = "XPathResultError"; +static PyObject *__pyx_kp_XPathResultError; +static char __pyx_k_174[] = "_ElementStringResult"; +static PyObject *__pyx_kp_174; +static char __pyx_k_XPathSyntaxError[] = "XPathSyntaxError"; +static PyObject *__pyx_kp_XPathSyntaxError; +static char __pyx_k_XSLTError[] = "XSLTError"; +static PyObject *__pyx_kp_XSLTError; +static char __pyx_k_XSLTParseError[] = "XSLTParseError"; +static PyObject *__pyx_kp_XSLTParseError; +static char __pyx_k_XSLTApplyError[] = "XSLTApplyError"; +static PyObject *__pyx_kp_XSLTApplyError; +static char __pyx_k_XSLTSaveError[] = "XSLTSaveError"; +static PyObject *__pyx_kp_XSLTSaveError; +static char __pyx_k_XSLTExtensionError[] = "XSLTExtensionError"; +static PyObject *__pyx_kp_XSLTExtensionError; +static char __pyx_k_192[] = "LIBXSLT_COMPILED_VERSION"; +static PyObject *__pyx_kp_192; +static char __pyx_k_LIBXSLT_VERSION[] = "LIBXSLT_VERSION"; +static PyObject *__pyx_kp_LIBXSLT_VERSION; +static char __pyx_k_DocumentInvalid[] = "DocumentInvalid"; +static PyObject *__pyx_kp_DocumentInvalid; +static char __pyx_k_DTDError[] = "DTDError"; +static PyObject *__pyx_kp_DTDError; +static char __pyx_k_DTDParseError[] = "DTDParseError"; +static PyObject *__pyx_kp_DTDParseError; +static char __pyx_k_DTDValidateError[] = "DTDValidateError"; +static PyObject *__pyx_kp_DTDValidateError; +static char __pyx_k_RelaxNGError[] = "RelaxNGError"; +static PyObject *__pyx_kp_RelaxNGError; +static char __pyx_k_RelaxNGParseError[] = "RelaxNGParseError"; +static PyObject *__pyx_kp_RelaxNGParseError; +static char __pyx_k_209[] = "RelaxNGValidateError"; +static PyObject *__pyx_kp_209; +static char __pyx_k_XMLSchemaError[] = "XMLSchemaError"; +static PyObject *__pyx_kp_XMLSchemaError; +static char __pyx_k_XMLSchemaParseError[] = "XMLSchemaParseError"; +static PyObject *__pyx_kp_XMLSchemaParseError; +static char __pyx_k_213[] = "XMLSchemaValidateError"; +static PyObject *__pyx_kp_213; +static char __pyx_k_216[] = "xs"; +static PyObject *__pyx_kp_216; +static char __pyx_k_SchematronError[] = "SchematronError"; +static PyObject *__pyx_kp_SchematronError; +static char __pyx_k_220[] = "SchematronParseError"; +static PyObject *__pyx_kp_220; +static char __pyx_k_222[] = "SchematronValidateError"; +static PyObject *__pyx_kp_222; +static char __pyx_k_super[] = "super"; +static PyObject *__pyx_kp_super; +static char __pyx_k_224[] = "ASCII"; +static PyObject *__pyx_kp_224; +static char __pyx_k_split[] = "split"; +static PyObject *__pyx_kp_split; +static char __pyx_k_ValueError[] = "ValueError"; +static PyObject *__pyx_kp_ValueError; +static char __pyx_k_startswith[] = "startswith"; +static PyObject *__pyx_kp_startswith; +static char __pyx_k_228[] = "dev"; +static PyObject *__pyx_kp_228; +static char __pyx_k_229[] = "alpha"; +static PyObject *__pyx_kp_229; +static char __pyx_k_230[] = "beta"; +static PyObject *__pyx_kp_230; +static char __pyx_k_exc_info[] = "exc_info"; +static PyObject *__pyx_kp_exc_info; +static char __pyx_k_TypeError[] = "TypeError"; +static PyObject *__pyx_kp_TypeError; +static char __pyx_k_238[] = "items"; +static PyObject *__pyx_kp_238; +static char __pyx_k_KeyError[] = "KeyError"; +static PyObject *__pyx_kp_KeyError; +static char __pyx_k_strip[] = "strip"; +static PyObject *__pyx_kp_strip; +static char __pyx_k_UnicodeEncodeError[] = "UnicodeEncodeError"; +static PyObject *__pyx_kp_UnicodeEncodeError; +static char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError"; +static PyObject *__pyx_kp_UnicodeDecodeError; +static char __pyx_k_275[] = "name"; +static PyObject *__pyx_kp_275; +static char __pyx_k_276[] = "geturl"; +static PyObject *__pyx_kp_276; +static char __pyx_k_277[] = "filename"; +static PyObject *__pyx_kp_277; +static char __pyx_k_python[] = "python"; +static PyObject *__pyx_kp_python; +static char __pyx_k_278[] = "PyUnicode_DecodeASCII"; +static PyObject *__pyx_kp_278; +static char __pyx_k_279[] = "backslashreplace"; +static PyObject *__pyx_kp_279; +static char __pyx_k_level_name[] = "level_name"; +static PyObject *__pyx_kp_level_name; +static char __pyx_k_domain_name[] = "domain_name"; +static PyObject *__pyx_kp_domain_name; +static char __pyx_k_type_name[] = "type_name"; +static PyObject *__pyx_kp_type_name; +static char __pyx_k__getName[] = "_getName"; +static PyObject *__pyx_kp__getName; +static char __pyx_k_283[] = "unknown"; +static PyObject *__pyx_kp_283; +static char __pyx_k_RELAXNGV[] = "RELAXNGV"; +static PyObject *__pyx_kp_RELAXNGV; +static char __pyx_k_284[] = "unknown"; +static PyObject *__pyx_kp_284; +static char __pyx_k_285[] = "unknown"; +static PyObject *__pyx_kp_285; +static char __pyx_k_join[] = "join"; +static PyObject *__pyx_kp_join; +static char __pyx_k_FATAL[] = "FATAL"; +static PyObject *__pyx_kp_FATAL; +static char __pyx_k_ERROR[] = "ERROR"; +static PyObject *__pyx_kp_ERROR; +static char __pyx_k_WARNING[] = "WARNING"; +static PyObject *__pyx_kp_WARNING; +static char __pyx_k__accepted_domains[] = "_accepted_domains"; +static PyObject *__pyx_kp__accepted_domains; +static char __pyx_k_domain[] = "domain"; +static PyObject *__pyx_kp_domain; +static char __pyx_k_logging[] = "logging"; +static PyObject *__pyx_kp_logging; +static char __pyx_k_CRITICAL[] = "CRITICAL"; +static PyObject *__pyx_kp_CRITICAL; +static char __pyx_k_getLogger[] = "getLogger"; +static PyObject *__pyx_kp_getLogger; +static char __pyx_k_292[] = "_GlobalErrorLog"; +static PyObject *__pyx_kp_292; +static char __pyx_k_293[] = "_GlobalErrorLog"; +static PyObject *__pyx_kp_293; +static char __pyx_k_294[] = "_GlobalErrorLog"; +static PyObject *__pyx_kp_294; +static char __pyx_k__names[] = "_names"; +static PyObject *__pyx_kp__names; +static char __pyx_k_304[] = "A"; +static PyObject *__pyx_kp_304; +static char __pyx_k_305[] = "A"; +static PyObject *__pyx_kp_305; +static char __pyx_k_IndexError[] = "IndexError"; +static PyObject *__pyx_kp_IndexError; +static char __pyx_k_tail[] = "tail"; +static PyObject *__pyx_kp_tail; +static char __pyx_k_id[] = "id"; +static PyObject *__pyx_kp_id; +static char __pyx_k_warnings[] = "warnings"; +static PyObject *__pyx_kp_warnings; +static char __pyx_k_warn[] = "warn"; +static PyObject *__pyx_kp_warn; +static char __pyx_k_FutureWarning[] = "FutureWarning"; +static PyObject *__pyx_kp_FutureWarning; +static char __pyx_k_Comment[] = "Comment"; +static PyObject *__pyx_kp_Comment; +static char __pyx_k_Entity[] = "Entity"; +static PyObject *__pyx_kp_Entity; +static char __pyx_k_349[] = "ASCII"; +static PyObject *__pyx_kp_349; +static char __pyx_k_350[] = "ASCII"; +static PyObject *__pyx_kp_350; +static char __pyx_k_upper[] = "upper"; +static PyObject *__pyx_kp_upper; +static char __pyx_k_352[] = "ASCII"; +static PyObject *__pyx_kp_352; +static char __pyx_k_353[] = "UTF8"; +static PyObject *__pyx_kp_353; +static char __pyx_k_StopIteration[] = "StopIteration"; +static PyObject *__pyx_kp_StopIteration; +static char __pyx_k_Element[] = "Element"; +static PyObject *__pyx_kp_Element; +static char __pyx_k_373[] = "start"; +static PyObject *__pyx_kp_373; +static char __pyx_k_374[] = "end"; +static PyObject *__pyx_kp_374; +static char __pyx_k_375[] = "start"; +static PyObject *__pyx_kp_375; +static char __pyx_k_376[] = "start"; +static PyObject *__pyx_kp_376; +static char __pyx_k_stdout[] = "stdout"; +static PyObject *__pyx_kp_stdout; +static char __pyx_k_382[] = "ASCII"; +static PyObject *__pyx_kp_382; +static char __pyx_k_384[] = "UTF8"; +static PyObject *__pyx_kp_384; +static char __pyx_k_386[] = "ASCII"; +static PyObject *__pyx_kp_386; +static char __pyx_k__doc[] = "_doc"; +static PyObject *__pyx_kp__doc; +static char __pyx_k_NAMESPACE[] = "NAMESPACE"; +static PyObject *__pyx_kp_NAMESPACE; +static char __pyx_k_TAG[] = "TAG"; +static PyObject *__pyx_kp_TAG; +static char __pyx_k___class__[] = "__class__"; +static PyObject *__pyx_kp___class__; +static char __pyx_k___name__[] = "__name__"; +static PyObject *__pyx_kp___name__; +static char __pyx_k_PARSER[] = "PARSER"; +static PyObject *__pyx_kp_PARSER; +static char __pyx_k_HTML[] = "HTML"; +static PyObject *__pyx_kp_HTML; +static char __pyx_k_408[] = "element"; +static PyObject *__pyx_kp_408; +static char __pyx_k_409[] = "comment"; +static PyObject *__pyx_kp_409; +static char __pyx_k_410[] = "PI"; +static PyObject *__pyx_kp_410; +static char __pyx_k_411[] = "entity"; +static PyObject *__pyx_kp_411; +static char __pyx_k_412[] = "element"; +static PyObject *__pyx_kp_412; +static char __pyx_k_413[] = "items"; +static PyObject *__pyx_kp_413; +static char __pyx_k_414[] = "_"; +static PyObject *__pyx_kp_414; +static char __pyx_k_read[] = "read"; +static PyObject *__pyx_kp_read; +static char __pyx_k_discard[] = "discard"; +static PyObject *__pyx_kp_discard; +static char __pyx_k_position[] = "position"; +static PyObject *__pyx_kp_position; +static char __pyx_k_426[] = "_ParserDictionaryContext"; +static PyObject *__pyx_kp_426; +static char __pyx_k_427[] = "_ParserDictionaryContext"; +static PyObject *__pyx_kp_427; +static char __pyx_k_428[] = "_ParserDictionaryContext"; +static PyObject *__pyx_kp_428; +static char __pyx_k_IOError[] = "IOError"; +static PyObject *__pyx_kp_IOError; +static char __pyx_k_443[] = "WAR_UNDECLARED_ENTITY"; +static PyObject *__pyx_kp_443; +static char __pyx_k_444[] = "ERR_UNDECLARED_ENTITY"; +static PyObject *__pyx_kp_444; +static char __pyx_k_LookupError[] = "LookupError"; +static PyObject *__pyx_kp_LookupError; +static char __pyx_k_455[] = "getvalue"; +static PyObject *__pyx_kp_455; +static char __pyx_k_456[] = "tell"; +static PyObject *__pyx_kp_456; +static char __pyx_k_tell[] = "tell"; +static PyObject *__pyx_kp_tell; +static char __pyx_k_getvalue[] = "getvalue"; +static PyObject *__pyx_kp_getvalue; +static char __pyx_k_457[] = "read"; +static PyObject *__pyx_kp_457; +static char __pyx_k_doctype[] = "doctype"; +static PyObject *__pyx_kp_doctype; +static char __pyx_k_472[] = "__dict__"; +static PyObject *__pyx_kp_472; +static char __pyx_k_lower[] = "lower"; +static PyObject *__pyx_kp_lower; +static char __pyx_k_473[] = "xml"; +static PyObject *__pyx_kp_473; +static char __pyx_k_474[] = "html"; +static PyObject *__pyx_kp_474; +static char __pyx_k_475[] = "text"; +static PyObject *__pyx_kp_475; +static char __pyx_k_479[] = "ASCII"; +static PyObject *__pyx_kp_479; +static char __pyx_k_GzipFile[] = "GzipFile"; +static PyObject *__pyx_kp_GzipFile; +static char __pyx_k_fileobj[] = "fileobj"; +static PyObject *__pyx_kp_fileobj; +static char __pyx_k_mode[] = "mode"; +static PyObject *__pyx_kp_mode; +static char __pyx_k_503[] = "wb"; +static PyObject *__pyx_kp_503; +static char __pyx_k_compresslevel[] = "compresslevel"; +static PyObject *__pyx_kp_compresslevel; +static char __pyx_k_506[] = "wb"; +static PyObject *__pyx_kp_506; +static char __pyx_k_open[] = "open"; +static PyObject *__pyx_kp_open; +static char __pyx_k_507[] = "wb"; +static PyObject *__pyx_kp_507; +static char __pyx_k_510[] = "write"; +static PyObject *__pyx_kp_510; +static char __pyx_k_512[] = "write"; +static PyObject *__pyx_kp_512; +static char __pyx_k_517[] = "start"; +static PyObject *__pyx_kp_517; +static char __pyx_k_518[] = "end"; +static PyObject *__pyx_kp_518; +static char __pyx_k_521[] = "comment"; +static PyObject *__pyx_kp_521; +static char __pyx_k_522[] = "pi"; +static PyObject *__pyx_kp_522; +static char __pyx_k_530[] = "start"; +static PyObject *__pyx_kp_530; +static char __pyx_k_531[] = "end"; +static PyObject *__pyx_kp_531; +static char __pyx_k_533[] = "comment"; +static PyObject *__pyx_kp_533; +static char __pyx_k_534[] = "pi"; +static PyObject *__pyx_kp_534; +static char __pyx_k_535[] = "read"; +static PyObject *__pyx_kp_535; +static char __pyx_k_536[] = "rb"; +static PyObject *__pyx_kp_536; +static char __pyx_k_544[] = "start"; +static PyObject *__pyx_kp_544; +static char __pyx_k_545[] = "end"; +static PyObject *__pyx_kp_545; +static char __pyx_k_XML[] = "XML"; +static PyObject *__pyx_kp_XML; +static char __pyx_k_548[] = "id"; +static PyObject *__pyx_kp_548; +static char __pyx_k_enumerate[] = "enumerate"; +static PyObject *__pyx_kp_enumerate; +static char __pyx_k_sort[] = "sort"; +static PyObject *__pyx_kp_sort; +static char __pyx_k_565[] = "_"; +static PyObject *__pyx_kp_565; +static char __pyx_k_UNICODE[] = "UNICODE"; +static PyObject *__pyx_kp_UNICODE; +static char __pyx_k_IGNORECASE[] = "IGNORECASE"; +static PyObject *__pyx_kp_IGNORECASE; +static char __pyx_k_567[] = "i"; +static PyObject *__pyx_kp_567; +static char __pyx_k_search[] = "search"; +static PyObject *__pyx_kp_search; +static char __pyx_k_568[] = "i"; +static PyObject *__pyx_kp_568; +static char __pyx_k_569[] = "g"; +static PyObject *__pyx_kp_569; +static char __pyx_k_groups[] = "groups"; +static PyObject *__pyx_kp_groups; +static char __pyx_k_571[] = "matches"; +static PyObject *__pyx_kp_571; +static char __pyx_k_SubElement[] = "SubElement"; +static PyObject *__pyx_kp_SubElement; +static char __pyx_k_573[] = "match"; +static PyObject *__pyx_kp_573; +static char __pyx_k_574[] = "i"; +static PyObject *__pyx_kp_574; +static char __pyx_k_575[] = "g"; +static PyObject *__pyx_kp_575; +static char __pyx_k_577[] = "test"; +static PyObject *__pyx_kp_577; +static char __pyx_k_578[] = "match"; +static PyObject *__pyx_kp_578; +static char __pyx_k_579[] = "replace"; +static PyObject *__pyx_kp_579; +static char __pyx_k_NotImplementedError[] = "NotImplementedError"; +static PyObject *__pyx_kp_NotImplementedError; +static char __pyx_k_583[] = "XPATH_POINT"; +static PyObject *__pyx_kp_583; +static char __pyx_k_584[] = "XPATH_RANGE"; +static PyObject *__pyx_kp_584; +static char __pyx_k_585[] = "XPATH_LOCATIONSET"; +static PyObject *__pyx_kp_585; +static char __pyx_k_586[] = "XPATH_USERS"; +static PyObject *__pyx_kp_586; +static char __pyx_k_is_attribute[] = "is_attribute"; +static PyObject *__pyx_kp_is_attribute; +static char __pyx_k_is_tail[] = "is_tail"; +static PyObject *__pyx_kp_is_tail; +static char __pyx_k_is_text[] = "is_text"; +static PyObject *__pyx_kp_is_text; +static char __pyx_k_resolvers[] = "resolvers"; +static PyObject *__pyx_kp_resolvers; +static char __pyx_k_607[] = "read_file"; +static PyObject *__pyx_kp_607; +static char __pyx_k_608[] = "write_file"; +static PyObject *__pyx_kp_608; +static char __pyx_k_609[] = "create_dir"; +static PyObject *__pyx_kp_609; +static char __pyx_k_610[] = "read_network"; +static PyObject *__pyx_kp_610; +static char __pyx_k_611[] = "write_network"; +static PyObject *__pyx_kp_611; +static char __pyx_k_options[] = "options"; +static PyObject *__pyx_kp_options; +static char __pyx_k_ElementTree[] = "ElementTree"; +static PyObject *__pyx_kp_ElementTree; +static char __pyx_k_628[] = "xsl"; +static PyObject *__pyx_kp_628; +static char __pyx_k_635[] = "href"; +static PyObject *__pyx_kp_635; +static char __pyx_k_AssertionError[] = "AssertionError"; +static PyObject *__pyx_kp_AssertionError; +static char __pyx_k_652[] = "read"; +static PyObject *__pyx_kp_652; +static PyObject *__pyx_kp_37; +static PyObject *__pyx_kp_41; +static PyObject *__pyx_kp_42; +static PyObject *__pyx_kp_44; +static PyObject *__pyx_kp_46; +static PyObject *__pyx_kp_48; +static PyObject *__pyx_kp_50; +static PyObject *__pyx_kp_52; +static PyObject *__pyx_kp_54; +static PyObject *__pyx_kp_56; +static PyObject *__pyx_kp_58; +static PyObject *__pyx_kp_59; +static PyObject *__pyx_kp_61; +static PyObject *__pyx_kp_62; +static PyObject *__pyx_kp_64; +static PyObject *__pyx_kp_68; +static PyObject *__pyx_kp_69; +static PyObject *__pyx_kp_70; +static PyObject *__pyx_kp_71; +static PyObject *__pyx_kp_72; +static PyObject *__pyx_kp_73; +static PyObject *__pyx_kp_74; +static PyObject *__pyx_kp_75; +static PyObject *__pyx_kp_76; +static PyObject *__pyx_kp_77; +static PyObject *__pyx_kp_78; +static PyObject *__pyx_kp_79; +static PyObject *__pyx_kp_80; +static PyObject *__pyx_kp_81; +static PyObject *__pyx_kp_82; +static PyObject *__pyx_kp_83; +static PyObject *__pyx_kp_84; +static PyObject *__pyx_kp_85; +static PyObject *__pyx_kp_86; +static PyObject *__pyx_kp_111; +static PyObject *__pyx_kp_113; +static PyObject *__pyx_kp_114; +static PyObject *__pyx_kp_115; +static PyObject *__pyx_kp_116; +static PyObject *__pyx_kp_150; +static PyObject *__pyx_kp_167; +static PyObject *__pyx_kp_168; +static PyObject *__pyx_kp_169; +static PyObject *__pyx_kp_170; +static PyObject *__pyx_kp_171; +static PyObject *__pyx_kp_183; +static PyObject *__pyx_kp_184; +static PyObject *__pyx_kp_187; +static PyObject *__pyx_kp_188; +static PyObject *__pyx_kp_189; +static PyObject *__pyx_kp_190; +static PyObject *__pyx_kp_191; +static PyObject *__pyx_kp_201; +static PyObject *__pyx_kp_202; +static PyObject *__pyx_kp_203; +static PyObject *__pyx_kp_204; +static PyObject *__pyx_kp_205; +static PyObject *__pyx_kp_206; +static PyObject *__pyx_kp_207; +static PyObject *__pyx_kp_208; +static PyObject *__pyx_kp_210; +static PyObject *__pyx_kp_211; +static PyObject *__pyx_kp_212; +static PyObject *__pyx_kp_214; +static PyObject *__pyx_kp_215; +static PyObject *__pyx_kp_217; +static PyObject *__pyx_kp_219; +static PyObject *__pyx_kp_221; +static PyObject *__pyx_kp_223; +static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin_AttributeError; +static PyObject *__pyx_builtin_Exception; +static PyObject *__pyx_builtin_SyntaxError; +static PyObject *__pyx_builtin_super; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_KeyError; +static PyObject *__pyx_builtin_UnicodeEncodeError; +static PyObject *__pyx_builtin_UnicodeDecodeError; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_id; +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 PyObject *__pyx_kp_225; +static PyObject *__pyx_kp_226; +static PyObject *__pyx_kp_227; +static char __pyx_k_225[] = "-"; +static char __pyx_k_226[] = "."; +static char __pyx_k_227[] = "."; +static PyObject *__pyx_kp_231; +static char __pyx_k_231[] = "double registering proxy!"; +static PyObject *__pyx_kp_232; +static char __pyx_k_232[] = "Tried to unregister unknown proxy"; +static PyObject *__pyx_kp_233; +static char __pyx_k_233[] = " "; +static PyObject *__pyx_kp_234; +static PyObject *__pyx_kp_235; +static char __pyx_k_234[] = "Invalid input object: %s"; +static char __pyx_k_235[] = "Input object has no document: %s"; +static PyObject *__pyx_kp_236; +static PyObject *__pyx_kp_237; +static char __pyx_k_236[] = "Invalid input object: %s"; +static char __pyx_k_237[] = "Input object has no element: %s"; +static PyObject *__pyx_kp_239; +static char __pyx_k_239[] = "Invalid attribute dictionary: %s"; +static PyObject *__pyx_kp_240; +static char __pyx_k_240[] = "\\g<1>"; +static PyObject *__pyx_kp_241; +static PyObject *__pyx_kp_242; +static PyObject *__pyx_kp_243; +static char __pyx_k_241[] = ""; +static char __pyx_k_243[] = "\n\r "; +static PyObject *__pyx_kp_244; +static PyObject *__pyx_kp_245; +static PyObject *__pyx_kp_246; +static char __pyx_k_244[] = ""; +static char __pyx_k_245[] = ""; +static char __pyx_k_246[] = ""; +static char __pyx_k_247[] = "%s:%s"; +static PyObject *__pyx_kp_248; +static PyObject *__pyx_kp_249; +static PyObject *__pyx_kp_250; +static PyObject *__pyx_kp_251; +static PyObject *__pyx_kp_252; +static PyObject *__pyx_kp_253; +static PyObject *__pyx_kp_254; +static char __pyx_k_248[] = "attempt to assign sequence of size %d to extended slice of size %d"; +static char __pyx_k_249[] = "Node must not be None"; +static char __pyx_k_250[] = "Node must not be None"; +static char __pyx_k_251[] = "Node must not be None"; +static char __pyx_k_252[] = "Node must not be None"; +static char __pyx_k_253[] = "Node must not be None"; +static char __pyx_k_254[] = "Node must not be None"; +static PyObject *__pyx_kp_255; +static PyObject *__pyx_kp_256; +static char __pyx_k_255[] = "Argument must be string or unicode."; +static char __pyx_k_256[] = "All strings must be XML compatible: Unicode or ASCII, no NULL bytes"; +static PyObject *__pyx_kp_258; +static char __pyx_k_257[] = "UTF-8"; +static char __pyx_k_258[] = "Argument must be string or unicode."; +static char __pyx_k_259[] = "replace"; +static PyObject *__pyx_kp_260; +static char __pyx_k_260[] = "Argument must be string or unicode."; +static PyObject *__pyx_kp_261; +static PyObject *__pyx_kp_262; +static PyObject *__pyx_kp_263; +static char __pyx_k_261[] = "Invalid tag name"; +static char __pyx_k_262[] = "Empty tag name"; +static char __pyx_k_263[] = "Empty tag name"; +static PyObject *__pyx_kp_264; +static char __pyx_k_264[] = "Invalid tag name %r"; +static char __pyx_k_265[] = "UTF-8"; +static PyObject *__pyx_kp_266; +static char __pyx_k_266[] = "Invalid HTML tag name %r"; +static char __pyx_k_267[] = "UTF-8"; +static PyObject *__pyx_kp_268; +static char __pyx_k_268[] = "Invalid attribute name %r"; +static char __pyx_k_269[] = "UTF-8"; +static PyObject *__pyx_kp_270; +static char __pyx_k_270[] = "Invalid namespace prefix %r"; +static char __pyx_k_271[] = "UTF-8"; +static char __pyx_k_272[] = "{%s}%s"; +static char __pyx_k_273[] = "{%s}%s"; +static char __pyx_k_274[] = "UTF-8"; +static PyObject *__pyx_kp_280; +static PyObject *__pyx_kp_281; +static char __pyx_k_280[] = ""; +static char __pyx_k_281[] = ""; +static PyObject *__pyx_kp_282; +static char __pyx_k_282[] = "%s:%d:%d:%s:%s:%s: %s"; +static PyObject *__pyx_kp_286; +static char __pyx_k_286[] = ""; +static PyObject *__pyx_kp_287; +static PyObject *__pyx_kp_288; +static char __pyx_k_287[] = "%s, line %d, column %d"; +static char __pyx_k_288[] = "%s, line %d"; +static PyObject *__pyx_kp_289; +static PyObject *__pyx_kp_290; +static char __pyx_k_289[] = "%s, line %d, column %d"; +static char __pyx_k_290[] = "%s, line %d"; +static PyObject *__pyx_kp_291; +static char __pyx_k_291[] = "\n"; +static char __pyx_k_295[] = "file %s"; +static char __pyx_k_296[] = "string://__STRING__XSLT"; +static char __pyx_k_297[] = ""; +static char __pyx_k_298[] = "line %d"; +static char __pyx_k_299[] = "element %s"; +static char __pyx_k_300[] = ""; +static char __pyx_k_301[] = "%s, element '%s'"; +static PyObject *__pyx_kp_302; +static char __pyx_k_302[] = "\\s*([a-zA-Z0-9_]+)\\s*=\\s*([0-9]+)"; +static char __pyx_k_303[] = "ns%d"; +static PyObject *__pyx_kp_306; +static char __pyx_k_306[] = "invalid node type %d, expected %d"; +static char __pyx_k_307[] = "ns%d"; +static PyObject *__pyx_kp_308; +static char __pyx_k_308[] = "Could not find root node"; +static PyObject *__pyx_kp_309; +static PyObject *__pyx_kp_310; +static PyObject *__pyx_kp_311; +static PyObject *__pyx_kp_312; +static PyObject *__pyx_kp_313; +static char __pyx_k_309[] = ""; +static char __pyx_k_310[] = ""; +static char __pyx_k_311[] = ""; +static char __pyx_k_312[] = ""; +static char __pyx_k_313[] = ""; +static PyObject *__pyx_kp_314; +static PyObject *__pyx_kp_315; +static char __pyx_k_314[] = "cannot assign None"; +static char __pyx_k_315[] = "list index out of range"; +static PyObject *__pyx_kp_316; +static char __pyx_k_316[] = "index out of range: %d"; +static PyObject *__pyx_kp_317; +static char __pyx_k_317[] = "Only processing instructions and comments can be siblings of the root element"; +static PyObject *__pyx_kp_318; +static char __pyx_k_318[] = "Only processing instructions and comments can be siblings of the root element"; +static PyObject *__pyx_kp_319; +static char __pyx_k_319[] = "Element is not a child of this node."; +static PyObject *__pyx_kp_320; +static char __pyx_k_320[] = "Element is not a child of this node."; +static char __pyx_k_321[] = "UTF-8"; +static char __pyx_k_322[] = "strict"; +static PyObject *__pyx_kp_323; +static char __pyx_k_323[] = ""; +static PyObject *__pyx_kp_324; +static char __pyx_k_324[] = "list index out of range"; +static PyObject *__pyx_kp_325; +static char __pyx_k_325[] = "The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead."; +static PyObject *__pyx_kp_326; +static PyObject *__pyx_kp_327; +static PyObject *__pyx_kp_328; +static PyObject *__pyx_kp_329; +static PyObject *__pyx_kp_330; +static PyObject *__pyx_kp_331; +static char __pyx_k_326[] = "Element is not a child of this node."; +static char __pyx_k_327[] = "list.index(x): x not in slice"; +static char __pyx_k_328[] = "list.index(x): x not in slice"; +static char __pyx_k_329[] = "list.index(x): x not in slice"; +static char __pyx_k_330[] = "list.index(x): x not in slice"; +static char __pyx_k_331[] = "list.index(x): x not in list"; +static PyObject *__pyx_kp_332; +static char __pyx_k_332[] = "this element does not have children or attributes"; +static PyObject *__pyx_kp_333; +static char __pyx_k_333[] = ""; +static PyObject *__pyx_kp_334; +static char __pyx_k_334[] = "list index out of range"; +static PyObject *__pyx_kp_335; +static char __pyx_k_335[] = ""; +static PyObject *__pyx_kp_336; +static PyObject *__pyx_kp_337; +static char __pyx_k_336[] = ""; +static char __pyx_k_337[] = ""; +static PyObject *__pyx_kp_338; +static PyObject *__pyx_kp_339; +static PyObject *__pyx_kp_340; +static char __pyx_k_338[] = "&"; +static char __pyx_k_339[] = ";"; +static char __pyx_k_340[] = "Invalid entity name '%s'"; +static PyObject *__pyx_kp_341; +static char __pyx_k_341[] = "&%s;"; +static PyObject *__pyx_kp_342; +static char __pyx_k_342[] = "&%s;"; +static PyObject *__pyx_kp_343; +static PyObject *__pyx_kp_346; +static char __pyx_k_343[] = "Invalid input tag of type %r"; +static char __pyx_k_344[] = "UTF-8"; +static char __pyx_k_345[] = "UTF-8"; +static char __pyx_k_346[] = "{%s}%s"; +static PyObject *__pyx_kp_347; +static char __pyx_k_347[] = "ElementTree not initialized, missing root"; +static PyObject *__pyx_kp_348; +static char __pyx_k_348[] = "Only elements can be the root of an ElementTree"; +static PyObject *__pyx_kp_351; +static PyObject *__pyx_kp_354; +static char __pyx_k_351[] = "US-ASCII"; +static char __pyx_k_354[] = "UTF-8"; +static PyObject *__pyx_kp_355; +static char __pyx_k_355[] = "Element is not in this tree."; +static PyObject *__pyx_kp_356; +static PyObject *__pyx_kp_357; +static PyObject *__pyx_kp_358; +static PyObject *__pyx_kp_359; +static char __pyx_k_356[] = "/"; +static char __pyx_k_357[] = "."; +static char __pyx_k_358[] = "/"; +static char __pyx_k_359[] = "."; +static PyObject *__pyx_kp_360; +static PyObject *__pyx_kp_361; +static PyObject *__pyx_kp_362; +static PyObject *__pyx_kp_363; +static char __pyx_k_360[] = "/"; +static char __pyx_k_361[] = "."; +static char __pyx_k_362[] = "/"; +static char __pyx_k_363[] = "."; +static PyObject *__pyx_kp_364; +static PyObject *__pyx_kp_365; +static PyObject *__pyx_kp_366; +static PyObject *__pyx_kp_367; +static char __pyx_k_364[] = "/"; +static char __pyx_k_365[] = "."; +static char __pyx_k_366[] = "/"; +static char __pyx_k_367[] = "."; +static PyObject *__pyx_kp_368; +static PyObject *__pyx_kp_369; +static PyObject *__pyx_kp_370; +static PyObject *__pyx_kp_371; +static char __pyx_k_368[] = "/"; +static char __pyx_k_369[] = "."; +static char __pyx_k_370[] = "/"; +static char __pyx_k_371[] = "."; +static PyObject *__pyx_kp_372; +static char __pyx_k_372[] = "pop expected at most 2 arguments, got %d"; +static PyObject *__pyx_kp_377; +static char __pyx_k_377[] = ""; +static PyObject *__pyx_kp_378; +static char __pyx_k_378[] = ""; +static PyObject *__pyx_kp_379; +static PyObject *__pyx_kp_380; +static char __pyx_k_379[] = "Invalid character reference: '%s'"; +static char __pyx_k_380[] = "Invalid entity reference: '%s'"; +static PyObject *__pyx_kp_381; +static PyObject *__pyx_kp_383; +static PyObject *__pyx_kp_385; +static PyObject *__pyx_kp_387; +static char __pyx_k_381[] = "Serialisation to unicode must not request an XML declaration"; +static char __pyx_k_383[] = "UTF-8"; +static char __pyx_k_385[] = "US-ASCII"; +static char __pyx_k_387[] = "Type '%s' cannot be serialized."; +static PyObject *__pyx_kp_388; +static char __pyx_k_388[] = "Type '%s' cannot be serialized."; +static PyObject *__pyx_kp_389; +static char __pyx_k_389[] = "Proxy invalidated!"; +static PyObject *__pyx_kp_390; +static char __pyx_k_390[] = ""; +static PyObject *__pyx_kp_391; +static char __pyx_k_391[] = "list index out of range"; +static PyObject *__pyx_kp_392; +static char __pyx_k_392[] = "*"; +static char __pyx_k_393[] = "UTF-8"; +static char __pyx_k_394[] = "strict"; +static PyObject *__pyx_kp_395; +static PyObject *__pyx_kp_396; +static char __pyx_k_395[] = "invalid value to append()"; +static char __pyx_k_396[] = "invalid element"; +static PyObject *__pyx_kp_397; +static PyObject *__pyx_kp_398; +static PyObject *__pyx_kp_399; +static char __pyx_k_397[] = "."; +static char __pyx_k_398[] = "."; +static char __pyx_k_399[] = "Invalid child type: %r"; +static PyObject *__pyx_kp_400; +static PyObject *__pyx_kp_401; +static PyObject *__pyx_kp_402; +static PyObject *__pyx_kp_403; +static char __pyx_k_400[] = "element class must be subclass of ElementBase"; +static char __pyx_k_401[] = "comment class must be subclass of CommentBase"; +static char __pyx_k_402[] = "Entity class must be subclass of EntityBase"; +static char __pyx_k_403[] = "PI class must be subclass of PIBase"; +static PyObject *__pyx_kp_407; +static char __pyx_k_404[] = "xml-stylesheet"; +static char __pyx_k_405[] = "text/xsl"; +static char __pyx_k_406[] = "text/xml"; +static char __pyx_k_407[] = "Unknown node type: %s"; +static PyObject *__pyx_kp_415; +static char __pyx_k_415[] = "Name not registered."; +static PyObject *__pyx_kp_416; +static char __pyx_k_416[] = "Name not registered."; +static PyObject *__pyx_kp_417; +static char __pyx_k_417[] = "Registered element classes must be subtypes of ElementBase"; +static PyObject *__pyx_kp_418; +static char __pyx_k_418[] = "Namespace(%r)"; +static PyObject *__pyx_kp_419; +static PyObject *__pyx_kp_420; +static char __pyx_k_419[] = "Registered functions must be callable."; +static char __pyx_k_420[] = "extensions must have non empty names"; +static PyObject *__pyx_kp_421; +static char __pyx_k_421[] = "FunctionNamespace(%r)"; +static PyObject *__pyx_kp_422; +static char __pyx_k_422[] = ""; +static PyObject *__pyx_kp_423; +static char __pyx_k_423[] = ""; +static PyObject *__pyx_kp_424; +static char __pyx_k_424[] = "argument must be a byte string or unicode string"; +static PyObject *__pyx_kp_425; +static char __pyx_k_425[] = "Argument is not a file-like object"; +static char __pyx_k_429[] = ""; +static char __pyx_k_430[] = "UTF-16LE"; +static char __pyx_k_431[] = "UTF-16BE"; +static char __pyx_k_432[] = "UTF-16LE"; +static char __pyx_k_433[] = "UTF-16BE"; +static char __pyx_k_434[] = "UCS-4LE"; +static char __pyx_k_435[] = "UCS-4BE"; +static PyObject *__pyx_kp_436; +static char __pyx_k_436[] = ""; +static PyObject *__pyx_kp_437; +static char __pyx_k_437[] = "reading from file-like objects must return byte strings or unicode strings"; +static PyObject *__pyx_kp_438; +static char __pyx_k_438[] = "parser locking failed"; +static PyObject *__pyx_kp_439; +static PyObject *__pyx_kp_440; +static PyObject *__pyx_kp_441; +static PyObject *__pyx_kp_442; +static char __pyx_k_439[] = "Error reading file '%s': %s"; +static char __pyx_k_440[] = "Error reading '%s'"; +static char __pyx_k_441[] = "Document is not well formed"; +static char __pyx_k_442[] = "line %d: %s"; +static char __pyx_k_445[] = "UTF-8"; +static PyObject *__pyx_kp_446; +static PyObject *__pyx_kp_447; +static char __pyx_k_446[] = "This class cannot be instantiated"; +static char __pyx_k_447[] = "unknown encoding: '%s'"; +static char __pyx_k_448[] = "dummy"; +static PyObject *__pyx_kp_449; +static char __pyx_k_449[] = "libxml2 %d.%d.%d"; +static PyObject *__pyx_kp_450; +static char __pyx_k_450[] = "string is too long to parse it with libxml2"; +static PyObject *__pyx_kp_451; +static PyObject *__pyx_kp_452; +static char __pyx_k_451[] = "Unicode parsing is not supported on this platform"; +static char __pyx_k_452[] = "Parsing requires string data"; +static PyObject *__pyx_kp_453; +static char __pyx_k_453[] = "no element found"; +static char __pyx_k_454[] = "UTF-8"; +static PyObject *__pyx_kp_458; +static char __pyx_k_458[] = "cannot parse from '%s'"; +static PyObject *__pyx_kp_459; +static PyObject *__pyx_kp_460; +static char __pyx_k_459[] = "Unicode strings with encoding declaration are not supported."; +static char __pyx_k_460[] = "can only parse strings"; +static PyObject *__pyx_kp_461; +static PyObject *__pyx_kp_462; +static char __pyx_k_461[] = ""; +static char __pyx_k_462[] = ""; +static char __pyx_k_463[] = "strict"; +static PyObject *__pyx_kp_464; +static PyObject *__pyx_kp_465; +static char __pyx_k_464[] = ""; +static char __pyx_k_465[] = ""; +static PyObject *__pyx_kp_466; +static PyObject *__pyx_kp_467; +static PyObject *__pyx_kp_468; +static char __pyx_k_466[] = ""; +static char __pyx_k_467[] = "internal error (tail)"; +static char __pyx_k_468[] = "internal error (text)"; +static PyObject *__pyx_kp_469; +static PyObject *__pyx_kp_470; +static char __pyx_k_469[] = "missing end tags"; +static char __pyx_k_470[] = "missing toplevel element"; +static PyObject *__pyx_kp_471; +static char __pyx_k_471[] = "end tag mismatch (expected %s, got %s)"; +static PyObject *__pyx_kp_476; +static char __pyx_k_476[] = "unknown output method %r"; +static PyObject *__pyx_kp_477; +static PyObject *__pyx_kp_478; +static char __pyx_k_477[] = "Error during serialisation (out of memory?)"; +static char __pyx_k_478[] = "UTF-8"; +static char __pyx_k_480[] = "strict"; +static char __pyx_k_481[] = "strict"; +static PyObject *__pyx_kp_482; +static PyObject *__pyx_kp_483; +static char __pyx_k_482[] = "UTF-8"; +static char __pyx_k_483[] = "unknown encoding: '%s'"; +static char __pyx_k_484[] = "strict"; +static PyObject *__pyx_kp_485; +static char __pyx_k_485[] = "unknown error %d"; +static char __pyx_k_486[] = "\n"; +static char __pyx_k_487[] = "1.0"; +static char __pyx_k_488[] = "\n"; +static char __pyx_k_491[] = "' standalone='yes'?>\n"; +static char __pyx_k_492[] = "'?>\n"; +static char __pyx_k_493[] = "\n"; +static char __pyx_k_499[] = " [\n"; +static char __pyx_k_500[] = "]>\n"; +static char __pyx_k_501[] = "\n"; +static char __pyx_k_502[] = "\n"; +static PyObject *__pyx_kp_504; +static char __pyx_k_504[] = "Could not create I/O writer context."; +static PyObject *__pyx_kp_505; +static char __pyx_k_505[] = "File is already closed"; +static PyObject *__pyx_kp_508; +static PyObject *__pyx_kp_509; +static PyObject *__pyx_kp_511; +static char __pyx_k_508[] = "UTF-8"; +static char __pyx_k_509[] = "unknown encoding: '%s'"; +static char __pyx_k_511[] = "File or filename expected, got '%s'"; +static PyObject *__pyx_kp_513; +static PyObject *__pyx_kp_514; +static char __pyx_k_513[] = "File or filename expected, got '%s'"; +static char __pyx_k_514[] = "C14N failed"; +static PyObject *__pyx_kp_515; +static char __pyx_k_515[] = "not a file"; +static char __pyx_k_516[] = "\n"; +static PyObject *__pyx_kp_519; +static PyObject *__pyx_kp_520; +static PyObject *__pyx_kp_523; +static char __pyx_k_519[] = "start-ns"; +static char __pyx_k_520[] = "end-ns"; +static char __pyx_k_523[] = "invalid event name '%s'"; +static PyObject *__pyx_kp_524; +static PyObject *__pyx_kp_525; +static PyObject *__pyx_kp_526; +static char __pyx_k_524[] = ""; +static char __pyx_k_525[] = ""; +static char __pyx_k_526[] = "start-ns"; +static PyObject *__pyx_kp_527; +static PyObject *__pyx_kp_528; +static PyObject *__pyx_kp_529; +static char __pyx_k_527[] = "*"; +static char __pyx_k_528[] = "*"; +static char __pyx_k_529[] = "*"; +static PyObject *__pyx_kp_532; +static char __pyx_k_532[] = "end-ns"; +static PyObject *__pyx_kp_537; +static PyObject *__pyx_kp_538; +static char __pyx_k_537[] = "start-ns"; +static char __pyx_k_538[] = "end-ns"; +static PyObject *__pyx_kp_539; +static char __pyx_k_539[] = "iterparse parsers cannot be copied"; +static PyObject *__pyx_kp_540; +static char __pyx_k_540[] = "reading file objects must return plain strings"; +static PyObject *__pyx_kp_541; +static PyObject *__pyx_kp_542; +static PyObject *__pyx_kp_543; +static char __pyx_k_541[] = "*"; +static char __pyx_k_542[] = "*"; +static char __pyx_k_543[] = "*"; +static PyObject *__pyx_kp_546; +static char __pyx_k_546[] = "end-ns"; +static PyObject *__pyx_kp_547; +static char __pyx_k_547[] = "//*[string(@id)]"; +static PyObject *__pyx_kp_549; +static char __pyx_k_549[] = "No ID dictionary available."; +static PyObject *__pyx_kp_550; +static PyObject *__pyx_kp_551; +static char __pyx_k_550[] = "key not found."; +static char __pyx_k_551[] = "ID attribute not found."; +static PyObject *__pyx_kp_552; +static char __pyx_k_552[] = "XInclude processing failed"; +static PyObject *__pyx_kp_553; +static char __pyx_k_553[] = "*"; +static PyObject *__pyx_kp_554; +static char __pyx_k_554[] = ""; +static PyObject *__pyx_kp_555; +static char __pyx_k_555[] = "*"; +static PyObject *__pyx_kp_172; +static PyObject *__pyx_kp_173; +static PyObject *__pyx_kp_556; +static PyObject *__pyx_kp_557; +static PyObject *__pyx_kp_558; +static char __pyx_k_556[] = "extensions must have non empty names"; +static char __pyx_k_557[] = "empty namespace prefix is not supported in XPath"; +static char __pyx_k_558[] = "setting default namespace is not supported in XPath"; +static PyObject *__pyx_kp_559; +static char __pyx_k_559[] = "empty prefix is not supported in XPath"; +static PyObject *__pyx_kp_560; +static char __pyx_k_560[] = "empty prefix is not supported in XPath"; +static PyObject *__pyx_kp_561; +static PyObject *__pyx_kp_562; +static PyObject *__pyx_kp_563; +static PyObject *__pyx_kp_564; +static char __pyx_k_561[] = "XPath context is only usable during the evaluation"; +static char __pyx_k_562[] = "no context node"; +static char __pyx_k_563[] = "document-external context nodes are not supported"; +static char __pyx_k_564[] = "document context is missing"; +static PyObject *__pyx_kp_566; +static char __pyx_k_566[] = ""; +static PyObject *__pyx_kp_570; +static PyObject *__pyx_kp_572; +static char __pyx_k_570[] = ""; +static char __pyx_k_572[] = ""; +static PyObject *__pyx_kp_576; +static char __pyx_k_576[] = "http://exslt.org/regular-expressions"; +static PyObject *__pyx_kp_580; +static PyObject *__pyx_kp_581; +static char __pyx_k_580[] = "This is not a node: %r"; +static char __pyx_k_581[] = "Unknown return type: %s"; +static PyObject *__pyx_kp_582; +static PyObject *__pyx_kp_587; +static char __pyx_k_582[] = "Undefined xpath result"; +static char __pyx_k_587[] = "Unknown xpath result %s"; +static PyObject *__pyx_kp_588; +static char __pyx_k_588[] = "Not yet implemented result node type: %d"; +static PyObject *__pyx_kp_589; +static PyObject *__pyx_kp_590; +static char __pyx_k_589[] = "{%s}%s"; +static char __pyx_k_590[] = "XPath function '%s' not found"; +static PyObject *__pyx_kp_591; +static PyObject *__pyx_kp_592; +static char __pyx_k_591[] = "This version of libxml2 has a known XPath bug. "; +static char __pyx_k_592[] = "Use it at your own risk."; +static PyObject *__pyx_kp_593; +static char __pyx_k_593[] = "parser locking failed"; +static PyObject *__pyx_kp_594; +static char __pyx_k_594[] = "Error in xpath expression"; +static PyObject *__pyx_kp_595; +static char __pyx_k_595[] = "Error in xpath expression"; +static PyObject *__pyx_kp_596; +static PyObject *__pyx_kp_602; +static char __pyx_k_596[] = ""; +static char __pyx_k_597[] = "__xpp%02d"; +static char __pyx_k_598[] = "UTF-8"; +static char __pyx_k_599[] = "strict"; +static char __pyx_k_600[] = "UTF-8"; +static char __pyx_k_601[] = "strict"; +static char __pyx_k_602[] = ":"; +static char __pyx_k_603[] = "UTF-8"; +static char __pyx_k_604[] = "strict"; +static char __pyx_k_605[] = "string://__STRING__XSLT__/"; +static PyObject *__pyx_kp_606; +static char __pyx_k_606[] = "Cannot resolve URI %s"; +static PyObject *__pyx_kp_612; +static PyObject *__pyx_kp_613; +static PyObject *__pyx_kp_614; +static PyObject *__pyx_kp_615; +static char __pyx_k_612[] = "%s(%s)"; +static char __pyx_k_613[] = "."; +static char __pyx_k_614[] = ", "; +static char __pyx_k_615[] = "%s=%r"; +static PyObject *__pyx_kp_616; +static char __pyx_k_616[] = "extensions must not have empty namespaces"; +static PyObject *__pyx_kp_617; +static PyObject *__pyx_kp_618; +static char __pyx_k_617[] = "string://__STRING__XSLT__/%d.xslt"; +static char __pyx_k_618[] = "Cannot parse stylesheet"; +static PyObject *__pyx_kp_619; +static PyObject *__pyx_kp_620; +static PyObject *__pyx_kp_621; +static char __pyx_k_619[] = "%s, line %d"; +static char __pyx_k_620[] = "Error applying stylesheet, line %d"; +static char __pyx_k_621[] = "Error applying stylesheet"; +static PyObject *__pyx_kp_622; +static char __pyx_k_622[] = ""; +static PyObject *__pyx_kp_623; +static char __pyx_k_623[] = ""; +static char __pyx_k_624[] = "ascii"; +static char __pyx_k_625[] = "strict"; +static char __pyx_k_626[] = "B"; +static PyObject *__pyx_kp_627; +static PyObject *__pyx_kp_629; +static char __pyx_k_627[] = "//xsl:stylesheet[@xml:id = $id]"; +static char __pyx_k_629[] = "http://www.w3.org/1999/XSL/Transform"; +static PyObject *__pyx_kp_630; +static PyObject *__pyx_kp_631; +static PyObject *__pyx_kp_632; +static PyObject *__pyx_kp_633; +static PyObject *__pyx_kp_634; +static char __pyx_k_630[] = "PI lacks content"; +static char __pyx_k_631[] = " "; +static char __pyx_k_632[] = "malformed PI attributes"; +static char __pyx_k_633[] = "reference to non-existing embedded stylesheet"; +static char __pyx_k_634[] = "ambiguous reference to embedded stylesheet"; +static PyObject *__pyx_kp_636; +static PyObject *__pyx_kp_637; +static PyObject *__pyx_kp_638; +static PyObject *__pyx_kp_639; +static PyObject *__pyx_kp_640; +static PyObject *__pyx_kp_641; +static PyObject *__pyx_kp_642; +static char __pyx_k_636[] = "only setting the 'href' attribute is supported on XSLT-PIs"; +static char __pyx_k_637[] = ""; +static char __pyx_k_638[] = "\""; +static char __pyx_k_639[] = ">"; +static char __pyx_k_640[] = "Invalid URL, must not contain '\"' or '>'"; +static char __pyx_k_641[] = " href=\"%s\""; +static char __pyx_k_642[] = " "; +static PyObject *__pyx_kp_643; +static char __pyx_k_643[] = " "; +static PyObject *__pyx_kp_645; +static char __pyx_k_644[] = "fake-parent"; +static char __pyx_k_645[] = "unsupported XSLT result type: %d"; +static PyObject *__pyx_kp_646; +static PyObject *__pyx_kp_647; +static char __pyx_k_646[] = "extension element %s not found"; +static char __pyx_k_647[] = "UTF-8"; +static char __pyx_k_648[] = "Error executing extension element '%s': %s"; +static char __pyx_k_649[] = "Error executing extension element '%s'"; +static PyObject *__pyx_kp_650; +static char __pyx_k_650[] = "Document does not comply with schema"; +static PyObject *__pyx_kp_651; +static char __pyx_k_651[] = "Document does not comply with schema"; +static PyObject *__pyx_kp_653; +static PyObject *__pyx_kp_654; +static PyObject *__pyx_kp_655; +static char __pyx_k_653[] = "file must be a filename or file-like object"; +static char __pyx_k_654[] = "either filename or external ID required"; +static char __pyx_k_655[] = "error parsing DTD"; +static PyObject *__pyx_kp_656; +static PyObject *__pyx_kp_657; +static char __pyx_k_656[] = "Failed to create validation context"; +static char __pyx_k_657[] = "Internal error in DTD validation"; +static PyObject *__pyx_kp_658; +static char __pyx_k_658[] = "error parsing DTD"; +static PyObject *__pyx_kp_660; +static PyObject *__pyx_kp_661; +static PyObject *__pyx_kp_662; +static PyObject *__pyx_kp_663; +static char __pyx_k_659[] = "http://relaxng.org/ns/structure/1.0"; +static char __pyx_k_660[] = "Document is not Relax NG"; +static char __pyx_k_661[] = "No tree or file given"; +static char __pyx_k_662[] = "Document is not parsable as Relax NG"; +static char __pyx_k_663[] = "Document is not valid Relax NG"; +static PyObject *__pyx_kp_664; +static char __pyx_k_664[] = "Internal error in Relax NG validation"; +static PyObject *__pyx_kp_666; +static PyObject *__pyx_kp_667; +static PyObject *__pyx_kp_668; +static char __pyx_k_665[] = "http://www.w3.org/2001/XMLSchema"; +static char __pyx_k_666[] = "Document is not XML Schema"; +static char __pyx_k_667[] = "No tree or file given"; +static char __pyx_k_668[] = "Document is not valid XML Schema"; +static PyObject *__pyx_kp_669; +static char __pyx_k_669[] = "Internal error in XML Schema validation."; +static PyObject *__pyx_kp_670; +static PyObject *__pyx_kp_671; +static PyObject *__pyx_kp_672; +static char __pyx_k_670[] = "lxml.etree was compiled without Schematron support."; +static char __pyx_k_671[] = "No tree or file given"; +static char __pyx_k_672[] = "Document is not a valid Schematron schema"; +static PyObject *__pyx_kp_673; +static char __pyx_k_673[] = "Internal error in Schematron validation"; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":118 + * 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_kp_self,&__pyx_kp_message,&__pyx_kp_error_log,0}; + __Pyx_SetupRefcountContext("__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] = 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_kp_self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_message); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_error_log); + if (unlikely(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 = 118; __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 = 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 = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.LxmlError.__init__"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":119 + * """ + * def __init__(self, message, error_log=None): + * if python.PY_VERSION_HEX >= 0x02050000: # <<<<<<<<<<<<<< + * # Python >= 2.5 uses new style class exceptions + * super(_LxmlError, self).__init__(message) + */ + __pyx_t_1 = (PY_VERSION_HEX >= 0x02050000); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":121 + * if python.PY_VERSION_HEX >= 0x02050000: + * # Python >= 2.5 uses new style class exceptions + * super(_LxmlError, 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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_4lxml_5etree__LxmlError); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__LxmlError); + __Pyx_GIVEREF(__pyx_v_4lxml_5etree__LxmlError); + __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 = 121; __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_kp___init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __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 = 121; __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 = 121; __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-2.2/src/lxml/lxml.etree.pyx":123 + * super(_LxmlError, 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 = 123; __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 = 123; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":124 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":125 + * 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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_error_log, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":127 + * self.error_log = __copyGlobalErrorLog() + * else: + * self.error_log = error_log.copy() # <<<<<<<<<<<<<< + * + * cdef object _LxmlError + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_error_log, __pyx_kp_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __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 = 127; __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_kp_error_log, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":148 + * + * # 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_1 = 0; + int __pyx_2; + PyObject *__pyx_t_1 = NULL; + 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; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":149 + * # 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 = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_version_list = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":150 + * 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_kp_decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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 = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_224)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_224)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_224)); + __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 = 150; __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_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_replace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_225)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_225)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_225)); + __Pyx_INCREF(((PyObject *)__pyx_kp_226)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_226)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_226)); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __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 = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_227)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_227)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_227)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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 = 150; __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 = 150; __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_1 = PySequence_GetSlice(__pyx_t_1, 0, 4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":151 + * 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_1 = __pyx_v_l; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":152 + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":153 + * for item in l: + * try: + * item = int(item) # <<<<<<<<<<<<<< + * except ValueError: + * if item.startswith(u'dev'): + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_item); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_item); + __Pyx_GIVEREF(__pyx_v_item); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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_1); __pyx_1 = 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-2.2/src/lxml/lxml.etree.pyx":154 + * try: + * item = int(item) + * except ValueError: # <<<<<<<<<<<<<< + * if item.startswith(u'dev'): + * count = item[3:] + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":155 + * item = int(item) + * except ValueError: + * if item.startswith(u'dev'): # <<<<<<<<<<<<<< + * count = item[3:] + * item = -300 + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_item, __pyx_kp_startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_228)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_228)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_228)); + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__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 = 155; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":156 + * except ValueError: + * if item.startswith(u'dev'): + * count = item[3:] # <<<<<<<<<<<<<< + * item = -300 + * elif item.startswith(u'alpha'): + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_item, 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":157 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":158 + * count = item[3:] + * item = -300 + * elif item.startswith(u'alpha'): # <<<<<<<<<<<<<< + * count = item[5:] + * item = -200 + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_item, __pyx_kp_startswith); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_229)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_229)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_229)); + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":159 + * item = -300 + * elif item.startswith(u'alpha'): + * count = item[5:] # <<<<<<<<<<<<<< + * item = -200 + * elif item.startswith(u'beta'): + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_item, 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":160 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":161 + * count = item[5:] + * item = -200 + * elif item.startswith(u'beta'): # <<<<<<<<<<<<<< + * count = item[4:] + * item = -100 + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_item, __pyx_kp_startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_230)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_230)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_230)); + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__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 = 161; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":162 + * item = -200 + * elif item.startswith(u'beta'): + * count = item[4:] # <<<<<<<<<<<<<< + * item = -100 + * else: + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_item, 4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":163 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":165 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":166 + * 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 = 166; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":167 + * 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 = 167; __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 = 167; __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 = 167; __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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":168 + * if count: + * item = item + int(count) + * version_list.append(item) # <<<<<<<<<<<<<< + * return tuple(version_list) + * + */ + __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_version_list), __pyx_v_item); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":169 + * item = item + int(count) + * version_list.append(item) + * return tuple(version_list) # <<<<<<<<<<<<<< + * + * cdef __unpackIntVersion(int c_version): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_v_version_list)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_version_list)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_version_list)); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__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_1); + __Pyx_XDECREF(__pyx_t_1); + __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_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":171 + * 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_SetupRefcountContext("__unpackIntVersion"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":172 + * + * cdef __unpackIntVersion(int c_version): + * return ( # <<<<<<<<<<<<<< + * ((c_version / (100*100)) % 100), + * ((c_version / 100) % 100), + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":173 + * cdef __unpackIntVersion(int c_version): + * return ( + * ((c_version / (100*100)) % 100), # <<<<<<<<<<<<<< + * ((c_version / 100) % 100), + * (c_version % 100) + */ + __pyx_t_1 = PyInt_FromLong(((__pyx_v_c_version / 10000) % 100)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":174 + * return ( + * ((c_version / (100*100)) % 100), + * ((c_version / 100) % 100), # <<<<<<<<<<<<<< + * (c_version % 100) + * ) + */ + __pyx_t_2 = PyInt_FromLong(((__pyx_v_c_version / 100) % 100)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":175 + * ((c_version / (100*100)) % 100), + * ((c_version / 100) % 100), + * (c_version % 100) # <<<<<<<<<<<<<< + * ) + * + */ + __pyx_t_3 = PyInt_FromLong((__pyx_v_c_version % 100)); 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_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":196 + * 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_SetupRefcountContext("__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-2.2/src/lxml/lxml.etree.pyx":197 + * 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 = 197; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":199 + * 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_SetupRefcountContext("add"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":200 + * + * cdef int add(self, obj) except -1: + * self._storage.append(obj) # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_1 = PyList_Append(((PyObject *)__pyx_v_self->_storage), __pyx_v_obj); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":201 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":203 + * 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_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":204 + * + * cdef int clear(self) except -1: + * del self._storage[:] # <<<<<<<<<<<<<< + * return 0 + * + */ + if (PySequence_DelSlice(((PyObject *)__pyx_v_self->_storage), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":205 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":210 + * 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_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":211 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":213 + * 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_SetupRefcountContext("_store_raised"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":214 + * + * 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_kp_exc_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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 = 214; __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":216 + * 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_SetupRefcountContext("_store_exception"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":217 + * + * 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 = 217; __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":219 + * 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_SetupRefcountContext("_has_raised"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":220 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":222 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":223 + * + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":224 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":225 + * 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_v_type); + __pyx_v_type = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_traceback); + __pyx_v_traceback = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_v_self->_exc_info); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_type); + __pyx_v_type = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_traceback); + __pyx_v_traceback = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":226 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":227 + * 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_2 = (__pyx_v_traceback == 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-2.2/src/lxml/lxml.etree.pyx":228 + * 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 = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":230 + * 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 = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":7 + * # the Python class + * + * cdef inline _Element getProxy(xmlNode* c_node): # <<<<<<<<<<<<<< + * u"""Get a proxy for a given node. + * """ + */ + +static INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *__pyx_v_c_node) { + struct LxmlElement *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("getProxy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":11 + * """ + * #print "getProxy for:", c_node + * if c_node is not NULL and c_node._private is not NULL: # <<<<<<<<<<<<<< + * return <_Element>c_node._private + * else: + */ + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c_node->_private != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":12 + * #print "getProxy for:", 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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":16 + * return None + * + * cdef inline int hasProxy(xmlNode* c_node): # <<<<<<<<<<<<<< + * return c_node._private is not NULL + * + */ + +static INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *__pyx_v_c_node) { + int __pyx_r; + __Pyx_SetupRefcountContext("hasProxy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 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_SetupRefcountContext("_registerProxy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":24 + * """ + * #print "registering for:", proxy._c_node + * assert c_node._private is NULL, u"double registering proxy!" # <<<<<<<<<<<<<< + * proxy._doc = doc + * proxy._c_node = c_node + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_c_node->_private == NULL))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_231)); + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":25 + * #print "registering for:", proxy._c_node + * assert c_node._private is NULL, u"double registering proxy!" + * proxy._doc = doc # <<<<<<<<<<<<<< + * proxy._c_node = c_node + * c_node._private = 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-2.2/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 = 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-2.2/src/lxml/proxy.pxi":27 + * proxy._doc = doc + * proxy._c_node = c_node + * c_node._private = proxy # <<<<<<<<<<<<<< + * # additional INCREF to make sure _Document is GC-ed LAST! + * proxy._gc_doc = doc + */ + __pyx_v_c_node->_private = ((void *)__pyx_v_proxy); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":29 + * c_node._private = proxy + * # additional INCREF to make sure _Document is GC-ed LAST! + * proxy._gc_doc = doc # <<<<<<<<<<<<<< + * python.Py_INCREF(doc) + * + */ + __pyx_v_proxy->_gc_doc = ((PyObject *)__pyx_v_doc); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":30 + * # additional INCREF to make sure _Document is GC-ed LAST! + * proxy._gc_doc = 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *__pyx_v_proxy) { + xmlNode *__pyx_v_c_node; + int __pyx_r; + __Pyx_SetupRefcountContext("_unregisterProxy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":36 + * """ + * cdef xmlNode* c_node + * c_node = proxy._c_node # <<<<<<<<<<<<<< + * assert c_node._private is 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-2.2/src/lxml/proxy.pxi":37 + * cdef xmlNode* c_node + * c_node = proxy._c_node + * assert c_node._private is proxy, u"Tried to unregister unknown proxy" # <<<<<<<<<<<<<< + * c_node._private = NULL + * return 0 + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_c_node->_private == ((void *)__pyx_v_proxy)))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_232)); + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":38 + * c_node = proxy._c_node + * assert c_node._private is 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-2.2/src/lxml/proxy.pxi":39 + * assert c_node._private is 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":41 + * return 0 + * + * cdef inline void _releaseProxy(_Element proxy): # <<<<<<<<<<<<<< + * u"""An additional DECREF for the document. + * """ + */ + +static INLINE void __pyx_f_4lxml_5etree__releaseProxy(struct LxmlElement *__pyx_v_proxy) { + __Pyx_SetupRefcountContext("_releaseProxy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 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_SetupRefcountContext("_updateProxyDocument"); + __pyx_v_old_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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 = 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-2.2/src/lxml/proxy.pxi":56 + * old_doc = element._doc + * element._doc = doc + * python.Py_INCREF(doc) # <<<<<<<<<<<<<< + * element._gc_doc = doc + * python.Py_DECREF(old_doc) + */ + Py_INCREF(((PyObject *)__pyx_v_doc)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":57 + * element._doc = doc + * python.Py_INCREF(doc) + * element._gc_doc = doc # <<<<<<<<<<<<<< + * python.Py_DECREF(old_doc) + * + */ + __pyx_v_element->_gc_doc = ((PyObject *)__pyx_v_doc); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":58 + * python.Py_INCREF(doc) + * element._gc_doc = 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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: # <<<<<<<<<<<<<< + * # build a temporary document that has the given node as root node + * # note that copy and original must not be modified during its lifetime!! + */ + +static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node) { + 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; + xmlDoc *__pyx_t_2; + __Pyx_SetupRefcountContext("_fakeRootDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":71 + * cdef xmlNode* c_new_root + * cdef xmlDoc* c_doc + * c_root = tree.xmlDocGetRootElement(c_base_doc) # <<<<<<<<<<<<<< + * if c_root is c_node: + * # already the root node + */ + __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_base_doc); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":72 + * cdef xmlDoc* c_doc + * c_root = tree.xmlDocGetRootElement(c_base_doc) + * if c_root is c_node: # <<<<<<<<<<<<<< + * # already the root node + * 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-2.2/src/lxml/proxy.pxi":74 + * if c_root is c_node: + * # already the root node + * 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_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":76 + * 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_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_base_doc, 0); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":77 + * + * 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-2.2/src/lxml/proxy.pxi":78 + * 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-2.2/src/lxml/proxy.pxi":79 + * 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-2.2/src/lxml/proxy.pxi":81 + * _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-2.2/src/lxml/proxy.pxi":82 + * + * 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-2.2/src/lxml/proxy.pxi":83 + * 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-2.2/src/lxml/proxy.pxi":86 + * + * # 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-2.2/src/lxml/proxy.pxi":89 + * + * # 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-2.2/src/lxml/proxy.pxi":90 + * # 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-2.2/src/lxml/proxy.pxi":91 + * 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-2.2/src/lxml/proxy.pxi":92 + * 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-2.2/src/lxml/proxy.pxi":94 + * 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-2.2/src/lxml/proxy.pxi":95 + * + * 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._fakeRootDoc"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":97 + * 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_SetupRefcountContext("_destroyFakeDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":102 + * 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-2.2/src/lxml/proxy.pxi":103 + * 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-2.2/src/lxml/proxy.pxi":104 + * 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-2.2/src/lxml/proxy.pxi":107 + * + * # restore parent pointers of children + * c_parent = 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-2.2/src/lxml/proxy.pxi":108 + * # restore parent pointers of children + * c_parent = 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-2.2/src/lxml/proxy.pxi":109 + * c_parent = 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-2.2/src/lxml/proxy.pxi":110 + * 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-2.2/src/lxml/proxy.pxi":111 + * 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-2.2/src/lxml/proxy.pxi":114 + * + * # 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-2.2/src/lxml/proxy.pxi":115 + * # 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":117 + * 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_SetupRefcountContext("_fakeDocElementFactory"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":126 + * 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-2.2/src/lxml/proxy.pxi":127 + * """ + * 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 = c_element.doc._private + */ + __pyx_t_1 = (__pyx_v_c_element->doc->_private != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":128 + * 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 = 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-2.2/src/lxml/proxy.pxi":129 + * if c_element.doc._private is not NULL: + * if c_element is c_element.doc.children: + * c_element = 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-2.2/src/lxml/proxy.pxi":131 + * c_element = 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[6]; __pyx_lineno = 131; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":136 + * # 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_SetupRefcountContext("attemptDeallocation"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":141 + * 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-2.2/src/lxml/proxy.pxi":143 + * 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-2.2/src/lxml/proxy.pxi":144 + * #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-2.2/src/lxml/proxy.pxi":145 + * 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-2.2/src/lxml/proxy.pxi":147 + * 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-2.2/src/lxml/proxy.pxi":148 + * #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-2.2/src/lxml/proxy.pxi":149 + * _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-2.2/src/lxml/proxy.pxi":150 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":152 + * 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; + __Pyx_SetupRefcountContext("getDeallocationTop"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":158 + * 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-2.2/src/lxml/proxy.pxi":160 + * 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-2.2/src/lxml/proxy.pxi":161 + * #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-2.2/src/lxml/proxy.pxi":162 + * 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-2.2/src/lxml/proxy.pxi":163 + * 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-2.2/src/lxml/proxy.pxi":165 + * 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" + */ + if (!(__pyx_v_c_current->type == XML_DOCUMENT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":166 + * #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_1 = (__pyx_v_c_current->type == XML_HTML_DOCUMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_current->type == XML_DOCUMENT_NODE); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":168 + * 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-2.2/src/lxml/proxy.pxi":170 + * 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_1 = (__pyx_v_c_current->_private != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":172 + * 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-2.2/src/lxml/proxy.pxi":173 + * #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-2.2/src/lxml/proxy.pxi":174 + * 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-2.2/src/lxml/proxy.pxi":176 + * c_current = c_current.parent + * # see whether we have children to deallocate + * if canDeallocateChildNodes(c_top): # <<<<<<<<<<<<<< + * return c_top + * else: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_top); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":177 + * # 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-2.2/src/lxml/proxy.pxi":179 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":181 + * 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_SetupRefcountContext("canDeallocateChildNodes"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":183 + * 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-2.2/src/lxml/proxy.pxi":184 + * 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-2.2/src/lxml/proxy.pxi":185 + * 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-2.2/src/lxml/proxy.pxi":186 + * 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-2.2/src/lxml/proxy.pxi":187 + * 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-2.2/src/lxml/proxy.pxi":188 + * return 0 + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + * return 1 # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":193 + * # 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":200 + * 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-2.2/src/lxml/proxy.pxi":201 + * 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) { + if ((__pyx_v_c_parent != NULL)) { + if (!_isElementOrXInclude(__pyx_v_c_parent)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":202 + * 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_1 = (__pyx_v_c_parent->type == XML_DOCUMENT_NODE); + } else { + __pyx_t_1 = _isElementOrXInclude(__pyx_v_c_parent); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_parent != NULL); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":203 + * 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-2.2/src/lxml/proxy.pxi":204 + * 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-2.2/src/lxml/proxy.pxi":206 + * 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-2.2/src/lxml/proxy.pxi":207 + * # 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-2.2/src/lxml/proxy.pxi":208 + * 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-2.2/src/lxml/proxy.pxi":216 + * 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_SetupRefcountContext("_growNsCache"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":218 + * 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-2.2/src/lxml/proxy.pxi":219 + * 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-2.2/src/lxml/proxy.pxi":221 + * c_ns_cache.size = 20 + * else: + * c_ns_cache.size *= 2 # <<<<<<<<<<<<<< + * c_ns_ptr = cstd.realloc( + * c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*)) + */ + __pyx_v_c_ns_cache->size *= 2; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":223 + * c_ns_cache.size *= 2 + * c_ns_ptr = 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-2.2/src/lxml/proxy.pxi":224 + * c_ns_ptr = 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 = cstd.realloc( + */ + __pyx_t_1 = (__pyx_v_c_ns_ptr != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":225 + * 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 = 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-2.2/src/lxml/proxy.pxi":227 + * c_ns_cache.new = c_ns_ptr + * c_ns_ptr = 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-2.2/src/lxml/proxy.pxi":228 + * c_ns_ptr = 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-2.2/src/lxml/proxy.pxi":229 + * 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-2.2/src/lxml/proxy.pxi":231 + * 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-2.2/src/lxml/proxy.pxi":232 + * 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-2.2/src/lxml/proxy.pxi":233 + * 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[6]; __pyx_lineno = 233; __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-2.2/src/lxml/proxy.pxi":234 + * 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-2.2/src/lxml/proxy.pxi":235 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":237 + * 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 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_SetupRefcountContext("_appendToNsCache"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":239 + * 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-2.2/src/lxml/proxy.pxi":240 + * 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[6]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":241 + * 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-2.2/src/lxml/proxy.pxi":242 + * _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-2.2/src/lxml/proxy.pxi":243 + * 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 += 1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._appendToNsCache"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":245 + * 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_SetupRefcountContext("_stripRedundantNamespaceDeclarations"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":255 + * 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-2.2/src/lxml/proxy.pxi":256 + * # 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-2.2/src/lxml/proxy.pxi":258 + * 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-2.2/src/lxml/proxy.pxi":259 + * 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-2.2/src/lxml/proxy.pxi":261 + * 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[6]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":262 + * # 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 => strip the ns + */ + __pyx_v_c_nsdef = (&(__pyx_v_c_nsdef[0])->next); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":266 + * # known namespace href => strip the ns + * if c_ns is tree.xmlSearchNs(c_element.doc, c_element.parent, + * c_ns.prefix): # <<<<<<<<<<<<<< + * # prefix is not shadowed by parents => ns is reusable + * _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns) + */ + __pyx_t_1 = (__pyx_v_c_ns == xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element->parent, __pyx_v_c_ns->prefix)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":268 + * c_ns.prefix): + * # prefix is not shadowed by parents => ns is reusable + * _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[6]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":270 + * _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-2.2/src/lxml/proxy.pxi":271 + * # 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-2.2/src/lxml/proxy.pxi":272 + * 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-2.2/src/lxml/proxy.pxi":273 + * 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-2.2/src/lxml/proxy.pxi":274 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":276 + * 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; + __Pyx_SetupRefcountContext("moveNodeToDocument"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":315 + * 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-2.2/src/lxml/proxy.pxi":317 + * 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-2.2/src/lxml/proxy.pxi":318 + * + * 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-2.2/src/lxml/proxy.pxi":320 + * 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-2.2/src/lxml/proxy.pxi":321 + * + * 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-2.2/src/lxml/proxy.pxi":323 + * 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-2.2/src/lxml/proxy.pxi":324 + * + * 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-2.2/src/lxml/proxy.pxi":325 + * 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-2.2/src/lxml/proxy.pxi":326 + * 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-2.2/src/lxml/proxy.pxi":328 + * 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-2.2/src/lxml/proxy.pxi":329 + * + * 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-2.2/src/lxml/proxy.pxi":330 + * 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-2.2/src/lxml/proxy.pxi":331 + * 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 += 1; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":335 + * # 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-2.2/src/lxml/proxy.pxi":337 + * 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[6]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":341 + * # 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-2.2/src/lxml/proxy.pxi":342 + * # 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-2.2/src/lxml/proxy.pxi":343 + * 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-2.2/src/lxml/proxy.pxi":344 + * 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-2.2/src/lxml/proxy.pxi":345 + * 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-2.2/src/lxml/proxy.pxi":346 + * 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-2.2/src/lxml/proxy.pxi":347 + * 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-2.2/src/lxml/proxy.pxi":351 + * # not in cache => find a replacement from this document + * c_ns = doc._findOrBuildNodeNs( + * c_start_node, c_node.ns.href, c_node.ns.prefix) # <<<<<<<<<<<<<< + * _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); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_ns = __pyx_t_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":352 + * c_ns = doc._findOrBuildNodeNs( + * c_start_node, c_node.ns.href, c_node.ns.prefix) + * _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[6]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":353 + * c_start_node, c_node.ns.href, c_node.ns.prefix) + * _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-2.2/src/lxml/proxy.pxi":355 + * c_node.ns = c_ns + * + * if c_node is c_element: # <<<<<<<<<<<<<< + * # after the element, continue with its attributes + * c_node = c_element.properties + */ + __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_element); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":357 + * if c_node is c_element: + * # after the element, continue with its attributes + * c_node = 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-2.2/src/lxml/proxy.pxi":359 + * c_node = 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-2.2/src/lxml/proxy.pxi":360 + * 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-2.2/src/lxml/proxy.pxi":363 + * + * # 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-2.2/src/lxml/proxy.pxi":364 + * # 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-2.2/src/lxml/proxy.pxi":367 + * + * # 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-2.2/src/lxml/proxy.pxi":368 + * # 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-2.2/src/lxml/proxy.pxi":369 + * 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-2.2/src/lxml/proxy.pxi":370 + * 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-2.2/src/lxml/proxy.pxi":373 + * + * # 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-2.2/src/lxml/proxy.pxi":374 + * # 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-2.2/src/lxml/proxy.pxi":378 + * # 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-2.2/src/lxml/proxy.pxi":379 + * # (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: + */ + if ((__pyx_v_proxy_count == 1)) { + __pyx_t_1 = (__pyx_v_c_start_node->_private != NULL); + } else { + __pyx_t_1 = (__pyx_v_proxy_count == 1); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":380 + * 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-2.2/src/lxml/proxy.pxi":382 + * _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-2.2/src/lxml/proxy.pxi":384 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":387 + * + * + * 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_SetupRefcountContext("fixElementDocument"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":389 + * 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-2.2/src/lxml/proxy.pxi":390 + * 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-2.2/src/lxml/proxy.pxi":391 + * 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-2.2/src/lxml/proxy.pxi":392 + * 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-2.2/src/lxml/proxy.pxi":393 + * if c_node._private is not NULL: + * _updateProxyDocument(c_node, doc) + * proxy_count -= 1 # <<<<<<<<<<<<<< + * if proxy_count == 0: + * return + */ + __pyx_v_proxy_count -= 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":394 + * _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-2.2/src/lxml/proxy.pxi":395 + * 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-2.2/src/lxml/proxy.pxi":396 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":398 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":405 + * # 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 + */ + if (!(__pyx_v_c_element->type == XML_DOCUMENT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":406 + * # 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_1 = (__pyx_v_c_element->type == XML_HTML_DOCUMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_element->type == XML_DOCUMENT_NODE); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":408 + * 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-2.2/src/lxml/proxy.pxi":409 + * # may define "xml" namespace + * fixThreadDictNsForNode(c_element, c_src_dict, c_dict) + * c_element = c_element.children # <<<<<<<<<<<<<< + * while c_element is not NULL: + * if tree._isElementOrXInclude(c_element): + */ + __pyx_v_c_element = __pyx_v_c_element->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":410 + * fixThreadDictNsForNode(c_element, c_src_dict, c_dict) + * c_element = c_element.children + * while c_element is not NULL: # <<<<<<<<<<<<<< + * if tree._isElementOrXInclude(c_element): + * fixThreadDictNamesForNode(c_element, c_src_dict, c_dict) + */ + while (1) { + __pyx_t_1 = (__pyx_v_c_element != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":411 + * c_element = c_element.children + * while c_element is not NULL: + * if tree._isElementOrXInclude(c_element): # <<<<<<<<<<<<<< + * fixThreadDictNamesForNode(c_element, c_src_dict, c_dict) + * c_element = c_element.next + */ + __pyx_t_1 = _isElementOrXInclude(__pyx_v_c_element); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":412 + * while c_element is not NULL: + * if tree._isElementOrXInclude(c_element): + * 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); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":413 + * if tree._isElementOrXInclude(c_element): + * 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-2.2/src/lxml/proxy.pxi":414 + * 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_1 = _isElementOrXInclude(__pyx_v_c_element); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":415 + * 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-2.2/src/lxml/proxy.pxi":417 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":420 + * 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-2.2/src/lxml/proxy.pxi":421 + * 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-2.2/src/lxml/proxy.pxi":422 + * 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 == tree.XML_ELEMENT_NODE: + */ + __pyx_t_1 = (__pyx_v_c_node->name != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":423 + * 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 == tree.XML_ELEMENT_NODE: + * 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-2.2/src/lxml/proxy.pxi":424 + * if c_node.name is not NULL: + * fixThreadDictNameForNode(c_node, c_src_dict, c_dict) + * if c_node.type == tree.XML_ELEMENT_NODE: # <<<<<<<<<<<<<< + * fixThreadDictNamesForAttributes( + * c_node.properties, c_src_dict, c_dict) + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":426 + * if c_node.type == tree.XML_ELEMENT_NODE: + * fixThreadDictNamesForAttributes( + * c_node.properties, 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_fixThreadDictNamesForAttributes(__pyx_v_c_node->properties, __pyx_v_c_src_dict, __pyx_v_c_dict); + goto __pyx_L4; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":427 + * fixThreadDictNamesForAttributes( + * c_node.properties, 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-2.2/src/lxml/proxy.pxi":429 + * 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-2.2/src/lxml/proxy.pxi":430 + * # 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-2.2/src/lxml/proxy.pxi":432 + * 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 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-2.2/src/lxml/proxy.pxi":436 + * tree.xmlDict* c_dict) nogil: + * cdef xmlNode* c_child + * cdef xmlNode* c_node = 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-2.2/src/lxml/proxy.pxi":437 + * cdef xmlNode* c_child + * cdef xmlNode* c_node = 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-2.2/src/lxml/proxy.pxi":438 + * cdef xmlNode* c_node = 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-2.2/src/lxml/proxy.pxi":440 + * 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-2.2/src/lxml/proxy.pxi":441 + * # 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-2.2/src/lxml/proxy.pxi":442 + * 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-2.2/src/lxml/proxy.pxi":443 + * 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-2.2/src/lxml/proxy.pxi":444 + * 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-2.2/src/lxml/proxy.pxi":446 + * c_node = c_node.next + * + * cdef inline void fixThreadDictNameForNode(xmlNode* c_node, # <<<<<<<<<<<<<< + * tree.xmlDict* c_src_dict, + * tree.xmlDict* c_dict) nogil: + */ + +static 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":449 + * 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-2.2/src/lxml/proxy.pxi":450 + * 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: + */ + if ((__pyx_v_c_name != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":451 + * 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): + */ + if ((__pyx_v_c_node->type != XML_TEXT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":452 + * 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_1 = (__pyx_v_c_node->type != XML_COMMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_node->type != XML_TEXT_NODE); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_name != NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":453 + * 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_3 = xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->name); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":455 + * 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-2.2/src/lxml/proxy.pxi":456 + * # 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-2.2/src/lxml/proxy.pxi":457 + * 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-2.2/src/lxml/proxy.pxi":459 + * c_node.name = c_name + * + * cdef inline void fixThreadDictContentForNode(xmlNode* c_node, # <<<<<<<<<<<<<< + * tree.xmlDict* c_src_dict, + * tree.xmlDict* c_dict) nogil: + */ + +static 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":462 + * tree.xmlDict* c_src_dict, + * tree.xmlDict* c_dict) nogil: + * if c_node.content is not NULL and \ # <<<<<<<<<<<<<< + * c_node.content is not &c_node.properties: + * if tree.xmlDictOwns(c_src_dict, c_node.content): + */ + if ((__pyx_v_c_node->content != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":463 + * tree.xmlDict* c_dict) nogil: + * if c_node.content is not NULL and \ + * c_node.content is not &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_1 = (__pyx_v_c_node->content != ((char *)(&__pyx_v_c_node->properties))); + } else { + __pyx_t_1 = (__pyx_v_c_node->content != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":464 + * if c_node.content is not NULL and \ + * c_node.content is not &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_2 = xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->content); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/proxy.pxi":466 + * 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-2.2/src/lxml/proxy.pxi":468 + * 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 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-2.2/src/lxml/proxy.pxi":471 + * 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-2.2/src/lxml/proxy.pxi":472 + * 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-2.2/src/lxml/proxy.pxi":473 + * 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-2.2/src/lxml/proxy.pxi":474 + * 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-2.2/src/lxml/proxy.pxi":475 + * 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-2.2/src/lxml/proxy.pxi":476 + * 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-2.2/src/lxml/proxy.pxi":477 + * 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-2.2/src/lxml/proxy.pxi":478 + * 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-2.2/src/lxml/proxy.pxi":479 + * 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-2.2/src/lxml/apihelpers.pxi":3 + * # Private/public helper functions for API functions + * + * 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_SetupRefcountContext("displayNode"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":6 + * # to help with debugging + * cdef xmlNode* c_child + * print indent * u' ', c_node # <<<<<<<<<<<<<< + * c_child = c_node.children + * while c_child is not NULL: + */ + __pyx_t_1 = PyNumber_Multiply(__pyx_v_indent, ((PyObject *)__pyx_kp_233)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __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[1]; __pyx_lineno = 6; __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 = 6; __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(((PyObject *)__pyx_t_3), 1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":7 + * cdef xmlNode* c_child + * print indent * u' ', 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-2.2/src/lxml/apihelpers.pxi":8 + * print indent * u' ', 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-2.2/src/lxml/apihelpers.pxi":9 + * 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[1]; __pyx_lineno = 9; __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-2.2/src/lxml/apihelpers.pxi":10 + * while c_child is not NULL: + * displayNode(c_child, indent + 1) + * c_child = c_child.next # <<<<<<<<<<<<<< + * + * cdef _Document _documentOrRaise(object input): + */ + __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":12 + * c_child = c_child.next + * + * 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; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":20 + * cdef _Document doc + * cdef _Element element + * if isinstance(input, _ElementTree): # <<<<<<<<<<<<<< + * element = (<_ElementTree>input)._context_node + * if element is not None: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":21 + * 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-2.2/src/lxml/apihelpers.pxi":22 + * 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-2.2/src/lxml/apihelpers.pxi":23 + * 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-2.2/src/lxml/apihelpers.pxi":24 + * if element is not None: + * doc = element._doc + * elif isinstance(input, _Element): # <<<<<<<<<<<<<< + * doc = (<_Element>input)._doc + * elif isinstance(input, _Document): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":25 + * 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-2.2/src/lxml/apihelpers.pxi":26 + * elif isinstance(input, _Element): + * doc = (<_Element>input)._doc + * elif isinstance(input, _Document): # <<<<<<<<<<<<<< + * doc = <_Document>input + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":27 + * 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-2.2/src/lxml/apihelpers.pxi":30 + * 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 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_234), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":31 + * 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-2.2/src/lxml/apihelpers.pxi":33 + * if doc is None: + * raise ValueError, u"Input object has no document: %s" % \ + * python._fqtypename(input) # <<<<<<<<<<<<<< + * else: + * return doc + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_235), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":35 + * python._fqtypename(input) + * else: + * 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_L5:; + + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":37 + * 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; + __Pyx_SetupRefcountContext("_rootNodeOrRaise"); + __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":44 + * """ + * cdef _Element node + * if isinstance(input, _ElementTree): # <<<<<<<<<<<<<< + * node = (<_ElementTree>input)._context_node + * elif isinstance(input, _Element): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":45 + * 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-2.2/src/lxml/apihelpers.pxi":46 + * if isinstance(input, _ElementTree): + * node = (<_ElementTree>input)._context_node + * elif isinstance(input, _Element): # <<<<<<<<<<<<<< + * node = <_Element>input + * elif isinstance(input, _Document): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":47 + * 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-2.2/src/lxml/apihelpers.pxi":48 + * elif isinstance(input, _Element): + * node = <_Element>input + * elif isinstance(input, _Document): # <<<<<<<<<<<<<< + * node = (<_Document>input).getroot() + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":49 + * 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[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __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-2.2/src/lxml/apihelpers.pxi":52 + * 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 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_236), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":53 + * 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-2.2/src/lxml/apihelpers.pxi":55 + * if node is None: + * raise ValueError, u"Input object has no element: %s" % \ + * python._fqtypename(input) # <<<<<<<<<<<<<< + * else: + * return node + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_237), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __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_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":57 + * python._fqtypename(input) + * else: + * 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_L4:; + + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":59 + * 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_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_documentOf"); + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":64 + * # may return None! + * cdef _Element element + * if isinstance(input, _ElementTree): # <<<<<<<<<<<<<< + * element = (<_ElementTree>input)._context_node + * if element is not None: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":65 + * cdef _Element element + * if isinstance(input, _ElementTree): + * element = (<_ElementTree>input)._context_node # <<<<<<<<<<<<<< + * if element is not None: + * return 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-2.2/src/lxml/apihelpers.pxi":66 + * if isinstance(input, _ElementTree): + * element = (<_ElementTree>input)._context_node + * if element is not None: # <<<<<<<<<<<<<< + * return 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-2.2/src/lxml/apihelpers.pxi":67 + * element = (<_ElementTree>input)._context_node + * if element is not None: + * return element._doc # <<<<<<<<<<<<<< + * elif isinstance(input, _Element): + * return (<_Element>input)._doc + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_element->_doc)); + __pyx_r = __pyx_v_element->_doc; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":68 + * if element is not None: + * return element._doc + * elif isinstance(input, _Element): # <<<<<<<<<<<<<< + * return (<_Element>input)._doc + * elif isinstance(input, _Document): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":69 + * return element._doc + * elif isinstance(input, _Element): + * return (<_Element>input)._doc # <<<<<<<<<<<<<< + * elif isinstance(input, _Document): + * return <_Document>input + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_input)->_doc)); + __pyx_r = ((struct LxmlElement *)__pyx_v_input)->_doc; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":70 + * elif isinstance(input, _Element): + * return (<_Element>input)._doc + * elif isinstance(input, _Document): # <<<<<<<<<<<<<< + * return <_Document>input + * return None + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":71 + * return (<_Element>input)._doc + * elif isinstance(input, _Document): + * return <_Document>input # <<<<<<<<<<<<<< + * return None + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)((struct LxmlDocument *)__pyx_v_input))); + __pyx_r = ((struct LxmlDocument *)__pyx_v_input); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":72 + * elif isinstance(input, _Document): + * return <_Document>input + * return None # <<<<<<<<<<<<<< + * + * cdef _Element _rootNodeOf(object input): + */ + __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); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":74 + * return None + * + * 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_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_rootNodeOf"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":78 + * # _Document, _ElementTree or _Element object + * # may return None! + * if isinstance(input, _ElementTree): # <<<<<<<<<<<<<< + * return (<_ElementTree>input)._context_node + * elif isinstance(input, _Element): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":79 + * # may return None! + * if isinstance(input, _ElementTree): + * return (<_ElementTree>input)._context_node # <<<<<<<<<<<<<< + * elif isinstance(input, _Element): + * return <_Element>input + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node)); + __pyx_r = ((struct LxmlElementTree *)__pyx_v_input)->_context_node; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":80 + * if isinstance(input, _ElementTree): + * return (<_ElementTree>input)._context_node + * elif isinstance(input, _Element): # <<<<<<<<<<<<<< + * return <_Element>input + * elif isinstance(input, _Document): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":81 + * return (<_ElementTree>input)._context_node + * elif isinstance(input, _Element): + * return <_Element>input # <<<<<<<<<<<<<< + * elif isinstance(input, _Document): + * return (<_Document>input).getroot() + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_input))); + __pyx_r = ((struct LxmlElement *)__pyx_v_input); + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":82 + * elif isinstance(input, _Element): + * return <_Element>input + * elif isinstance(input, _Document): # <<<<<<<<<<<<<< + * return (<_Document>input).getroot() + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":83 + * return <_Element>input + * elif isinstance(input, _Document): + * return (<_Document>input).getroot() # <<<<<<<<<<<<<< + * else: + * return None + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __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[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct LxmlElement *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":85 + * return (<_Document>input).getroot() + * else: + * return None # <<<<<<<<<<<<<< + * + * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc, + */ + __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); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._rootNodeOf"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":87 + * return None + * + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + xmlDoc *__pyx_t_5; + xmlDoc *__pyx_t_6; + xmlNode *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":105 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":106 + * 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-2.2/src/lxml/apihelpers.pxi":107 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":108 + * 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_3 = __pyx_v_parser->_for_html; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":109 + * 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_4 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":110 + * if parser is not None and parser._for_html: + * _htmlTagValidOrRaise(name_utf) + * if c_doc is NULL: # <<<<<<<<<<<<<< + * c_doc = _newHTMLDoc() + * else: + */ + __pyx_t_3 = (__pyx_v_c_doc == NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":111 + * _htmlTagValidOrRaise(name_utf) + * if c_doc is NULL: + * c_doc = _newHTMLDoc() # <<<<<<<<<<<<<< + * else: + * _tagValidOrRaise(name_utf) + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_5; + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":113 + * c_doc = _newHTMLDoc() + * else: + * _tagValidOrRaise(name_utf) # <<<<<<<<<<<<<< + * if c_doc is NULL: + * c_doc = _newXMLDoc() + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":114 + * else: + * _tagValidOrRaise(name_utf) + * if c_doc is NULL: # <<<<<<<<<<<<<< + * c_doc = _newXMLDoc() + * c_node = _createElement(c_doc, name_utf) + */ + __pyx_t_3 = (__pyx_v_c_doc == NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":115 + * _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_6 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_6; + goto __pyx_L6; + } + __pyx_L6:; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":116 + * 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_7 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_t_7; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":117 + * 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_3 = (__pyx_v_c_node == NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":118 + * 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_3 = (((PyObject *)__pyx_v_doc) == Py_None); + if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_c_doc != NULL); + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":119 + * 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-2.2/src/lxml/apihelpers.pxi":120 + * 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[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __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-2.2/src/lxml/apihelpers.pxi":121 + * 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-2.2/src/lxml/apihelpers.pxi":122 + * return python.PyErr_NoMemory() + * try: + * if doc is None: # <<<<<<<<<<<<<< + * tree.xmlDocSetRootElement(c_doc, c_node) + * doc = _documentFactory(c_doc, parser) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":123 + * 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-2.2/src/lxml/apihelpers.pxi":124 + * 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[1]; __pyx_lineno = 124; __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-2.2/src/lxml/apihelpers.pxi":125 + * 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_1 = (__pyx_v_text != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":126 + * 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_4 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":127 + * 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_1 = (__pyx_v_tail != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":128 + * _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_4 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + goto __pyx_L19; + } + __pyx_L19:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":130 + * _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_4 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":131 + * # 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[1]; __pyx_lineno = 131; __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-2.2/src/lxml/apihelpers.pxi":132 + * _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[1]; __pyx_lineno = 132; __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_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_L0; + __pyx_L9_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":133 + * _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_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_9); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":135 + * 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_1 = (__pyx_v_c_node->doc != __pyx_v_c_doc); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":137 + * 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_1 = (__pyx_v_tail != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":138 + * # 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-2.2/src/lxml/apihelpers.pxi":139 + * 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-2.2/src/lxml/apihelpers.pxi":140 + * _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_1 = (((PyObject *)__pyx_v_doc) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":142 + * 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-2.2/src/lxml/apihelpers.pxi":143 + * # 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_Raise(__pyx_t_2, __pyx_t_8, __pyx_t_9); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L10_exception_handled; + } + __pyx_L11_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":145 + * 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; + int __pyx_t_2; + xmlDoc *__pyx_t_3; + xmlDoc *__pyx_t_4; + xmlNode *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_SetupRefcountContext("_initNewElement"); + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":155 + * cdef xmlNode* c_node + * cdef _Document doc + * if is_html: # <<<<<<<<<<<<<< + * _htmlTagValidOrRaise(name_utf) + * c_doc = _newHTMLDoc() + */ + __pyx_t_1 = __pyx_v_is_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":156 + * cdef _Document doc + * if is_html: + * _htmlTagValidOrRaise(name_utf) # <<<<<<<<<<<<<< + * c_doc = _newHTMLDoc() + * else: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":157 + * if is_html: + * _htmlTagValidOrRaise(name_utf) + * c_doc = _newHTMLDoc() # <<<<<<<<<<<<<< + * else: + * _tagValidOrRaise(name_utf) + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __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-2.2/src/lxml/apihelpers.pxi":159 + * c_doc = _newHTMLDoc() + * else: + * _tagValidOrRaise(name_utf) # <<<<<<<<<<<<<< + * c_doc = _newXMLDoc() + * c_node = _createElement(c_doc, name_utf) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":160 + * else: + * _tagValidOrRaise(name_utf) + * c_doc = _newXMLDoc() # <<<<<<<<<<<<<< + * c_node = _createElement(c_doc, name_utf) + * if c_node is NULL: + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_4; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":161 + * _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_5 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":162 + * 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":163 + * 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_1 = (__pyx_v_c_doc != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":164 + * 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-2.2/src/lxml/apihelpers.pxi":165 + * 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[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_2; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":166 + * 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-2.2/src/lxml/apihelpers.pxi":167 + * 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[1]; __pyx_lineno = 167; __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-2.2/src/lxml/apihelpers.pxi":169 + * 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_2 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":170 + * # 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[1]; __pyx_lineno = 170; __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-2.2/src/lxml/apihelpers.pxi":171 + * _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_2 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_element, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":172 + * _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_kp__init); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __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[1]; __pyx_lineno = 172; __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-2.2/src/lxml/apihelpers.pxi":173 + * _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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":175 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + xmlNode *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":182 + * cdef xmlNode* c_node + * cdef xmlDoc* c_doc + * if parent is None or parent._doc is None: # <<<<<<<<<<<<<< + * return None + * ns_utf, name_utf = _getNsTag(tag) + */ + __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-2.2/src/lxml/apihelpers.pxi":183 + * cdef xmlDoc* c_doc + * if parent is None or parent._doc is None: + * return None # <<<<<<<<<<<<<< + * ns_utf, name_utf = _getNsTag(tag) + * c_doc = parent._doc._c_doc + */ + __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-2.2/src/lxml/apihelpers.pxi":184 + * if parent is None or parent._doc is None: + * return None + * ns_utf, name_utf = _getNsTag(tag) # <<<<<<<<<<<<<< + * c_doc = parent._doc._c_doc + * + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":185 + * return None + * 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-2.2/src/lxml/apihelpers.pxi":187 + * 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-2.2/src/lxml/apihelpers.pxi":188 + * + * if parent._doc._parser is not None and parent._doc._parser._for_html: + * _htmlTagValidOrRaise(name_utf) # <<<<<<<<<<<<<< + * else: + * _tagValidOrRaise(name_utf) + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":190 + * _htmlTagValidOrRaise(name_utf) + * else: + * _tagValidOrRaise(name_utf) # <<<<<<<<<<<<<< + * + * c_node = _createElement(c_doc, name_utf) + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":192 + * _tagValidOrRaise(name_utf) + * + * c_node = _createElement(c_doc, name_utf) # <<<<<<<<<<<<<< + * if c_node is NULL: + * return python.PyErr_NoMemory() + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_t_6; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":193 + * + * 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-2.2/src/lxml/apihelpers.pxi":194 + * 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_4 = PyErr_NoMemory(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct LxmlElement *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":195 + * 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-2.2/src/lxml/apihelpers.pxi":197 + * 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-2.2/src/lxml/apihelpers.pxi":198 + * + * 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-2.2/src/lxml/apihelpers.pxi":199 + * try: + * if text is not None: + * _setNodeText(c_node, text) # <<<<<<<<<<<<<< + * if tail is not None: + * _setTailText(c_node, tail) + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":200 + * 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-2.2/src/lxml/apihelpers.pxi":201 + * _setNodeText(c_node, text) + * if tail is not None: + * _setTailText(c_node, tail) # <<<<<<<<<<<<<< + * + * # add namespaces to node if necessary + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":204 + * + * # 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 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_parent->_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":205 + * # 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_4 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_parent->_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":206 + * _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_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_parent->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = ((struct LxmlElement *)__pyx_t_4); + __pyx_t_4 = 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_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_L0; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":207 + * _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_4, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":209 + * except: + * # make sure we clean up in case of an error + * _removeNode(parent._doc, c_node) # <<<<<<<<<<<<<< + * raise + * + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_parent->_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":210 + * # 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_Raise(__pyx_t_4, __pyx_t_7, __pyx_t_8); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":212 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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; + __Pyx_SetupRefcountContext("_initNodeNamespaces"); + __Pyx_INCREF(__pyx_v_node_ns_utf); + __pyx_v_nsdefs = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_item = 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 = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":223 + * cdef char* c_href + * cdef list nsdefs + * if not nsmap: # <<<<<<<<<<<<<< + * if node_ns_utf is not None: + * doc._setNodeNs(c_node, _cstr(node_ns_utf)) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":224 + * cdef list nsdefs + * if not nsmap: + * 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-2.2/src/lxml/apihelpers.pxi":225 + * if not nsmap: + * 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, PyString_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":226 + * if node_ns_utf is not None: + * 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-2.2/src/lxml/apihelpers.pxi":228 + * return 0 + * + * nsdefs = list(nsmap.items()) # <<<<<<<<<<<<<< + * if None in nsmap and python.PyList_GET_SIZE(nsdefs) > 1: + * # Move the default namespace to the end. This makes sure libxml2 + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_nsmap, __pyx_kp_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __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[1]; __pyx_lineno = 228; __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[1]; __pyx_lineno = 228; __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[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(PyList_CheckExact(__pyx_t_5)) || (__pyx_t_5) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_nsdefs)); + __pyx_v_nsdefs = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":229 + * + * nsdefs = list(nsmap.items()) + * if None in nsmap and python.PyList_GET_SIZE(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[1]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + __pyx_t_1 = (PyList_GET_SIZE(((PyObject *)__pyx_v_nsdefs)) > 1); + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":236 + * # elements serialise without prefix (i.e. into the non-default + * # namespace). + * item = (None, nsmap[None]) # <<<<<<<<<<<<<< + * nsdefs.remove(item) + * nsdefs.append(item) + */ + __pyx_1 = PyObject_GetItem(__pyx_v_nsmap, Py_None); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __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_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":237 + * # namespace). + * item = (None, nsmap[None]) + * nsdefs.remove(item) # <<<<<<<<<<<<<< + * nsdefs.append(item) + * + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_nsdefs), __pyx_kp_remove); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __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[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_item); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_item); + __Pyx_GIVEREF(__pyx_v_item); + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":238 + * item = (None, nsmap[None]) + * nsdefs.remove(item) + * nsdefs.append(item) # <<<<<<<<<<<<<< + * + * for prefix, href in nsdefs: + */ + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_nsdefs), __pyx_v_item); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":240 + * nsdefs.append(item) + * + * for prefix, href in nsdefs: # <<<<<<<<<<<<<< + * href_utf = _utf8(href) + * c_href = _cstr(href_utf) + */ + if (likely(((PyObject *)__pyx_v_nsdefs) != Py_None)) { + __pyx_t_7 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_nsdefs); __Pyx_INCREF(__pyx_t_6); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + 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++; + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_href); + __pyx_v_href = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_href); + __pyx_v_href = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":241 + * + * for prefix, href in nsdefs: + * href_utf = _utf8(href) # <<<<<<<<<<<<<< + * c_href = _cstr(href_utf) + * if prefix is not None: + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_href); 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_v_href_utf); + __pyx_v_href_utf = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":242 + * for prefix, href in nsdefs: + * href_utf = _utf8(href) + * c_href = _cstr(href_utf) # <<<<<<<<<<<<<< + * if prefix is not None: + * prefix_utf = _utf8(prefix) + */ + __pyx_v_c_href = PyString_AS_STRING(__pyx_v_href_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":243 + * href_utf = _utf8(href) + * c_href = _cstr(href_utf) + * if prefix is not None: # <<<<<<<<<<<<<< + * prefix_utf = _utf8(prefix) + * _prefixValidOrRaise(prefix_utf) + */ + __pyx_t_1 = (__pyx_v_prefix != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":244 + * c_href = _cstr(href_utf) + * if prefix is not None: + * prefix_utf = _utf8(prefix) # <<<<<<<<<<<<<< + * _prefixValidOrRaise(prefix_utf) + * c_prefix = _cstr(prefix_utf) + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_prefix_utf); + __pyx_v_prefix_utf = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":245 + * 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(__pyx_v_prefix_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":246 + * prefix_utf = _utf8(prefix) + * _prefixValidOrRaise(prefix_utf) + * c_prefix = _cstr(prefix_utf) # <<<<<<<<<<<<<< + * else: + * c_prefix = NULL + */ + __pyx_v_c_prefix = PyString_AS_STRING(__pyx_v_prefix_utf); + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":248 + * 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-2.2/src/lxml/apihelpers.pxi":250 + * 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-2.2/src/lxml/apihelpers.pxi":251 + * # 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: + */ + if (!(__pyx_v_c_ns == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":252 + * 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) + */ + if (!(__pyx_v_c_ns->href == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":253 + * 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); + } else { + __pyx_t_1 = (__pyx_v_c_ns->href == NULL); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_ns == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":254 + * 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-2.2/src/lxml/apihelpers.pxi":255 + * 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_4 = PyObject_RichCompare(__pyx_v_href_utf, __pyx_v_node_ns_utf, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 255; __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-2.2/src/lxml/apihelpers.pxi":256 + * 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-2.2/src/lxml/apihelpers.pxi":257 + * 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_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":259 + * 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-2.2/src/lxml/apihelpers.pxi":260 + * + * 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, PyString_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":261 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":263 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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; + int __pyx_t_8; + xmlNs *__pyx_t_9; + __Pyx_SetupRefcountContext("_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 = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":269 + * 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_kp_238)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; __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-2.2/src/lxml/apihelpers.pxi":271 + * 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 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_attrib)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_239), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":272 + * 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_3 = (__pyx_v_extra != Py_None); + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":273 + * python._fqtypename(attrib) + * if extra is not None and extra: + * if attrib is None: # <<<<<<<<<<<<<< + * attrib = extra + * else: + */ + __pyx_t_2 = (__pyx_v_attrib == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":274 + * 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-2.2/src/lxml/apihelpers.pxi":276 + * attrib = extra + * else: + * attrib.update(extra) # <<<<<<<<<<<<<< + * if attrib: + * is_html = doc._parser._for_html + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_attrib, __pyx_kp_update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __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[1]; __pyx_lineno = 276; __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[1]; __pyx_lineno = 276; __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-2.2/src/lxml/apihelpers.pxi":277 + * else: + * attrib.update(extra) + * if attrib: # <<<<<<<<<<<<<< + * is_html = doc._parser._for_html + * for name, value in attrib.items(): + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":278 + * 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-2.2/src/lxml/apihelpers.pxi":279 + * 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_kp_items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __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[1]; __pyx_lineno = 279; __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[1]; __pyx_lineno = 279; __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[1]; __pyx_lineno = 279; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":280 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_attr_ns_utf); + __pyx_v_attr_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_attr_name_utf); + __pyx_v_attr_name_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_attr_ns_utf); + __pyx_v_attr_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_attr_name_utf); + __pyx_v_attr_name_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":281 + * 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_2 = (!__pyx_v_is_html); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":282 + * 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_8 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_attr_name_utf); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":283 + * 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_value_utf); + __pyx_v_value_utf = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":284 + * _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_2 = (__pyx_v_attr_ns_utf == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":285 + * value_utf = _utf8(value) + * if attr_ns_utf is None: + * tree.xmlNewProp(c_node, _cstr(attr_name_utf), _cstr(value_utf)) # <<<<<<<<<<<<<< + * else: + * c_ns = doc._findOrBuildNodeNs(c_node, _cstr(attr_ns_utf), NULL) + */ + xmlNewProp(__pyx_v_c_node, PyString_AS_STRING(__pyx_v_attr_name_utf), PyString_AS_STRING(__pyx_v_value_utf)); + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":287 + * tree.xmlNewProp(c_node, _cstr(attr_name_utf), _cstr(value_utf)) + * else: + * c_ns = doc._findOrBuildNodeNs(c_node, _cstr(attr_ns_utf), NULL) # <<<<<<<<<<<<<< + * tree.xmlNewNsProp(c_node, c_ns, + * _cstr(attr_name_utf), _cstr(value_utf)) + */ + __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, PyString_AS_STRING(__pyx_v_attr_ns_utf), NULL); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_ns = __pyx_t_9; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":289 + * c_ns = doc._findOrBuildNodeNs(c_node, _cstr(attr_ns_utf), NULL) + * 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, PyString_AS_STRING(__pyx_v_attr_name_utf), PyString_AS_STRING(__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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":295 + * xmlNode* node + * + * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element) except -1: # <<<<<<<<<<<<<< + * u"""Remove any namespace declarations from a subtree that do 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; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + __Pyx_SetupRefcountContext("_removeUnusedNamespaceDeclarations"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":307 + * 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-2.2/src/lxml/apihelpers.pxi":308 + * + * 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-2.2/src/lxml/apihelpers.pxi":309 + * 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-2.2/src/lxml/apihelpers.pxi":311 + * 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 + */ + if ((__pyx_v_c_element->parent != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":312 + * + * 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_1 = (__pyx_v_c_element->parent->type == XML_DOCUMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_element->parent != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":314 + * 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-2.2/src/lxml/apihelpers.pxi":315 + * # 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_1 = (__pyx_v_c_nsdef != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":316 + * 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_1 = (__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":317 + * 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_1 = (__pyx_v_c_ns_list == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":318 + * 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-2.2/src/lxml/apihelpers.pxi":320 + * 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 *= 2; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":322 + * 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-2.2/src/lxml/apihelpers.pxi":323 + * 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_1 = (__pyx_v_c_nsref_ptr == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":324 + * 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_1 = (__pyx_v_c_ns_list != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":325 + * 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-2.2/src/lxml/apihelpers.pxi":326 + * 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_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __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-2.2/src/lxml/apihelpers.pxi":327 + * 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-2.2/src/lxml/apihelpers.pxi":328 + * 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-2.2/src/lxml/apihelpers.pxi":330 + * 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-2.2/src/lxml/apihelpers.pxi":331 + * + * 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-2.2/src/lxml/apihelpers.pxi":332 + * 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 += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":333 + * 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-2.2/src/lxml/apihelpers.pxi":335 + * 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-2.2/src/lxml/apihelpers.pxi":337 + * 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-2.2/src/lxml/apihelpers.pxi":338 + * # 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_1 = (__pyx_v_c_nsdef != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":339 + * 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_1 = (__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":340 + * 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_1 = (__pyx_v_c_ns_list == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":341 + * 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-2.2/src/lxml/apihelpers.pxi":343 + * 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 *= 2; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":345 + * 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-2.2/src/lxml/apihelpers.pxi":346 + * 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_1 = (__pyx_v_c_nsref_ptr == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":347 + * 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_1 = (__pyx_v_c_ns_list != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":348 + * 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-2.2/src/lxml/apihelpers.pxi":349 + * 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_2 = PyErr_NoMemory(); 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(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":350 + * 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-2.2/src/lxml/apihelpers.pxi":351 + * 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-2.2/src/lxml/apihelpers.pxi":353 + * 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-2.2/src/lxml/apihelpers.pxi":354 + * + * 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-2.2/src/lxml/apihelpers.pxi":355 + * 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 += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":356 + * 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-2.2/src/lxml/apihelpers.pxi":359 + * + * # 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_1 = (__pyx_v_c_element->type == XML_ELEMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":360 + * # 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-2.2/src/lxml/apihelpers.pxi":361 + * 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_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":362 + * 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_1 = (__pyx_v_c_node->ns != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":363 + * 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_3 = __pyx_v_c_ns_list_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":364 + * 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_1 = (__pyx_v_c_node->ns == (__pyx_v_c_ns_list[__pyx_v_i]).ns); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":365 + * 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 -= 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":366 + * 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-2.2/src/lxml/apihelpers.pxi":367 + * 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-2.2/src/lxml/apihelpers.pxi":368 + * 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-2.2/src/lxml/apihelpers.pxi":369 + * 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-2.2/src/lxml/apihelpers.pxi":370 + * 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-2.2/src/lxml/apihelpers.pxi":371 + * c_ns_list[c_ns_list_len].node = NULL + * break + * if c_node is c_element: # <<<<<<<<<<<<<< + * # continue with attributes + * c_node = c_element.properties + */ + __pyx_t_1 = (__pyx_v_c_node == __pyx_v_c_element); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":373 + * if c_node is c_element: + * # continue with attributes + * c_node = 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-2.2/src/lxml/apihelpers.pxi":375 + * c_node = 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-2.2/src/lxml/apihelpers.pxi":376 + * 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-2.2/src/lxml/apihelpers.pxi":378 + * tree.END_FOR_EACH_ELEMENT_FROM(c_element) + * + * if c_ns_list is NULL: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_1 = (__pyx_v_c_ns_list == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":379 + * + * 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-2.2/src/lxml/apihelpers.pxi":382 + * + * # 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_3 = __pyx_v_c_ns_list_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":383 + * # 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-2.2/src/lxml/apihelpers.pxi":384 + * 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-2.2/src/lxml/apihelpers.pxi":385 + * 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_1 = (__pyx_v_c_nsdef == (__pyx_v_c_ns_list[__pyx_v_i]).ns); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":386 + * 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-2.2/src/lxml/apihelpers.pxi":388 + * 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_1 = (__pyx_v_c_nsdef->next != (__pyx_v_c_ns_list[__pyx_v_i]).ns); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":389 + * 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-2.2/src/lxml/apihelpers.pxi":390 + * 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-2.2/src/lxml/apihelpers.pxi":391 + * 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-2.2/src/lxml/apihelpers.pxi":393 + * tree.xmlFreeNs(c_ns_list[i].ns) + * + * if c_ns_list is not NULL: # <<<<<<<<<<<<<< + * cstd.free(c_ns_list) + * return 0 + */ + __pyx_t_1 = (__pyx_v_c_ns_list != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":394 + * + * 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-2.2/src/lxml/apihelpers.pxi":395 + * if c_ns_list is not NULL: + * cstd.free(c_ns_list) + * return 0 # <<<<<<<<<<<<<< + * + * cdef int _replaceNodeByChildren(_Document doc, 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_AddTraceback("lxml.etree._removeUnusedNamespaceDeclarations"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":397 + * return 0 + * + * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1: # <<<<<<<<<<<<<< + * cdef xmlNode* c_parent + * cdef xmlNode* c_child + */ + +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_SetupRefcountContext("_replaceNodeByChildren"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":400 + * 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-2.2/src/lxml/apihelpers.pxi":401 + * 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-2.2/src/lxml/apihelpers.pxi":402 + * 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-2.2/src/lxml/apihelpers.pxi":404 + * 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-2.2/src/lxml/apihelpers.pxi":406 + * 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-2.2/src/lxml/apihelpers.pxi":407 + * # 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-2.2/src/lxml/apihelpers.pxi":408 + * 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-2.2/src/lxml/apihelpers.pxi":409 + * 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-2.2/src/lxml/apihelpers.pxi":413 + * # 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-2.2/src/lxml/apihelpers.pxi":414 + * # 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-2.2/src/lxml/apihelpers.pxi":415 + * 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-2.2/src/lxml/apihelpers.pxi":416 + * 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[1]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":417 + * 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-2.2/src/lxml/apihelpers.pxi":420 + * + * # 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-2.2/src/lxml/apihelpers.pxi":421 + * # 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-2.2/src/lxml/apihelpers.pxi":423 + * 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-2.2/src/lxml/apihelpers.pxi":424 + * 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-2.2/src/lxml/apihelpers.pxi":425 + * 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-2.2/src/lxml/apihelpers.pxi":426 + * 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-2.2/src/lxml/apihelpers.pxi":428 + * 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-2.2/src/lxml/apihelpers.pxi":429 + * 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-2.2/src/lxml/apihelpers.pxi":432 + * + * # 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-2.2/src/lxml/apihelpers.pxi":433 + * # 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-2.2/src/lxml/apihelpers.pxi":434 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":436 + * 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_SetupRefcountContext("_attributeValue"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":439 + * cdef char* value + * cdef char* c_href + * c_href = _getNs(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-2.2/src/lxml/apihelpers.pxi":440 + * cdef char* c_href + * c_href = _getNs(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-2.2/src/lxml/apihelpers.pxi":441 + * c_href = _getNs(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-2.2/src/lxml/apihelpers.pxi":442 + * 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[1]; __pyx_lineno = 442; __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; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":444 + * result = funicode(value) + * finally: + * tree.xmlFree(value) # <<<<<<<<<<<<<< + * return result + * + */ + 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-2.2/src/lxml/apihelpers.pxi":445 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":447 + * 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_SetupRefcountContext("_attributeValueFromNsName"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":449 + * 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-2.2/src/lxml/apihelpers.pxi":450 + * 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-2.2/src/lxml/apihelpers.pxi":451 + * 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-2.2/src/lxml/apihelpers.pxi":452 + * if c_result is NULL: + * return None + * try: # <<<<<<<<<<<<<< + * result = funicode(c_result) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":453 + * 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[1]; __pyx_lineno = 453; __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; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":455 + * result = funicode(c_result) + * finally: + * tree.xmlFree(c_result) # <<<<<<<<<<<<<< + * return result + * + */ + 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-2.2/src/lxml/apihelpers.pxi":456 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":458 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + void *__pyx_4; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":461 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":462 + * 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_2 = (__pyx_v_ns == Py_None); + if (__pyx_t_2) { + __pyx_4 = NULL; + } else { + __pyx_4 = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_v_c_href = __pyx_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":463 + * 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, PyString_AS_STRING(__pyx_v_tag), __pyx_v_c_href); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":464 + * 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_2 = (__pyx_v_c_result == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":466 + * 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-2.2/src/lxml/apihelpers.pxi":467 + * # XXX free namespace that is not in use..? + * return default + * try: # <<<<<<<<<<<<<< + * result = funicode(c_result) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":468 + * 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[1]; __pyx_lineno = 468; __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; + } + /*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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":470 + * result = funicode(c_result) + * finally: + * tree.xmlFree(c_result) # <<<<<<<<<<<<<< + * return result + * + */ + 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-2.2/src/lxml/apihelpers.pxi":471 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":473 + * return result + * + * cdef inline object _getAttributeValue(_Element element, key, default): # <<<<<<<<<<<<<< + * return _getNodeAttributeValue(element._c_node, key, default) + * + */ + +static 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_SetupRefcountContext("_getAttributeValue"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":474 + * + * 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[1]; __pyx_lineno = 474; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":476 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + xmlNs *__pyx_t_4; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":480 + * cdef char* c_value + * cdef char* c_tag + * ns, tag = _getNsTag(key) # <<<<<<<<<<<<<< + * if not element._doc._parser._for_html: + * _attributeValidOrRaise(tag) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 480; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":481 + * cdef char* c_tag + * ns, tag = _getNsTag(key) + * if not element._doc._parser._for_html: # <<<<<<<<<<<<<< + * _attributeValidOrRaise(tag) + * c_tag = _cstr(tag) + */ + __pyx_t_2 = (!__pyx_v_element->_doc->_parser->_for_html); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":482 + * ns, tag = _getNsTag(key) + * if not element._doc._parser._for_html: + * _attributeValidOrRaise(tag) # <<<<<<<<<<<<<< + * c_tag = _cstr(tag) + * if isinstance(value, QName): + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_tag); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":483 + * 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 = PyString_AS_STRING(__pyx_v_tag); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":484 + * _attributeValidOrRaise(tag) + * c_tag = _cstr(tag) + * if isinstance(value, QName): # <<<<<<<<<<<<<< + * value = _resolveQNameText(element, value) + * else: + */ + __pyx_t_2 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":485 + * c_tag = _cstr(tag) + * if isinstance(value, QName): + * value = _resolveQNameText(element, value) # <<<<<<<<<<<<<< + * else: + * value = _utf8(value) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_element, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 485; __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-2.2/src/lxml/apihelpers.pxi":487 + * value = _resolveQNameText(element, value) + * else: + * value = _utf8(value) # <<<<<<<<<<<<<< + * c_value = _cstr(value) + * if ns is None: + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 487; __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-2.2/src/lxml/apihelpers.pxi":488 + * else: + * value = _utf8(value) + * c_value = _cstr(value) # <<<<<<<<<<<<<< + * if ns is None: + * c_ns = NULL + */ + __pyx_v_c_value = PyString_AS_STRING(__pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":489 + * value = _utf8(value) + * c_value = _cstr(value) + * if ns is None: # <<<<<<<<<<<<<< + * c_ns = NULL + * else: + */ + __pyx_t_2 = (__pyx_v_ns == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":490 + * 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-2.2/src/lxml/apihelpers.pxi":493 + * else: + * c_ns = element._doc._findOrBuildNodeNs(element._c_node, + * _cstr(ns), NULL) # <<<<<<<<<<<<<< + * tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value) + * return 0 + */ + __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_element->_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, PyString_AS_STRING(__pyx_v_ns), NULL); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_ns = __pyx_t_4; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":494 + * c_ns = element._doc._findOrBuildNodeNs(element._c_node, + * _cstr(ns), NULL) + * 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-2.2/src/lxml/apihelpers.pxi":495 + * _cstr(ns), NULL) + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":497 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + void *__pyx_4; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":499 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 499; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":500 + * 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_2 = (__pyx_v_ns == Py_None); + if (__pyx_t_2) { + __pyx_4 = NULL; + } else { + __pyx_4 = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_v_c_href = __pyx_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":501 + * 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_3 = __pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_element->_c_node, __pyx_v_c_href, PyString_AS_STRING(__pyx_v_tag)); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":502 + * 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[1]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":503 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._delAttribute"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":505 + * 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_SetupRefcountContext("_delAttributeFromNsName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":507 + * 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-2.2/src/lxml/apihelpers.pxi":508 + * 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-2.2/src/lxml/apihelpers.pxi":510 + * 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-2.2/src/lxml/apihelpers.pxi":511 + * # 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-2.2/src/lxml/apihelpers.pxi":512 + * return -1 + * tree.xmlRemoveProp(c_attr) + * return 0 # <<<<<<<<<<<<<< + * + * cdef object _collectAttributes(xmlNode* c_node, int collecttype): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":514 + * return 0 + * + * cdef object _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_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":520 + * 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-2.2/src/lxml/apihelpers.pxi":521 + * 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-2.2/src/lxml/apihelpers.pxi":522 + * 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-2.2/src/lxml/apihelpers.pxi":523 + * 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-2.2/src/lxml/apihelpers.pxi":524 + * 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-2.2/src/lxml/apihelpers.pxi":525 + * 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-2.2/src/lxml/apihelpers.pxi":527 + * 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-2.2/src/lxml/apihelpers.pxi":528 + * + * if count == 0: + * return [] # <<<<<<<<<<<<<< + * + * attributes = python.PyList_New(count) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __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_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":530 + * 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[1]; __pyx_lineno = 530; __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-2.2/src/lxml/apihelpers.pxi":531 + * + * 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-2.2/src/lxml/apihelpers.pxi":532 + * 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-2.2/src/lxml/apihelpers.pxi":533 + * 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-2.2/src/lxml/apihelpers.pxi":534 + * count = 0 + * while c_attr is not NULL: + * if c_attr.type == tree.XML_ATTRIBUTE_NODE: # <<<<<<<<<<<<<< + * if collecttype == 1: + * item = _namespacedName(c_attr) + */ + __pyx_t_1 = (__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":535 + * while c_attr is not NULL: + * if c_attr.type == tree.XML_ATTRIBUTE_NODE: + * if collecttype == 1: # <<<<<<<<<<<<<< + * item = _namespacedName(c_attr) + * elif collecttype == 2: + */ + switch (__pyx_v_collecttype) { + case 1: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":536 + * if c_attr.type == tree.XML_ATTRIBUTE_NODE: + * if collecttype == 1: + * item = _namespacedName(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[1]; __pyx_lineno = 536; __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-2.2/src/lxml/apihelpers.pxi":537 + * if collecttype == 1: + * item = _namespacedName(c_attr) + * elif collecttype == 2: # <<<<<<<<<<<<<< + * item = _attributeValue(c_node, c_attr) + * else: + */ + case 2: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":538 + * item = _namespacedName(c_attr) + * elif collecttype == 2: + * item = _attributeValue(c_node, c_attr) # <<<<<<<<<<<<<< + * else: + * item = (_namespacedName(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[1]; __pyx_lineno = 538; __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-2.2/src/lxml/apihelpers.pxi":540 + * item = _attributeValue(c_node, c_attr) + * else: + * item = (_namespacedName(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[1]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":541 + * else: + * item = (_namespacedName(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[1]; __pyx_lineno = 541; __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 = 540; __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-2.2/src/lxml/apihelpers.pxi":543 + * _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-2.2/src/lxml/apihelpers.pxi":544 + * + * 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-2.2/src/lxml/apihelpers.pxi":545 + * 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-2.2/src/lxml/apihelpers.pxi":546 + * 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-2.2/src/lxml/apihelpers.pxi":547 + * count = count + 1 + * c_attr = c_attr.next + * return attributes # <<<<<<<<<<<<<< + * + * cdef object __RE_XML_ENCODING + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_attributes); + __pyx_r = __pyx_v_attributes; + 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._collectAttributes"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_attributes); + __Pyx_DECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":559 + * __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_SetupRefcountContext("_stripEncodingDeclaration"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":561 + * 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 int _hasEncodingDeclaration(object xml_string): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_240)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_240)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_240)); + __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[1]; __pyx_lineno = 561; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":563 + * return __REPLACE_XML_ENCODING(ur'\g<1>', xml_string) + * + * cdef int _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_SetupRefcountContext("_hasEncodingDeclaration"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":565 + * cdef int _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[1]; __pyx_lineno = 565; __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[1]; __pyx_lineno = 565; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":567 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + __Pyx_SetupRefcountContext("_stripDeclaration"); + __Pyx_INCREF(__pyx_v_xml_string); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":569 + * 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] == '') + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_xml_string, __pyx_kp_strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 569; __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 = 569; __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-2.2/src/lxml/apihelpers.pxi":570 + * # this is a hack to remove the XML declaration when we encode to UTF-8 + * xml_string = xml_string.strip() + * if xml_string[:5] == '') + * if i != -1: + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_xml_string, 0, 5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_1, __pyx_kp_241, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 570; __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-2.2/src/lxml/apihelpers.pxi":571 + * xml_string = xml_string.strip() + * if xml_string[:5] == '') # <<<<<<<<<<<<<< + * if i != -1: + * i = i + 2 + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_xml_string, __pyx_kp_find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 571; __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[1]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_242); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_242); + __Pyx_GIVEREF(__pyx_kp_242); + __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 = 571; __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_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":572 + * if xml_string[:5] == '') + * if i != -1: # <<<<<<<<<<<<<< + * i = i + 2 + * while xml_string[i:i+1] in '\n\r ': + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_i, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 572; __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-2.2/src/lxml/apihelpers.pxi":573 + * i = xml_string.find('?>') + * if i != -1: + * i = i + 2 # <<<<<<<<<<<<<< + * while xml_string[i:i+1] in '\n\r ': + * i = i+1 + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_i, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":574 + * 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_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_1 = PySequence_GetSlice(__pyx_v_xml_string, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = (PySequence_Contains(__pyx_kp_243, __pyx_1)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":575 + * 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_4 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":576 + * while xml_string[i:i+1] in '\n\r ': + * i = i+1 + * xml_string = xml_string[i:] # <<<<<<<<<<<<<< + * return xml_string + * + */ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = PySequence_GetSlice(__pyx_v_xml_string, __pyx_t_6, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_xml_string); + __pyx_v_xml_string = __pyx_1; + __pyx_1 = 0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":577 + * i = i+1 + * xml_string = xml_string[i:] + * return xml_string # <<<<<<<<<<<<<< + * + * cdef inline int _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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":579 + * return xml_string + * + * cdef inline int _hasText(xmlNode* c_node): # <<<<<<<<<<<<<< + * return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL + * + */ + +static INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *__pyx_v_c_node) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_hasText"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":580 + * + * cdef inline int _hasText(xmlNode* c_node): + * return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL # <<<<<<<<<<<<<< + * + * cdef inline int _hasTail(xmlNode* c_node): + */ + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->children) != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":582 + * return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL + * + * cdef inline int _hasTail(xmlNode* c_node): # <<<<<<<<<<<<<< + * return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL + * + */ + +static INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *__pyx_v_c_node) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_hasTail"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":583 + * + * cdef inline int _hasTail(xmlNode* c_node): + * return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL # <<<<<<<<<<<<<< + * + * cdef _collectText(xmlNode* c_node): + */ + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next) != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":585 + * 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_SetupRefcountContext("_collectText"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":596 + * 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-2.2/src/lxml/apihelpers.pxi":597 + * # 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-2.2/src/lxml/apihelpers.pxi":598 + * 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-2.2/src/lxml/apihelpers.pxi":599 + * 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-2.2/src/lxml/apihelpers.pxi":600 + * 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-2.2/src/lxml/apihelpers.pxi":601 + * 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-2.2/src/lxml/apihelpers.pxi":602 + * 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-2.2/src/lxml/apihelpers.pxi":603 + * 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-2.2/src/lxml/apihelpers.pxi":606 + * + * # 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-2.2/src/lxml/apihelpers.pxi":607 + * # 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-2.2/src/lxml/apihelpers.pxi":608 + * if c_text is NULL: + * if scount > 0: + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * return u'' + * else: + */ + __pyx_t_2 = IS_PYTHON3; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":609 + * if scount > 0: + * if python.IS_PYTHON3: + * return u'' # <<<<<<<<<<<<<< + * else: + * return '' + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_244)); + __pyx_r = ((PyObject *)__pyx_kp_244); + goto __pyx_L0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":611 + * return u'' + * else: + * return '' # <<<<<<<<<<<<<< + * else: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_245); + __pyx_r = __pyx_kp_245; + goto __pyx_L0; + } + __pyx_L8:; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":613 + * return '' + * 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-2.2/src/lxml/apihelpers.pxi":614 + * 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-2.2/src/lxml/apihelpers.pxi":615 + * 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[1]; __pyx_lineno = 615; __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-2.2/src/lxml/apihelpers.pxi":618 + * + * # the rest is not performance critical anymore + * result = '' # <<<<<<<<<<<<<< + * while c_node is not NULL: + * result = result + c_node.content + */ + __Pyx_INCREF(__pyx_kp_246); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_kp_246; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":619 + * # the rest is not performance critical anymore + * result = '' + * 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-2.2/src/lxml/apihelpers.pxi":620 + * result = '' + * while c_node is not NULL: + * result = result + c_node.content # <<<<<<<<<<<<<< + * c_node = _textNodeOrSkip(c_node.next) + * return funicode(result) + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Add(__pyx_v_result, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 620; __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_result); + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":621 + * 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-2.2/src/lxml/apihelpers.pxi":622 + * 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 = __Pyx_PyBytes_AsString(__pyx_v_result); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 622; __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[1]; __pyx_lineno = 622; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":624 + * 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_SetupRefcountContext("_removeText"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":630 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":631 + * 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-2.2/src/lxml/apihelpers.pxi":632 + * 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-2.2/src/lxml/apihelpers.pxi":633 + * 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-2.2/src/lxml/apihelpers.pxi":634 + * 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-2.2/src/lxml/apihelpers.pxi":635 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":637 + * 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; + __Pyx_SetupRefcountContext("_setNodeText"); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":640 + * 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-2.2/src/lxml/apihelpers.pxi":641 + * # 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-2.2/src/lxml/apihelpers.pxi":642 + * _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-2.2/src/lxml/apihelpers.pxi":644 + * 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-2.2/src/lxml/apihelpers.pxi":645 + * # 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":646 + * 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, PyString_AS_STRING(__pyx_v_text)); + goto __pyx_L4; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":647 + * 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((value)._utf8_data), + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_CDATA))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":650 + * c_text_node = tree.xmlNewCDataBlock( + * c_node.doc, _cstr((value)._utf8_data), + * python.PyString_GET_SIZE((value)._utf8_data)) # <<<<<<<<<<<<<< + * else: + * # this will raise the right error + */ + __pyx_v_c_text_node = xmlNewCDataBlock(__pyx_v_c_node->doc, PyString_AS_STRING(((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data), PyString_GET_SIZE(((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data)); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":653 + * else: + * # this will raise the right error + * _utf8(value) # <<<<<<<<<<<<<< + * return -1 + * if c_node.children is NULL: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 653; __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-2.2/src/lxml/apihelpers.pxi":654 + * # 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-2.2/src/lxml/apihelpers.pxi":655 + * _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-2.2/src/lxml/apihelpers.pxi":656 + * 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-2.2/src/lxml/apihelpers.pxi":658 + * 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-2.2/src/lxml/apihelpers.pxi":659 + * 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_AddTraceback("lxml.etree._setNodeText"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_text); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":661 + * 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_SetupRefcountContext("_setTailText"); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":664 + * 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-2.2/src/lxml/apihelpers.pxi":665 + * # 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-2.2/src/lxml/apihelpers.pxi":666 + * _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-2.2/src/lxml/apihelpers.pxi":667 + * 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 667; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":668 + * 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, PyString_AS_STRING(__pyx_v_text)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":670 + * 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-2.2/src/lxml/apihelpers.pxi":671 + * # XXX what if we're the top element? + * tree.xmlAddNextSibling(c_node, c_text_node) + * return 0 # <<<<<<<<<<<<<< + * + * cdef _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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":673 + * return 0 + * + * cdef _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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + xmlNs *__pyx_t_3; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/apihelpers.pxi":675 + * cdef _resolveQNameText(_Element element, value): + * cdef xmlNs* c_ns + * ns, tag = _getNsTag(value) # <<<<<<<<<<<<<< + * if ns is None: + * return tag + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 675; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":676 + * cdef xmlNs* c_ns + * ns, tag = _getNsTag(value) + * if ns is None: # <<<<<<<<<<<<<< + * return tag + * else: + */ + __pyx_t_2 = (__pyx_v_ns == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":677 + * ns, tag = _getNsTag(value) + * if ns is None: + * return tag # <<<<<<<<<<<<<< + * else: + * c_ns = element._doc._findOrBuildNodeNs( + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_tag); + __pyx_r = __pyx_v_tag; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":680 + * else: + * c_ns = element._doc._findOrBuildNodeNs( + * element._c_node, _cstr(ns), NULL) # <<<<<<<<<<<<<< + * return python.PyString_FromFormat('%s:%s', c_ns.prefix, _cstr(tag)) + * + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_element->_doc->__pyx_vtab)->_findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, PyString_AS_STRING(__pyx_v_ns), NULL); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_ns = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":681 + * c_ns = element._doc._findOrBuildNodeNs( + * element._c_node, _cstr(ns), NULL) + * return python.PyString_FromFormat('%s:%s', c_ns.prefix, _cstr(tag)) # <<<<<<<<<<<<<< + * + * cdef inline bint _hasChild(xmlNode* c_node): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyString_FromFormat(__pyx_k_247, __pyx_v_c_ns->prefix, PyString_AS_STRING(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 681; __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_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":683 + * return python.PyString_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 INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *__pyx_v_c_node) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_hasChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":684 + * + * 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): + */ + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0) != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":686 + * 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 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_SetupRefcountContext("_countElements"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":689 + * 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-2.2/src/lxml/apihelpers.pxi":690 + * 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-2.2/src/lxml/apihelpers.pxi":691 + * 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-2.2/src/lxml/apihelpers.pxi":692 + * 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-2.2/src/lxml/apihelpers.pxi":693 + * 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-2.2/src/lxml/apihelpers.pxi":694 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":696 + * return count + * + * cdef int _findChildSlice( # <<<<<<<<<<<<<< + * python.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(PySliceObject *__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; + int __pyx_t_2; + __Pyx_SetupRefcountContext("_findChildSlice"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":705 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":706 + * 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-2.2/src/lxml/apihelpers.pxi":707 + * 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-2.2/src/lxml/apihelpers.pxi":708 + * 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-2.2/src/lxml/apihelpers.pxi":709 + * c_start_node[0] = NULL + * c_length[0] = 0 + * if sliceobject.step is None: # <<<<<<<<<<<<<< + * c_step[0] = 1 + * else: + */ + __pyx_t_1 = (__pyx_v_sliceobject->step == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":710 + * 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-2.2/src/lxml/apihelpers.pxi":712 + * c_step[0] = 1 + * else: + * python._PyEval_SliceIndex(sliceobject.step, c_step) # <<<<<<<<<<<<<< + * return 0 + * python.PySlice_GetIndicesEx( + */ + __pyx_t_2 = _PyEval_SliceIndex(__pyx_v_sliceobject->step, __pyx_v_c_step); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":713 + * 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-2.2/src/lxml/apihelpers.pxi":715 + * 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_2 = 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_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":716 + * 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_v_childcount / 2)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":717 + * 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-2.2/src/lxml/apihelpers.pxi":719 + * 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-2.2/src/lxml/apihelpers.pxi":720 + * else: + * c_start_node[0] = _findChild(c_parent, start) + * return 0 # <<<<<<<<<<<<<< + * + * cdef bint _isFullSlice(python.slice sliceobject): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._findChildSlice"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":722 + * return 0 + * + * cdef bint _isFullSlice(python.slice sliceobject): # <<<<<<<<<<<<<< + * u"""Conservative guess if this slice is a full slice as in ``s[:]``. + * """ + */ + +static int __pyx_f_4lxml_5etree__isFullSlice(PySliceObject *__pyx_v_sliceobject) { + Py_ssize_t __pyx_v_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_isFullSlice"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":726 + * """ + * cdef Py_ssize_t step + * if sliceobject is None: # <<<<<<<<<<<<<< + * return 0 + * if sliceobject.start is None and \ + */ + __pyx_t_1 = (((PyObject *)__pyx_v_sliceobject) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":727 + * 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-2.2/src/lxml/apihelpers.pxi":728 + * if sliceobject is None: + * return 0 + * if sliceobject.start is None and \ # <<<<<<<<<<<<<< + * sliceobject.stop is None: + * if sliceobject.step is None: + */ + __pyx_t_1 = (__pyx_v_sliceobject->start == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":729 + * return 0 + * if sliceobject.start is None and \ + * sliceobject.stop is None: # <<<<<<<<<<<<<< + * if sliceobject.step is None: + * return 1 + */ + __pyx_t_2 = (__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-2.2/src/lxml/apihelpers.pxi":730 + * 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 = (__pyx_v_sliceobject->step == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":731 + * 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-2.2/src/lxml/apihelpers.pxi":732 + * if sliceobject.step is None: + * return 1 + * python._PyEval_SliceIndex(sliceobject.step, &step) # <<<<<<<<<<<<<< + * if step == 1: + * return 1 + */ + __pyx_t_4 = _PyEval_SliceIndex(__pyx_v_sliceobject->step, (&__pyx_v_step)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":733 + * 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-2.2/src/lxml/apihelpers.pxi":734 + * 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-2.2/src/lxml/apihelpers.pxi":735 + * 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-2.2/src/lxml/apihelpers.pxi":736 + * 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_WriteUnraisable("lxml.etree._isFullSlice"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":738 + * 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; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_collectChildren"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":740 + * 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[1]; __pyx_lineno = 740; __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-2.2/src/lxml/apihelpers.pxi":741 + * 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-2.2/src/lxml/apihelpers.pxi":742 + * 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-2.2/src/lxml/apihelpers.pxi":743 + * 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-2.2/src/lxml/apihelpers.pxi":744 + * 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-2.2/src/lxml/apihelpers.pxi":745 + * 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-2.2/src/lxml/apihelpers.pxi":746 + * 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 + */ + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_element->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":747 + * 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-2.2/src/lxml/apihelpers.pxi":748 + * 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_AddTraceback("lxml.etree._collectChildren"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":750 + * return result + * + * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index): # <<<<<<<<<<<<<< + * if index < 0: + * return _findChildBackwards(c_node, -index - 1) + */ + +static 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_SetupRefcountContext("_findChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":751 + * + * 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-2.2/src/lxml/apihelpers.pxi":752 + * 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-2.2/src/lxml/apihelpers.pxi":754 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":756 + * 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 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_SetupRefcountContext("_findChildForwards"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":761 + * 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-2.2/src/lxml/apihelpers.pxi":762 + * 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-2.2/src/lxml/apihelpers.pxi":763 + * 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-2.2/src/lxml/apihelpers.pxi":764 + * 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-2.2/src/lxml/apihelpers.pxi":765 + * 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-2.2/src/lxml/apihelpers.pxi":766 + * 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-2.2/src/lxml/apihelpers.pxi":767 + * 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-2.2/src/lxml/apihelpers.pxi":768 + * 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-2.2/src/lxml/apihelpers.pxi":769 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":771 + * 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 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_SetupRefcountContext("_findChildBackwards"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":777 + * 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-2.2/src/lxml/apihelpers.pxi":778 + * 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-2.2/src/lxml/apihelpers.pxi":779 + * 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-2.2/src/lxml/apihelpers.pxi":780 + * 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-2.2/src/lxml/apihelpers.pxi":781 + * 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-2.2/src/lxml/apihelpers.pxi":782 + * 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-2.2/src/lxml/apihelpers.pxi":783 + * 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-2.2/src/lxml/apihelpers.pxi":784 + * 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-2.2/src/lxml/apihelpers.pxi":785 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":787 + * 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 INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *__pyx_v_c_node) { + xmlNode *__pyx_r; + int __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":794 + * nodes. + * """ + * while c_node is not NULL: # <<<<<<<<<<<<<< + * if c_node.type == tree.XML_TEXT_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-2.2/src/lxml/apihelpers.pxi":795 + * """ + * while c_node is not NULL: + * if c_node.type == tree.XML_TEXT_NODE: # <<<<<<<<<<<<<< + * return c_node + * if c_node.type == tree.XML_CDATA_SECTION_NODE: + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_TEXT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":796 + * while c_node is not NULL: + * if c_node.type == tree.XML_TEXT_NODE: + * return c_node # <<<<<<<<<<<<<< + * if c_node.type == tree.XML_CDATA_SECTION_NODE: + * return c_node + */ + __pyx_r = __pyx_v_c_node; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":797 + * if c_node.type == tree.XML_TEXT_NODE: + * return c_node + * if c_node.type == tree.XML_CDATA_SECTION_NODE: # <<<<<<<<<<<<<< + * return c_node + * elif c_node.type == tree.XML_XINCLUDE_START or \ + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_CDATA_SECTION_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":798 + * return c_node + * if 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_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":799 + * if 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 + */ + if (!(__pyx_v_c_node->type == XML_XINCLUDE_START)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":800 + * 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); + } else { + __pyx_t_1 = (__pyx_v_c_node->type == XML_XINCLUDE_START); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":801 + * 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_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":803 + * c_node = c_node.next + * else: + * return NULL # <<<<<<<<<<<<<< + * return NULL + * + */ + __pyx_r = NULL; + goto __pyx_L0; + } + __pyx_L6:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":804 + * 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-2.2/src/lxml/apihelpers.pxi":806 + * return NULL + * + * cdef inline xmlNode* _nextElement(xmlNode* c_node): # <<<<<<<<<<<<<< + * u"""Given a node, find the next sibling that is an element. + * """ + */ + +static INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *__pyx_v_c_node) { + xmlNode *__pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_nextElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":809 + * 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-2.2/src/lxml/apihelpers.pxi":810 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":811 + * 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-2.2/src/lxml/apihelpers.pxi":812 + * 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-2.2/src/lxml/apihelpers.pxi":813 + * 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-2.2/src/lxml/apihelpers.pxi":814 + * 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-2.2/src/lxml/apihelpers.pxi":815 + * 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-2.2/src/lxml/apihelpers.pxi":816 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":818 + * return NULL + * + * cdef inline xmlNode* _previousElement(xmlNode* c_node): # <<<<<<<<<<<<<< + * u"""Given a node, find the next sibling that is an element. + * """ + */ + +static INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *__pyx_v_c_node) { + xmlNode *__pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_previousElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":821 + * 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-2.2/src/lxml/apihelpers.pxi":822 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":823 + * 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-2.2/src/lxml/apihelpers.pxi":824 + * 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-2.2/src/lxml/apihelpers.pxi":825 + * 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-2.2/src/lxml/apihelpers.pxi":826 + * 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-2.2/src/lxml/apihelpers.pxi":827 + * 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-2.2/src/lxml/apihelpers.pxi":828 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":830 + * 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 INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *__pyx_v_c_node) { + xmlNode *__pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_parentElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":832 + * 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 + */ + if (!(__pyx_v_c_node == NULL)) { + __pyx_t_1 = (!_isElement(__pyx_v_c_node)); + } else { + __pyx_t_1 = (__pyx_v_c_node == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":833 + * 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-2.2/src/lxml/apihelpers.pxi":834 + * 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-2.2/src/lxml/apihelpers.pxi":835 + * return NULL + * c_node = c_node.parent + * if c_node is NULL or not _isElement(c_node): # <<<<<<<<<<<<<< + * return NULL + * return c_node + */ + if (!(__pyx_v_c_node == NULL)) { + __pyx_t_1 = (!_isElement(__pyx_v_c_node)); + } else { + __pyx_t_1 = (__pyx_v_c_node == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":836 + * 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-2.2/src/lxml/apihelpers.pxi":837 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":839 + * 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 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; + __Pyx_SetupRefcountContext("_tagMatches"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":854 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":855 + * 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-2.2/src/lxml/apihelpers.pxi":856 + * 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-2.2/src/lxml/apihelpers.pxi":858 + * 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: + */ + if ((__pyx_v_c_name == NULL)) { + __pyx_t_1 = (__pyx_v_c_href == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_name == NULL); + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":859 + * # 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_1 = (__pyx_v_c_name == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":860 + * 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_1 = (__pyx_v_c_href == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":862 + * 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-2.2/src/lxml/apihelpers.pxi":864 + * 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-2.2/src/lxml/apihelpers.pxi":865 + * else: + * 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-2.2/src/lxml/apihelpers.pxi":866 + * 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-2.2/src/lxml/apihelpers.pxi":868 + * 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-2.2/src/lxml/apihelpers.pxi":869 + * 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_1 = (__pyx_v_c_href == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":870 + * 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_1 = (_getNs(__pyx_v_c_node) != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":871 + * 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-2.2/src/lxml/apihelpers.pxi":872 + * 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) + */ + if (!(__pyx_v_c_node->name == __pyx_v_c_name)) { + __pyx_t_1 = (strcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0); + } else { + __pyx_t_1 = (__pyx_v_c_node->name == __pyx_v_c_name); + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":873 + * 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: + */ + if (!(__pyx_v_c_node->name == __pyx_v_c_name)) { + __pyx_t_1 = (strcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0); + } else { + __pyx_t_1 = (__pyx_v_c_node->name == __pyx_v_c_name); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":874 + * 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-2.2/src/lxml/apihelpers.pxi":875 + * 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-2.2/src/lxml/apihelpers.pxi":876 + * 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-2.2/src/lxml/apihelpers.pxi":878 + * 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-2.2/src/lxml/apihelpers.pxi":880 + * return cstd.strcmp(c_node_href, c_href) == 0 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1: + */ + __pyx_r = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":882 + * return 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_SetupRefcountContext("_removeNode"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":887 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":888 + * 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-2.2/src/lxml/apihelpers.pxi":889 + * 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-2.2/src/lxml/apihelpers.pxi":890 + * 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-2.2/src/lxml/apihelpers.pxi":892 + * 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[1]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":893 + * # make namespaces absolute + * moveNodeToDocument(doc, c_node.doc, c_node) + * return 0 # <<<<<<<<<<<<<< + * + * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target): + */ + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":895 + * 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_SetupRefcountContext("_moveTail"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":899 + * # 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-2.2/src/lxml/apihelpers.pxi":900 + * # 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-2.2/src/lxml/apihelpers.pxi":901 + * 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-2.2/src/lxml/apihelpers.pxi":902 + * 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-2.2/src/lxml/apihelpers.pxi":903 + * 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-2.2/src/lxml/apihelpers.pxi":904 + * 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-2.2/src/lxml/apihelpers.pxi":905 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":907 + * 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_SetupRefcountContext("_copyTail"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":911 + * # 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-2.2/src/lxml/apihelpers.pxi":912 + * # 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-2.2/src/lxml/apihelpers.pxi":913 + * 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-2.2/src/lxml/apihelpers.pxi":914 + * 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-2.2/src/lxml/apihelpers.pxi":916 + * 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-2.2/src/lxml/apihelpers.pxi":917 + * 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-2.2/src/lxml/apihelpers.pxi":918 + * 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[1]; __pyx_lineno = 918; __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-2.2/src/lxml/apihelpers.pxi":919 + * 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-2.2/src/lxml/apihelpers.pxi":920 + * 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-2.2/src/lxml/apihelpers.pxi":921 + * 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-2.2/src/lxml/apihelpers.pxi":922 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":924 + * 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; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_copyNonElementSiblings"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":926 + * 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-2.2/src/lxml/apihelpers.pxi":927 + * 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) { + if ((__pyx_v_c_sibling->prev != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":928 + * 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 + */ + if (!(__pyx_v_c_sibling->prev->type == XML_PI_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":929 + * 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_1 = (__pyx_v_c_sibling->prev->type == XML_COMMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_sibling->prev->type == XML_PI_NODE); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_sibling->prev != NULL); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":930 + * (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-2.2/src/lxml/apihelpers.pxi":931 + * 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-2.2/src/lxml/apihelpers.pxi":932 + * 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-2.2/src/lxml/apihelpers.pxi":933 + * 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-2.2/src/lxml/apihelpers.pxi":934 + * 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_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 934; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":935 + * 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-2.2/src/lxml/apihelpers.pxi":936 + * 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-2.2/src/lxml/apihelpers.pxi":937 + * 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) { + if ((__pyx_v_c_sibling->next != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":938 + * 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 + */ + if (!(__pyx_v_c_sibling->next->type == XML_PI_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":939 + * 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_2 = (__pyx_v_c_sibling->next->type == XML_COMMENT_NODE); + } else { + __pyx_t_2 = (__pyx_v_c_sibling->next->type == XML_PI_NODE); + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = (__pyx_v_c_sibling->next != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":940 + * (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-2.2/src/lxml/apihelpers.pxi":941 + * 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-2.2/src/lxml/apihelpers.pxi":942 + * 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-2.2/src/lxml/apihelpers.pxi":943 + * 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_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 943; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":944 + * 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_3); + __Pyx_AddTraceback("lxml.etree._copyNonElementSiblings"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":946 + * 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; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_deleteSlice"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":954 + * 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-2.2/src/lxml/apihelpers.pxi":955 + * 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-2.2/src/lxml/apihelpers.pxi":956 + * 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-2.2/src/lxml/apihelpers.pxi":957 + * 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-2.2/src/lxml/apihelpers.pxi":959 + * 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-2.2/src/lxml/apihelpers.pxi":960 + * 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-2.2/src/lxml/apihelpers.pxi":962 + * 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-2.2/src/lxml/apihelpers.pxi":963 + * # 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-2.2/src/lxml/apihelpers.pxi":964 + * 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c < __pyx_v_count); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":965 + * 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_2 = __pyx_v_step; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":966 + * 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-2.2/src/lxml/apihelpers.pxi":967 + * 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_3 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":968 + * 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-2.2/src/lxml/apihelpers.pxi":969 + * _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-2.2/src/lxml/apihelpers.pxi":970 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":972 + * 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; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_SetupRefcountContext("_replaceSlice"); + __Pyx_INCREF(__pyx_v_elements); + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":987 + * 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 PYREX_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_step > 0))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":988 + * cdef _node_to_node_function next_element + * assert step > 0 + * if left_to_right: # <<<<<<<<<<<<<< + * next_element = _nextElement + * else: + */ + __pyx_t_1 = __pyx_v_left_to_right; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":989 + * 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-2.2/src/lxml/apihelpers.pxi":991 + * 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-2.2/src/lxml/apihelpers.pxi":993 + * next_element = _previousElement + * + * if not python.PyList_Check(elements) and \ # <<<<<<<<<<<<<< + * not python.PyTuple_Check(elements): + * elements = list(elements) + */ + if ((!PyList_Check(__pyx_v_elements))) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":994 + * + * if not python.PyList_Check(elements) and \ + * not python.PyTuple_Check(elements): # <<<<<<<<<<<<<< + * elements = list(elements) + * + */ + __pyx_t_1 = (!PyTuple_Check(__pyx_v_elements)); + } else { + __pyx_t_1 = (!PyList_Check(__pyx_v_elements)); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":995 + * if not python.PyList_Check(elements) and \ + * not python.PyTuple_Check(elements): + * elements = list(elements) # <<<<<<<<<<<<<< + * + * if step > 1: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_elements); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_elements); + __Pyx_GIVEREF(__pyx_v_elements); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyList_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __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_elements); + __pyx_v_elements = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":997 + * elements = list(elements) + * + * if step > 1: # <<<<<<<<<<<<<< + * # *replacing* children stepwise with list => check size! + * seqlength = len(elements) + */ + __pyx_t_1 = (__pyx_v_step > 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":999 + * 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_4 = PyObject_Length(__pyx_v_elements); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_seqlength = __pyx_t_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1000 + * # *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_1 = (__pyx_v_seqlength != __pyx_v_slicelength); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1002 + * 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_3 = PyInt_FromSsize_t(__pyx_v_seqlength); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_slicelength); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_248), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1004 + * 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1006 + * 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" + */ + __pyx_t_1 = __pyx_v_left_to_right; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1007 + * # 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_4 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1008 + * if left_to_right: + * for element in elements: + * assert element is not None, u"Node must not be None" # <<<<<<<<<<<<<< + * _appendChild(parent, element) + * else: + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_249)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1009 + * 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_6 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1011 + * _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_4 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1012 + * else: + * for element in elements: + * assert element is not None, u"Node must not be None" # <<<<<<<<<<<<<< + * _prependChild(parent, element) + * return 0 + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_250)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1013 + * for element in elements: + * assert element is not None, u"Node must not be None" + * _prependChild(parent, element) # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1014 + * 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-2.2/src/lxml/apihelpers.pxi":1017 + * + * # 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) + */ + __pyx_t_1 = __pyx_v_left_to_right; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1019 + * 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-2.2/src/lxml/apihelpers.pxi":1022 + * 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-2.2/src/lxml/apihelpers.pxi":1028 + * # 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-2.2/src/lxml/apihelpers.pxi":1029 + * # 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-2.2/src/lxml/apihelpers.pxi":1030 + * 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c < __pyx_v_slicelength); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1031 + * 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_4 = __pyx_v_step; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1032 + * 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-2.2/src/lxml/apihelpers.pxi":1033 + * 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_6 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_parent->_doc, __pyx_v_c_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1034 + * 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-2.2/src/lxml/apihelpers.pxi":1035 + * _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-2.2/src/lxml/apihelpers.pxi":1038 + * + * # make sure each element is inserted only once + * elements = iter(elements) # <<<<<<<<<<<<<< + * + * # find the first node right of the new insertion point + */ + __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_elements); + __pyx_v_elements = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1041 + * + * # 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) + */ + __pyx_t_1 = __pyx_v_left_to_right; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1042 + * # 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_1 = (__pyx_v_c_orig_neighbour != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1043 + * 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-2.2/src/lxml/apihelpers.pxi":1046 + * 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-2.2/src/lxml/apihelpers.pxi":1047 + * # 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_1 = (__pyx_v_c_orig_neighbour == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1050 + * # 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_4 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1051 + * # 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 PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_251)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1052 + * 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_6 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1053 + * 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-2.2/src/lxml/apihelpers.pxi":1054 + * _appendChild(parent, element) + * c_node = element._c_node + * if slicelength > 0: # <<<<<<<<<<<<<< + * slicelength = slicelength - 1 + * for i from 1 <= i < step: + */ + __pyx_t_1 = (__pyx_v_slicelength > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1055 + * 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-2.2/src/lxml/apihelpers.pxi":1056 + * if slicelength > 0: + * slicelength = slicelength - 1 + * for i from 1 <= i < step: # <<<<<<<<<<<<<< + * c_node = next_element(c_node) + * break + */ + __pyx_t_7 = __pyx_v_step; + for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1057 + * 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-2.2/src/lxml/apihelpers.pxi":1058 + * 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_2); __pyx_t_2 = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1060 + * break + * + * if left_to_right: # <<<<<<<<<<<<<< + * # adjust step size after removing slice as we are not stepping + * # over the newly inserted elements + */ + __pyx_t_1 = __pyx_v_left_to_right; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1063 + * # 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-2.2/src/lxml/apihelpers.pxi":1066 + * + * # 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_1 = (__pyx_v_c_node != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1067 + * # 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" + * # move element and tail over + */ + if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) { + __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1068 + * if c_node is not NULL: + * for element in elements: + * assert element is not None, u"Node must not be None" # <<<<<<<<<<<<<< + * # move element and tail over + * c_source_doc = element._c_node.doc + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_252)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1070 + * assert element is not None, u"Node must not be None" + * # 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-2.2/src/lxml/apihelpers.pxi":1071 + * # 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-2.2/src/lxml/apihelpers.pxi":1072 + * 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-2.2/src/lxml/apihelpers.pxi":1073 + * 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-2.2/src/lxml/apihelpers.pxi":1076 + * + * # integrate element into new document + * moveNodeToDocument(parent._doc, c_source_doc, element._c_node) # <<<<<<<<<<<<<< + * + * # stop at the end of the slice + */ + __pyx_t_6 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_parent->_doc, __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1079 + * + * # stop at the end of the slice + * if slicelength > 0: # <<<<<<<<<<<<<< + * slicelength = slicelength - 1 + * for i from 0 <= i < step: + */ + __pyx_t_1 = (__pyx_v_slicelength > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1080 + * # 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-2.2/src/lxml/apihelpers.pxi":1081 + * 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_7 = __pyx_v_step; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1082 + * 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-2.2/src/lxml/apihelpers.pxi":1083 + * for i from 0 <= i < step: + * c_node = next_element(c_node) + * if c_node is NULL: # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1084 + * 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-2.2/src/lxml/apihelpers.pxi":1087 + * else: + * # everything inserted + * return 0 # <<<<<<<<<<<<<< + * + * # append the remaining elements at the respective end + */ + __pyx_r = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + } + __pyx_L28_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L26; + } + __pyx_L26:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1090 + * + * # 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" + */ + __pyx_t_1 = __pyx_v_left_to_right; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1091 + * # 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" + * _appendChild(parent, element) + */ + if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) { + __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1092 + * if left_to_right: + * for element in elements: + * assert element is not None, u"Node must not be None" # <<<<<<<<<<<<<< + * _appendChild(parent, element) + * else: + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_253)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1093 + * 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_6 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L33; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1095 + * _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_4 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1096 + * else: + * for element in elements: + * assert element is not None, u"Node must not be None" # <<<<<<<<<<<<<< + * _prependChild(parent, element) + * + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_254)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1097 + * for element in elements: + * assert element is not None, u"Node must not be None" + * _prependChild(parent, element) # <<<<<<<<<<<<<< + * + * return 0 + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L33:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1099 + * _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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.etree._replaceSlice"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF(__pyx_v_elements); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1101 + * 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; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_appendChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1107 + * cdef xmlNode* c_node + * cdef xmlDoc* c_source_doc + * c_node = child._c_node # <<<<<<<<<<<<<< + * 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-2.2/src/lxml/apihelpers.pxi":1108 + * cdef xmlDoc* c_source_doc + * c_node = child._c_node + * 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-2.2/src/lxml/apihelpers.pxi":1110 + * 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-2.2/src/lxml/apihelpers.pxi":1112 + * 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-2.2/src/lxml/apihelpers.pxi":1113 + * # 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-2.2/src/lxml/apihelpers.pxi":1114 + * 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-2.2/src/lxml/apihelpers.pxi":1117 + * # 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 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_parent->_doc, __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._appendChild"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1119 + * 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; + int __pyx_t_2; + __Pyx_SetupRefcountContext("_prependChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1126 + * cdef xmlNode* c_node + * cdef xmlDoc* c_source_doc + * c_node = child._c_node # <<<<<<<<<<<<<< + * 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-2.2/src/lxml/apihelpers.pxi":1127 + * cdef xmlDoc* c_source_doc + * c_node = child._c_node + * 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-2.2/src/lxml/apihelpers.pxi":1129 + * 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-2.2/src/lxml/apihelpers.pxi":1131 + * 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-2.2/src/lxml/apihelpers.pxi":1132 + * # 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-2.2/src/lxml/apihelpers.pxi":1133 + * 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-2.2/src/lxml/apihelpers.pxi":1134 + * 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-2.2/src/lxml/apihelpers.pxi":1136 + * 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-2.2/src/lxml/apihelpers.pxi":1137 + * 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-2.2/src/lxml/apihelpers.pxi":1140 + * # 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 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_parent->_doc, __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._prependChild"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1142 + * 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_next; + xmlNode *__pyx_v_c_node; + xmlDoc *__pyx_v_c_source_doc; + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_appendSibling"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1148 + * cdef xmlNode* c_node + * cdef xmlDoc* c_source_doc + * c_node = sibling._c_node # <<<<<<<<<<<<<< + * c_source_doc = c_node.doc + * # store possible text node + */ + __pyx_v_c_node = __pyx_v_sibling->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1149 + * cdef xmlDoc* c_source_doc + * c_node = sibling._c_node + * 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-2.2/src/lxml/apihelpers.pxi":1151 + * c_source_doc = c_node.doc + * # 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-2.2/src/lxml/apihelpers.pxi":1153 + * 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-2.2/src/lxml/apihelpers.pxi":1154 + * # 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-2.2/src/lxml/apihelpers.pxi":1157 + * # 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 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_element->_doc, __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._appendSibling"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1159 + * 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_next; + xmlNode *__pyx_v_c_node; + xmlDoc *__pyx_v_c_source_doc; + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_prependSibling"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1165 + * cdef xmlNode* c_node + * cdef xmlDoc* c_source_doc + * c_node = sibling._c_node # <<<<<<<<<<<<<< + * c_source_doc = c_node.doc + * # store possible text node + */ + __pyx_v_c_node = __pyx_v_sibling->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1166 + * cdef xmlDoc* c_source_doc + * c_node = sibling._c_node + * 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-2.2/src/lxml/apihelpers.pxi":1168 + * c_source_doc = c_node.doc + * # 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-2.2/src/lxml/apihelpers.pxi":1170 + * 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-2.2/src/lxml/apihelpers.pxi":1171 + * # 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-2.2/src/lxml/apihelpers.pxi":1174 + * # 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 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_element->_doc, __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._prependSibling"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1176 + * moveNodeToDocument(element._doc, c_source_doc, c_node) + * + * cdef inline int isutf8(char* s): # <<<<<<<<<<<<<< + * cdef char c + * c = s[0] + */ + +static 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_SetupRefcountContext("isutf8"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1178 + * cdef inline int isutf8(char* s): + * cdef char c + * c = s[0] # <<<<<<<<<<<<<< + * while c != c'\0': + * if c & 0x80: + */ + __pyx_v_c = (__pyx_v_s[0]); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1179 + * cdef char c + * 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-2.2/src/lxml/apihelpers.pxi":1180 + * 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-2.2/src/lxml/apihelpers.pxi":1181 + * 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-2.2/src/lxml/apihelpers.pxi":1182 + * 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-2.2/src/lxml/apihelpers.pxi":1183 + * return 1 + * s = s + 1 + * c = s[0] # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_v_c = (__pyx_v_s[0]); + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1184 + * s = s + 1 + * c = s[0] + * return 0 # <<<<<<<<<<<<<< + * + * cdef int check_string_utf8(pystring): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1186 + * return 0 + * + * cdef int check_string_utf8(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; + int __pyx_t_1; + long __pyx_t_2; + __Pyx_SetupRefcountContext("check_string_utf8"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1195 + * cdef char c + * cdef bint is_non_ascii + * s = _cstr(pystring) # <<<<<<<<<<<<<< + * c_end = s + python.PyString_GET_SIZE(pystring) + * is_non_ascii = 0 + */ + __pyx_v_s = PyString_AS_STRING(__pyx_v_pystring); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1196 + * cdef bint is_non_ascii + * s = _cstr(pystring) + * c_end = s + python.PyString_GET_SIZE(pystring) # <<<<<<<<<<<<<< + * is_non_ascii = 0 + * while s < c_end: + */ + __pyx_v_c_end = (__pyx_v_s + PyString_GET_SIZE(__pyx_v_pystring)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1197 + * s = _cstr(pystring) + * c_end = s + python.PyString_GET_SIZE(pystring) + * is_non_ascii = 0 # <<<<<<<<<<<<<< + * while s < c_end: + * if s[0] & 0x80: + */ + __pyx_v_is_non_ascii = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1198 + * c_end = s + python.PyString_GET_SIZE(pystring) + * is_non_ascii = 0 + * while s < c_end: # <<<<<<<<<<<<<< + * if s[0] & 0x80: + * # skip the entire multi byte sequence + */ + while (1) { + __pyx_t_1 = (__pyx_v_s < __pyx_v_c_end); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1199 + * is_non_ascii = 0 + * while s < c_end: + * if s[0] & 0x80: # <<<<<<<<<<<<<< + * # skip the entire multi byte sequence + * while s[0] & 0x80: + */ + __pyx_t_2 = ((__pyx_v_s[0]) & 0x80); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1201 + * if s[0] & 0x80: + * # skip the entire multi byte sequence + * while s[0] & 0x80: # <<<<<<<<<<<<<< + * s += 1 + * is_non_ascii = 1 + */ + while (1) { + __pyx_t_2 = ((__pyx_v_s[0]) & 0x80); + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1202 + * # skip the entire multi byte sequence + * while s[0] & 0x80: + * s += 1 # <<<<<<<<<<<<<< + * is_non_ascii = 1 + * elif not tree.xmlIsChar_ch(s[0]): + */ + __pyx_v_s += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1203 + * while s[0] & 0x80: + * s += 1 + * is_non_ascii = 1 # <<<<<<<<<<<<<< + * elif not tree.xmlIsChar_ch(s[0]): + * return -1 # invalid! + */ + __pyx_v_is_non_ascii = 1; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1204 + * s += 1 + * is_non_ascii = 1 + * elif not tree.xmlIsChar_ch(s[0]): # <<<<<<<<<<<<<< + * return -1 # invalid! + * s += 1 + */ + __pyx_t_1 = (!xmlIsChar_ch((__pyx_v_s[0]))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1205 + * is_non_ascii = 1 + * elif not tree.xmlIsChar_ch(s[0]): + * return -1 # invalid! # <<<<<<<<<<<<<< + * s += 1 + * return is_non_ascii + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1206 + * elif not tree.xmlIsChar_ch(s[0]): + * return -1 # invalid! + * s += 1 # <<<<<<<<<<<<<< + * return is_non_ascii + * + */ + __pyx_v_s += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1207 + * 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; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1209 + * 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; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + __Pyx_SetupRefcountContext("funicode"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1213 + * cdef char* spos + * cdef bint is_non_ascii + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * slen = cstd.strlen(s) + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1214 + * cdef bint is_non_ascii + * if python.IS_PYTHON3: + * slen = cstd.strlen(s) # <<<<<<<<<<<<<< + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + * spos = s + */ + __pyx_v_slen = strlen(__pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1215 + * if python.IS_PYTHON3: + * slen = cstd.strlen(s) + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) # <<<<<<<<<<<<<< + * spos = s + * is_non_ascii = 0 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_s, __pyx_v_slen, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1215; __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-2.2/src/lxml/apihelpers.pxi":1216 + * slen = cstd.strlen(s) + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + * spos = s # <<<<<<<<<<<<<< + * is_non_ascii = 0 + * while spos[0] != c'\0': + */ + __pyx_v_spos = __pyx_v_s; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1217 + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + * 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-2.2/src/lxml/apihelpers.pxi":1218 + * spos = s + * is_non_ascii = 0 + * while spos[0] != c'\0': # <<<<<<<<<<<<<< + * if spos[0] & 0x80: + * is_non_ascii = 1 + */ + while (1) { + __pyx_t_1 = ((__pyx_v_spos[0]) != '\x00'); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1219 + * 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-2.2/src/lxml/apihelpers.pxi":1220 + * 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-2.2/src/lxml/apihelpers.pxi":1221 + * 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-2.2/src/lxml/apihelpers.pxi":1222 + * is_non_ascii = 1 + * break + * spos += 1 # <<<<<<<<<<<<<< + * while spos[0] != c'\0': + * spos += 1 + */ + __pyx_v_spos += 1; + } + __pyx_L5_break:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1223 + * break + * spos += 1 + * while spos[0] != c'\0': # <<<<<<<<<<<<<< + * spos += 1 + * slen = spos - s + */ + while (1) { + __pyx_t_1 = ((__pyx_v_spos[0]) != '\x00'); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1224 + * spos += 1 + * while spos[0] != c'\0': + * spos += 1 # <<<<<<<<<<<<<< + * slen = spos - s + * if is_non_ascii: + */ + __pyx_v_spos += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1225 + * while spos[0] != c'\0': + * spos += 1 + * slen = spos - s # <<<<<<<<<<<<<< + * if is_non_ascii: + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + */ + __pyx_v_slen = (__pyx_v_spos - __pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1226 + * spos += 1 + * slen = spos - s + * if is_non_ascii: # <<<<<<<<<<<<<< + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + * return python.PyString_FromStringAndSize(s, slen) + */ + __pyx_t_1 = __pyx_v_is_non_ascii; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1227 + * slen = spos - s + * if is_non_ascii: + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) # <<<<<<<<<<<<<< + * return python.PyString_FromStringAndSize(s, slen) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_s, __pyx_v_slen, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1227; __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_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1228 + * if is_non_ascii: + * return python.PyUnicode_DecodeUTF8(s, slen, NULL) + * return python.PyString_FromStringAndSize(s, slen) # <<<<<<<<<<<<<< + * + * cdef object _utf8(object s): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_s, __pyx_v_slen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1228; __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.funicode"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1230 + * return python.PyString_FromStringAndSize(s, slen) + * + * cdef object _utf8(object s): # <<<<<<<<<<<<<< + * cdef int invalid + * if python.PyString_CheckExact(s): + */ + +static PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *__pyx_v_s) { + int __pyx_v_invalid; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_utf8"); + __Pyx_INCREF(__pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1232 + * cdef object _utf8(object s): + * cdef int invalid + * if python.PyString_CheckExact(s): # <<<<<<<<<<<<<< + * invalid = check_string_utf8(s) + * elif python.PyUnicode_CheckExact(s) or python.PyUnicode_Check(s): + */ + __pyx_t_1 = PyString_CheckExact(__pyx_v_s); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1233 + * cdef int invalid + * if python.PyString_CheckExact(s): + * invalid = check_string_utf8(s) # <<<<<<<<<<<<<< + * elif python.PyUnicode_CheckExact(s) or python.PyUnicode_Check(s): + * s = python.PyUnicode_AsUTF8String(s) + */ + __pyx_v_invalid = __pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_s); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1234 + * if python.PyString_CheckExact(s): + * invalid = check_string_utf8(s) + * elif python.PyUnicode_CheckExact(s) or python.PyUnicode_Check(s): # <<<<<<<<<<<<<< + * s = python.PyUnicode_AsUTF8String(s) + * invalid = check_string_utf8(s) == -1 + */ + if (!PyUnicode_CheckExact(__pyx_v_s)) { + __pyx_t_1 = PyUnicode_Check(__pyx_v_s); + } else { + __pyx_t_1 = PyUnicode_CheckExact(__pyx_v_s); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1235 + * invalid = check_string_utf8(s) + * elif python.PyUnicode_CheckExact(s) or python.PyUnicode_Check(s): + * s = python.PyUnicode_AsUTF8String(s) # <<<<<<<<<<<<<< + * invalid = check_string_utf8(s) == -1 + * elif python.PyString_Check(s): + */ + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/apihelpers.pxi":1236 + * elif python.PyUnicode_CheckExact(s) or python.PyUnicode_Check(s): + * s = python.PyUnicode_AsUTF8String(s) + * invalid = check_string_utf8(s) == -1 # <<<<<<<<<<<<<< + * elif python.PyString_Check(s): + * invalid = check_string_utf8(s) + */ + __pyx_v_invalid = (__pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_s) == -1); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1237 + * s = python.PyUnicode_AsUTF8String(s) + * invalid = check_string_utf8(s) == -1 + * elif python.PyString_Check(s): # <<<<<<<<<<<<<< + * invalid = check_string_utf8(s) + * else: + */ + __pyx_t_1 = PyString_Check(__pyx_v_s); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1238 + * invalid = check_string_utf8(s) == -1 + * elif python.PyString_Check(s): + * invalid = check_string_utf8(s) # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"Argument must be string or unicode." + */ + __pyx_v_invalid = __pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_s); + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1240 + * invalid = check_string_utf8(s) + * else: + * raise TypeError, u"Argument must be string or unicode." # <<<<<<<<<<<<<< + * if invalid: + * raise ValueError, \ + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_255), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1241 + * else: + * raise TypeError, u"Argument must be string or unicode." + * if invalid: # <<<<<<<<<<<<<< + * raise ValueError, \ + * u"All strings must be XML compatible: Unicode or ASCII, no NULL bytes" + */ + __pyx_t_3 = __pyx_v_invalid; + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1243 + * if invalid: + * raise ValueError, \ + * u"All strings must be XML compatible: Unicode or ASCII, no NULL bytes" # <<<<<<<<<<<<<< + * return s + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_256), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1244 + * raise ValueError, \ + * u"All strings must be XML compatible: Unicode or ASCII, no NULL bytes" + * return s # <<<<<<<<<<<<<< + * + * cdef bint _isFilePath(char* c_path): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_s); + __pyx_r = __pyx_v_s; + 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._utf8"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1246 + * return s + * + * 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; + __Pyx_SetupRefcountContext("_isFilePath"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1250 + * 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-2.2/src/lxml/apihelpers.pxi":1251 + * # 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-2.2/src/lxml/apihelpers.pxi":1253 + * 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':': + */ + if (((__pyx_v_c_path[0]) >= 'a')) { + __pyx_t_1 = ((__pyx_v_c_path[0]) <= 'z'); + } else { + __pyx_t_1 = ((__pyx_v_c_path[0]) >= 'a'); + } + if (!__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1254 + * # 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 + */ + if (((__pyx_v_c_path[0]) >= 'A')) { + __pyx_t_2 = ((__pyx_v_c_path[0]) <= 'Z'); + } else { + __pyx_t_2 = ((__pyx_v_c_path[0]) >= 'A'); + } + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1255 + * 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_3 = ((__pyx_v_c_path[1]) == ':'); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1256 + * (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-2.2/src/lxml/apihelpers.pxi":1258 + * 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_3 = ((__pyx_v_c_path[0]) != '\x00'); + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1259 + * # 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-2.2/src/lxml/apihelpers.pxi":1260 + * while c_path[0] != c'\0': + * c = c_path[0] + * if c == c':': # <<<<<<<<<<<<<< + * return 0 + * elif c == c'/': + */ + switch (__pyx_v_c) { + case ':': + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1261 + * 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-2.2/src/lxml/apihelpers.pxi":1262 + * if c == c':': + * return 0 + * elif c == c'/': # <<<<<<<<<<<<<< + * return 1 + * elif c == c'\\': + */ + case '/': + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1263 + * 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-2.2/src/lxml/apihelpers.pxi":1264 + * elif c == c'/': + * return 1 + * elif c == c'\\': # <<<<<<<<<<<<<< + * return 1 + * c_path += 1 + */ + case '\\': + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1265 + * 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-2.2/src/lxml/apihelpers.pxi":1266 + * elif c == c'\\': + * return 1 + * c_path += 1 # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_v_c_path += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1267 + * return 1 + * c_path += 1 + * return 1 # <<<<<<<<<<<<<< + * + * cdef object _encodeFilename(object filename): + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1269 + * 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_1; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + char *__pyx_t_3; + __Pyx_SetupRefcountContext("_encodeFilename"); + __pyx_v_filename8 = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1272 + * u"""Make sure a filename is 8-bit encoded (or None). + * """ + * if filename is None: # <<<<<<<<<<<<<< + * return None + * elif python.PyString_Check(filename): + */ + __pyx_t_1 = (__pyx_v_filename == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1273 + * """ + * if filename is None: + * return None # <<<<<<<<<<<<<< + * elif python.PyString_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-2.2/src/lxml/apihelpers.pxi":1274 + * if filename is None: + * return None + * elif python.PyString_Check(filename): # <<<<<<<<<<<<<< + * return filename + * elif python.PyUnicode_Check(filename): + */ + __pyx_t_1 = PyString_Check(__pyx_v_filename); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1275 + * return None + * elif python.PyString_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-2.2/src/lxml/apihelpers.pxi":1276 + * elif python.PyString_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-2.2/src/lxml/apihelpers.pxi":1278 + * elif python.PyUnicode_Check(filename): + * filename8 = python.PyUnicode_AsEncodedString( + * filename, 'UTF-8', NULL) # <<<<<<<<<<<<<< + * if _isFilePath(filename8): + * try: + */ + __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_k_257, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_filename8); + __pyx_v_filename8 = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1279 + * filename8 = python.PyUnicode_AsEncodedString( + * filename, 'UTF-8', NULL) + * if _isFilePath(filename8): # <<<<<<<<<<<<<< + * try: + * return python.PyUnicode_AsEncodedString( + */ + __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_filename8); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1279; __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-2.2/src/lxml/apihelpers.pxi":1280 + * 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-2.2/src/lxml/apihelpers.pxi":1281 + * 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-2.2/src/lxml/apihelpers.pxi":1282 + * try: + * return python.PyUnicode_AsEncodedString( + * filename, _C_FILENAME_ENCODING, NULL) # <<<<<<<<<<<<<< + * except UnicodeEncodeError: + * pass + */ + __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1281; __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_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_L0; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1283 + * return python.PyUnicode_AsEncodedString( + * filename, _C_FILENAME_ENCODING, NULL) + * except UnicodeEncodeError: # <<<<<<<<<<<<<< + * pass + * return filename8 + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeEncodeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L6_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/apihelpers.pxi":1285 + * except UnicodeEncodeError: + * pass + * return filename8 # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"Argument must be string or unicode." + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_filename8); + __pyx_r = __pyx_v_filename8; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1287 + * 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_258), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1287; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1289 + * 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_1; + 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_SetupRefcountContext("_decodeFilename"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1292 + * 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-2.2/src/lxml/apihelpers.pxi":1293 + * """ + * 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-2.2/src/lxml/apihelpers.pxi":1294 + * 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-2.2/src/lxml/apihelpers.pxi":1295 + * 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-2.2/src/lxml/apihelpers.pxi":1296 + * try: + * return python.PyUnicode_Decode( + * c_path, c_len, _C_FILENAME_ENCODING, NULL) # <<<<<<<<<<<<<< + * except UnicodeDecodeError: + * pass + */ + __pyx_t_2 = 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[1]; __pyx_lineno = 1295; __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_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_L0; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1297 + * return python.PyUnicode_Decode( + * c_path, c_len, _C_FILENAME_ENCODING, NULL) + * except UnicodeDecodeError: # <<<<<<<<<<<<<< + * pass + * try: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L5_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/apihelpers.pxi":1299 + * except UnicodeDecodeError: + * pass + * try: # <<<<<<<<<<<<<< + * return python.PyUnicode_DecodeUTF8(c_path, c_len, NULL) + * 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-2.2/src/lxml/apihelpers.pxi":1300 + * pass + * try: + * return python.PyUnicode_DecodeUTF8(c_path, c_len, NULL) # <<<<<<<<<<<<<< + * except UnicodeDecodeError: + * # this is a stupid fallback, but it might still work... + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_c_path, __pyx_v_c_len, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __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_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_L0; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1301 + * try: + * return python.PyUnicode_DecodeUTF8(c_path, c_len, NULL) + * except UnicodeDecodeError: # <<<<<<<<<<<<<< + * # this is a stupid fallback, but it might still work... + * return python.PyUnicode_DecodeLatin1(c_path, c_len, 'replace') + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree._decodeFilename"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1303 + * except UnicodeDecodeError: + * # this is a stupid fallback, but it might still work... + * return python.PyUnicode_DecodeLatin1(c_path, c_len, 'replace') # <<<<<<<<<<<<<< + * + * cdef object _encodeFilenameUTF8(object filename): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyUnicode_DecodeLatin1(__pyx_v_c_path, __pyx_v_c_len, __pyx_k_259); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __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_L15_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_L13_exception_handled; + } + __pyx_L14_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.etree._decodeFilename"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1305 + * return python.PyUnicode_DecodeLatin1(c_path, c_len, '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_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_encodeFilenameUTF8"); + __Pyx_INCREF(__pyx_v_filename); + __pyx_v_decode_exc = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1310 + * """ + * cdef char* c_filename + * if filename is None: # <<<<<<<<<<<<<< + * return None + * elif python.PyString_Check(filename): + */ + __pyx_t_1 = (__pyx_v_filename == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1311 + * cdef char* c_filename + * if filename is None: + * return None # <<<<<<<<<<<<<< + * elif python.PyString_Check(filename): + * if not check_string_utf8(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-2.2/src/lxml/apihelpers.pxi":1312 + * if filename is None: + * return None + * elif python.PyString_Check(filename): # <<<<<<<<<<<<<< + * if not check_string_utf8(filename): + * # plain ASCII! + */ + __pyx_t_1 = PyString_Check(__pyx_v_filename); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1313 + * return None + * elif python.PyString_Check(filename): + * if not check_string_utf8(filename): # <<<<<<<<<<<<<< + * # plain ASCII! + * return filename + */ + __pyx_t_1 = (!__pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_filename)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1315 + * if not check_string_utf8(filename): + * # plain ASCII! + * return filename # <<<<<<<<<<<<<< + * c_filename = _cstr(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-2.2/src/lxml/apihelpers.pxi":1316 + * # plain ASCII! + * return filename + * c_filename = _cstr(filename) # <<<<<<<<<<<<<< + * try: + * # try to decode with default encoding + */ + __pyx_v_c_filename = PyString_AS_STRING(__pyx_v_filename); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1317 + * return filename + * c_filename = _cstr(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-2.2/src/lxml/apihelpers.pxi":1321 + * filename = python.PyUnicode_Decode( + * c_filename, python.PyString_GET_SIZE(filename), + * _C_FILENAME_ENCODING, NULL) # <<<<<<<<<<<<<< + * except UnicodeDecodeError, decode_exc: + * try: + */ + __pyx_t_2 = PyUnicode_Decode(__pyx_v_c_filename, PyString_GET_SIZE(__pyx_v_filename), __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_filename); + __pyx_v_filename = __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-2.2/src/lxml/apihelpers.pxi":1322 + * c_filename, python.PyString_GET_SIZE(filename), + * _C_FILENAME_ENCODING, NULL) + * except UnicodeDecodeError, decode_exc: # <<<<<<<<<<<<<< + * try: + * # try if it's UTF-8 + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8"); + if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_decode_exc); + __pyx_v_decode_exc = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1323 + * _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-2.2/src/lxml/apihelpers.pxi":1326 + * # try if it's UTF-8 + * filename = python.PyUnicode_DecodeUTF8( + * c_filename, python.PyString_GET_SIZE(filename), NULL) # <<<<<<<<<<<<<< + * except UnicodeDecodeError: + * raise decode_exc # otherwise re-raise original exception + */ + __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_c_filename, PyString_GET_SIZE(__pyx_v_filename), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L15_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_filename); + __pyx_v_filename = __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_L22_try_end; + __pyx_L15_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1327 + * filename = python.PyUnicode_DecodeUTF8( + * c_filename, python.PyString_GET_SIZE(filename), NULL) + * except UnicodeDecodeError: # <<<<<<<<<<<<<< + * raise decode_exc # otherwise re-raise original exception + * if python.PyUnicode_Check(filename): + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1328 + * c_filename, python.PyString_GET_SIZE(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[1]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;} + __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_L16_exception_handled; + } + __pyx_L17_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/apihelpers.pxi":1329 + * 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-2.2/src/lxml/apihelpers.pxi":1330 + * 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_4 = PyUnicode_AsUTF8String(__pyx_v_filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1330; __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; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1332 + * return python.PyUnicode_AsUTF8String(filename) + * else: + * raise TypeError, u"Argument must be string or unicode." # <<<<<<<<<<<<<< + * + * cdef _getNsTag(tag): + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_260), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1332; __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_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1334 + * raise TypeError, u"Argument must be string or unicode." + * + * cdef _getNsTag(tag): # <<<<<<<<<<<<<< + * u"""Given a tag, find namespace URI and tag name. + * Return None for NS uri if no namespace URI available. + */ + +static PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *__pyx_v_tag) { + 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; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_getNsTag"); + __Pyx_INCREF(__pyx_v_tag); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1343 + * cdef Py_ssize_t nslen + * # _isString() is much faster than isinstance() + * if not _isString(tag) and isinstance(tag, QName): # <<<<<<<<<<<<<< + * tag = (tag).text + * tag = _utf8(tag) + */ + if ((!_isString(__pyx_v_tag))) { + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_tag, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (!_isString(__pyx_v_tag)); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1344 + * # _isString() is much faster than isinstance() + * if not _isString(tag) and isinstance(tag, QName): + * tag = (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-2.2/src/lxml/apihelpers.pxi":1345 + * if not _isString(tag) and isinstance(tag, QName): + * tag = (tag).text + * tag = _utf8(tag) # <<<<<<<<<<<<<< + * c_tag = _cstr(tag) + * if c_tag[0] == c'{': + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/apihelpers.pxi":1346 + * tag = (tag).text + * tag = _utf8(tag) + * c_tag = _cstr(tag) # <<<<<<<<<<<<<< + * if c_tag[0] == c'{': + * c_tag = c_tag + 1 + */ + __pyx_v_c_tag = PyString_AS_STRING(__pyx_v_tag); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1347 + * tag = _utf8(tag) + * c_tag = _cstr(tag) + * if c_tag[0] == c'{': # <<<<<<<<<<<<<< + * c_tag = c_tag + 1 + * c_ns_end = cstd.strchr(c_tag, c'}') + */ + __pyx_t_2 = ((__pyx_v_c_tag[0]) == '{'); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1348 + * c_tag = _cstr(tag) + * if c_tag[0] == c'{': + * c_tag = 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-2.2/src/lxml/apihelpers.pxi":1349 + * if c_tag[0] == c'{': + * c_tag = 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-2.2/src/lxml/apihelpers.pxi":1350 + * c_tag = 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_2 = (__pyx_v_c_ns_end == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1351 + * 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.PyString_GET_SIZE(tag) - nslen - 2 + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_261), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1352 + * if c_ns_end is NULL: + * raise ValueError, u"Invalid tag name" + * nslen = c_ns_end - c_tag # <<<<<<<<<<<<<< + * taglen = python.PyString_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-2.2/src/lxml/apihelpers.pxi":1353 + * raise ValueError, u"Invalid tag name" + * nslen = c_ns_end - c_tag + * taglen = python.PyString_GET_SIZE(tag) - nslen - 2 # <<<<<<<<<<<<<< + * if taglen == 0: + * raise ValueError, u"Empty tag name" + */ + __pyx_v_taglen = ((PyString_GET_SIZE(__pyx_v_tag) - __pyx_v_nslen) - 2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1354 + * nslen = c_ns_end - c_tag + * taglen = python.PyString_GET_SIZE(tag) - nslen - 2 + * if taglen == 0: # <<<<<<<<<<<<<< + * raise ValueError, u"Empty tag name" + * if nslen > 0: + */ + __pyx_t_2 = (__pyx_v_taglen == 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1355 + * taglen = python.PyString_GET_SIZE(tag) - nslen - 2 + * if taglen == 0: + * raise ValueError, u"Empty tag name" # <<<<<<<<<<<<<< + * if nslen > 0: + * ns = python.PyString_FromStringAndSize(c_tag, nslen) + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_262), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1356 + * if taglen == 0: + * raise ValueError, u"Empty tag name" + * if nslen > 0: # <<<<<<<<<<<<<< + * ns = python.PyString_FromStringAndSize(c_tag, nslen) + * tag = python.PyString_FromStringAndSize(c_ns_end+1, taglen) + */ + __pyx_t_2 = (__pyx_v_nslen > 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1357 + * raise ValueError, u"Empty tag name" + * if nslen > 0: + * ns = python.PyString_FromStringAndSize(c_tag, nslen) # <<<<<<<<<<<<<< + * tag = python.PyString_FromStringAndSize(c_ns_end+1, taglen) + * elif python.PyString_GET_SIZE(tag) == 0: + */ + __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_c_tag, __pyx_v_nslen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1358 + * if nslen > 0: + * ns = python.PyString_FromStringAndSize(c_tag, nslen) + * tag = python.PyString_FromStringAndSize(c_ns_end+1, taglen) # <<<<<<<<<<<<<< + * elif python.PyString_GET_SIZE(tag) == 0: + * raise ValueError, u"Empty tag name" + */ + __pyx_t_3 = PyString_FromStringAndSize((__pyx_v_c_ns_end + 1), __pyx_v_taglen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L4; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1359 + * ns = python.PyString_FromStringAndSize(c_tag, nslen) + * tag = python.PyString_FromStringAndSize(c_ns_end+1, taglen) + * elif python.PyString_GET_SIZE(tag) == 0: # <<<<<<<<<<<<<< + * raise ValueError, u"Empty tag name" + * return ns, tag + */ + __pyx_t_2 = (PyString_GET_SIZE(__pyx_v_tag) == 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1360 + * tag = python.PyString_FromStringAndSize(c_ns_end+1, taglen) + * elif python.PyString_GET_SIZE(tag) == 0: + * raise ValueError, u"Empty tag name" # <<<<<<<<<<<<<< + * return ns, tag + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_263), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1361 + * elif python.PyString_GET_SIZE(tag) == 0: + * raise ValueError, u"Empty tag name" + * return ns, tag # <<<<<<<<<<<<<< + * + * cdef inline int _pyXmlNameIsValid(name_utf8): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_ns); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ns); + __Pyx_GIVEREF(__pyx_v_ns); + __Pyx_INCREF(__pyx_v_tag); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag); + __Pyx_GIVEREF(__pyx_v_tag); + __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_3); + __Pyx_AddTraceback("lxml.etree._getNsTag"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1363 + * return ns, tag + * + * cdef inline int _pyXmlNameIsValid(name_utf8): # <<<<<<<<<<<<<< + * return _xmlNameIsValid(_cstr(name_utf8)) + * + */ + +static INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *__pyx_v_name_utf8) { + int __pyx_r; + __Pyx_SetupRefcountContext("_pyXmlNameIsValid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1364 + * + * cdef inline int _pyXmlNameIsValid(name_utf8): + * return _xmlNameIsValid(_cstr(name_utf8)) # <<<<<<<<<<<<<< + * + * cdef inline int _pyHtmlNameIsValid(name_utf8): + */ + __pyx_r = __pyx_f_4lxml_5etree__xmlNameIsValid(PyString_AS_STRING(__pyx_v_name_utf8)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1366 + * return _xmlNameIsValid(_cstr(name_utf8)) + * + * cdef inline int _pyHtmlNameIsValid(name_utf8): # <<<<<<<<<<<<<< + * return _htmlNameIsValid(_cstr(name_utf8)) + * + */ + +static INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *__pyx_v_name_utf8) { + int __pyx_r; + __Pyx_SetupRefcountContext("_pyHtmlNameIsValid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1367 + * + * 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(PyString_AS_STRING(__pyx_v_name_utf8)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1369 + * return _htmlNameIsValid(_cstr(name_utf8)) + * + * cdef inline int _xmlNameIsValid(char* c_name): # <<<<<<<<<<<<<< + * return tree.xmlValidateNCName(c_name, 0) == 0 + * + */ + +static INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(char *__pyx_v_c_name) { + int __pyx_r; + __Pyx_SetupRefcountContext("_xmlNameIsValid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1370 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1372 + * 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; + __Pyx_SetupRefcountContext("_htmlNameIsValid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1374 + * 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': + */ + if (!(__pyx_v_c_name == NULL)) { + __pyx_t_1 = ((__pyx_v_c_name[0]) == '\x00'); + } else { + __pyx_t_1 = (__pyx_v_c_name == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1375 + * 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-2.2/src/lxml/apihelpers.pxi":1376 + * 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_1 = ((__pyx_v_c_name[0]) != '\x00'); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1377 + * 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-2.2/src/lxml/apihelpers.pxi":1378 + * 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-2.2/src/lxml/apihelpers.pxi":1379 + * 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-2.2/src/lxml/apihelpers.pxi":1380 + * 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-2.2/src/lxml/apihelpers.pxi":1381 + * 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-2.2/src/lxml/apihelpers.pxi":1382 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1384 + * 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; + __Pyx_SetupRefcountContext("_characterReferenceIsValid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1386 + * 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-2.2/src/lxml/apihelpers.pxi":1387 + * cdef bint is_hex + * if c_name[0] == c'x': + * c_name += 1 # <<<<<<<<<<<<<< + * is_hex = 1 + * else: + */ + __pyx_v_c_name += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1388 + * 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-2.2/src/lxml/apihelpers.pxi":1390 + * 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-2.2/src/lxml/apihelpers.pxi":1391 + * 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-2.2/src/lxml/apihelpers.pxi":1392 + * 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-2.2/src/lxml/apihelpers.pxi":1393 + * 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-2.2/src/lxml/apihelpers.pxi":1394 + * 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 + */ + if (!((__pyx_v_c_name[0]) < '0')) { + __pyx_t_1 = ((__pyx_v_c_name[0]) > '9'); + } else { + __pyx_t_1 = ((__pyx_v_c_name[0]) < '0'); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1395 + * 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_1 = (!__pyx_v_is_hex); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1396 + * 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-2.2/src/lxml/apihelpers.pxi":1397 + * 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 + */ + if (((__pyx_v_c_name[0]) >= 'a')) { + __pyx_t_1 = ((__pyx_v_c_name[0]) <= 'f'); + } else { + __pyx_t_1 = ((__pyx_v_c_name[0]) >= 'a'); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1398 + * 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 + */ + if (((__pyx_v_c_name[0]) >= 'A')) { + __pyx_t_2 = ((__pyx_v_c_name[0]) <= 'F'); + } else { + __pyx_t_2 = ((__pyx_v_c_name[0]) >= 'A'); + } + __pyx_t_1 = (!__pyx_t_2); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1399 + * 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-2.2/src/lxml/apihelpers.pxi":1400 + * if not (c_name[0] >= c'A' and c_name[0] <= c'F'): + * return 0 + * c_name += 1 # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_v_c_name += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1401 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1403 + * 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_SetupRefcountContext("_tagValidOrRaise"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1404 + * + * 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-2.2/src/lxml/apihelpers.pxi":1406 + * 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 = PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_265, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_264), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1407 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1409 + * 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_SetupRefcountContext("_htmlTagValidOrRaise"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1410 + * + * 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-2.2/src/lxml/apihelpers.pxi":1412 + * 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 = PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_267, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_266), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1413 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1415 + * 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_SetupRefcountContext("_attributeValidOrRaise"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1416 + * + * 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-2.2/src/lxml/apihelpers.pxi":1418 + * 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 = PyUnicode_FromEncodedObject(__pyx_v_name_utf, __pyx_k_269, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_268), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1419 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1421 + * 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_SetupRefcountContext("_prefixValidOrRaise"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1422 + * + * 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-2.2/src/lxml/apihelpers.pxi":1424 + * 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 = PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_271, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_270), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1425 + * raise ValueError, u"Invalid namespace prefix %r" % \ + * python.PyUnicode_FromEncodedObject(tag_utf, 'UTF-8', NULL) + * 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._prefixValidOrRaise"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1427 + * return 0 + * + * cdef inline object _namespacedName(xmlNode* c_node): # <<<<<<<<<<<<<< + * return _namespacedNameFromNsName(_getNs(c_node), c_node.name) + * + */ + +static INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *__pyx_v_c_node) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_namespacedName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1428 + * + * 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[1]; __pyx_lineno = 1428; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1430 + * 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; + __Pyx_SetupRefcountContext("_namespacedNameFromNsName"); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1431 + * + * 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-2.2/src/lxml/apihelpers.pxi":1432 + * 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[1]; __pyx_lineno = 1432; __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-2.2/src/lxml/apihelpers.pxi":1433 + * if href is NULL: + * return funicode(name) + * elif python.IS_PYTHON3: # <<<<<<<<<<<<<< + * return python.PyUnicode_FromFormat("{%s}%s", href, name) + * else: + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1434 + * return funicode(name) + * elif python.IS_PYTHON3: + * return python.PyUnicode_FromFormat("{%s}%s", href, name) # <<<<<<<<<<<<<< + * else: + * s = python.PyString_FromFormat("{%s}%s", href, name) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyUnicode_FromFormat(__pyx_k_272, __pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1434; __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-2.2/src/lxml/apihelpers.pxi":1436 + * return python.PyUnicode_FromFormat("{%s}%s", href, name) + * else: + * s = python.PyString_FromFormat("{%s}%s", href, name) # <<<<<<<<<<<<<< + * if isutf8(href) or isutf8(name): + * return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL) + */ + __pyx_t_2 = PyString_FromFormat(__pyx_k_273, __pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/apihelpers.pxi":1437 + * else: + * s = python.PyString_FromFormat("{%s}%s", href, name) + * if isutf8(href) or isutf8(name): # <<<<<<<<<<<<<< + * return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL) + * else: + */ + if (!__pyx_f_4lxml_5etree_isutf8(__pyx_v_href)) { + __pyx_t_1 = __pyx_f_4lxml_5etree_isutf8(__pyx_v_name); + } else { + __pyx_t_1 = __pyx_f_4lxml_5etree_isutf8(__pyx_v_href); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1438 + * s = python.PyString_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 = PyUnicode_FromEncodedObject(__pyx_v_s, __pyx_k_274, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1438; __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-2.2/src/lxml/apihelpers.pxi":1440 + * return python.PyUnicode_FromEncodedObject(s, 'UTF-8', NULL) + * else: + * return s # <<<<<<<<<<<<<< + * + * cdef _getFilenameForFile(source): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_s); + __pyx_r = __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1442 + * 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_v_geturl; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_getFilenameForFile"); + __pyx_v_filename = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_geturl = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1448 + * """ + * # file instances have a name attribute + * filename = getattr3(source, u'name', None) # <<<<<<<<<<<<<< + * if filename is not None: + * return os_path_abspath(filename) + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_source, ((PyObject *)__pyx_kp_275), Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_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-2.2/src/lxml/apihelpers.pxi":1449 + * # file instances have a name attribute + * filename = getattr3(source, u'name', None) + * if filename is not None: # <<<<<<<<<<<<<< + * return os_path_abspath(filename) + * # urllib2 provides a geturl() method + */ + __pyx_t_2 = (__pyx_v_filename != Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1450 + * filename = getattr3(source, u'name', None) + * if filename is not None: + * return os_path_abspath(filename) # <<<<<<<<<<<<<< + * # urllib2 provides a geturl() method + * geturl = getattr3(source, u'geturl', None) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_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_3 = PyObject_Call(__pyx_v_4lxml_5etree_os_path_abspath, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1452 + * return os_path_abspath(filename) + * # urllib2 provides a geturl() method + * geturl = getattr3(source, u'geturl', None) # <<<<<<<<<<<<<< + * if geturl is not None: + * return geturl() + */ + __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_source, ((PyObject *)__pyx_kp_276), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_geturl); + __pyx_v_geturl = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1453 + * # urllib2 provides a geturl() method + * geturl = getattr3(source, u'geturl', None) + * if geturl is not None: # <<<<<<<<<<<<<< + * return geturl() + * # gzip file instances have a filename attribute (before Py3k) + */ + __pyx_t_2 = (__pyx_v_geturl != Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1454 + * geturl = getattr3(source, u'geturl', None) + * if geturl is not None: + * return geturl() # <<<<<<<<<<<<<< + * # gzip file instances have a filename attribute (before Py3k) + * filename = getattr3(source, u'filename', None) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_Call(__pyx_v_geturl, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1454; __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-2.2/src/lxml/apihelpers.pxi":1456 + * return geturl() + * # gzip file instances have a filename attribute (before Py3k) + * filename = getattr3(source, u'filename', None) # <<<<<<<<<<<<<< + * if filename is not None: + * return os_path_abspath(filename) + */ + __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_source, ((PyObject *)__pyx_kp_277), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1456; __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-2.2/src/lxml/apihelpers.pxi":1457 + * # gzip file instances have a filename attribute (before Py3k) + * filename = getattr3(source, u'filename', None) + * if filename is not None: # <<<<<<<<<<<<<< + * return os_path_abspath(filename) + * # can't determine filename + */ + __pyx_t_2 = (__pyx_v_filename != Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1458 + * filename = getattr3(source, u'filename', None) + * if filename is not None: + * return os_path_abspath(filename) # <<<<<<<<<<<<<< + * # can't determine filename + * return None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + __pyx_t_1 = PyObject_Call(__pyx_v_4lxml_5etree_os_path_abspath, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":1460 + * return os_path_abspath(filename) + * # 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); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._getFilenameForFile"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_filename); + __Pyx_DECREF(__pyx_v_geturl); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":7 + * # module level API functions + * + * def clear_error_log(): # <<<<<<<<<<<<<< + * u"""clear_error_log() + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_clear_error_log(PyObject *__pyx_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_clear_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 PyObject *__pyx_pf_4lxml_5etree_clear_error_log(PyObject *__pyx_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("clear_error_log"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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[7]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_clear); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __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[7]; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_SetupRefcountContext("_initThreadLogging"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("connectErrorLog"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":50 + * 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; + PyObject *__pyx_1 = 0; + 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; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_SetupRefcountContext("_setError"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":52 + * cdef _setError(self, xmlerror.xmlError* error): + * cdef int size + * self.domain = error.domain # <<<<<<<<<<<<<< + * self.type = error.code + * self.level = error.level + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_error->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->domain); + __Pyx_DECREF(__pyx_v_self->domain); + __pyx_v_self->domain = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":53 + * cdef int size + * self.domain = error.domain + * self.type = error.code # <<<<<<<<<<<<<< + * self.level = error.level + * self.line = error.line + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_error->code); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->type); + __Pyx_DECREF(__pyx_v_self->type); + __pyx_v_self->type = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":54 + * self.domain = error.domain + * self.type = error.code + * self.level = error.level # <<<<<<<<<<<<<< + * self.line = error.line + * self.column = error.int2 + */ + __pyx_t_1 = PyInt_FromLong(((int)__pyx_v_error->level)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->level); + __Pyx_DECREF(__pyx_v_self->level); + __pyx_v_self->level = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":55 + * self.type = error.code + * self.level = error.level + * self.line = error.line # <<<<<<<<<<<<<< + * self.column = error.int2 + * size = cstd.strlen(error.message) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_error->line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->line); + __Pyx_DECREF(__pyx_v_self->line); + __pyx_v_self->line = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":56 + * self.level = 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_t_1 = PyInt_FromLong(__pyx_v_error->int2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->column); + __Pyx_DECREF(__pyx_v_self->column); + __pyx_v_self->column = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":57 + * 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-2.2/src/lxml/xmlerror.pxi":58 + * 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: + */ + if ((__pyx_v_size > 0)) { + __pyx_t_2 = ((__pyx_v_error->message[(__pyx_v_size - 1)]) == '\n'); + } else { + __pyx_t_2 = (__pyx_v_size > 0); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":59 + * 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-2.2/src/lxml/xmlerror.pxi":60 + * 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-2.2/src/lxml/xmlerror.pxi":62 + * try: + * self.message = python.PyUnicode_DecodeUTF8( + * error.message, size, NULL) # <<<<<<<<<<<<<< + * except: + * try: + */ + __pyx_t_1 = PyUnicode_DecodeUTF8(__pyx_v_error->message, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":61 + * size = size - 1 # strip EOL + * try: + * self.message = python.PyUnicode_DecodeUTF8( # <<<<<<<<<<<<<< + * error.message, size, NULL) + * except: + */ + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->message); + __Pyx_DECREF(__pyx_v_self->message); + __pyx_v_self->message = __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_L11_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":63 + * self.message = python.PyUnicode_DecodeUTF8( + * error.message, size, NULL) + * except: # <<<<<<<<<<<<<< + * try: + * self.message = python.PyUnicode_DecodeASCII( + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree._setError"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":64 + * 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-2.2/src/lxml/xmlerror.pxi":65 + * except: + * try: + * self.message = python.PyUnicode_DecodeASCII( # <<<<<<<<<<<<<< + * error.message, size, 'backslashreplace') + * except: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_python); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_278); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":66 + * try: + * self.message = python.PyUnicode_DecodeASCII( + * error.message, size, 'backslashreplace') # <<<<<<<<<<<<<< + * except: + * self.message = u'' + */ + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_error->message); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_kp_279); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_279); + __Pyx_GIVEREF(__pyx_kp_279); + __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[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L14_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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":65 + * except: + * try: + * self.message = python.PyUnicode_DecodeASCII( # <<<<<<<<<<<<<< + * error.message, size, 'backslashreplace') + * except: + */ + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_v_self->message); + __Pyx_DECREF(__pyx_v_self->message); + __pyx_v_self->message = __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_L21_try_end; + __pyx_L14_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":67 + * self.message = python.PyUnicode_DecodeASCII( + * error.message, size, 'backslashreplace') + * except: # <<<<<<<<<<<<<< + * self.message = u'' + * if error.file is NULL: + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree._setError"); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":68 + * error.message, size, 'backslashreplace') + * except: + * self.message = u'' # <<<<<<<<<<<<<< + * if error.file is NULL: + * self.filename = u'' + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_280)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_280)); + __Pyx_GOTREF(__pyx_v_self->message); + __Pyx_DECREF(__pyx_v_self->message); + __pyx_v_self->message = ((PyObject *)__pyx_kp_280); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L15_exception_handled; + } + __pyx_L16_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_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_L5_exception_handled; + } + __pyx_L6_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/xmlerror.pxi":69 + * except: + * self.message = u'' + * if error.file is NULL: # <<<<<<<<<<<<<< + * self.filename = u'' + * else: + */ + __pyx_t_2 = (__pyx_v_error->file == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":70 + * self.message = u'' + * if error.file is NULL: + * self.filename = u'' # <<<<<<<<<<<<<< + * else: + * self.filename = _decodeFilename(error.file) + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_281)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_281)); + __Pyx_GOTREF(__pyx_v_self->filename); + __Pyx_DECREF(__pyx_v_self->filename); + __pyx_v_self->filename = ((PyObject *)__pyx_kp_281); + goto __pyx_L24; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":72 + * self.filename = u'' + * else: + * self.filename = _decodeFilename(error.file) # <<<<<<<<<<<<<< + * + * cdef _setGeneric(self, int domain, int type, int level, int line, + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_error->file); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->filename); + __Pyx_DECREF(__pyx_v_self->filename); + __pyx_v_self->filename = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L24:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("lxml.etree._LogEntry._setError"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":74 + * 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; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_setGeneric"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":76 + * cdef _setGeneric(self, int domain, int type, int level, int line, + * message, filename): + * self.domain = domain # <<<<<<<<<<<<<< + * self.type = type + * self.level = level + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->domain); + __Pyx_DECREF(__pyx_v_self->domain); + __pyx_v_self->domain = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":77 + * message, filename): + * self.domain = domain + * self.type = type # <<<<<<<<<<<<<< + * self.level = level + * self.line = line + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->type); + __Pyx_DECREF(__pyx_v_self->type); + __pyx_v_self->type = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":78 + * self.domain = domain + * self.type = type + * self.level = level # <<<<<<<<<<<<<< + * self.line = line + * self.column = 0 + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->level); + __Pyx_DECREF(__pyx_v_self->level); + __pyx_v_self->level = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":79 + * self.type = type + * self.level = level + * self.line = line # <<<<<<<<<<<<<< + * self.column = 0 + * self.message = message + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->line); + __Pyx_DECREF(__pyx_v_self->line); + __pyx_v_self->line = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":80 + * self.level = level + * self.line = line + * self.column = 0 # <<<<<<<<<<<<<< + * self.message = message + * self.filename = filename + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GOTREF(__pyx_v_self->column); + __Pyx_DECREF(__pyx_v_self->column); + __pyx_v_self->column = __pyx_int_0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":81 + * 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-2.2/src/lxml/xmlerror.pxi":82 + * 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); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._LogEntry._setGeneric"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":84 + * 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; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":85 + * + * 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-2.2/src/lxml/xmlerror.pxi":86 + * 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 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_level_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":87 + * 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_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_domain_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_type_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->filename); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->line); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->line); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->line); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->column); + PyTuple_SET_ITEM(__pyx_t_4, 2, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->column); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->column); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->message); + PyTuple_SET_ITEM(__pyx_t_4, 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_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_282), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree._LogEntry.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":90 + * + * property domain_name: + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":91 + * property domain_name: + * def __get__(self): + * return ErrorDomains._getName(self.domain, u"unknown") # <<<<<<<<<<<<<< + * + * property type_name: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorDomains); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp__getName); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain); + __Pyx_INCREF(((PyObject *)__pyx_kp_283)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_283)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_283)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 91; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":94 + * + * property type_name: + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__get__"); + __pyx_v_getName = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":95 + * property type_name: + * def __get__(self): + * if self.domain == ErrorDomains.RELAXNGV: # <<<<<<<<<<<<<< + * getName = RelaxNGErrorTypes._getName + * else: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorDomains); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_RELAXNGV); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyObject_RichCompare(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->domain, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 95; __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[7]; __pyx_lineno = 95; __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-2.2/src/lxml/xmlerror.pxi":96 + * def __get__(self): + * if self.domain == ErrorDomains.RELAXNGV: + * getName = RelaxNGErrorTypes._getName # <<<<<<<<<<<<<< + * else: + * getName = ErrorTypes._getName + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp__getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_getName); + __pyx_v_getName = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":98 + * getName = RelaxNGErrorTypes._getName + * else: + * getName = ErrorTypes._getName # <<<<<<<<<<<<<< + * return getName(self.type, u"unknown") + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp__getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_getName); + __pyx_v_getName = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":99 + * else: + * getName = ErrorTypes._getName + * return getName(self.type, u"unknown") # <<<<<<<<<<<<<< + * + * property level_name: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->type); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->type); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->type); + __Pyx_INCREF(((PyObject *)__pyx_kp_284)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_284)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_284)); + __pyx_t_1 = PyObject_Call(__pyx_v_getName, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 99; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._LogEntry.type_name.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_getName); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":102 + * + * property level_name: + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":103 + * property level_name: + * def __get__(self): + * return ErrorLevels._getName(self.level, u"unknown") # <<<<<<<<<<<<<< + * + * cdef class _BaseErrorLog: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp__getName); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->level); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->level); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self)->level); + __Pyx_INCREF(((PyObject *)__pyx_kp_285)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_285)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_285)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":108 + * 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_kp_first_error,&__pyx_kp_last_error,0}; + __Pyx_SetupRefcountContext("__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_kp_first_error); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_last_error); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 108; __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[7]; __pyx_lineno = 108; __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[7]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":109 + * cdef readonly object last_error + * def __init__(self, first_error, last_error): + * self._first_error = first_error # <<<<<<<<<<<<<< + * self.last_error = last_error + * + */ + if (!(__Pyx_TypeTest(__pyx_v_first_error, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 109; __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-2.2/src/lxml/xmlerror.pxi":110 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":112 + * self.last_error = last_error + * + * def copy(self): # <<<<<<<<<<<<<< + * return _BaseErrorLog(self._first_error, self.last_error) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":113 + * + * 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[7]; __pyx_lineno = 113; __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[7]; __pyx_lineno = 113; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":115 + * return _BaseErrorLog(self._first_error, self.last_error) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return u'' + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":116 + * + * def __repr__(self): + * return u'' # <<<<<<<<<<<<<< + * + * cdef void _receive(self, xmlerror.xmlError* error): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_286)); + __pyx_r = ((PyObject *)__pyx_kp_286); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":118 + * 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; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/xmlerror.pxi":122 + * 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[7]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/xmlerror.pxi":123 + * 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[7]; __pyx_lineno = 123; __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-2.2/src/lxml/xmlerror.pxi":124 + * entry = _LogEntry() + * entry._setError(error) + * is_error = error.level == xmlerror.XML_ERR_ERROR or \ # <<<<<<<<<<<<<< + * error.level == xmlerror.XML_ERR_FATAL + * global_log = _getGlobalErrorLog() + */ + if (!(__pyx_v_error->level == XML_ERR_ERROR)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":125 + * 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_2 = (__pyx_v_error->level == XML_ERR_FATAL); + } else { + __pyx_t_2 = (__pyx_v_error->level == XML_ERR_ERROR); + } + __pyx_v_is_error = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":126 + * 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[7]; __pyx_lineno = 126; __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-2.2/src/lxml/xmlerror.pxi":127 + * error.level == xmlerror.XML_ERR_FATAL + * global_log = _getGlobalErrorLog() + * if global_log is not self: # <<<<<<<<<<<<<< + * global_log.receive(entry) + * if is_error: + */ + __pyx_t_2 = (__pyx_v_global_log != __pyx_v_self); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":128 + * 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_kp_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_entry)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_entry)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_entry)); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 128; __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(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":129 + * if global_log is not self: + * global_log.receive(entry) + * if is_error: # <<<<<<<<<<<<<< + * global_log.last_error = entry + * self.receive(entry) + */ + __pyx_t_2 = __pyx_v_is_error; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":130 + * 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-2.2/src/lxml/xmlerror.pxi":131 + * if is_error: + * global_log.last_error = entry + * self.receive(entry) # <<<<<<<<<<<<<< + * if is_error: + * self.last_error = entry + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_receive); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 131; __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[7]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_entry)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_entry)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_entry)); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 131; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":132 + * global_log.last_error = entry + * self.receive(entry) + * if is_error: # <<<<<<<<<<<<<< + * self.last_error = entry + * + */ + __pyx_t_2 = __pyx_v_is_error; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":133 + * 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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("lxml.etree._BaseErrorLog._receive"); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_entry); + __Pyx_DECREF((PyObject *)__pyx_v_global_log); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":135 + * 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; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/xmlerror.pxi":140 + * 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[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/xmlerror.pxi":141 + * 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[7]; __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-2.2/src/lxml/xmlerror.pxi":142 + * 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() + */ + if (!(__pyx_v_level == XML_ERR_ERROR)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":143 + * 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_2 = (__pyx_v_level == XML_ERR_FATAL); + } else { + __pyx_t_2 = (__pyx_v_level == XML_ERR_ERROR); + } + __pyx_v_is_error = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":144 + * 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[7]; __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-2.2/src/lxml/xmlerror.pxi":145 + * level == xmlerror.XML_ERR_FATAL + * global_log = _getGlobalErrorLog() + * if global_log is not self: # <<<<<<<<<<<<<< + * global_log.receive(entry) + * if is_error: + */ + __pyx_t_2 = (__pyx_v_global_log != __pyx_v_self); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_entry)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_entry)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_entry)); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __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(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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) + */ + __pyx_t_2 = __pyx_v_is_error; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_receive); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __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[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_entry)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_entry)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_entry)); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":150 + * global_log.last_error = entry + * self.receive(entry) + * if is_error: # <<<<<<<<<<<<<< + * self.last_error = entry + * + */ + __pyx_t_2 = __pyx_v_is_error; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":151 + * 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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("lxml.etree._BaseErrorLog._receiveGeneric"); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_entry); + __Pyx_DECREF((PyObject *)__pyx_v_global_log); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":153 + * 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) { + PyObject *__pyx_v_code; + PyObject *__pyx_v_message; + PyObject *__pyx_v_line; + PyObject *__pyx_v_column; + 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_SetupRefcountContext("_buildParseException"); + __pyx_v_code = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_message = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_line = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_column = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":154 + * + * 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_t_1 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_code); + __pyx_v_code = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":155 + * 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 self._first_error is None or \ + */ + __pyx_t_2 = (((PyObject *)__pyx_v_self->_first_error) == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":156 + * code = xmlerror.XML_ERR_INTERNAL_ERROR + * if self._first_error is None: + * return exctype(default_message, code, 0, 0) # <<<<<<<<<<<<<< + * if self._first_error is None or \ + * self._first_error.message is None or \ + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_default_message); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_default_message); + __Pyx_GIVEREF(__pyx_v_default_message); + __Pyx_INCREF(__pyx_v_code); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_code); + __Pyx_GIVEREF(__pyx_v_code); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_3 = PyObject_Call(__pyx_v_exctype, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":157 + * if self._first_error is None: + * return exctype(default_message, code, 0, 0) + * if self._first_error is None or \ # <<<<<<<<<<<<<< + * self._first_error.message is None or \ + * not self._first_error.message: + */ + __pyx_t_2 = (((PyObject *)__pyx_v_self->_first_error) == Py_None); + if (!__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":158 + * return exctype(default_message, code, 0, 0) + * if self._first_error is None or \ + * self._first_error.message is None or \ # <<<<<<<<<<<<<< + * not self._first_error.message: + * message = default_message + */ + __pyx_t_4 = (__pyx_v_self->_first_error->message == Py_None); + if (!__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":159 + * if self._first_error is None or \ + * self._first_error.message is None or \ + * not self._first_error.message: # <<<<<<<<<<<<<< + * message = default_message + * line = 0 + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_first_error->message); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_2; + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":160 + * self._first_error.message is None or \ + * not self._first_error.message: + * message = default_message # <<<<<<<<<<<<<< + * line = 0 + * column = 0 + */ + __Pyx_INCREF(__pyx_v_default_message); + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_v_default_message; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":161 + * not self._first_error.message: + * message = default_message + * line = 0 # <<<<<<<<<<<<<< + * column = 0 + * else: + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_int_0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":162 + * message = default_message + * line = 0 + * column = 0 # <<<<<<<<<<<<<< + * else: + * message = self._first_error.message + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_column); + __pyx_v_column = __pyx_int_0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":164 + * column = 0 + * 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-2.2/src/lxml/xmlerror.pxi":165 + * else: + * message = self._first_error.message + * code = self._first_error.type # <<<<<<<<<<<<<< + * line = self._first_error.line + * column = self._first_error.column + */ + __Pyx_INCREF(__pyx_v_self->_first_error->type); + __Pyx_DECREF(__pyx_v_code); + __pyx_v_code = __pyx_v_self->_first_error->type; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":166 + * message = self._first_error.message + * code = self._first_error.type + * line = self._first_error.line # <<<<<<<<<<<<<< + * column = self._first_error.column + * if line > 0: + */ + __Pyx_INCREF(__pyx_v_self->_first_error->line); + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_v_self->_first_error->line; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":167 + * code = self._first_error.type + * line = self._first_error.line + * column = self._first_error.column # <<<<<<<<<<<<<< + * if line > 0: + * if column > 0: + */ + __Pyx_INCREF(__pyx_v_self->_first_error->column); + __Pyx_DECREF(__pyx_v_column); + __pyx_v_column = __pyx_v_self->_first_error->column; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":168 + * 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_3 = PyObject_RichCompare(__pyx_v_line, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":169 + * column = self._first_error.column + * if line > 0: + * if column > 0: # <<<<<<<<<<<<<< + * message = u"%s, line %d, column %d" % (message, line, column) + * else: + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_column, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":170 + * 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_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __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_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_column); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_column); + __Pyx_GIVEREF(__pyx_v_column); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_287), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __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_v_message); + __pyx_v_message = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":172 + * 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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_message); + __Pyx_GIVEREF(__pyx_v_message); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_288), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":173 + * 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 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __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_INCREF(__pyx_v_code); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_code); + __Pyx_GIVEREF(__pyx_v_code); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_column); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_column); + __Pyx_GIVEREF(__pyx_v_column); + __pyx_t_1 = PyObject_Call(__pyx_v_exctype, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __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_3); + __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildParseException"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_code); + __Pyx_DECREF(__pyx_v_message); + __Pyx_DECREF(__pyx_v_line); + __Pyx_DECREF(__pyx_v_column); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":175 + * 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; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("_buildExceptionMessage"); + __pyx_v_message = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":176 + * + * cdef _buildExceptionMessage(self, default_message): + * if self._first_error is None: # <<<<<<<<<<<<<< + * return default_message + * if self._first_error.message is not None and 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-2.2/src/lxml/xmlerror.pxi":177 + * cdef _buildExceptionMessage(self, default_message): + * if self._first_error is None: + * return default_message # <<<<<<<<<<<<<< + * if self._first_error.message is not None and 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-2.2/src/lxml/xmlerror.pxi":178 + * if self._first_error is None: + * return default_message + * if self._first_error.message is not None and self._first_error.message: # <<<<<<<<<<<<<< + * message = self._first_error.message + * elif default_message is None: + */ + __pyx_t_1 = (__pyx_v_self->_first_error->message != Py_None); + if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_first_error->message); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 178; __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-2.2/src/lxml/xmlerror.pxi":179 + * return default_message + * if self._first_error.message is not None and 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-2.2/src/lxml/xmlerror.pxi":180 + * if self._first_error.message is not None and self._first_error.message: + * message = self._first_error.message + * elif default_message is None: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_3 = (__pyx_v_default_message == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":181 + * 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-2.2/src/lxml/xmlerror.pxi":183 + * 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-2.2/src/lxml/xmlerror.pxi":184 + * 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_4 = PyObject_RichCompare(__pyx_v_self->_first_error->line, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __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-2.2/src/lxml/xmlerror.pxi":185 + * 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_4 = PyObject_RichCompare(__pyx_v_self->_first_error->column, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __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-2.2/src/lxml/xmlerror.pxi":187 + * 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_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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); + __Pyx_INCREF(__pyx_v_self->_first_error->line); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->_first_error->line); + __Pyx_GIVEREF(__pyx_v_self->_first_error->line); + __Pyx_INCREF(__pyx_v_self->_first_error->column); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->_first_error->column); + __Pyx_GIVEREF(__pyx_v_self->_first_error->column); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_289), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __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_message); + __pyx_v_message = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":189 + * message, self._first_error.line, self._first_error.column) + * else: + * message = u"%s, line %d" % (message, self._first_error.line) # <<<<<<<<<<<<<< + * return message + * + */ + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __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); + __Pyx_INCREF(__pyx_v_self->_first_error->line); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_self->_first_error->line); + __Pyx_GIVEREF(__pyx_v_self->_first_error->line); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_290), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":190 + * 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildExceptionMessage"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_message); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":195 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_entries,&__pyx_kp_first_error,&__pyx_kp_last_error,0}; + __Pyx_SetupRefcountContext("__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_kp_entries); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_first_error); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_last_error); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 195; __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[7]; __pyx_lineno = 195; __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[7]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__"); + 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-2.2/src/lxml/xmlerror.pxi":196 + * 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[7]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":197 + * 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-2.2/src/lxml/xmlerror.pxi":198 + * if entries: + * if first_error is None: + * first_error = entries[0] # <<<<<<<<<<<<<< + * if last_error is None: + * last_error = entries[-1] + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_entries, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_first_error); + __pyx_v_first_error = __pyx_1; + __pyx_1 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":199 + * 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-2.2/src/lxml/xmlerror.pxi":200 + * first_error = entries[0] + * if last_error is None: + * last_error = entries[-1] # <<<<<<<<<<<<<< + * _BaseErrorLog.__init__(self, first_error, last_error) + * self._entries = entries + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_entries, -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_last_error); + __pyx_v_last_error = __pyx_1; + __pyx_1 = 0; + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":201 + * 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_kp___init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 201; __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[7]; __pyx_lineno = 201; __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[7]; __pyx_lineno = 201; __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-2.2/src/lxml/xmlerror.pxi":202 + * 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 %s", Py_TYPE(__pyx_v_entries)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 202; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":204 + * 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_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_copy[] = "Creates a shallow copy of this error log. Reuses the list of\n entries.\n "; +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":208 + * 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[7]; __pyx_lineno = 208; __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[7]; __pyx_lineno = 208; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":210 + * 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___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":211 + * + * def __iter__(self): + * return iter(self._entries) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 211; __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.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":213 + * return iter(self._entries) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * cdef list l = [] + * for entry in self._entries: + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog___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; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + __pyx_v_entry = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":214 + * + * 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[7]; __pyx_lineno = 214; __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-2.2/src/lxml/xmlerror.pxi":215 + * def __repr__(self): + * cdef list l = [] + * for entry in self._entries: # <<<<<<<<<<<<<< + * l.append(repr(entry)) + * return u'\n'.join(l) + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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-2.2/src/lxml/xmlerror.pxi":216 + * cdef list l = [] + * for entry in self._entries: + * l.append(repr(entry)) # <<<<<<<<<<<<<< + * return u'\n'.join(l) + * + */ + __pyx_t_3 = PyObject_Repr(__pyx_v_entry); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_l), __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 216; __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-2.2/src/lxml/xmlerror.pxi":217 + * 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_GetAttr(((PyObject *)__pyx_kp_291), __pyx_kp_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_l)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_l)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_l)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 217; __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_3)); __pyx_t_3 = 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_3); + __Pyx_XDECREF(__pyx_t_5); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":219 + * return u'\n'.join(l) + * + * def __getitem__(self, index): # <<<<<<<<<<<<<< + * return self._entries[index] + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + __Pyx_SetupRefcountContext("__getitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":220 + * + * def __getitem__(self, index): + * return self._entries[index] # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries), __pyx_v_index); if (!__pyx_1) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree._ListErrorLog.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":222 + * return self._entries[index] + * + * def __len__(self): # <<<<<<<<<<<<<< + * return len(self._entries) + * + */ + +static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog___len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + __Pyx_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":223 + * + * def __len__(self): + * return len(self._entries) # <<<<<<<<<<<<<< + * + * def __contains__(self, error_type): + */ + __pyx_t_1 = PyObject_Length(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 223; __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._ListErrorLog.__len__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":225 + * 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___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type); /*proto*/ +static int __pyx_pf_4lxml_5etree_13_ListErrorLog___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_SetupRefcountContext("__contains__"); + __pyx_v_entry = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":226 + * + * def __contains__(self, error_type): + * for entry in self._entries: # <<<<<<<<<<<<<< + * if entry.type == error_type: + * return True + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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-2.2/src/lxml/xmlerror.pxi":227 + * 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_kp_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 227; __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[7]; __pyx_lineno = 227; __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[7]; __pyx_lineno = 227; __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-2.2/src/lxml/xmlerror.pxi":228 + * 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-2.2/src/lxml/xmlerror.pxi":229 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":231 + * return False + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * cdef bint result + * result = self._entries + */ + +static int __pyx_pf_4lxml_5etree_13_ListErrorLog___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_5etree_13_ListErrorLog___nonzero__(PyObject *__pyx_v_self) { + int __pyx_v_result; + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__nonzero__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":233 + * 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))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":234 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":236 + * 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_filter_domains(PyObject *__pyx_v_self, PyObject *__pyx_v_domains); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_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_SetupRefcountContext("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-2.2/src/lxml/xmlerror.pxi":241 + * """ + * 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[7]; __pyx_lineno = 241; __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-2.2/src/lxml/xmlerror.pxi":242 + * 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-2.2/src/lxml/xmlerror.pxi":243 + * 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[7]; __pyx_lineno = 243; __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-2.2/src/lxml/xmlerror.pxi":244 + * if not python.PySequence_Check(domains): + * domains = (domains,) + * for entry in self._entries: # <<<<<<<<<<<<<< + * if entry.domain in domains: + * filtered.append(entry) + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 244; __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-2.2/src/lxml/xmlerror.pxi":245 + * domains = (domains,) + * for entry in self._entries: + * if entry.domain in domains: # <<<<<<<<<<<<<< + * filtered.append(entry) + * return _ListErrorLog(filtered, None, None) + */ + __pyx_t_2 = (PySequence_Contains(__pyx_v_domains, __pyx_v_entry->domain)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":246 + * for entry in self._entries: + * if entry.domain in domains: + * filtered.append(entry) # <<<<<<<<<<<<<< + * return _ListErrorLog(filtered, None, None) + * + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_filtered), ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 246; __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-2.2/src/lxml/xmlerror.pxi":247 + * 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[7]; __pyx_lineno = 247; __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[7]; __pyx_lineno = 247; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":249 + * return _ListErrorLog(filtered, None, None) + * + * def filter_types(self, types): # <<<<<<<<<<<<<< + * u"""filter_types(self, types) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_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_SetupRefcountContext("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-2.2/src/lxml/xmlerror.pxi":256 + * """ + * 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[7]; __pyx_lineno = 256; __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-2.2/src/lxml/xmlerror.pxi":257 + * 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-2.2/src/lxml/xmlerror.pxi":258 + * 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[7]; __pyx_lineno = 258; __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-2.2/src/lxml/xmlerror.pxi":259 + * if not python.PySequence_Check(types): + * types = (types,) + * for entry in self._entries: # <<<<<<<<<<<<<< + * if entry.type in types: + * filtered.append(entry) + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 259; __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-2.2/src/lxml/xmlerror.pxi":260 + * types = (types,) + * for entry in self._entries: + * if entry.type in types: # <<<<<<<<<<<<<< + * filtered.append(entry) + * return _ListErrorLog(filtered, None, None) + */ + __pyx_t_2 = (PySequence_Contains(__pyx_v_types, __pyx_v_entry->type)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":261 + * for entry in self._entries: + * if entry.type in types: + * filtered.append(entry) # <<<<<<<<<<<<<< + * return _ListErrorLog(filtered, None, None) + * + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_filtered), ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 261; __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-2.2/src/lxml/xmlerror.pxi":262 + * 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[7]; __pyx_lineno = 262; __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[7]; __pyx_lineno = 262; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":264 + * return _ListErrorLog(filtered, None, None) + * + * def filter_levels(self, levels): # <<<<<<<<<<<<<< + * u"""filter_levels(self, levels) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_levels(PyObject *__pyx_v_self, PyObject *__pyx_v_levels); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_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_SetupRefcountContext("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-2.2/src/lxml/xmlerror.pxi":271 + * """ + * 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[7]; __pyx_lineno = 271; __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-2.2/src/lxml/xmlerror.pxi":272 + * 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-2.2/src/lxml/xmlerror.pxi":273 + * 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[7]; __pyx_lineno = 273; __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-2.2/src/lxml/xmlerror.pxi":274 + * if not python.PySequence_Check(levels): + * levels = (levels,) + * for entry in self._entries: # <<<<<<<<<<<<<< + * if entry.level in levels: + * filtered.append(entry) + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 274; __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-2.2/src/lxml/xmlerror.pxi":275 + * levels = (levels,) + * for entry in self._entries: + * if entry.level in levels: # <<<<<<<<<<<<<< + * filtered.append(entry) + * return _ListErrorLog(filtered, None, None) + */ + __pyx_t_2 = (PySequence_Contains(__pyx_v_levels, __pyx_v_entry->level)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":276 + * for entry in self._entries: + * if entry.level in levels: + * filtered.append(entry) # <<<<<<<<<<<<<< + * return _ListErrorLog(filtered, None, None) + * + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_filtered), ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 276; __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-2.2/src/lxml/xmlerror.pxi":277 + * 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[7]; __pyx_lineno = 277; __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[7]; __pyx_lineno = 277; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":279 + * 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_filter_from_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_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; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("filter_from_level"); + __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":285 + * """ + * 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[7]; __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-2.2/src/lxml/xmlerror.pxi":286 + * cdef _LogEntry entry + * cdef list filtered = [] + * for entry in self._entries: # <<<<<<<<<<<<<< + * if entry.level >= level: + * filtered.append(entry) + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self)->_entries); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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 (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 286; __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-2.2/src/lxml/xmlerror.pxi":287 + * cdef list filtered = [] + * for entry in self._entries: + * if entry.level >= level: # <<<<<<<<<<<<<< + * filtered.append(entry) + * return _ListErrorLog(filtered, None, None) + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_entry->level, __pyx_v_level, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":288 + * for entry in self._entries: + * if entry.level >= level: + * filtered.append(entry) # <<<<<<<<<<<<<< + * return _ListErrorLog(filtered, None, None) + * + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_filtered), ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 288; __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-2.2/src/lxml/xmlerror.pxi":289 + * 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[7]; __pyx_lineno = 289; __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_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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 = 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.filter_from_level"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_entry); + __Pyx_XDECREF(__pyx_v_filtered); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":291 + * return _ListErrorLog(filtered, None, None) + * + * def filter_from_fatals(self): # <<<<<<<<<<<<<< + * u"""filter_from_fatals(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_from_fatals(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_from_fatals(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("filter_from_fatals"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":296 + * 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_kp_filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_FATAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 296; __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(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 296; __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_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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":298 + * 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_filter_from_errors(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_from_errors(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("filter_from_errors"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":303 + * 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_kp_filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 303; __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(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 303; __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_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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":305 + * 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_filter_from_warnings(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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_filter_from_warnings(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("filter_from_warnings"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":310 + * 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_kp_filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_WARNING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 310; __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(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 310; __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_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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":313 + * + * 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_SetupRefcountContext("__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-2.2/src/lxml/xmlerror.pxi":314 + * 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_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 314; __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[7]; __pyx_lineno = 314; __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[7]; __pyx_lineno = 314; __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[7]; __pyx_lineno = 314; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":316 + * _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_SetupRefcountContext("connect"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":317 + * + * cdef void connect(self): + * self._first_error = None # <<<<<<<<<<<<<< + * del self._entries[:] + * connectErrorLog(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-2.2/src/lxml/xmlerror.pxi":318 + * cdef void connect(self): + * self._first_error = None + * del self._entries[:] # <<<<<<<<<<<<<< + * connectErrorLog(self) + * + */ + if (PySequence_DelSlice(((PyObject *)__pyx_v_self->__pyx_base._entries), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":319 + * self._first_error = None + * del self._entries[:] + * connectErrorLog(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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":321 + * connectErrorLog(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_SetupRefcountContext("disconnect"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":322 + * + * cdef void disconnect(self): + * connectErrorLog(NULL) # <<<<<<<<<<<<<< + * + * def clear(self): + */ + __pyx_f_4lxml_5etree_connectErrorLog(NULL); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":324 + * connectErrorLog(NULL) + * + * def clear(self): # <<<<<<<<<<<<<< + * self._first_error = None + * del self._entries[:] + */ + +static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_clear(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_clear(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":325 + * + * 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-2.2/src/lxml/xmlerror.pxi":326 + * def clear(self): + * self._first_error = None + * del self._entries[:] # <<<<<<<<<<<<<< + * + * def copy(self): + */ + if (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[7]; __pyx_lineno = 326; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":328 + * 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_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_9_ErrorLog_copy[] = "Creates a shallow copy of this error log and the list of entries.\n "; +static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":331 + * 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_1 = PySequence_GetSlice(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":332 + * """ + * return _ListErrorLog(self._entries[:], self._first_error, + * self.last_error) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._first_error)); + PyTuple_SET_ITEM(__pyx_t_1, 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_1, 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_1 = 0; + __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[7]; __pyx_lineno = 331; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":334 + * self.last_error) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return iter(self._entries[:]) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":335 + * + * def __iter__(self): + * return iter(self._entries[:]) # <<<<<<<<<<<<<< + * + * def receive(self, entry): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = PySequence_GetSlice(((PyObject *)((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self)->__pyx_base._entries), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._ErrorLog.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":337 + * 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_receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("receive"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":338 + * + * 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-2.2/src/lxml/xmlerror.pxi":339 + * def receive(self, entry): + * if self._first_error is None: + * self._first_error = entry # <<<<<<<<<<<<<< + * self._entries.append(entry) + * + */ + if (!(__Pyx_TypeTest(__pyx_v_entry, __pyx_ptype_4lxml_5etree__LogEntry))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 339; __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-2.2/src/lxml/xmlerror.pxi":340 + * if self._first_error is None: + * self._first_error = entry + * self._entries.append(entry) # <<<<<<<<<<<<<< + * + * cdef class _DomainErrorLog(_ErrorLog): + */ + __pyx_t_2 = PyList_Append(((PyObject *)((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[7]; __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.receive"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":343 + * + * 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_kp_domains,0}; + __Pyx_SetupRefcountContext("__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_kp_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[7]; __pyx_lineno = 343; __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[7]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":344 + * 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_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 344; __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[7]; __pyx_lineno = 344; __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[7]; __pyx_lineno = 344; __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-2.2/src/lxml/xmlerror.pxi":345 + * 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[7]; __pyx_lineno = 345; __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[7]; __pyx_lineno = 345; __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_kp__accepted_domains, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 345; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":347 + * 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_receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_receive(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_SetupRefcountContext("receive"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":348 + * + * def receive(self, entry): + * if entry.domain in self._accepted_domains: # <<<<<<<<<<<<<< + * _ErrorLog.receive(self, entry) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_entry, __pyx_kp_domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp__accepted_domains); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 348; __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[7]; __pyx_lineno = 348; __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-2.2/src/lxml/xmlerror.pxi":349 + * 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_kp_receive); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 349; __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[7]; __pyx_lineno = 349; __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[7]; __pyx_lineno = 349; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":353 + * 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_kp_max_len,0}; + __Pyx_SetupRefcountContext("__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_kp_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[7]; __pyx_lineno = 353; __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[7]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":354 + * 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_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 354; __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[7]; __pyx_lineno = 354; __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[7]; __pyx_lineno = 354; __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-2.2/src/lxml/xmlerror.pxi":355 + * 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[7]; __pyx_lineno = 355; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":357 + * 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_receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("receive"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":358 + * + * 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 = (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._entries)) > ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->_max_len); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":359 + * 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[7]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":360 + * if python.PyList_GET_SIZE(self._entries) > self._max_len: + * del self._entries[0] + * self._entries.append(entry) # <<<<<<<<<<<<<< + * + * cdef class PyErrorLog(_BaseErrorLog): + */ + __pyx_t_2 = PyList_Append(((PyObject *)((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self)->__pyx_base.__pyx_base._entries), __pyx_v_entry); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 360; __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._RotatingErrorLog.receive"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":384 + * cdef object _map_level + * cdef object _log + * def __init__(self, logger_name=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_logging; + PyObject *__pyx_v_logger; + int __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_logger_name,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_logger_name); + if (unlikely(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[7]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_logger_name = values[0]; + } else { + __pyx_v_logger_name = Py_None; + switch (PyTuple_GET_SIZE(__pyx_args)) { + 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, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_logging = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_logger = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":385 + * cdef object _log + * def __init__(self, logger_name=None): + * _BaseErrorLog.__init__(self, None, None) # <<<<<<<<<<<<<< + * import logging + * self.level_map = { + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 385; __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[7]; __pyx_lineno = 385; __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[7]; __pyx_lineno = 385; __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-2.2/src/lxml/xmlerror.pxi":386 + * def __init__(self, logger_name=None): + * _BaseErrorLog.__init__(self, None, None) + * import logging # <<<<<<<<<<<<<< + * self.level_map = { + * ErrorLevels.WARNING : logging.WARNING, + */ + __pyx_1 = __Pyx_Import(__pyx_kp_logging, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_logging); + __pyx_v_logging = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":387 + * _BaseErrorLog.__init__(self, None, None) + * import logging + * self.level_map = { # <<<<<<<<<<<<<< + * ErrorLevels.WARNING : logging.WARNING, + * ErrorLevels.ERROR : logging.ERROR, + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":388 + * import logging + * self.level_map = { + * ErrorLevels.WARNING : logging.WARNING, # <<<<<<<<<<<<<< + * ErrorLevels.ERROR : logging.ERROR, + * ErrorLevels.FATAL : logging.CRITICAL + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_WARNING); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_logging, __pyx_kp_WARNING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_1, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":389 + * self.level_map = { + * ErrorLevels.WARNING : logging.WARNING, + * ErrorLevels.ERROR : logging.ERROR, # <<<<<<<<<<<<<< + * ErrorLevels.FATAL : logging.CRITICAL + * } + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_logging, __pyx_kp_ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_1, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 387; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":390 + * ErrorLevels.WARNING : logging.WARNING, + * ErrorLevels.ERROR : logging.ERROR, + * ErrorLevels.FATAL : logging.CRITICAL # <<<<<<<<<<<<<< + * } + * self._map_level = self.level_map.get + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_FATAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_logging, __pyx_kp_CRITICAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_1, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":387 + * _BaseErrorLog.__init__(self, None, None) + * import logging + * self.level_map = { # <<<<<<<<<<<<<< + * ErrorLevels.WARNING : logging.WARNING, + * ErrorLevels.ERROR : logging.ERROR, + */ + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map); + __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map); + ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":392 + * ErrorLevels.FATAL : logging.CRITICAL + * } + * self._map_level = self.level_map.get # <<<<<<<<<<<<<< + * if logger_name: + * logger = logging.getLogger(logger_name) + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->level_map, __pyx_kp_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 392; __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)->_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_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":393 + * } + * self._map_level = self.level_map.get + * 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[7]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":394 + * self._map_level = self.level_map.get + * if logger_name: + * logger = logging.getLogger(logger_name) # <<<<<<<<<<<<<< + * else: + * logger = logging.getLogger() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_logging, __pyx_kp_getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 394; __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[7]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_logger_name); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_logger_name); + __Pyx_GIVEREF(__pyx_v_logger_name); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 394; __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_DECREF(__pyx_v_logger); + __pyx_v_logger = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":396 + * logger = logging.getLogger(logger_name) + * else: + * logger = logging.getLogger() # <<<<<<<<<<<<<< + * self._log = logger.log + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_logging, __pyx_kp_getLogger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 396; __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_logger); + __pyx_v_logger = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":397 + * else: + * logger = logging.getLogger() + * self._log = logger.log # <<<<<<<<<<<<<< + * + * def copy(self): + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_logger, __pyx_kp_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 397; __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)->_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_3; + __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":399 + * self._log = logger.log + * + * def copy(self): # <<<<<<<<<<<<<< + * u"""Dummy method that returns an empty error log. + * """ + */ + +static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_10PyErrorLog_copy[] = "Dummy method that returns an empty error log.\n "; +static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":402 + * 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[7]; __pyx_lineno = 402; __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[7]; __pyx_lineno = 402; __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[7]; __pyx_lineno = 402; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":404 + * 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_log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_10PyErrorLog_log[] = "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_log(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_log_entry,&__pyx_kp_message,0}; + __Pyx_SetupRefcountContext("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_kp_log_entry); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_message); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 404; __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[7]; __pyx_lineno = 404; __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[7]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); + __Pyx_AddTraceback("lxml.etree.PyErrorLog.log"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":417 + * """ + * self._log( + * self._map_level(log_entry.level, 0), # <<<<<<<<<<<<<< + * message, *args + * ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_log_entry, __pyx_kp_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 417; __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[7]; __pyx_lineno = 417; __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[7]; __pyx_lineno = 417; __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-2.2/src/lxml/xmlerror.pxi":418 + * 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[7]; __pyx_lineno = 416; __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-2.2/src/lxml/xmlerror.pxi":419 + * self._map_level(log_entry.level, 0), + * message, *args + * ) # <<<<<<<<<<<<<< + * + * def receive(self, _LogEntry log_entry): + */ + __pyx_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + __pyx_t_2 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self)->_log, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 416; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree.PyErrorLog.log"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_args); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":421 + * ) + * + * def receive(self, _LogEntry log_entry): # <<<<<<<<<<<<<< + * u"""receive(self, log_entry) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_receive(PyObject *__pyx_v_self, PyObject *__pyx_v_log_entry); /*proto*/ +static char __pyx_doc_4lxml_5etree_10PyErrorLog_receive[] = "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_receive(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_SetupRefcountContext("receive"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "log_entry", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":432 + * 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_kp_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 432; __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[7]; __pyx_lineno = 432; __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[7]; __pyx_lineno = 432; __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[7]; __pyx_lineno = 432; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":440 + * __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; + PyObject *__pyx_v_log; + struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_2; + int __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_SetupRefcountContext("_getGlobalErrorLog"); + __pyx_v_log = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":443 + * 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-2.2/src/lxml/xmlerror.pxi":444 + * 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-2.2/src/lxml/xmlerror.pxi":445 + * thread_dict = python.PyThreadState_GetDict() + * if thread_dict is NULL: + * return __GLOBAL_ERROR_LOG # <<<<<<<<<<<<<< + * try: + * return (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-2.2/src/lxml/xmlerror.pxi":446 + * if thread_dict is NULL: + * return __GLOBAL_ERROR_LOG + * try: # <<<<<<<<<<<<<< + * return (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-2.2/src/lxml/xmlerror.pxi":447 + * return __GLOBAL_ERROR_LOG + * try: + * return (thread_dict)[u"_GlobalErrorLog"] # <<<<<<<<<<<<<< + * except KeyError: + * log = (thread_dict)[u"_GlobalErrorLog"] = \ + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_kp_292)); if (!__pyx_1) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4lxml_5etree__BaseErrorLog))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_1); + __pyx_1 = 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_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_L0; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":448 + * try: + * return (thread_dict)[u"_GlobalErrorLog"] + * except KeyError: # <<<<<<<<<<<<<< + * log = (thread_dict)[u"_GlobalErrorLog"] = \ + * _RotatingErrorLog(__MAX_LOG_SIZE) + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree._getGlobalErrorLog"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 448; __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-2.2/src/lxml/xmlerror.pxi":450 + * except KeyError: + * log = (thread_dict)[u"_GlobalErrorLog"] = \ + * _RotatingErrorLog(__MAX_LOG_SIZE) # <<<<<<<<<<<<<< + * return log + * + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_int_100); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_100); + __Pyx_GIVEREF(__pyx_int_100); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__RotatingErrorLog)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_log); + __pyx_v_log = __pyx_t_6; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":449 + * return (thread_dict)[u"_GlobalErrorLog"] + * except KeyError: + * log = (thread_dict)[u"_GlobalErrorLog"] = \ # <<<<<<<<<<<<<< + * _RotatingErrorLog(__MAX_LOG_SIZE) + * return log + */ + if (PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_kp_293), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":451 + * log = (thread_dict)[u"_GlobalErrorLog"] = \ + * _RotatingErrorLog(__MAX_LOG_SIZE) + * return log # <<<<<<<<<<<<<< + * + * cdef _setGlobalErrorLog(_BaseErrorLog log): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (!(__Pyx_TypeTest(__pyx_v_log, __pyx_ptype_4lxml_5etree__BaseErrorLog))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + __Pyx_INCREF(__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_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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_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._getGlobalErrorLog"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_log); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":453 + * 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_SetupRefcountContext("_setGlobalErrorLog"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":456 + * 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-2.2/src/lxml/xmlerror.pxi":457 + * 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-2.2/src/lxml/xmlerror.pxi":459 + * if thread_dict is NULL: + * global __GLOBAL_ERROR_LOG + * __GLOBAL_ERROR_LOG = log # <<<<<<<<<<<<<< + * else: + * (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-2.2/src/lxml/xmlerror.pxi":461 + * __GLOBAL_ERROR_LOG = log + * else: + * (thread_dict)[u"_GlobalErrorLog"] = log # <<<<<<<<<<<<<< + * + * cdef __copyGlobalErrorLog(): + */ + if (PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_kp_294), ((PyObject *)__pyx_v_log)) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 461; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":463 + * (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_SetupRefcountContext("__copyGlobalErrorLog"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":465 + * 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[7]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 465; __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[7]; __pyx_lineno = 465; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":467 + * return _getGlobalErrorLog().copy() + * + * def use_global_python_log(PyErrorLog log not None): # <<<<<<<<<<<<<< + * u"""use_global_python_log(log) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_use_global_python_log(PyObject *__pyx_self, PyObject *__pyx_v_log); /*proto*/ +static char __pyx_doc_4lxml_5etree_use_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 PyObject *__pyx_pf_4lxml_5etree_use_global_python_log(PyObject *__pyx_self, PyObject *__pyx_v_log) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("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[7]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":480 + * 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[7]; __pyx_lineno = 480; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":484 + * + * # 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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_forwardError"); + __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":486 + * 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-2.2/src/lxml/xmlerror.pxi":487 + * 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-2.2/src/lxml/xmlerror.pxi":489 + * 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[7]; __pyx_lineno = 489; __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-2.2/src/lxml/xmlerror.pxi":490 + * 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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":492 + * 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) { + int __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":495 + * # no Python objects here, may be called without thread context ! + * # when we declare a Python object, Pyrex will INCREF(None) ! + * if __DEBUG != 0: # <<<<<<<<<<<<<< + * _forwardError(c_log_handler, error) + * + */ + __pyx_t_1 = (1 != 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":496 + * # when we declare a Python object, Pyrex will INCREF(None) ! + * if __DEBUG != 0: + * _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); + goto __pyx_L3; + } + __pyx_L3:; + +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":498 + * _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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":507 + * 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 (!(1 == 0)) { + __pyx_t_1 = (__pyx_v_msg == NULL); + } else { + __pyx_t_1 = (1 == 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":508 + * 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-2.2/src/lxml/xmlerror.pxi":509 + * if __DEBUG == 0 or msg is NULL: + * return + * if msg[0] == c'\n' or msg[0] == c'\0': # <<<<<<<<<<<<<< + * return + * + */ + if (!((__pyx_v_msg[0]) == '\n')) { + __pyx_t_1 = ((__pyx_v_msg[0]) == '\x00'); + } else { + __pyx_t_1 = ((__pyx_v_msg[0]) == '\n'); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":510 + * 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-2.2/src/lxml/xmlerror.pxi":512 + * 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-2.2/src/lxml/xmlerror.pxi":513 + * + * cstd.va_start(args, msg) + * if msg[0] == c'%' and msg[1] == c's': # <<<<<<<<<<<<<< + * c_text = cstd.va_charptr(args) + * else: + */ + if (((__pyx_v_msg[0]) == '%')) { + __pyx_t_1 = ((__pyx_v_msg[1]) == 's'); + } else { + __pyx_t_1 = ((__pyx_v_msg[0]) == '%'); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":514 + * 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-2.2/src/lxml/xmlerror.pxi":516 + * 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-2.2/src/lxml/xmlerror.pxi":517 + * 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_295) != 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":518 + * 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-2.2/src/lxml/xmlerror.pxi":519 + * 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-2.2/src/lxml/xmlerror.pxi":521 + * if c_error.file and \ + * cstd.strncmp(c_error.file, + * 'string://__STRING__XSLT', 23) == 0: # <<<<<<<<<<<<<< + * c_error.file = '' + * else: + */ + __pyx_t_1 = (strncmp(__pyx_v_c_error.file, __pyx_k_296, 23) == 0); + } else { + __pyx_t_1 = (__pyx_v_c_error.file != 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":522 + * cstd.strncmp(c_error.file, + * 'string://__STRING__XSLT', 23) == 0: + * c_error.file = '' # <<<<<<<<<<<<<< + * else: + * c_error.file = NULL + */ + __pyx_v_c_error.file = __pyx_k_297; + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":524 + * c_error.file = '' + * 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-2.2/src/lxml/xmlerror.pxi":525 + * else: + * c_error.file = NULL + * if cstd.strstr(msg, 'line %d'): # <<<<<<<<<<<<<< + * c_error.line = cstd.va_int(args) + * else: + */ + __pyx_t_1 = (strstr(__pyx_v_msg, __pyx_k_298) != 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":526 + * 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-2.2/src/lxml/xmlerror.pxi":528 + * 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-2.2/src/lxml/xmlerror.pxi":529 + * else: + * c_error.line = 0 + * if cstd.strstr(msg, 'element %s'): # <<<<<<<<<<<<<< + * c_element = cstd.va_charptr(args) + * else: + */ + __pyx_t_1 = (strstr(__pyx_v_msg, __pyx_k_299) != 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":530 + * 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-2.2/src/lxml/xmlerror.pxi":532 + * 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-2.2/src/lxml/xmlerror.pxi":533 + * else: + * c_element = NULL + * cstd.va_end(args) # <<<<<<<<<<<<<< + * + * c_message = NULL + */ + va_end(__pyx_v_args); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":535 + * 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-2.2/src/lxml/xmlerror.pxi":536 + * + * 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_1 = (__pyx_v_c_text == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":537 + * 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' + */ + if ((__pyx_v_c_element != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":538 + * 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, '%')); + } else { + __pyx_t_1 = (__pyx_v_c_element != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":540 + * 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 = cstd.malloc( + */ + __pyx_v_text_size = strlen(__pyx_v_msg); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":541 + * # special case: a single occurrence of 'element %s' + * text_size = cstd.strlen(msg) + * element_size = cstd.strlen(c_element) # <<<<<<<<<<<<<< + * c_message = cstd.malloc( + * (text_size + element_size + 1) * sizeof(char)) + */ + __pyx_v_element_size = strlen(__pyx_v_c_element); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":543 + * element_size = cstd.strlen(c_element) + * c_message = 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-2.2/src/lxml/xmlerror.pxi":544 + * c_message = 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-2.2/src/lxml/xmlerror.pxi":545 + * (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-2.2/src/lxml/xmlerror.pxi":547 + * 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_300; + } + __pyx_L11:; + goto __pyx_L10; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":548 + * else: + * c_error.message = '' + * elif c_element is NULL: # <<<<<<<<<<<<<< + * c_error.message = c_text + * else: + */ + __pyx_t_1 = (__pyx_v_c_element == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":549 + * 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-2.2/src/lxml/xmlerror.pxi":551 + * c_error.message = c_text + * else: + * text_size = cstd.strlen(c_text) # <<<<<<<<<<<<<< + * element_size = cstd.strlen(c_element) + * c_message = cstd.malloc( + */ + __pyx_v_text_size = strlen(__pyx_v_c_text); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":552 + * else: + * text_size = cstd.strlen(c_text) + * element_size = cstd.strlen(c_element) # <<<<<<<<<<<<<< + * c_message = 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-2.2/src/lxml/xmlerror.pxi":554 + * element_size = cstd.strlen(c_element) + * c_message = 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-2.2/src/lxml/xmlerror.pxi":555 + * c_message = 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_301, __pyx_v_c_text, __pyx_v_c_element); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":556 + * (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-2.2/src/lxml/xmlerror.pxi":558 + * 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-2.2/src/lxml/xmlerror.pxi":559 + * + * 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-2.2/src/lxml/xmlerror.pxi":560 + * 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-2.2/src/lxml/xmlerror.pxi":561 + * 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-2.2/src/lxml/xmlerror.pxi":563 + * 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-2.2/src/lxml/xmlerror.pxi":565 + * _forwardError(c_log_handler, &c_error) + * + * if c_message is not NULL: # <<<<<<<<<<<<<< + * cstd.free(c_message) + * + */ + __pyx_t_1 = (__pyx_v_c_message != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":566 + * + * 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-2.2/src/lxml/xmlerror.pxi":572 + * ################################################################################ + * + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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; + __Pyx_SetupRefcountContext("__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 = 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-2.2/src/lxml/xmlerror.pxi":575 + * 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_kp_compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 575; __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[7]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_302)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_302)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_302)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 575; __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_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_findall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 575; __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_find_constants); + __pyx_v_find_constants = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":576 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorLevels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_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_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":577 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorDomains); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_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_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":578 + * const_defs = ((ErrorLevels, __ERROR_LEVELS), + * (ErrorDomains, __ERROR_DOMAINS), + * (ErrorTypes, __PARSER_ERROR_TYPES), # <<<<<<<<<<<<<< + * (RelaxNGErrorTypes, __RELAXNG_ERROR_TYPES)) + * for cls, constant_tuple in const_defs: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __Pyx_INCREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES); + __Pyx_GIVEREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":579 + * (ErrorDomains, __ERROR_DOMAINS), + * (ErrorTypes, __PARSER_ERROR_TYPES), + * (RelaxNGErrorTypes, __RELAXNG_ERROR_TYPES)) # <<<<<<<<<<<<<< + * for cls, constant_tuple in const_defs: + * reverse_dict = {} + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __Pyx_INCREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES); + __Pyx_GIVEREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES); + __pyx_1 = 0; + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_const_defs); + __pyx_v_const_defs = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":580 + * (ErrorTypes, __PARSER_ERROR_TYPES), + * (RelaxNGErrorTypes, __RELAXNG_ERROR_TYPES)) + * for cls, constant_tuple in const_defs: # <<<<<<<<<<<<<< + * reverse_dict = {} + * cls._names = reverse_dict + */ + if (PyList_CheckExact(__pyx_v_const_defs) || PyTuple_CheckExact(__pyx_v_const_defs)) { + __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_const_defs; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_const_defs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + 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[7]; __pyx_lineno = 580; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_cls); + __pyx_v_cls = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_constant_tuple); + __pyx_v_constant_tuple = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_cls); + __pyx_v_cls = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_constant_tuple); + __pyx_v_constant_tuple = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":581 + * (RelaxNGErrorTypes, __RELAXNG_ERROR_TYPES)) + * for cls, constant_tuple in const_defs: + * reverse_dict = {} # <<<<<<<<<<<<<< + * cls._names = reverse_dict + * cls._getName = reverse_dict.get + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_reverse_dict)); + __pyx_v_reverse_dict = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":582 + * 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_kp__names, ((PyObject *)__pyx_v_reverse_dict)) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":583 + * reverse_dict = {} + * cls._names = reverse_dict + * cls._getName = reverse_dict.get # <<<<<<<<<<<<<< + * for constants in constant_tuple: + * #print len(constants) + 1 + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_reverse_dict), __pyx_kp_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyObject_SetAttr(__pyx_v_cls, __pyx_kp__getName, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":584 + * 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_4 = __pyx_v_constant_tuple; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_constant_tuple); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_4); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_constants); + __pyx_v_constants = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":586 + * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_constants); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_constants); + __Pyx_GIVEREF(__pyx_v_constants); + __pyx_t_3 = PyObject_Call(__pyx_v_find_constants, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_8 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __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_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_1; + __pyx_1 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_1; + __pyx_1 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":587 + * #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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 587; __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*)&PyInt_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 587; __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_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":588 + * 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-2.2/src/lxml/xmlerror.pxi":589 + * 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[7]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __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_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __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_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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":262 + * 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_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":270 + * #print self._c_doc, self._c_doc.dict is __GLOBAL_PARSER_CONTEXT._c_dict + * #print self._c_doc, canDeallocateChildNodes(self._c_doc) + * tree.xmlFreeDoc(self._c_doc) # <<<<<<<<<<<<<< + * #_deallocDocument(self._c_doc) + * + */ + xmlFreeDoc(((struct LxmlDocument *)__pyx_v_self)->_c_doc); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":273 + * #_deallocDocument(self._c_doc) + * + * cdef getroot(self): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * c_node = tree.xmlDocGetRootElement(self._c_doc) + */ + +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_SetupRefcountContext("getroot"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":275 + * cdef getroot(self): + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":276 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":277 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":278 + * 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 = 278; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":280 + * return _elementFactory(self, c_node) + * + * cdef bint hasdoctype(self): # <<<<<<<<<<<<<< + * return self._c_doc.intSubset is not NULL + * + */ + +static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *__pyx_v_self) { + int __pyx_r; + __Pyx_SetupRefcountContext("hasdoctype"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":281 + * + * cdef bint hasdoctype(self): + * return self._c_doc.intSubset is not NULL # <<<<<<<<<<<<<< + * + * cdef getdoctype(self): + */ + __pyx_r = (__pyx_v_self->_c_doc->intSubset != NULL); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":283 + * return self._c_doc.intSubset is not NULL + * + * cdef getdoctype(self): # <<<<<<<<<<<<<< + * cdef tree.xmlDtd* c_dtd + * cdef xmlNode* c_root_node + */ + +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; + __Pyx_SetupRefcountContext("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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":286 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":287 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":288 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":289 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":290 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":291 + * 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 = 291; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":292 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":293 + * 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 = 293; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":294 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":295 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":296 + * 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 = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ((!__pyx_t_1)) { + __pyx_t_3 = (__pyx_v_c_dtd->ExternalID != NULL); + } else { + __pyx_t_3 = (!__pyx_t_1); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":297 + * 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 = 297; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":298 + * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_sys_url); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ((!__pyx_t_3)) { + __pyx_t_1 = (__pyx_v_c_dtd->SystemID != NULL); + } else { + __pyx_t_1 = (!__pyx_t_3); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":299 + * 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 = 299; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":300 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":301 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":302 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":304 + * 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 = 304; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":305 + * 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 = 305; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":307 + * return (root_name, public_id, sys_url) + * + * cdef getxmlinfo(self): # <<<<<<<<<<<<<< + * cdef xmlDoc* c_doc + * 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_SetupRefcountContext("getxmlinfo"); + __pyx_v_version = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_encoding = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":309 + * cdef getxmlinfo(self): + * cdef xmlDoc* c_doc + * c_doc = self._c_doc # <<<<<<<<<<<<<< + * if c_doc.version is NULL: + * version = None + */ + __pyx_v_c_doc = __pyx_v_self->_c_doc; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":310 + * cdef xmlDoc* c_doc + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":311 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":313 + * 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 = 313; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":314 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":315 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":317 + * 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 = 317; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":318 + * 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 = 318; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":320 + * return (version, encoding) + * + * cdef isstandalone(self): # <<<<<<<<<<<<<< + * if self._c_doc.standalone == -1: + * return None + */ + +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_SetupRefcountContext("isstandalone"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":321 + * + * cdef isstandalone(self): + * if self._c_doc.standalone == -1: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_self->_c_doc->standalone == -1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":322 + * cdef isstandalone(self): + * if self._c_doc.standalone == -1: + * return None # <<<<<<<<<<<<<< + * else: + * return (self._c_doc.standalone == 1) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":324 + * return None + * else: + * return (self._c_doc.standalone == 1) # <<<<<<<<<<<<<< + * + * cdef buildNewPrefix(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(((int)(__pyx_v_self->_c_doc->standalone == 1))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":326 + * return (self._c_doc.standalone == 1) + * + * cdef buildNewPrefix(self): # <<<<<<<<<<<<<< + * if self._ns_counter < python.PyTuple_GET_SIZE(_PREFIX_CACHE): + * ns = python.PyTuple_GET_ITEM(_PREFIX_CACHE, self._ns_counter) + */ + +static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *__pyx_v_self) { + PyObject *__pyx_v_ns; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("buildNewPrefix"); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":327 + * + * cdef buildNewPrefix(self): + * if self._ns_counter < python.PyTuple_GET_SIZE(_PREFIX_CACHE): # <<<<<<<<<<<<<< + * ns = python.PyTuple_GET_ITEM(_PREFIX_CACHE, self._ns_counter) + * python.Py_INCREF(ns) + */ + __pyx_t_1 = (__pyx_v_self->_ns_counter < PyTuple_GET_SIZE(__pyx_v_4lxml_5etree__PREFIX_CACHE)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":328 + * cdef buildNewPrefix(self): + * if self._ns_counter < python.PyTuple_GET_SIZE(_PREFIX_CACHE): + * ns = python.PyTuple_GET_ITEM(_PREFIX_CACHE, self._ns_counter) # <<<<<<<<<<<<<< + * python.Py_INCREF(ns) + * else: + */ + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_4lxml_5etree__PREFIX_CACHE, __pyx_v_self->_ns_counter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":329 + * if self._ns_counter < python.PyTuple_GET_SIZE(_PREFIX_CACHE): + * ns = python.PyTuple_GET_ITEM(_PREFIX_CACHE, self._ns_counter) + * python.Py_INCREF(ns) # <<<<<<<<<<<<<< + * else: + * ns = python.PyString_FromFormat("ns%d", self._ns_counter) + */ + Py_INCREF(__pyx_v_ns); + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":331 + * python.Py_INCREF(ns) + * else: + * ns = python.PyString_FromFormat("ns%d", self._ns_counter) # <<<<<<<<<<<<<< + * if self._prefix_tail is not None: + * ns += self._prefix_tail + */ + __pyx_t_2 = PyString_FromFormat(__pyx_k_303, __pyx_v_self->_ns_counter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __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_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":332 + * else: + * ns = python.PyString_FromFormat("ns%d", self._ns_counter) + * if self._prefix_tail is not None: # <<<<<<<<<<<<<< + * ns += self._prefix_tail + * self._ns_counter += 1 + */ + __pyx_t_1 = (__pyx_v_self->_prefix_tail != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":333 + * ns = python.PyString_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_1 = PyNumber_InPlaceAdd(__pyx_v_ns, __pyx_v_self->_prefix_tail); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_1; + __pyx_1 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":334 + * 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 += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":335 + * ns += self._prefix_tail + * self._ns_counter += 1 + * if self._ns_counter < 0: # <<<<<<<<<<<<<< + * # overflow! + * self._ns_counter = 0 + */ + __pyx_t_1 = (__pyx_v_self->_ns_counter < 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":337 + * if self._ns_counter < 0: + * # overflow! + * self._ns_counter = 0 # <<<<<<<<<<<<<< + * if self._prefix_tail is None: + * self._prefix_tail = "A" + */ + __pyx_v_self->_ns_counter = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":338 + * # overflow! + * self._ns_counter = 0 + * if self._prefix_tail is None: # <<<<<<<<<<<<<< + * self._prefix_tail = "A" + * else: + */ + __pyx_t_1 = (__pyx_v_self->_prefix_tail == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":339 + * self._ns_counter = 0 + * if self._prefix_tail is None: + * self._prefix_tail = "A" # <<<<<<<<<<<<<< + * else: + * self._prefix_tail += "A" + */ + __Pyx_INCREF(__pyx_kp_304); + __Pyx_GIVEREF(__pyx_kp_304); + __Pyx_GOTREF(__pyx_v_self->_prefix_tail); + __Pyx_DECREF(__pyx_v_self->_prefix_tail); + __pyx_v_self->_prefix_tail = __pyx_kp_304; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":341 + * self._prefix_tail = "A" + * else: + * self._prefix_tail += "A" # <<<<<<<<<<<<<< + * return ns + * + */ + __pyx_1 = PyNumber_InPlaceAdd(__pyx_v_self->_prefix_tail, __pyx_kp_305); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GIVEREF(__pyx_1); + __Pyx_GOTREF(__pyx_v_self->_prefix_tail); + __Pyx_DECREF(__pyx_v_self->_prefix_tail); + __pyx_v_self->_prefix_tail = __pyx_1; + __pyx_1 = 0; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":342 + * else: + * self._prefix_tail += "A" + * return ns # <<<<<<<<<<<<<< + * + * cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ns); + __pyx_r = __pyx_v_ns; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Document.buildNewPrefix"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":344 + * return ns + * + * cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node, # <<<<<<<<<<<<<< + * char* c_href, char* c_prefix) except NULL: + * u"""Get or create namespace structure for a node. Reuses the prefix if + */ + +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) { + 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; + __Pyx_SetupRefcountContext("_findOrBuildNodeNs"); + __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":352 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":353 + * 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 PYREX_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_c_node->type == XML_ELEMENT_NODE))) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":355 + * 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 + * c_ns = tree.xmlSearchNsByHref(self._c_doc, c_node, c_href) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __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 = 355; __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 = 355; __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_306), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":357 + * c_node.type, tree.XML_ELEMENT_NODE) + * # look for existing ns + * c_ns = tree.xmlSearchNsByHref(self._c_doc, c_node, c_href) # <<<<<<<<<<<<<< + * if c_ns is not NULL: + * return c_ns + */ + __pyx_v_c_ns = xmlSearchNsByHref(__pyx_v_self->_c_doc, __pyx_v_c_node, __pyx_v_c_href); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":358 + * # look for existing ns + * c_ns = tree.xmlSearchNsByHref(self._c_doc, c_node, c_href) + * if c_ns is not NULL: # <<<<<<<<<<<<<< + * return c_ns + * + */ + __pyx_t_1 = (__pyx_v_c_ns != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":359 + * c_ns = tree.xmlSearchNsByHref(self._c_doc, c_node, c_href) + * if c_ns is not NULL: + * return c_ns # <<<<<<<<<<<<<< + * + * if c_prefix is NULL: + */ + __pyx_r = __pyx_v_c_ns; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":361 + * return c_ns + * + * if c_prefix is NULL: # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem( + * _DEFAULT_NAMESPACE_PREFIXES, c_href) + */ + __pyx_t_1 = (__pyx_v_c_prefix == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":363 + * if c_prefix is NULL: + * dict_result = python.PyDict_GetItem( + * _DEFAULT_NAMESPACE_PREFIXES, c_href) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * prefix = dict_result + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_dict_result = PyDict_GetItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":364 + * dict_result = python.PyDict_GetItem( + * _DEFAULT_NAMESPACE_PREFIXES, c_href) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * prefix = dict_result + * else: + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":365 + * _DEFAULT_NAMESPACE_PREFIXES, c_href) + * if dict_result is not NULL: + * prefix = 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_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":367 + * prefix = dict_result + * else: + * prefix = self.buildNewPrefix() # <<<<<<<<<<<<<< + * c_prefix = _cstr(prefix) + * + */ + __pyx_t_3 = ((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 = 367; __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_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":368 + * else: + * prefix = self.buildNewPrefix() + * c_prefix = _cstr(prefix) # <<<<<<<<<<<<<< + * + * # make sure the prefix is not in use already + */ + __pyx_v_c_prefix = PyString_AS_STRING(__pyx_v_prefix); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":371 + * + * # 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_1 = (xmlSearchNs(__pyx_v_self->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix) != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":372 + * # 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 = ((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 = 372; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":373 + * while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL: + * prefix = self.buildNewPrefix() + * c_prefix = _cstr(prefix) # <<<<<<<<<<<<<< + * + * c_ns = tree.xmlNewNs(c_node, c_href, c_prefix) + */ + __pyx_v_c_prefix = PyString_AS_STRING(__pyx_v_prefix); + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":375 + * c_prefix = _cstr(prefix) + * + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":376 + * + * c_ns = tree.xmlNewNs(c_node, c_href, c_prefix) + * if c_ns is NULL: # <<<<<<<<<<<<<< + * python.PyErr_NoMemory() + * return c_ns + */ + __pyx_t_1 = (__pyx_v_c_ns == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":377 + * 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 = 377; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":378 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":380 + * 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_SetupRefcountContext("_setNodeNs"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":383 + * u"Lookup namespace structure and set it for the node." + * cdef xmlNs* c_ns + * c_ns = self._findOrBuildNodeNs(c_node, href, NULL) # <<<<<<<<<<<<<< + * 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); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_ns = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":384 + * cdef xmlNs* c_ns + * c_ns = self._findOrBuildNodeNs(c_node, href, NULL) + * tree.xmlSetNs(c_node, c_ns) # <<<<<<<<<<<<<< + * + * cdef __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":386 + * tree.xmlSetNs(c_node, c_ns) + * + * cdef __initPrefixCache(): # <<<<<<<<<<<<<< + * cdef int i + * return tuple([ python.PyString_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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__initPrefixCache"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":388 + * cdef __initPrefixCache(): + * cdef int i + * return tuple([ python.PyString_FromFormat("ns%d", i) # <<<<<<<<<<<<<< + * for i from 0 <= i < 30 ]) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":389 + * cdef int i + * return tuple([ python.PyString_FromFormat("ns%d", i) + * for i from 0 <= i < 30 ]) # <<<<<<<<<<<<<< + * + * cdef object _PREFIX_CACHE + */ + for (__pyx_v_i = 0; __pyx_v_i < 30; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":388 + * cdef __initPrefixCache(): + * cdef int i + * return tuple([ python.PyString_FromFormat("ns%d", i) # <<<<<<<<<<<<<< + * for i from 0 <= i < 30 ]) + * + */ + __pyx_t_2 = PyString_FromFormat(__pyx_k_307, __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_2); if (unlikely(__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__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.__initPrefixCache"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":398 + * 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_SetupRefcountContext("_documentFactory"); + __Pyx_INCREF((PyObject *)__pyx_v_parser); + __pyx_v_result = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":400 + * 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 = 400; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":401 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":402 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":403 + * 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(__pyx_v_result->_prefix_tail); + __pyx_v_result->_prefix_tail = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":404 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":405 + * 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 = 405; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":406 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":407 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":413 + * u"Document information provided by parser and DTD." + * cdef _Document _doc + * def __init__(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___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_7DocInfo___init__[] = "Create a DocInfo object for an ElementTree object or root Element."; +static int __pyx_pf_4lxml_5etree_7DocInfo___init__(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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tree,0}; + __Pyx_SetupRefcountContext("__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_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __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("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.DocInfo.__init__"); + 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":415 + * def __init__(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 = 415; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":416 + * 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 = 416; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":417 + * 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_2 = __Pyx_PyObject_IsTrue(__pyx_v_root_name); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":418 + * 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_308), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree.DocInfo.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_root_name); + __Pyx_DECREF(__pyx_v_public_id); + __Pyx_DECREF(__pyx_v_system_url); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":422 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":423 + * 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 = 423; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":424 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":428 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":429 + * 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 = 429; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":430 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":434 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":435 + * 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 = 435; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":436 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":440 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + __pyx_v_xml_version = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_encoding = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":441 + * 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 = 441; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_xml_version); + __pyx_v_xml_version = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_xml_version); + __pyx_v_xml_version = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":442 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":446 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + __pyx_v_xml_version = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_encoding = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":447 + * 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 = 447; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_xml_version); + __pyx_v_xml_version = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_xml_version); + __pyx_v_xml_version = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":448 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":458 + * ``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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":459 + * """ + * 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 = 459; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":463 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":464 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":465 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":466 + * 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 = 466; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":467 + * 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___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/ +static int __pyx_pf_4lxml_5etree_7DocInfo_3URL___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_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":469 + * 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 = 469; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":470 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":471 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":472 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":474 + * 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(PyString_AS_STRING(__pyx_v_url)); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":475 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":476 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":480 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":481 + * 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 = 481; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_root_name); + __pyx_v_root_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_public_id); + __pyx_v_public_id = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_system_url); + __pyx_v_system_url = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":482 + * def __get__(self): + * root_name, public_id, system_url = self._doc.getdoctype() + * if public_id: # <<<<<<<<<<<<<< + * if system_url: + * return u'' % ( + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":483 + * root_name, public_id, system_url = self._doc.getdoctype() + * if public_id: + * if system_url: # <<<<<<<<<<<<<< + * return u'' % ( + * root_name, public_id, system_url) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":484 + * if public_id: + * if system_url: + * return u'' % ( # <<<<<<<<<<<<<< + * root_name, public_id, system_url) + * else: + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":485 + * if system_url: + * return u'' % ( + * root_name, public_id, system_url) # <<<<<<<<<<<<<< + * else: + * return u'' % ( + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __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_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_309), ((PyObject *)__pyx_t_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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":487 + * root_name, public_id, system_url) + * else: + * return u'' % ( # <<<<<<<<<<<<<< + * root_name, public_id) + * elif system_url: + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":488 + * else: + * return u'' % ( + * root_name, public_id) # <<<<<<<<<<<<<< + * elif system_url: + * return u'' % ( + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_root_name); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_root_name); + __Pyx_GIVEREF(__pyx_v_root_name); + __Pyx_INCREF(__pyx_v_public_id); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_public_id); + __Pyx_GIVEREF(__pyx_v_public_id); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_310), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L6:; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":489 + * return u'' % ( + * root_name, public_id) + * elif system_url: # <<<<<<<<<<<<<< + * return u'' % ( + * root_name, system_url) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":490 + * root_name, public_id) + * elif system_url: + * return u'' % ( # <<<<<<<<<<<<<< + * root_name, system_url) + * elif self._doc.hasdoctype(): + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":491 + * elif system_url: + * return u'' % ( + * root_name, system_url) # <<<<<<<<<<<<<< + * elif self._doc.hasdoctype(): + * return u'' % root_name + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __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_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_311), ((PyObject *)__pyx_t_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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":492 + * return u'' % ( + * root_name, system_url) + * elif self._doc.hasdoctype(): # <<<<<<<<<<<<<< + * return u'' % root_name + * else: + */ + __pyx_t_2 = ((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_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":493 + * root_name, system_url) + * elif self._doc.hasdoctype(): + * return u'' % root_name # <<<<<<<<<<<<<< + * else: + * return u"" + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_312), __pyx_v_root_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __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-2.2/src/lxml/lxml.etree.pyx":495 + * return u'' % root_name + * else: + * return u"" # <<<<<<<<<<<<<< + * + * property internalDTD: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_313)); + __pyx_r = ((PyObject *)__pyx_kp_313); + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":499 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":500 + * 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 = 500; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":504 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":505 + * 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 = 505; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":522 + * cdef object _attrib + * + * def _init(self): # <<<<<<<<<<<<<< + * u"""_init(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(PyObject *__pyx_v_self, 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, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("_init"); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":529 + * """ + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * #print "trying to free node:", self._c_node + * #displayNode(self._c_node, 0) + */ + +static void __pyx_pf_4lxml_5etree_8_Element___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_8_Element___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":532 + * #print "trying to free node:", 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":533 + * #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 = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":534 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":535 + * _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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":539 + * # MANIPULATORS + * + * def __setitem__(self, x, value): # <<<<<<<<<<<<<< + * u"""__setitem__(self, x, value) + * + */ + +static int __pyx_pf_4lxml_5etree_8_Element___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___setitem__[] = "__setitem__(self, x, value)\n\n Replaces the given subelement index or slice.\n "; +static int __pyx_pf_4lxml_5etree_8_Element___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; + __Pyx_SetupRefcountContext("__setitem__"); + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":550 + * cdef bint left_to_right + * cdef Py_ssize_t slicelength, step + * if value is None: # <<<<<<<<<<<<<< + * raise ValueError, u"cannot assign None" + * if python.PySlice_Check(x): + */ + __pyx_t_1 = (__pyx_v_value == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":551 + * cdef Py_ssize_t slicelength, step + * 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_314), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":552 + * if value is None: + * raise ValueError, u"cannot assign None" + * if python.PySlice_Check(x): # <<<<<<<<<<<<<< + * # slice assignment + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + */ + __pyx_t_1 = PySlice_Check(__pyx_v_x); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":554 + * if python.PySlice_Check(x): + * # slice assignment + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) # <<<<<<<<<<<<<< + * if step > 0: + * left_to_right = 1 + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__findChildSlice(((PySliceObject *)__pyx_v_x), ((struct LxmlElement *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":555 + * # slice assignment + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + * if step > 0: # <<<<<<<<<<<<<< + * left_to_right = 1 + * else: + */ + __pyx_t_1 = (__pyx_v_step > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":556 + * _findChildSlice(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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":558 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":559 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":560 + * left_to_right = 0 + * step = -step + * _replaceSlice(self, c_node, slicelength, step, left_to_right, value) # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_t_2 = __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_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":561 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":564 + * else: + * # otherwise: normal item assignment + * element = value # <<<<<<<<<<<<<< + * c_node = _findChild(self._c_node, x) + * if c_node is NULL: + */ + if (!(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":565 + * # otherwise: normal item assignment + * element = value + * 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 = 565; __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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":566 + * element = value + * 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":567 + * 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_315), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":568 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":569 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":570 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":571 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":572 + * _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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":573 + * 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_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":574 + * _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_1 = (!__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":575 + * 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_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._Element.__setitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":577 + * moveNodeToDocument(self._doc, c_node.doc, c_node) + * + * def __delitem__(self, x): # <<<<<<<<<<<<<< + * u"""__delitem__(self, x) + * + */ + +static int __pyx_pf_4lxml_5etree_8_Element___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___delitem__[] = "__delitem__(self, x)\n\n Deletes the given subelement or a slice.\n "; +static int __pyx_pf_4lxml_5etree_8_Element___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; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__delitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":585 + * cdef xmlNode* c_next + * cdef Py_ssize_t step, slicelength + * if python.PySlice_Check(x): # <<<<<<<<<<<<<< + * # slice deletion + * if _isFullSlice(x): + */ + __pyx_t_1 = PySlice_Check(__pyx_v_x); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":587 + * if python.PySlice_Check(x): + * # slice deletion + * if _isFullSlice(x): # <<<<<<<<<<<<<< + * c_node = self._c_node.children + * if c_node is not NULL: + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__isFullSlice(((PySliceObject *)__pyx_v_x)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":588 + * # slice deletion + * if _isFullSlice(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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":589 + * if _isFullSlice(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_1 = (__pyx_v_c_node != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":590 + * 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_1 = (!_isElement(__pyx_v_c_node)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":591 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":592 + * 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_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":593 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":594 + * while c_node is not NULL: + * c_next = _nextElement(c_node) + * _removeNode(self._doc, c_node) # <<<<<<<<<<<<<< + * c_node = c_next + * else: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":595 + * c_next = _nextElement(c_node) + * _removeNode(self._doc, c_node) + * c_node = c_next # <<<<<<<<<<<<<< + * else: + * _findChildSlice(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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":597 + * c_node = c_next + * else: + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) # <<<<<<<<<<<<<< + * _deleteSlice(self._doc, c_node, slicelength, step) + * else: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__findChildSlice(((PySliceObject *)__pyx_v_x), ((struct LxmlElement *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":598 + * else: + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + * _deleteSlice(self._doc, c_node, slicelength, step) # <<<<<<<<<<<<<< + * else: + * # item deletion + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__deleteSlice(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L6:; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":601 + * 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_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 = 601; __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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":602 + * # 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":603 + * 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_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_316), __pyx_v_x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":604 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":605 + * raise IndexError, u"index out of range: %d" % x + * _removeText(c_node.next) + * _removeNode(self._doc, c_node) # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree._Element.__delitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":607 + * _removeNode(self._doc, c_node) + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * u"__deepcopy__(self, memo)" + * return self.__copy__() + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___deepcopy__[] = "__deepcopy__(self, memo)"; +static PyObject *__pyx_pf_4lxml_5etree_8_Element___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__deepcopy__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":609 + * 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_kp___copy__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __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 = 609; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":611 + * return self.__copy__() + * + * def __copy__(self): # <<<<<<<<<<<<<< + * u"__copy__(self)" + * cdef xmlDoc* c_doc + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element___copy__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___copy__[] = "__copy__(self)"; +static PyObject *__pyx_pf_4lxml_5etree_8_Element___copy__(PyObject *__pyx_v_self, 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; + xmlDoc *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__copy__"); + __pyx_v_new_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":616 + * cdef xmlNode* c_node + * cdef _Document new_doc + * 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_1 = __pyx_f_4lxml_5etree__copyDocRoot(((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc, ((struct LxmlElement *)__pyx_v_self)->_c_node); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":617 + * cdef _Document new_doc + * 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_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct LxmlElement *)__pyx_v_self)->_doc->_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_new_doc)); + __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":618 + * 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_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_new_doc->__pyx_vtab)->getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __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-2.2/src/lxml/lxml.etree.pyx":619 + * new_doc = _documentFactory(c_doc, self._doc._parser) + * 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-2.2/src/lxml/lxml.etree.pyx":620 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":622 + * 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-2.2/src/lxml/lxml.etree.pyx":623 + * # 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_3 = (__pyx_v_c_node->type != ((struct LxmlElement *)__pyx_v_self)->_c_node->type); + } else { + __pyx_t_3 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":624 + * 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-2.2/src/lxml/lxml.etree.pyx":625 + * 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_3 = (__pyx_v_c_node == NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":626 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":627 + * if c_node is NULL: + * return None + * return _elementFactory(new_doc, c_node) # <<<<<<<<<<<<<< + * + * def set(self, key, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __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; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":629 + * return _elementFactory(new_doc, c_node) + * + * def set(self, key, value): # <<<<<<<<<<<<<< + * u"""set(self, key, value) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_set[] = "set(self, key, value)\n\n Sets an element attribute.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_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_kp_key,&__pyx_kp_value,0}; + __Pyx_SetupRefcountContext("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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __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 = 629; __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 = 629; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.set"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":634 + * Sets an element attribute. + * """ + * _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 = 634; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":636 + * _setAttributeValue(self, key, value) + * + * def append(self, _Element element not None): # <<<<<<<<<<<<<< + * u"""append(self, element) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_append(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_append[] = "append(self, element)\n\n Adds a subelement to the end of this element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_append(PyObject *__pyx_v_self, PyObject *__pyx_v_element) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("append"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":641 + * Adds a subelement to the end of this element. + * """ + * _appendChild(self, element) # <<<<<<<<<<<<<< + * + * def addnext(self, _Element element): + */ + __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 = 641; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":643 + * _appendChild(self, element) + * + * def addnext(self, _Element element): # <<<<<<<<<<<<<< + * u"""addnext(self, element) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_addnext(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_addnext[] = "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_addnext(PyObject *__pyx_v_self, PyObject *__pyx_v_element) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("addnext"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 1, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":653 + * discarded when adding at the root level. + * """ + * 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: + */ + if ((((struct LxmlElement *)__pyx_v_self)->_c_node->parent != NULL)) { + __pyx_t_1 = (!_isElement(((struct LxmlElement *)__pyx_v_self)->_c_node->parent)); + } else { + __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_c_node->parent != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":654 + * """ + * 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_1 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_PI_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":655 + * 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_1 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_COMMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":656 + * 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_317), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":657 + * 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_kp_tail, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":658 + * 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): + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__appendSibling(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":660 + * _appendSibling(self, element) + * + * def addprevious(self, _Element element): # <<<<<<<<<<<<<< + * u"""addprevious(self, element) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_addprevious(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_addprevious[] = "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_addprevious(PyObject *__pyx_v_self, PyObject *__pyx_v_element) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("addprevious"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 1, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":670 + * automatically discarded when adding at the root level. + * """ + * 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: + */ + if ((((struct LxmlElement *)__pyx_v_self)->_c_node->parent != NULL)) { + __pyx_t_1 = (!_isElement(((struct LxmlElement *)__pyx_v_self)->_c_node->parent)); + } else { + __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_c_node->parent != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":671 + * """ + * 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_1 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_PI_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":672 + * 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_1 = (((struct LxmlElement *)__pyx_v_element)->_c_node->type != XML_COMMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":673 + * 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_318), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":674 + * 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_kp_tail, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":675 + * 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_2 = __pyx_f_4lxml_5etree__prependSibling(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":677 + * _prependSibling(self, element) + * + * def extend(self, elements): # <<<<<<<<<<<<<< + * u"""extend(self, elements) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_extend[] = "extend(self, elements)\n\n Extends the current children by the elements in the iterable.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) { + PyObject *__pyx_v_element; + PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("extend"); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":682 + * Extends the current children by the elements in the iterable. + * """ + * for element in elements: # <<<<<<<<<<<<<< + * _appendChild(self, element) + * + */ + if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) { + __pyx_t_1 = 0; __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __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[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_element); + __pyx_v_element = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":683 + * """ + * for element in elements: + * _appendChild(self, element) # <<<<<<<<<<<<<< + * + * def clear(self): + */ + if (!(__Pyx_TypeTest(__pyx_v_element, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __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_AddTraceback("lxml.etree._Element.extend"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_element); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":685 + * _appendChild(self, element) + * + * def clear(self): # <<<<<<<<<<<<<< + * u"""clear(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_clear(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_clear[] = "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_clear(PyObject *__pyx_v_self, 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; + __Pyx_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":695 + * cdef xmlNode* c_node + * cdef xmlNode* c_node_next + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":697 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":698 + * # 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":700 + * _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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":701 + * # 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_1 = (__pyx_v_c_attr != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":702 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":703 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":704 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":706 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":707 + * # 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_1 = (__pyx_v_c_node != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":708 + * 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_1 = (!_isElement(__pyx_v_c_node)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":709 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":710 + * 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_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":711 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":712 + * while c_node is not NULL: + * c_node_next = _nextElement(c_node) + * _removeNode(self._doc, c_node) # <<<<<<<<<<<<<< + * c_node = c_node_next + * + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":713 + * 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_AddTraceback("lxml.etree._Element.clear"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":715 + * 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_insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_insert[] = "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_insert(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; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_index,&__pyx_kp_element,0}; + __Pyx_SetupRefcountContext("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_kp_index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_element); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __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 = 715; __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 = 715; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.insert"); + 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 = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":723 + * cdef xmlNode* c_next + * cdef xmlDoc* c_source_doc + * c_node = _findChild(self._c_node, index) # <<<<<<<<<<<<<< + * if c_node is NULL: + * _appendChild(self, element) + */ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __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_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":724 + * cdef xmlDoc* c_source_doc + * c_node = _findChild(self._c_node, index) + * if c_node is NULL: # <<<<<<<<<<<<<< + * _appendChild(self, element) + * return + */ + __pyx_t_2 = (__pyx_v_c_node == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":725 + * c_node = _findChild(self._c_node, index) + * if c_node is NULL: + * _appendChild(self, element) # <<<<<<<<<<<<<< + * return + * c_source_doc = c_node.doc + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_element); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":726 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":727 + * _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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":728 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":729 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":730 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":731 + * 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_3 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __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.insert"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":733 + * 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_remove(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_remove[] = "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_remove(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; + __Pyx_SetupRefcountContext("remove"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":742 + * cdef xmlNode* c_node + * cdef xmlNode* c_next + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":743 + * cdef xmlNode* c_next + * 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_1 = (__pyx_v_c_node->parent != ((struct LxmlElement *)__pyx_v_self)->_c_node); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":744 + * 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_319), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":745 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":746 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":747 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":749 + * _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_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __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.remove"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":751 + * 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_replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_replace[] = "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_replace(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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_old_element,&__pyx_kp_new_element,0}; + __Pyx_SetupRefcountContext("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_kp_old_element); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_new_element); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __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 = 751; __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 = 751; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.replace"); + 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 = 751; __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 = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":762 + * cdef xmlNode* c_new_next + * cdef xmlDoc* c_source_doc + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":763 + * cdef xmlDoc* c_source_doc + * 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_1 = (__pyx_v_c_old_node->parent != ((struct LxmlElement *)__pyx_v_self)->_c_node); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":764 + * 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_320), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":765 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":766 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":767 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":768 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":769 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":770 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":771 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":772 + * _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_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_source_doc, __pyx_v_c_new_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":774 + * 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_2 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_old_node->doc, __pyx_v_c_old_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __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.replace"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":780 + * 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; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":781 + * """ + * def __get__(self): + * if self._tag is not None: # <<<<<<<<<<<<<< + * return self._tag + * self._tag = _namespacedName(self._c_node) + */ + __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_tag != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":782 + * def __get__(self): + * if self._tag is not None: + * return self._tag # <<<<<<<<<<<<<< + * self._tag = _namespacedName(self._c_node) + * return self._tag + */ + __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":783 + * if self._tag is not None: + * return self._tag + * self._tag = _namespacedName(self._c_node) # <<<<<<<<<<<<<< + * return self._tag + * + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(((struct LxmlElement *)__pyx_v_self)->_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct LxmlElement *)__pyx_v_self)->_tag); + __Pyx_DECREF(((struct LxmlElement *)__pyx_v_self)->_tag); + ((struct LxmlElement *)__pyx_v_self)->_tag = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":784 + * return self._tag + * 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_2); + __Pyx_AddTraceback("lxml.etree._Element.tag.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":786 + * return self._tag + * + * def __set__(self, value): # <<<<<<<<<<<<<< + * cdef _BaseParser parser + * ns, name = _getNsTag(value) + */ + +static int __pyx_pf_4lxml_5etree_8_Element_3tag___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_8_Element_3tag___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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":788 + * def __set__(self, value): + * cdef _BaseParser parser + * ns, name = _getNsTag(value) # <<<<<<<<<<<<<< + * parser = self._doc._parser + * if parser is not None and parser._for_html: + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":789 + * cdef _BaseParser parser + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":790 + * ns, name = _getNsTag(value) + * parser = self._doc._parser + * if parser is not None and parser._for_html: # <<<<<<<<<<<<<< + * _htmlTagValidOrRaise(name) + * else: + */ + __pyx_t_2 = (((PyObject *)__pyx_v_parser) != Py_None); + if (__pyx_t_2) { + __pyx_t_3 = __pyx_v_parser->_for_html; + } else { + __pyx_t_3 = __pyx_t_2; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":791 + * parser = self._doc._parser + * if parser is not None and parser._for_html: + * _htmlTagValidOrRaise(name) # <<<<<<<<<<<<<< + * else: + * _tagValidOrRaise(name) + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":793 + * _htmlTagValidOrRaise(name) + * else: + * _tagValidOrRaise(name) # <<<<<<<<<<<<<< + * self._tag = value + * tree.xmlNodeSetName(self._c_node, _cstr(name)) + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":794 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":795 + * _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, PyString_AS_STRING(__pyx_v_name)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":796 + * self._tag = value + * tree.xmlNodeSetName(self._c_node, _cstr(name)) + * if ns is None: # <<<<<<<<<<<<<< + * self._c_node.ns = NULL + * else: + */ + __pyx_t_3 = (__pyx_v_ns == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":797 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":799 + * self._c_node.ns = NULL + * else: + * self._doc._setNodeNs(self._c_node, _cstr(ns)) # <<<<<<<<<<<<<< + * + * property attrib: + */ + __pyx_t_4 = ((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, PyString_AS_STRING(__pyx_v_ns)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":805 + * keys(), values() and items() to access element attributes. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * if self._attrib is None: + * self._attrib = _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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":806 + * """ + * def __get__(self): + * if self._attrib is None: # <<<<<<<<<<<<<< + * self._attrib = _Attrib(self) + * return self._attrib + */ + __pyx_t_1 = (((struct LxmlElement *)__pyx_v_self)->_attrib == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":807 + * def __get__(self): + * if self._attrib is None: + * self._attrib = _Attrib(self) # <<<<<<<<<<<<<< + * return self._attrib + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __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 = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct LxmlElement *)__pyx_v_self)->_attrib); + __Pyx_DECREF(((struct LxmlElement *)__pyx_v_self)->_attrib); + ((struct LxmlElement *)__pyx_v_self)->_attrib = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":808 + * if self._attrib is None: + * self._attrib = _Attrib(self) + * return self._attrib # <<<<<<<<<<<<<< + * + * property text: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct LxmlElement *)__pyx_v_self)->_attrib); + __pyx_r = ((struct LxmlElement *)__pyx_v_self)->_attrib; + 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":814 + * the value None, if there was no text. + * """ + * def __get__(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; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":815 + * """ + * def __get__(self): + * return _collectText(self._c_node.children) # <<<<<<<<<<<<<< + * + * def __set__(self, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__collectText(((struct LxmlElement *)__pyx_v_self)->_c_node->children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __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.text.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":817 + * return _collectText(self._c_node.children) + * + * def __set__(self, value): # <<<<<<<<<<<<<< + * if isinstance(value, QName): + * value = python.PyUnicode_FromEncodedObject( + */ + +static int __pyx_pf_4lxml_5etree_8_Element_4text___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_8_Element_4text___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":818 + * + * def __set__(self, value): + * if isinstance(value, QName): # <<<<<<<<<<<<<< + * value = python.PyUnicode_FromEncodedObject( + * _resolveQNameText(self, value), 'UTF-8', 'strict') + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":820 + * if isinstance(value, QName): + * value = python.PyUnicode_FromEncodedObject( + * _resolveQNameText(self, value), 'UTF-8', 'strict') # <<<<<<<<<<<<<< + * _setNodeText(self._c_node, value) + * + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__resolveQNameText(((struct LxmlElement *)__pyx_v_self), __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyUnicode_FromEncodedObject(__pyx_t_2, __pyx_k_321, __pyx_k_322); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __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_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":821 + * 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_4 = __pyx_f_4lxml_5etree__setNodeText(((struct LxmlElement *)__pyx_v_self)->_c_node, __pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __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._Element.text.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_value); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":832 + * there was no text. + * """ + * def __get__(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; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":833 + * """ + * def __get__(self): + * return _collectText(self._c_node.next) # <<<<<<<<<<<<<< + * + * def __set__(self, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__collectText(((struct LxmlElement *)__pyx_v_self)->_c_node->next); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __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.tail.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":835 + * return _collectText(self._c_node.next) + * + * def __set__(self, value): # <<<<<<<<<<<<<< + * _setTailText(self._c_node, value) + * + */ + +static int __pyx_pf_4lxml_5etree_8_Element_4tail___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_8_Element_4tail___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__set__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":836 + * + * def __set__(self, value): + * _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 = 836; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":846 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":847 + * """ + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":848 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":849 + * 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 = 849; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":850 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":856 + * u"""Original line number as found by the parser or None if unknown. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * cdef long line + * line = tree.xmlGetLineNo(self._c_node) + */ + +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; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":858 + * def __get__(self): + * cdef long line + * line = tree.xmlGetLineNo(self._c_node) # <<<<<<<<<<<<<< + * if line > 0: + * return line + */ + __pyx_v_line = xmlGetLineNo(((struct LxmlElement *)__pyx_v_self)->_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":859 + * cdef long line + * line = tree.xmlGetLineNo(self._c_node) + * if line > 0: # <<<<<<<<<<<<<< + * return line + * else: + */ + __pyx_t_1 = (__pyx_v_line > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":860 + * line = tree.xmlGetLineNo(self._c_node) + * if line > 0: + * return line # <<<<<<<<<<<<<< + * else: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":862 + * 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_2); + __Pyx_AddTraceback("lxml.etree._Element.sourceline.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":864 + * return None + * + * def __set__(self, line): # <<<<<<<<<<<<<< + * if line < 0: + * self._c_node.line = 0 + */ + +static int __pyx_pf_4lxml_5etree_8_Element_10sourceline___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line); /*proto*/ +static int __pyx_pf_4lxml_5etree_8_Element_10sourceline___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + unsigned short __pyx_t_3; + __Pyx_SetupRefcountContext("__set__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":865 + * + * def __set__(self, line): + * if line < 0: # <<<<<<<<<<<<<< + * self._c_node.line = 0 + * else: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_line, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __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 = 865; __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-2.2/src/lxml/lxml.etree.pyx":866 + * def __set__(self, line): + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":868 + * self._c_node.line = 0 + * else: + * self._c_node.line = line # <<<<<<<<<<<<<< + * + * # not in ElementTree, read-only + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedShort(__pyx_v_line); if (unlikely((__pyx_t_3 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct LxmlElement *)__pyx_v_self)->_c_node->line = __pyx_t_3; + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._Element.sourceline.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":874 + * u"""Namespace prefix->URI mapping known in the context of this 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_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":877 + * cdef xmlNode* c_node + * cdef xmlNs* c_ns + * cdef dict nsmap = {} # <<<<<<<<<<<<<< + * c_node = self._c_node + * while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE: + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_v_nsmap = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":878 + * cdef xmlNs* c_ns + * cdef dict nsmap = {} + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":879 + * cdef dict nsmap = {} + * 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":880 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":881 + * 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_1 = (__pyx_v_c_ns != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":882 + * c_ns = c_node.nsDef + * while c_ns is not NULL: + * if c_ns.prefix is NULL: # <<<<<<<<<<<<<< + * prefix = None + * else: + */ + __pyx_t_1 = (__pyx_v_c_ns->prefix == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":883 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":885 + * prefix = None + * else: + * prefix = funicode(c_ns.prefix) # <<<<<<<<<<<<<< + * if not python.PyDict_GetItem(nsmap, prefix): + * nsmap[prefix] = funicode(c_ns.href) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __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_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":886 + * else: + * prefix = funicode(c_ns.prefix) + * if not python.PyDict_GetItem(nsmap, prefix): # <<<<<<<<<<<<<< + * nsmap[prefix] = funicode(c_ns.href) + * c_ns = c_ns.next + */ + __pyx_t_1 = (!(PyDict_GetItem(((PyObject *)__pyx_v_nsmap), __pyx_v_prefix) != 0)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":887 + * prefix = funicode(c_ns.prefix) + * if not python.PyDict_GetItem(nsmap, prefix): + * nsmap[prefix] = funicode(c_ns.href) # <<<<<<<<<<<<<< + * c_ns = c_ns.next + * c_node = c_node.parent + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(((PyObject *)__pyx_v_nsmap), __pyx_v_prefix, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":888 + * if not python.PyDict_GetItem(nsmap, prefix): + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":889 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":890 + * 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_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":904 + * Element, regardless of the document type (XML or HTML). + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * cdef char* c_base + * c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node) + */ + +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; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + __pyx_v_base = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":906 + * def __get__(self): + * cdef char* c_base + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":907 + * cdef char* c_base + * 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_1 = (__pyx_v_c_base == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":908 + * 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_1 = (((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc->URL == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":909 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":910 + * 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_2 = __pyx_f_4lxml_5etree__decodeFilename(((struct LxmlElement *)__pyx_v_self)->_doc->_c_doc->URL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __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-2.2/src/lxml/lxml.etree.pyx":911 + * return None + * return _decodeFilename(self._doc._c_doc.URL) + * base = _decodeFilename(c_base) # <<<<<<<<<<<<<< + * tree.xmlFree(c_base) + * return base + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_base); + __pyx_v_base = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":912 + * return _decodeFilename(self._doc._c_doc.URL) + * base = _decodeFilename(c_base) + * tree.xmlFree(c_base) # <<<<<<<<<<<<<< + * return base + * def __set__(self, url): + */ + xmlFree(__pyx_v_c_base); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":913 + * base = _decodeFilename(c_base) + * tree.xmlFree(c_base) + * return base # <<<<<<<<<<<<<< + * def __set__(self, url): + * cdef char* c_base + */ + __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_2); + __Pyx_AddTraceback("lxml.etree._Element.base.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_base); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":914 + * tree.xmlFree(c_base) + * return base + * def __set__(self, url): # <<<<<<<<<<<<<< + * cdef char* c_base + * if url is None: + */ + +static int __pyx_pf_4lxml_5etree_8_Element_4base___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/ +static int __pyx_pf_4lxml_5etree_8_Element_4base___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) { + char *__pyx_v_c_base; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":916 + * def __set__(self, url): + * cdef char* c_base + * if url is None: # <<<<<<<<<<<<<< + * c_base = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_url == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":917 + * cdef char* c_base + * if url is None: + * c_base = NULL # <<<<<<<<<<<<<< + * else: + * url = _encodeFilename(url) + */ + __pyx_v_c_base = NULL; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":919 + * c_base = NULL + * else: + * url = _encodeFilename(url) # <<<<<<<<<<<<<< + * c_base = _cstr(url) + * tree.xmlNodeSetBase(self._c_node, c_base) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __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-2.2/src/lxml/lxml.etree.pyx":920 + * else: + * url = _encodeFilename(url) + * c_base = _cstr(url) # <<<<<<<<<<<<<< + * tree.xmlNodeSetBase(self._c_node, c_base) + * + */ + __pyx_v_c_base = PyString_AS_STRING(__pyx_v_url); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":921 + * 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_2); + __Pyx_AddTraceback("lxml.etree._Element.base.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_url); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":924 + * + * # ACCESSORS + * def __repr__(self): # <<<<<<<<<<<<<< + * u"__repr__(self)" + * return u"" % (self.tag, id(self)) + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element___repr__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___repr__[] = "__repr__(self)"; +static PyObject *__pyx_pf_4lxml_5etree_8_Element___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_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":926 + * def __repr__(self): + * u"__repr__(self)" + * return u"" % (self.tag, id(self)) # <<<<<<<<<<<<<< + * + * def __getitem__(self, x): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __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 = 926; __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 = 926; __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 = 926; __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_323), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __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_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":928 + * return u"" % (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___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___getitem__[] = "Returns the subelement at the given position or the requested\n slice.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element___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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + __Pyx_SetupRefcountContext("__getitem__"); + __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":937 + * cdef _node_to_node_function next_element + * cdef list result + * if python.PySlice_Check(x): # <<<<<<<<<<<<<< + * # slicing + * if _isFullSlice(x): + */ + __pyx_t_1 = PySlice_Check(__pyx_v_x); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":939 + * if python.PySlice_Check(x): + * # slicing + * if _isFullSlice(x): # <<<<<<<<<<<<<< + * return _collectChildren(self) + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__isFullSlice(((PySliceObject *)__pyx_v_x)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":940 + * # slicing + * if _isFullSlice(x): + * return _collectChildren(self) # <<<<<<<<<<<<<< + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + * if c_node is NULL: + */ + __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 = 940; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":941 + * if _isFullSlice(x): + * return _collectChildren(self) + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) # <<<<<<<<<<<<<< + * if c_node is NULL: + * return [] + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__findChildSlice(((PySliceObject *)__pyx_v_x), ((struct LxmlElement *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":942 + * return _collectChildren(self) + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + * if c_node is NULL: # <<<<<<<<<<<<<< + * return [] + * if step > 0: + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":943 + * _findChildSlice(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_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __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_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":944 + * if c_node is NULL: + * return [] + * if step > 0: # <<<<<<<<<<<<<< + * next_element = _nextElement + * else: + */ + __pyx_t_1 = (__pyx_v_step > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":945 + * 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-2.2/src/lxml/lxml.etree.pyx":947 + * next_element = _nextElement + * else: + * step = -step # <<<<<<<<<<<<<< + * next_element = _previousElement + * result = [] + */ + __pyx_v_step = (-__pyx_v_step); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":948 + * 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-2.2/src/lxml/lxml.etree.pyx":949 + * step = -step + * next_element = _previousElement + * result = [] # <<<<<<<<<<<<<< + * c = 0 + * while c_node is not NULL and c < slicelength: + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.etree.pyx":950 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":951 + * result = [] + * c = 0 + * while c_node is not NULL and c < slicelength: # <<<<<<<<<<<<<< + * result.append(_elementFactory(self._doc, c_node)) + * c = c + 1 + */ + while (1) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c < __pyx_v_slicelength); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":952 + * 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: + */ + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":953 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":954 + * 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_4 = __pyx_v_step; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":955 + * 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-2.2/src/lxml/lxml.etree.pyx":956 + * 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-2.2/src/lxml/lxml.etree.pyx":959 + * else: + * # indexing + * c_node = _findChild(self._c_node, x) # <<<<<<<<<<<<<< + * if c_node is NULL: + * raise IndexError, u"list index out of range" + */ + __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 = 959; __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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":960 + * # 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":961 + * 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_324), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":962 + * 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_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __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._Element.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":964 + * return _elementFactory(self._doc, c_node) + * + * def __len__(self): # <<<<<<<<<<<<<< + * u"""__len__(self) + * + */ + +static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element___len__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___len__[] = "__len__(self)\n\n Returns the number of subelements.\n "; +static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element___len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":969 + * Returns the number of subelements. + * """ + * 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; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":971 + * return _countElements(self._c_node.children) + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * u"__nonzero__(self)" + * import warnings + */ + +static int __pyx_pf_4lxml_5etree_8_Element___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___nonzero__[] = "__nonzero__(self)"; +static int __pyx_pf_4lxml_5etree_8_Element___nonzero__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_warnings; + int __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__nonzero__"); + __pyx_v_warnings = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":973 + * def __nonzero__(self): + * u"__nonzero__(self)" + * import warnings # <<<<<<<<<<<<<< + * warnings.warn( + * u"The behavior of this method will change in future versions. " + */ + __pyx_1 = __Pyx_Import(__pyx_kp_warnings, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_warnings); + __pyx_v_warnings = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":974 + * u"__nonzero__(self)" + * 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_kp_warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":978 + * u"Use specific 'len(elem)' or 'elem is not None' test instead.", + * FutureWarning + * ) # <<<<<<<<<<<<<< + * # emulate old behaviour + * return _hasChild(self._c_node) + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_325)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_325)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_325)); + __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 = 974; __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-2.2/src/lxml/lxml.etree.pyx":980 + * ) + * # emulate old behaviour + * 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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":982 + * 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___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___contains__[] = "__contains__(self, element)"; +static int __pyx_pf_4lxml_5etree_8_Element___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; + __Pyx_SetupRefcountContext("__contains__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":985 + * u"__contains__(self, element)" + * cdef xmlNode* c_node + * if not isinstance(element, _Element): # <<<<<<<<<<<<<< + * return 0 + * c_node = (<_Element>element)._c_node + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":986 + * cdef xmlNode* c_node + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":987 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":988 + * 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): + */ + if ((__pyx_v_c_node != NULL)) { + __pyx_t_2 = (__pyx_v_c_node->parent == ((struct LxmlElement *)__pyx_v_self)->_c_node); + } else { + __pyx_t_2 = (__pyx_v_c_node != NULL); + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":990 + * 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___iter__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___iter__[] = "__iter__(self)"; +static PyObject *__pyx_pf_4lxml_5etree_8_Element___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":992 + * 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 = 992; __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 = 992; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":994 + * return ElementChildIterator(self) + * + * def __reversed__(self): # <<<<<<<<<<<<<< + * u"__reversed__(self)" + * return ElementChildIterator(self, reversed=True) + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element___reversed__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element___reversed__[] = "__reversed__(self)"; +static PyObject *__pyx_pf_4lxml_5etree_8_Element___reversed__(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__reversed__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":996 + * 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 = 996; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_1, __pyx_kp_reversed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __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_1)); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Element.__reversed__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":998 + * 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_index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_index[] = "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_index(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; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_child,&__pyx_kp_start,&__pyx_kp_stop,0}; + __Pyx_SetupRefcountContext("index"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = Py_None; + values[2] = 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_kp_child); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_start); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_stop); + if (unlikely(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 = 998; __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 = Py_None; + __pyx_v_stop = 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 = 998; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.index"); + 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 = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1009 + * cdef xmlNode* c_child + * cdef xmlNode* c_start_node + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1010 + * cdef xmlNode* c_start_node + * 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_1 = (__pyx_v_c_child->parent != ((struct LxmlElement *)__pyx_v_self)->_c_node); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1011 + * 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_326), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1014 + * + * # 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_1 = (__pyx_v_stop == Py_None); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_start == Py_None); + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1015 + * # 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1016 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1017 + * k = 0 + * c_child = c_child.prev + * while c_child is not NULL: # <<<<<<<<<<<<<< + * if _isElement(c_child): + * k = k + 1 + */ + while (1) { + __pyx_t_2 = (__pyx_v_c_child != NULL); + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1018 + * 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_2 = _isElement(__pyx_v_c_child); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1019 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1020 + * if _isElement(c_child): + * k = k + 1 + * c_child = c_child.prev # <<<<<<<<<<<<<< + * return k + * + */ + __pyx_v_c_child = __pyx_v_c_child->prev; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1021 + * k = k + 1 + * c_child = c_child.prev + * return k # <<<<<<<<<<<<<< + * + * # check indices + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __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_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1024 + * + * # check indices + * if start is None: # <<<<<<<<<<<<<< + * c_start = 0 + * else: + */ + __pyx_t_2 = (__pyx_v_start == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1025 + * # check indices + * if start is None: + * c_start = 0 # <<<<<<<<<<<<<< + * else: + * c_start = start + */ + __pyx_v_c_start = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1027 + * c_start = 0 + * else: + * c_start = start # <<<<<<<<<<<<<< + * if stop is None: + * c_stop = 0 + */ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_start = __pyx_t_6; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1028 + * else: + * c_start = start + * if stop is None: # <<<<<<<<<<<<<< + * c_stop = 0 + * else: + */ + __pyx_t_2 = (__pyx_v_stop == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1029 + * c_start = start + * if stop is None: + * c_stop = 0 # <<<<<<<<<<<<<< + * else: + * c_stop = stop + */ + __pyx_v_c_stop = 0; + goto __pyx_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1031 + * 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_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_stop); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_stop = __pyx_t_6; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1032 + * 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" + */ + if (!(__pyx_v_c_stop == 0)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1033 + * 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" + * + */ + if ((__pyx_v_c_start >= __pyx_v_c_stop)) { + if (!(__pyx_v_c_stop > 0)) { + __pyx_t_2 = (__pyx_v_c_start < 0); + } else { + __pyx_t_2 = (__pyx_v_c_stop > 0); + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = (__pyx_v_c_start >= __pyx_v_c_stop); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_stop == 0); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1034 + * 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_327), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1037 + * + * # 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: + */ + if (!(__pyx_v_c_start < 0)) { + __pyx_t_2 = (__pyx_v_c_stop < 0); + } else { + __pyx_t_2 = (__pyx_v_c_start < 0); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1039 + * 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_2 = (__pyx_v_c_start < __pyx_v_c_stop); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1040 + * # 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1042 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1043 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1044 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1045 + * 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) { + if ((__pyx_v_c_start_node != __pyx_v_c_child)) { + __pyx_t_2 = (__pyx_v_l < __pyx_v_k); + } else { + __pyx_t_2 = (__pyx_v_c_start_node != __pyx_v_c_child); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1046 + * 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_2 = _isElement(__pyx_v_c_start_node); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1047 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1048 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1049 + * 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_2 = (__pyx_v_c_start_node == __pyx_v_c_child); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1051 + * 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: + */ + if ((__pyx_v_c_stop < 0)) { + __pyx_t_2 = (__pyx_v_l <= (-__pyx_v_c_stop)); + } else { + __pyx_t_2 = (__pyx_v_c_stop < 0); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1052 + * # 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_328), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L20; + } + __pyx_L20:; + goto __pyx_L19; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1053 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1054 + * 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_329), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L19; + } + __pyx_L19:; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1057 + * + * # 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1058 + * # 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1059 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1061 + * 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) { + if ((__pyx_v_c_child != NULL)) { + __pyx_t_2 = (__pyx_v_k < __pyx_v_c_stop); + } else { + __pyx_t_2 = (__pyx_v_c_child != NULL); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1062 + * # 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_2 = _isElement(__pyx_v_c_child); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1063 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1064 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1065 + * k = k + 1 + * c_child = c_child.prev + * if k < c_stop: # <<<<<<<<<<<<<< + * return k + * else: + */ + __pyx_t_2 = (__pyx_v_k < __pyx_v_c_stop); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1066 + * c_child = c_child.prev + * if k < c_stop: + * return k # <<<<<<<<<<<<<< + * else: + * # traverse all + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __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_L25; + } + __pyx_L25:; + goto __pyx_L21; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1069 + * else: + * # traverse all + * while c_child != NULL: # <<<<<<<<<<<<<< + * if _isElement(c_child): + * k = k + 1 + */ + while (1) { + __pyx_t_2 = (__pyx_v_c_child != NULL); + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1070 + * # traverse all + * while c_child != NULL: + * if _isElement(c_child): # <<<<<<<<<<<<<< + * k = k + 1 + * c_child = c_child.prev + */ + __pyx_t_2 = _isElement(__pyx_v_c_child); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1071 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1072 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1073 + * k = k + 1 + * c_child = c_child.prev + * if c_start > 0: # <<<<<<<<<<<<<< + * if k >= c_start: + * return k + */ + __pyx_t_2 = (__pyx_v_c_start > 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1074 + * c_child = c_child.prev + * if c_start > 0: + * if k >= c_start: # <<<<<<<<<<<<<< + * return k + * else: + */ + __pyx_t_2 = (__pyx_v_k >= __pyx_v_c_start); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1075 + * if c_start > 0: + * if k >= c_start: + * return k # <<<<<<<<<<<<<< + * else: + * return k + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __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_L30; + } + __pyx_L30:; + goto __pyx_L29; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1077 + * 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_3 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __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_L29:; + } + __pyx_L21:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1078 + * else: + * return k + * if c_start != 0 or c_stop != 0: # <<<<<<<<<<<<<< + * raise ValueError, u"list.index(x): x not in slice" + * else: + */ + if (!(__pyx_v_c_start != 0)) { + __pyx_t_2 = (__pyx_v_c_stop != 0); + } else { + __pyx_t_2 = (__pyx_v_c_start != 0); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1079 + * 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_330), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L31; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1081 + * 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_331), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __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_3); + __Pyx_AddTraceback("lxml.etree._Element.index"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1083 + * 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_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_get[] = "get(self, key, default=None)\n\n Gets an element attribute.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_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; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_key,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("get"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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 = 1083; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_key = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = 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 = 1083; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.get"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1088 + * Gets an element attribute. + * """ + * return _getAttributeValue(self, key, default) # <<<<<<<<<<<<<< + * + * def keys(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __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.get"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1090 + * return _getAttributeValue(self, key, default) + * + * def keys(self): # <<<<<<<<<<<<<< + * u"""keys(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_keys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_keys[] = "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_keys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("keys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1096 + * arbitrary order (just like for an ordinary Python dictionary). + * """ + * return _collectAttributes(self._c_node, 1) # <<<<<<<<<<<<<< + * + * def values(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(((struct LxmlElement *)__pyx_v_self)->_c_node, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __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.keys"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1098 + * return _collectAttributes(self._c_node, 1) + * + * def values(self): # <<<<<<<<<<<<<< + * u"""values(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_values(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_values[] = "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_values(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("values"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1104 + * attributes are returned in an arbitrary order. + * """ + * return _collectAttributes(self._c_node, 2) # <<<<<<<<<<<<<< + * + * def items(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(((struct LxmlElement *)__pyx_v_self)->_c_node, 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __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.values"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1106 + * return _collectAttributes(self._c_node, 2) + * + * def items(self): # <<<<<<<<<<<<<< + * u"""items(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_items(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_items[] = "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_items(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("items"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1112 + * an arbitrary order. + * """ + * return _collectAttributes(self._c_node, 3) # <<<<<<<<<<<<<< + * + * def getchildren(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(((struct LxmlElement *)__pyx_v_self)->_c_node, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __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.items"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1114 + * return _collectAttributes(self._c_node, 3) + * + * def getchildren(self): # <<<<<<<<<<<<<< + * u"""getchildren(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getchildren(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_getchildren[] = "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_getchildren(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("getchildren"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1124 + * ``list(element)`` or simply iterate over elements. + * """ + * return _collectChildren(self) # <<<<<<<<<<<<<< + * + * def getparent(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __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.getchildren"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1126 + * return _collectChildren(self) + * + * def getparent(self): # <<<<<<<<<<<<<< + * u"""getparent(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getparent(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_getparent[] = "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_getparent(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("getparent"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1132 + * """ + * cdef xmlNode* c_node + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1133 + * cdef xmlNode* c_node + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1134 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1135 + * if c_node is NULL: + * return None + * return _elementFactory(self._doc, c_node) # <<<<<<<<<<<<<< + * + * def getnext(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __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.getparent"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1137 + * return _elementFactory(self._doc, c_node) + * + * def getnext(self): # <<<<<<<<<<<<<< + * u"""getnext(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getnext(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_getnext[] = "getnext(self)\n\n Returns the following sibling of this element or None.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getnext(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("getnext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1143 + * """ + * cdef xmlNode* c_node + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1144 + * cdef xmlNode* c_node + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1145 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1146 + * if c_node is NULL: + * return None + * return _elementFactory(self._doc, c_node) # <<<<<<<<<<<<<< + * + * def getprevious(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __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.getnext"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1148 + * return _elementFactory(self._doc, c_node) + * + * def getprevious(self): # <<<<<<<<<<<<<< + * u"""getprevious(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getprevious(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_getprevious[] = "getprevious(self)\n\n Returns the preceding sibling of this element or None.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getprevious(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("getprevious"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1154 + * """ + * cdef xmlNode* c_node + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1155 + * cdef xmlNode* c_node + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1156 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1157 + * 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 *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlElement *)__pyx_v_self)->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __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.getprevious"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1159 + * 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_itersiblings(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_itersiblings[] = "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 defaults\n to False, i.e. forward iteration over the following siblings. The\n generated elements can be restricted to a specific tag name with the\n 'tag' keyword.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_itersiblings(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tag,&__pyx_kp_preceding,0}; + __Pyx_SetupRefcountContext("itersiblings"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = __pyx_k_87; + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 1159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + __pyx_v_preceding = values[1]; + } else { + __pyx_v_tag = Py_None; + __pyx_v_preceding = __pyx_k_87; + 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 = 1159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.itersiblings"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1169 + * 'tag' 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 = 1169; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_preceding, __pyx_v_preceding) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_SiblingsIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __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_1)); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Element.itersiblings"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1171 + * return SiblingsIterator(self, tag, preceding=preceding) + * + * def iterancestors(self, tag=None): # <<<<<<<<<<<<<< + * u"""iterancestors(self, tag=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_iterancestors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_iterancestors[] = "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_iterancestors(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_kp_tag,0}; + __Pyx_SetupRefcountContext("iterancestors"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + } else { + __pyx_v_tag = 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 = 1171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.iterancestors"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1179 + * 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 = 1179; __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 = 1179; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1181 + * return AncestorsIterator(self, tag) + * + * def iterdescendants(self, tag=None): # <<<<<<<<<<<<<< + * u"""iterdescendants(self, tag=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_iterdescendants(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_iterdescendants[] = "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_iterdescendants(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_tag = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tag,0}; + __Pyx_SetupRefcountContext("iterdescendants"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + } else { + __pyx_v_tag = 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 = 1181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.iterdescendants"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1190 + * 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 = 1190; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_1, __pyx_kp_inclusive, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __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_1)); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Element.iterdescendants"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1192 + * 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_iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_iterchildren[] = "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_iterchildren(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tag,&__pyx_kp_reversed,0}; + __Pyx_SetupRefcountContext("iterchildren"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = __pyx_k_88; + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 1192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + __pyx_v_reversed = values[1]; + } else { + __pyx_v_tag = Py_None; + __pyx_v_reversed = __pyx_k_88; + 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 = 1192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.iterchildren"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1201 + * 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 = 1201; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_reversed, __pyx_v_reversed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __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_1)); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Element.iterchildren"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1203 + * return ElementChildIterator(self, tag, reversed=reversed) + * + * def getroottree(self): # <<<<<<<<<<<<<< + * u"""getroottree(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getroottree(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_getroottree[] = "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_getroottree(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("getroottree"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1212 + * returns None (for the root element) and then build an ElementTree for + * the last parent that was returned.""" + * return _elementTreeFactory(self._doc, None) # <<<<<<<<<<<<<< + * + * def getiterator(self, tag=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlElement *)__pyx_v_self)->_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __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.getroottree"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1214 + * return _elementTreeFactory(self._doc, None) + * + * def getiterator(self, tag=None): # <<<<<<<<<<<<<< + * u"""getiterator(self, tag=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_getiterator[] = "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_getiterator(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_kp_tag,0}; + __Pyx_SetupRefcountContext("getiterator"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + } else { + __pyx_v_tag = 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 = 1214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.getiterator"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1235 + * 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 = 1235; __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 = 1235; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1237 + * return ElementDepthFirstIterator(self, tag) + * + * def iter(self, tag=None): # <<<<<<<<<<<<<< + * u"""iter(self, tag=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_iter[] = "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_iter(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_kp_tag,0}; + __Pyx_SetupRefcountContext("iter"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1237; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + } else { + __pyx_v_tag = 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 = 1237; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.iter"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1249 + * 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 = 1249; __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 = 1249; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1251 + * 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_itertext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_itertext[] = "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_itertext(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tag,&__pyx_kp_with_tail,0}; + __Pyx_SetupRefcountContext("itertext"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = __pyx_k_89; + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 1251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + __pyx_v_with_tail = values[1]; + } else { + __pyx_v_tag = Py_None; + __pyx_v_with_tail = __pyx_k_89; + 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 = 1251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.itertext"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1262 + * 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 = 1262; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_with_tail, __pyx_v_with_tail) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementTextIterator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __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_1)); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Element.itertext"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1264 + * 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_makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_makeelement[] = "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_makeelement(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_kp__tag,&__pyx_kp_attrib,&__pyx_kp_nsmap,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = 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_kp__tag); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_attrib); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_nsmap); + if (unlikely(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 = 1264; __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 = Py_None; + __pyx_v_nsmap = 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 = 1264; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__extra); + __Pyx_AddTraceback("lxml.etree._Element.makeelement"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1269 + * Creates a new element associated with the same document. + * """ + * return _makeElement(_tag, NULL, self._doc, None, None, None, # <<<<<<<<<<<<<< + * attrib, nsmap, _extra) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1270 + * """ + * return _makeElement(_tag, NULL, self._doc, None, None, None, + * attrib, nsmap, _extra) # <<<<<<<<<<<<<< + * + * def find(self, path): + */ + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlElement *)__pyx_v_self)->_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __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.makeelement"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v__extra); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1272 + * attrib, nsmap, _extra) + * + * def find(self, path): # <<<<<<<<<<<<<< + * u"""find(self, path) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_find(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_find[] = "find(self, path)\n\n Finds the first matching subelement, by tag name or path.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_find(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("find"); + __Pyx_INCREF(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1277 + * Finds the first matching subelement, by tag name or path. + * """ + * if isinstance(path, QName): # <<<<<<<<<<<<<< + * path = (path).text + * return _elementpath.find(self, path) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_path, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1278 + * """ + * if isinstance(path, QName): + * path = (path).text # <<<<<<<<<<<<<< + * return _elementpath.find(self, path) + * + */ + __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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1279 + * if isinstance(path, QName): + * path = (path).text + * return _elementpath.find(self, path) # <<<<<<<<<<<<<< + * + * def findtext(self, path, default=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_kp_find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __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[0]; __pyx_lineno = 1279; __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_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1281 + * return _elementpath.find(self, path) + * + * def findtext(self, path, default=None): # <<<<<<<<<<<<<< + * u"""findtext(self, path, default=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_findtext[] = "findtext(self, path, default=None)\n\n Finds text for the first matching subelement, by tag name or path.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_default = 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_kp_path,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("findtext"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_path); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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), "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_path = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = Py_None; + switch (PyTuple_GET_SIZE(__pyx_args)) { + 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, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Element.findtext"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1286 + * Finds text for the first matching subelement, by tag name or path. + * """ + * if isinstance(path, QName): # <<<<<<<<<<<<<< + * path = (path).text + * return _elementpath.findtext(self, path, default) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_path, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1287 + * """ + * if isinstance(path, QName): + * path = (path).text # <<<<<<<<<<<<<< + * return _elementpath.findtext(self, path, default) + * + */ + __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1288 + * if isinstance(path, QName): + * path = (path).text + * return _elementpath.findtext(self, path, default) # <<<<<<<<<<<<<< + * + * def findall(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_kp_findtext); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __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 = 1288; __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_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1290 + * return _elementpath.findtext(self, path, default) + * + * def findall(self, path): # <<<<<<<<<<<<<< + * u"""findall(self, path) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_findall(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_findall[] = "findall(self, path)\n\n Finds all matching subelements, by tag name or path.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_findall(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("findall"); + __Pyx_INCREF(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1295 + * Finds all matching subelements, by tag name or path. + * """ + * if isinstance(path, QName): # <<<<<<<<<<<<<< + * path = (path).text + * return _elementpath.findall(self, path) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_path, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1296 + * """ + * if isinstance(path, QName): + * path = (path).text # <<<<<<<<<<<<<< + * return _elementpath.findall(self, path) + * + */ + __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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1297 + * if isinstance(path, QName): + * path = (path).text + * return _elementpath.findall(self, path) # <<<<<<<<<<<<<< + * + * def iterfind(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_kp_findall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1297; __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[0]; __pyx_lineno = 1297; __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_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1297; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1299 + * return _elementpath.findall(self, path) + * + * def iterfind(self, path): # <<<<<<<<<<<<<< + * u"""iterfind(self, path) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8_Element_iterfind(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_iterfind[] = "iterfind(self, path)\n\n Iterates over all matching subelements, by tag name or path.\n "; +static PyObject *__pyx_pf_4lxml_5etree_8_Element_iterfind(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("iterfind"); + __Pyx_INCREF(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1304 + * Iterates over all matching subelements, by tag name or path. + * """ + * if isinstance(path, QName): # <<<<<<<<<<<<<< + * path = (path).text + * return _elementpath.iterfind(self, path) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_path, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1305 + * """ + * if isinstance(path, QName): + * path = (path).text # <<<<<<<<<<<<<< + * return _elementpath.iterfind(self, path) + * + */ + __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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1306 + * if isinstance(path, QName): + * path = (path).text + * return _elementpath.iterfind(self, path) # <<<<<<<<<<<<<< + * + * def xpath(self, _path, *, namespaces=None, extensions=None, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree__elementpath, __pyx_kp_iterfind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __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[0]; __pyx_lineno = 1306; __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_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1308 + * return _elementpath.iterfind(self, path) + * + * 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_xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8_Element_xpath[] = "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_xpath(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp__path,&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = Py_None; + values[3] = __pyx_k_90; + 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_kp__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 = 1308; __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 = Py_None; + __pyx_v_extensions = Py_None; + __pyx_v_smart_strings = __pyx_k_90; + } + 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 = 1308; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__variables); + __Pyx_AddTraceback("lxml.etree._Element.xpath"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_evaluator = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1314 + * 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 = 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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1315 + * """ + * evaluator = XPathElementEvaluator(self, namespaces=namespaces, + * extensions=extensions, # <<<<<<<<<<<<<< + * smart_strings=smart_strings) + * return evaluator(_path, **_variables) + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1316 + * evaluator = XPathElementEvaluator(self, namespaces=namespaces, + * extensions=extensions, + * smart_strings=smart_strings) # <<<<<<<<<<<<<< + * return evaluator(_path, **_variables) + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __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_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_evaluator); + __pyx_v_evaluator = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1317 + * extensions=extensions, + * smart_strings=smart_strings) + * return evaluator(_path, **_variables) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __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_t_1 = PyEval_CallObjectWithKeywords(__pyx_v_evaluator, ((PyObject *)__pyx_t_2), __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1324 + * cdef _Element 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_SetupRefcountContext("_elementFactory"); + __pyx_v_result = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_element_class = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1326 + * 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 = 1326; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1327 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1328 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1329 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1330 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1333 + * + * 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 = 1332; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1334 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1336 + * 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 = 1336; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1337 + * # 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 = ((PyObject *)PY_NEW(__pyx_v_element_class)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1338 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1340 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1341 + * # 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 = 1341; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1343 + * 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 = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1344 + * + * _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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1345 + * _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_kp__init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __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 = 1345; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1346 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1350 + * + * 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_SetupRefcountContext("_raiseImmutable"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1351 + * 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_332), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1353 + * 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_kp_key,&__pyx_kp_value,0}; + __Pyx_SetupRefcountContext("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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __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 = 1353; __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 = 1353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1355 + * 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 = 1355; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1357 + * self._raiseImmutable() + * + * def append(self, value): # <<<<<<<<<<<<<< + * u"append(self, value)" + * self._raiseImmutable() + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_append[] = "append(self, value)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_append(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("append"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1359 + * 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 = 1359; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1361 + * self._raiseImmutable() + * + * def insert(self, index, value): # <<<<<<<<<<<<<< + * u"insert(self, index, value)" + * self._raiseImmutable() + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_insert[] = "insert(self, index, value)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_insert(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_kp_index,&__pyx_kp_value,0}; + __Pyx_SetupRefcountContext("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_kp_index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __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 = 1361; __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 = 1361; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1363 + * 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 = 1363; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1365 + * self._raiseImmutable() + * + * def __setitem__(self, index, value): # <<<<<<<<<<<<<< + * u"__setitem__(self, index, value)" + * self._raiseImmutable() + */ + +static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement___setitem__[] = "__setitem__(self, index, value)"; +static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__setitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1367 + * 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 = 1367; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1370 + * + * 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_1 = 0; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1371 + * property attrib: + * def __get__(self): + * return {} # <<<<<<<<<<<<<< + * + * property text: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_r = ((PyObject *)__pyx_1); + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.attrib.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1374 + * + * property text: + * def __get__(self): # <<<<<<<<<<<<<< + * if self._c_node.content is NULL: + * return '' + */ + +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; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1375 + * property text: + * def __get__(self): + * if self._c_node.content is NULL: # <<<<<<<<<<<<<< + * return '' + * else: + */ + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_base._c_node->content == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1376 + * def __get__(self): + * if self._c_node.content is NULL: + * return '' # <<<<<<<<<<<<<< + * else: + * return funicode(self._c_node.content) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_333); + __pyx_r = __pyx_kp_333; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1378 + * return '' + * else: + * return funicode(self._c_node.content) # <<<<<<<<<<<<<< + * + * def __set__(self, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self)->__pyx_base._c_node->content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __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.__ContentOnlyElement.text.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1380 + * 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___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___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_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1383 + * cdef tree.xmlDict* c_dict + * cdef char* c_text + * if value is None: # <<<<<<<<<<<<<< + * c_text = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_value == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1384 + * cdef char* c_text + * 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-2.2/src/lxml/lxml.etree.pyx":1386 + * c_text = NULL + * else: + * value = _utf8(value) # <<<<<<<<<<<<<< + * c_text = _cstr(value) + * tree.xmlNodeSetContent(self._c_node, c_text) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __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-2.2/src/lxml/lxml.etree.pyx":1387 + * else: + * value = _utf8(value) + * c_text = _cstr(value) # <<<<<<<<<<<<<< + * tree.xmlNodeSetContent(self._c_node, c_text) + * + */ + __pyx_v_c_text = PyString_AS_STRING(__pyx_v_value); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1388 + * 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_2); + __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_value); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1391 + * + * # ACCESSORS + * def __getitem__(self, x): # <<<<<<<<<<<<<< + * u"__getitem__(self, x)" + * if python.PySlice_Check(x): + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement___getitem__[] = "__getitem__(self, x)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__getitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1393 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1394 + * 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 = 1394; __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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1396 + * return [] + * else: + * raise IndexError, u"list index out of range" # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_334), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1398 + * 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___len__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement___len__[] = "__len__(self)"; +static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement___len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1400 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1402 + * return 0 + * + * def get(self, key, default=None): # <<<<<<<<<<<<<< + * u"get(self, key, default=None)" + * return None + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_get[] = "get(self, key, default=None)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_key,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("get"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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 = 1402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_key = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = 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 = 1402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.get"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1404 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1406 + * return None + * + * def keys(self): # <<<<<<<<<<<<<< + * u"keys(self)" + * return [] + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_keys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_keys[] = "keys(self)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_keys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("keys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1408 + * 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 = 1408; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1410 + * return [] + * + * def items(self): # <<<<<<<<<<<<<< + * u"items(self)" + * return [] + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_items(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_items[] = "items(self)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_items(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("items"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1412 + * 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 = 1412; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1414 + * return [] + * + * def values(self): # <<<<<<<<<<<<<< + * u"values(self)" + * return [] + */ + +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_values(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_values[] = "values(self)"; +static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_values(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("values"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1416 + * 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 = 1416; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1420 + * 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_1 = 0; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1421 + * property tag: + * def __get__(self): + * return Comment # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Comment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree._Comment.tag.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1423 + * return Comment + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return u"" % 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_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1424 + * + * def __repr__(self): + * return u"" % self.text # <<<<<<<<<<<<<< + * + * cdef class _ProcessingInstruction(__ContentOnlyElement): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_335), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __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._Comment.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1428 + * 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_1 = 0; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1429 + * property tag: + * def __get__(self): + * return ProcessingInstruction # <<<<<<<<<<<<<< + * + * property target: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_101); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.tag.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1433 + * property target: + * # not in ElementTree + * def __get__(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; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1434 + * # not in ElementTree + * 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__ProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __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.target.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1436 + * return funicode(self._c_node.name) + * + * def __set__(self, value): # <<<<<<<<<<<<<< + * value = _utf8(value) + * c_text = _cstr(value) + */ + +static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_v_c_text; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + __Pyx_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_c_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1437 + * + * def __set__(self, value): + * value = _utf8(value) # <<<<<<<<<<<<<< + * c_text = _cstr(value) + * tree.xmlNodeSetName(self._c_node, c_text) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __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-2.2/src/lxml/lxml.etree.pyx":1438 + * def __set__(self, value): + * value = _utf8(value) + * c_text = _cstr(value) # <<<<<<<<<<<<<< + * tree.xmlNodeSetName(self._c_node, c_text) + * + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(PyString_AS_STRING(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_c_text); + __pyx_v_c_text = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1439 + * value = _utf8(value) + * c_text = _cstr(value) + * tree.xmlNodeSetName(self._c_node, c_text) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_c_text); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_t_2); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_c_text); + __Pyx_DECREF(__pyx_v_value); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1441 + * 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_SetupRefcountContext("__repr__"); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1442 + * + * def __repr__(self): + * text = self.text # <<<<<<<<<<<<<< + * if text: + * return u"" % (self.target, text) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1443 + * def __repr__(self): + * text = self.text + * if text: # <<<<<<<<<<<<<< + * return u"" % (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 = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1444 + * text = self.text + * if text: + * return u"" % (self.target, text) # <<<<<<<<<<<<<< + * else: + * return u"" % self.target + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __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 = 1444; __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_336), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1446 + * return u"" % (self.target, text) + * else: + * return u"" % self.target # <<<<<<<<<<<<<< + * + * cdef class _Entity(__ContentOnlyElement): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_337), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1446; __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_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1450 + * 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_1 = 0; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1451 + * property tag: + * def __get__(self): + * return Entity # <<<<<<<<<<<<<< + * + * property name: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Entity); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree._Entity.tag.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1455 + * property name: + * # not in ElementTree + * def __get__(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; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1456 + * # not in ElementTree + * 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__Entity *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __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.name.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1458 + * 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_7_Entity_4name___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_Entity_4name___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_v_c_text; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_c_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1459 + * + * 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __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-2.2/src/lxml/lxml.etree.pyx":1460 + * 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 PYREX_WITHOUT_ASSERTIONS + __pyx_t_2 = (!PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_338))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + __pyx_t_3 = (!PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_339))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __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-2.2/src/lxml/lxml.etree.pyx":1461 + * 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_340), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1462 + * 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 = __Pyx_PyBytes_FromString(PyString_AS_STRING(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_c_text); + __pyx_v_c_text = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1463 + * u"Invalid entity name '%s'" % value + * c_text = _cstr(value) + * tree.xmlNodeSetName(self._c_node, c_text) # <<<<<<<<<<<<<< + * + * property text: + */ + __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_c_text); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + xmlNodeSetName(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_t_5); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._Entity.name.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_c_text); + __Pyx_DECREF(__pyx_v_value); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1468 + * # FIXME: should this be None or '&[VALUE];' or the resolved + * # entity value ? + * def __get__(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; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1469 + * # entity value ? + * def __get__(self): + * return u'&%s;' % funicode(self._c_node.name) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_341), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __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._Entity.text.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1471 + * 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_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1472 + * + * def __repr__(self): + * return u"&%s;" % self.name # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_342), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __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._Entity.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1495 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_36,&__pyx_kp_tag,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_36); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1495; __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 = 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 = 1495; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.QName.__init__"); + 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1496 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1497 + * 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 = PyObject_TypeCheck(__pyx_v_text_or_uri_or_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1498 + * 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, ("Invalid input tag of type %r" % + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_text_or_uri_or_element, __pyx_kp_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1499 + * 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, ("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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1501 + * if not _isString(text_or_uri_or_element): + * raise ValueError, ("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 = (text_or_uri_or_element).text + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __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*)&PyType_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __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 = PyNumber_Remainder(__pyx_kp_343, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1502 + * raise ValueError, ("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 = (text_or_uri_or_element).text + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_text_or_uri_or_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1503 + * type(text_or_uri_or_element)) + * elif isinstance(text_or_uri_or_element, QName): + * text_or_uri_or_element = (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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1505 + * text_or_uri_or_element = (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 = 1505; __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 = 1505; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1507 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_text_or_uri_or_element); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag_utf); + __pyx_v_tag_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag_utf); + __pyx_v_tag_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1508 + * + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1510 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1511 + * # 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1512 + * 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1513 + * 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_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_tag_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1515 + * _tagValidOrRaise(tag_utf) + * self.localname = python.PyUnicode_FromEncodedObject( + * tag_utf, 'UTF-8', NULL) # <<<<<<<<<<<<<< + * if ns_utf is None: + * self.namespace = None + */ + __pyx_t_3 = PyUnicode_FromEncodedObject(__pyx_v_tag_utf, __pyx_k_344, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1514 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1516 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1517 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1518 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1521 + * 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 = PyUnicode_FromEncodedObject(__pyx_v_ns_utf, __pyx_k_345, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1520 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1522 + * 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 = 1522; __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_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_346), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __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 = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1523 + * 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___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_5QName___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__str__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1524 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1525 + * 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___hash__(PyObject *__pyx_v_self); /*proto*/ +static long __pyx_pf_4lxml_5etree_5QName___hash__(PyObject *__pyx_v_self) { + long __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + __Pyx_SetupRefcountContext("__hash__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1526 + * 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_kp___hash__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __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 = 1526; __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 = 1526; __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:; + __Pyx_FinishRefcountContext(); + if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1527 + * 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___richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_5QName___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_SetupRefcountContext("__richcmp__"); + __Pyx_INCREF(__pyx_v_one); + __Pyx_INCREF(__pyx_v_other); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1528 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1529 + * 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 = 1529; __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 = 1529; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1530 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1531 + * 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 = 1531; __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 = 1531; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1532 + * 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 = 1532; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1544 + * # 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_SetupRefcountContext("_assertHasRoot"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1550 + * the caller program. + * """ + * assert self._context_node is not None, \ # <<<<<<<<<<<<<< + * u"ElementTree not initialized, missing root" + * + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None); + if (unlikely(!__pyx_t_1)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1551 + * """ + * assert self._context_node is not None, \ + * u"ElementTree not initialized, missing root" # <<<<<<<<<<<<<< + * + * def parse(self, source, _BaseParser parser=None, *, base_url=None): + */ + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_347)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1553 + * 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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_source,&__pyx_kp_parser,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_source); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 1553; __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 = 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 = 1553; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ElementTree.parse"); + 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 = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1558 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1559 + * """ + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1560 + * 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 = 1560; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1561 + * 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 = 1561; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1562 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1563 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1564 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyErr_ExceptionMatches(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.parse"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_result_container); + __pyx_v_result_container = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1566 + * 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_1 = PyObject_GetAttr(__pyx_v_result_container, __pyx_kp_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L8_except_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; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/lxml.etree.pyx":1567 + * # 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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1569 + * return self._context_node + * + * def _setroot(self, _Element root not None): # <<<<<<<<<<<<<< + * u"""_setroot(self, root) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree__setroot(PyObject *__pyx_v_self, PyObject *__pyx_v_root); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree__setroot[] = "_setroot(self, root)\n\n Relocate the ElementTree to a new root node.\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree__setroot(PyObject *__pyx_v_self, PyObject *__pyx_v_root) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_setroot"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_5etree__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1574 + * Relocate the ElementTree to a new root node. + * """ + * 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_1 = (((struct LxmlElement *)__pyx_v_root)->_c_node->type != XML_ELEMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1575 + * """ + * 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_348), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1576 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1577 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1579 + * self._doc = None + * + * def getroot(self): # <<<<<<<<<<<<<< + * u"""getroot(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_getroot(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_getroot[] = "getroot(self)\n\n Gets the root element for this tree.\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_getroot(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("getroot"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1584 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1586 + * return self._context_node + * + * def __copy__(self): # <<<<<<<<<<<<<< + * return _elementTreeFactory(self._doc, self._context_node) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree___copy__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree___copy__(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__copy__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1587 + * + * def __copy__(self): + * return _elementTreeFactory(self._doc, self._context_node) # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlElementTree *)__pyx_v_self)->_doc, ((struct LxmlElementTree *)__pyx_v_self)->_context_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __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._ElementTree.__copy__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1589 + * 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___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree___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; + __Pyx_SetupRefcountContext("__deepcopy__"); + __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1593 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1594 + * 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_kp___copy__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __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 = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1595 + * 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 = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1596 + * 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 and not doc._c_doc.intSubset: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_root->_doc)); + __Pyx_DECREF(((PyObject *)__pyx_v_doc)); + __pyx_v_doc = __pyx_v_root->_doc; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1597 + * _copyNonElementSiblings(self._context_node._c_node, root._c_node) + * doc = root._doc + * c_doc = self._context_node._doc._c_doc # <<<<<<<<<<<<<< + * if c_doc.intSubset and not doc._c_doc.intSubset: + * doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset) + */ + __pyx_v_c_doc = ((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc->_c_doc; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1598 + * doc = root._doc + * c_doc = self._context_node._doc._c_doc + * if c_doc.intSubset and not doc._c_doc.intSubset: # <<<<<<<<<<<<<< + * doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset) + * if doc._c_doc.intSubset is NULL: + */ + if ((__pyx_v_c_doc->intSubset != 0)) { + __pyx_t_1 = (!(__pyx_v_doc->_c_doc->intSubset != 0)); + } else { + __pyx_t_1 = (__pyx_v_c_doc->intSubset != 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1599 + * c_doc = self._context_node._doc._c_doc + * if c_doc.intSubset and not doc._c_doc.intSubset: + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1600 + * if c_doc.intSubset and not doc._c_doc.intSubset: + * doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset) + * if doc._c_doc.intSubset is NULL: # <<<<<<<<<<<<<< + * python.PyErr_NoMemory() + * if c_doc.extSubset and not doc._c_doc.extSubset: + */ + __pyx_t_1 = (__pyx_v_doc->_c_doc->intSubset == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1601 + * doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset) + * if doc._c_doc.intSubset is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * if c_doc.extSubset and not doc._c_doc.extSubset: + * 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 = 1601; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1602 + * if doc._c_doc.intSubset is NULL: + * python.PyErr_NoMemory() + * if c_doc.extSubset and not doc._c_doc.extSubset: # <<<<<<<<<<<<<< + * doc._c_doc.extSubset = tree.xmlCopyDtd(c_doc.extSubset) + * if doc._c_doc.extSubset is NULL: + */ + if ((__pyx_v_c_doc->extSubset != 0)) { + __pyx_t_1 = (!(__pyx_v_doc->_c_doc->extSubset != 0)); + } else { + __pyx_t_1 = (__pyx_v_c_doc->extSubset != 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1603 + * python.PyErr_NoMemory() + * if c_doc.extSubset and not doc._c_doc.extSubset: + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1604 + * if c_doc.extSubset and not doc._c_doc.extSubset: + * 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_1 = (__pyx_v_doc->_c_doc->extSubset == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1605 + * 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 = 1605; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1606 + * if doc._c_doc.extSubset is NULL: + * python.PyErr_NoMemory() + * return _elementTreeFactory(None, root) # <<<<<<<<<<<<<< + * elif self._doc is not None: + * c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1) + */ + __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 = 1606; __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-2.2/src/lxml/lxml.etree.pyx":1607 + * python.PyErr_NoMemory() + * return _elementTreeFactory(None, root) + * elif self._doc is not None: # <<<<<<<<<<<<<< + * c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1) + * if c_doc is NULL: + */ + __pyx_t_1 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_doc) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1608 + * return _elementTreeFactory(None, root) + * elif self._doc is not None: + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1609 + * elif self._doc is not None: + * 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_1 = (__pyx_v_c_doc == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1610 + * 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 = 1610; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1611 + * if c_doc is NULL: + * python.PyErr_NoMemory() + * doc = _documentFactory(c_doc, self._doc._parser) # <<<<<<<<<<<<<< + * return _elementTreeFactory(doc, None) + * else: + */ + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct LxmlElementTree *)__pyx_v_self)->_doc->_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __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-2.2/src/lxml/lxml.etree.pyx":1612 + * python.PyErr_NoMemory() + * doc = _documentFactory(c_doc, self._doc._parser) + * return _elementTreeFactory(doc, None) # <<<<<<<<<<<<<< + * else: + * # so what ... + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __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-2.2/src/lxml/lxml.etree.pyx":1615 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1624 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1625 + * """ + * 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 = 1625; __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-2.2/src/lxml/lxml.etree.pyx":1626 + * 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 = 1626; __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 = 1626; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1632 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1633 + * """ + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1634 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1635 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1636 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1637 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1638 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1640 + * return None + * + * def write(self, file, *, encoding=None, method=u"xml", # <<<<<<<<<<<<<< + * pretty_print=False, xml_declaration=None, with_tail=True, + * standalone=None, compression=0): + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_write[] = "write(self, file, encoding=None, method=\"xml\",\n pretty_print=False, xml_declaration=None, with_tail=True,\n standalone=None, compression=0)\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: 'xml' or\n 'html'.\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_write(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_compression = 0; + int __pyx_v_write_declaration; + int __pyx_v_is_standalone; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_file,&__pyx_kp_encoding,&__pyx_kp_method,&__pyx_kp_pretty_print,&__pyx_kp_xml_declaration,&__pyx_kp_with_tail,&__pyx_kp_standalone,&__pyx_kp_compression,0}; + __Pyx_SetupRefcountContext("write"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + values[1] = Py_None; + values[2] = ((PyObject *)__pyx_kp_91); + values[3] = __pyx_k_92; + values[4] = Py_None; + values[5] = __pyx_k_93; + values[6] = Py_None; + values[7] = __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_kp_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_kp_encoding); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_method); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_pretty_print); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_xml_declaration); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_with_tail); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_standalone); + if (value) { values[6] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_compression); + if (value) { values[7] = 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 = 1640; __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_compression = values[7]; + } 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_encoding = Py_None; + __pyx_v_method = ((PyObject *)__pyx_kp_91); + __pyx_v_pretty_print = __pyx_k_92; + __pyx_v_xml_declaration = Py_None; + __pyx_v_with_tail = __pyx_k_93; + __pyx_v_standalone = Py_None; + __pyx_v_compression = __pyx_int_0; + } + 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 = 1640; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ElementTree.write"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_encoding); + __Pyx_INCREF(__pyx_v_compression); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1662 + * cdef bint write_declaration + * cdef int is_standalone + * self._assertHasRoot() # <<<<<<<<<<<<<< + * # suppress decl. in default case (purely for ElementTree compatibility) + * if xml_declaration is not None: + */ + __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 = 1662; __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-2.2/src/lxml/lxml.etree.pyx":1664 + * self._assertHasRoot() + * # 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_2 = (__pyx_v_xml_declaration != Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1665 + * # 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_2 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_write_declaration = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1666 + * if xml_declaration is not None: + * write_declaration = xml_declaration + * if encoding is None: # <<<<<<<<<<<<<< + * encoding = u'ASCII' + * elif encoding is None: + */ + __pyx_t_2 = (__pyx_v_encoding == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1667 + * write_declaration = xml_declaration + * if encoding is None: + * encoding = u'ASCII' # <<<<<<<<<<<<<< + * elif encoding is None: + * encoding = u'ASCII' + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_349)); + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = ((PyObject *)__pyx_kp_349); + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1668 + * if encoding is None: + * encoding = u'ASCII' + * elif encoding is None: # <<<<<<<<<<<<<< + * encoding = u'ASCII' + * write_declaration = 0 + */ + __pyx_t_2 = (__pyx_v_encoding == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1669 + * encoding = u'ASCII' + * elif encoding is None: + * encoding = u'ASCII' # <<<<<<<<<<<<<< + * write_declaration = 0 + * else: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_350)); + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = ((PyObject *)__pyx_kp_350); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1670 + * elif encoding is None: + * encoding = u'ASCII' + * write_declaration = 0 # <<<<<<<<<<<<<< + * else: + * encoding = encoding.upper() + */ + __pyx_v_write_declaration = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1672 + * write_declaration = 0 + * else: + * encoding = encoding.upper() # <<<<<<<<<<<<<< + * write_declaration = encoding not in \ + * (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8') + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_encoding, __pyx_kp_upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __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_encoding); + __pyx_v_encoding = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1673 + * 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_3 = __pyx_v_encoding; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1674 + * encoding = encoding.upper() + * write_declaration = encoding not in \ + * (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8') # <<<<<<<<<<<<<< + * if standalone is None: + * is_standalone = -1 + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_351), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __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 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (((int)__pyx_t_2)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1673 + * else: + * encoding = encoding.upper() + * write_declaration = encoding not in \ # <<<<<<<<<<<<<< + * (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8') + * if standalone is None: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_352), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __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 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((int)__pyx_t_4); + } else { + __pyx_t_5 = ((int)__pyx_t_2); + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1674 + * encoding = encoding.upper() + * write_declaration = encoding not in \ + * (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8') # <<<<<<<<<<<<<< + * if standalone is None: + * is_standalone = -1 + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_353), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __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 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = ((int)__pyx_t_2); + } else { + __pyx_t_4 = __pyx_t_5; + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1673 + * else: + * encoding = encoding.upper() + * write_declaration = encoding not in \ # <<<<<<<<<<<<<< + * (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8') + * if standalone is None: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_354), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __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 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((int)__pyx_t_5); + } else { + __pyx_t_2 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_write_declaration = __pyx_t_2; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1675 + * 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_2 = (__pyx_v_standalone == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1676 + * (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_L8; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1677 + * 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 = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1678 + * is_standalone = -1 + * elif standalone: + * write_declaration = 1 # <<<<<<<<<<<<<< + * is_standalone = 1 + * else: + */ + __pyx_v_write_declaration = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1679 + * elif standalone: + * write_declaration = 1 + * is_standalone = 1 # <<<<<<<<<<<<<< + * else: + * write_declaration = 1 + */ + __pyx_v_is_standalone = 1; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1681 + * is_standalone = 1 + * else: + * write_declaration = 1 # <<<<<<<<<<<<<< + * is_standalone = 0 + * if compression is None or compression < 0: + */ + __pyx_v_write_declaration = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1682 + * else: + * write_declaration = 1 + * is_standalone = 0 # <<<<<<<<<<<<<< + * if compression is None or compression < 0: + * compression = 0 + */ + __pyx_v_is_standalone = 0; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1683 + * write_declaration = 1 + * is_standalone = 0 + * if compression is None or compression < 0: # <<<<<<<<<<<<<< + * compression = 0 + * _tofilelike(file, self._context_node, encoding, method, + */ + __pyx_t_2 = (__pyx_v_compression == Py_None); + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1684 + * is_standalone = 0 + * if compression is None or compression < 0: + * compression = 0 # <<<<<<<<<<<<<< + * _tofilelike(file, self._context_node, encoding, method, + * write_declaration, 1, pretty_print, with_tail, + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_compression); + __pyx_v_compression = __pyx_int_0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1686 + * compression = 0 + * _tofilelike(file, self._context_node, encoding, 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))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1687 + * _tofilelike(file, self._context_node, encoding, method, + * write_declaration, 1, pretty_print, with_tail, + * is_standalone, compression) # <<<<<<<<<<<<<< + * + * def getpath(self, _Element element not None): + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_compression); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4lxml_5etree__tofilelike(__pyx_v_file, ((struct LxmlElementTree *)__pyx_v_self)->_context_node, __pyx_v_encoding, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_t_5, __pyx_t_2, __pyx_v_is_standalone, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __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_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1689 + * is_standalone, compression) + * + * def getpath(self, _Element element not None): # <<<<<<<<<<<<<< + * u"""getpath(self, element) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_getpath(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_getpath[] = "getpath(self, element)\n\n Returns a structural, absolute XPath expression to find that element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_getpath(PyObject *__pyx_v_self, PyObject *__pyx_v_element) { + struct LxmlDocument *__pyx_v_doc; + xmlDoc *__pyx_v_c_doc; + char *__pyx_v_c_path; + PyObject *__pyx_v_path; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + xmlDoc *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("getpath"); + __pyx_v_doc = ((struct LxmlDocument *)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 = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1697 + * cdef xmlDoc* c_doc + * cdef char* c_path + * doc = self._context_node._doc # <<<<<<<<<<<<<< + * if element._doc is not doc: + * raise ValueError, u"Element is not in this tree." + */ + __Pyx_INCREF(((PyObject *)((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc)); + __Pyx_DECREF(((PyObject *)__pyx_v_doc)); + __pyx_v_doc = ((struct LxmlElementTree *)__pyx_v_self)->_context_node->_doc; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1698 + * cdef char* c_path + * doc = self._context_node._doc + * if element._doc is not doc: # <<<<<<<<<<<<<< + * raise ValueError, u"Element is not in this tree." + * c_doc = _fakeRootDoc(doc._c_doc, self._context_node._c_node) + */ + __pyx_t_1 = (((struct LxmlElement *)__pyx_v_element)->_doc != __pyx_v_doc); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1699 + * doc = self._context_node._doc + * if element._doc is not doc: + * raise ValueError, u"Element is not in this tree." # <<<<<<<<<<<<<< + * c_doc = _fakeRootDoc(doc._c_doc, self._context_node._c_node) + * c_path = tree.xmlGetNodePath(element._c_node) + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_355), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1700 + * if element._doc is not doc: + * raise ValueError, u"Element is not in this tree." + * c_doc = _fakeRootDoc(doc._c_doc, self._context_node._c_node) # <<<<<<<<<<<<<< + * c_path = tree.xmlGetNodePath(element._c_node) + * _destroyFakeDoc(doc._c_doc, c_doc) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, ((struct LxmlElementTree *)__pyx_v_self)->_context_node->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1701 + * raise ValueError, u"Element is not in this tree." + * c_doc = _fakeRootDoc(doc._c_doc, self._context_node._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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1702 + * c_doc = _fakeRootDoc(doc._c_doc, self._context_node._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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1703 + * 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_1 = (__pyx_v_c_path == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1704 + * _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 = 1704; __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-2.2/src/lxml/lxml.etree.pyx":1705 + * 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 = 1705; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1706 + * python.PyErr_NoMemory() + * path = funicode(c_path) + * tree.xmlFree(c_path) # <<<<<<<<<<<<<< + * return path + * + */ + xmlFree(__pyx_v_c_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1707 + * 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(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1709 + * return path + * + * def getiterator(self, tag=None): # <<<<<<<<<<<<<< + * u"""getiterator(self, tag=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_getiterator[] = "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_getiterator(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_kp_tag,0}; + __Pyx_SetupRefcountContext("getiterator"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1709; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + } else { + __pyx_v_tag = 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 = 1709; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1730 + * with older versions of lxml or ElementTree. + * """ + * root = self.getroot() # <<<<<<<<<<<<<< + * if root is None: + * return () + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __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 = 1730; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1731 + * """ + * root = self.getroot() + * if root is None: # <<<<<<<<<<<<<< + * return () + * return root.getiterator(tag) + */ + __pyx_t_3 = (__pyx_v_root == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1732 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1733 + * 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_kp_getiterator); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __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 = 1733; __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 = 1733; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1735 + * return root.getiterator(tag) + * + * def iter(self, tag=None): # <<<<<<<<<<<<<< + * u"""iter(self, tag=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_iter[] = "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_iter(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_kp_tag,0}; + __Pyx_SetupRefcountContext("iter"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 1735; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + } else { + __pyx_v_tag = 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 = 1735; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ElementTree.iter"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1741 + * 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_kp_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __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 = 1741; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1742 + * """ + * root = self.getroot() + * if root is None: # <<<<<<<<<<<<<< + * return () + * return root.iter(tag) + */ + __pyx_t_3 = (__pyx_v_root == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1743 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1744 + * if root is None: + * return () + * return root.iter(tag) # <<<<<<<<<<<<<< + * + * def find(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_kp_iter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __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 = 1744; __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 = 1744; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1746 + * return root.iter(tag) + * + * def find(self, path): # <<<<<<<<<<<<<< + * u"""find(self, path) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_find(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_find[] = "find(self, path)\n\n Finds the first toplevel element with given tag. Same as\n ``tree.getroot().find(path)``.\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_find(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_root; + PyObject *__pyx_v_start; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("find"); + __Pyx_INCREF(__pyx_v_path); + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_start = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1752 + * ``tree.getroot().find(path)``. + * """ + * 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 = 1752; __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-2.2/src/lxml/lxml.etree.pyx":1753 + * """ + * self._assertHasRoot() + * root = self.getroot() # <<<<<<<<<<<<<< + * if _isString(path): + * start = path[:1] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __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 = 1753; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1754 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1755 + * root = self.getroot() + * if _isString(path): + * start = path[:1] # <<<<<<<<<<<<<< + * if start == u"/": + * path = u"." + path + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1756 + * if _isString(path): + * start = path[:1] + * if start == u"/": # <<<<<<<<<<<<<< + * path = u"." + path + * elif start == "/": + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_356), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __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 = 1756; __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-2.2/src/lxml/lxml.etree.pyx":1757 + * start = path[:1] + * if start == u"/": + * path = u"." + path # <<<<<<<<<<<<<< + * elif start == "/": + * path = "." + path + */ + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_357), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __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_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1758 + * if start == u"/": + * path = u"." + path + * elif start == "/": # <<<<<<<<<<<<<< + * path = "." + path + * return root.find(path) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_kp_358, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __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 = 1758; __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-2.2/src/lxml/lxml.etree.pyx":1759 + * path = u"." + path + * elif start == "/": + * path = "." + path # <<<<<<<<<<<<<< + * return root.find(path) + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_kp_359, __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __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_L6; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1760 + * elif start == "/": + * path = "." + path + * return root.find(path) # <<<<<<<<<<<<<< + * + * def findtext(self, path, default=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_kp_find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __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 = 1760; __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_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1762 + * return root.find(path) + * + * def findtext(self, path, default=None): # <<<<<<<<<<<<<< + * u"""findtext(self, path, default=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_findtext[] = "findtext(self, path, default=None)\n\n Finds the text for the first element matching the ElementPath\n expression. Same as getroot().findtext(path)\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_default = 0; + PyObject *__pyx_v_root; + PyObject *__pyx_v_start; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_path,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("findtext"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_path); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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), "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_path = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = Py_None; + switch (PyTuple_GET_SIZE(__pyx_args)) { + 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, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ElementTree.findtext"); + 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1768 + * expression. Same as getroot().findtext(path) + * """ + * 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 = 1768; __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-2.2/src/lxml/lxml.etree.pyx":1769 + * """ + * self._assertHasRoot() + * root = self.getroot() # <<<<<<<<<<<<<< + * if _isString(path): + * start = path[:1] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __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 = 1769; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1770 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1771 + * root = self.getroot() + * if _isString(path): + * start = path[:1] # <<<<<<<<<<<<<< + * if start == u"/": + * path = u"." + path + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1772 + * if _isString(path): + * start = path[:1] + * if start == u"/": # <<<<<<<<<<<<<< + * path = u"." + path + * elif start == "/": + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_360), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __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 = 1772; __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-2.2/src/lxml/lxml.etree.pyx":1773 + * start = path[:1] + * if start == u"/": + * path = u"." + path # <<<<<<<<<<<<<< + * elif start == "/": + * path = "." + path + */ + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_361), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1774 + * if start == u"/": + * path = u"." + path + * elif start == "/": # <<<<<<<<<<<<<< + * path = "." + path + * return root.findtext(path, default) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_kp_362, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __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 = 1774; __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-2.2/src/lxml/lxml.etree.pyx":1775 + * path = u"." + path + * elif start == "/": + * path = "." + path # <<<<<<<<<<<<<< + * return root.findtext(path, default) + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_kp_363, __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1776 + * elif start == "/": + * path = "." + path + * return root.findtext(path, default) # <<<<<<<<<<<<<< + * + * def findall(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_kp_findtext); 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_t_1 = PyTuple_New(2); 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(__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_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1778 + * return root.findtext(path, default) + * + * def findall(self, path): # <<<<<<<<<<<<<< + * u"""findall(self, path) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_findall(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_findall[] = "findall(self, path)\n\n Finds all elements matching the ElementPath expression. Same as\n getroot().findall(path).\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_findall(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_root; + PyObject *__pyx_v_start; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("findall"); + __Pyx_INCREF(__pyx_v_path); + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_start = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1784 + * getroot().findall(path). + * """ + * 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 = 1784; __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-2.2/src/lxml/lxml.etree.pyx":1785 + * """ + * self._assertHasRoot() + * root = self.getroot() # <<<<<<<<<<<<<< + * if _isString(path): + * start = path[:1] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __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 = 1785; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1786 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1787 + * root = self.getroot() + * if _isString(path): + * start = path[:1] # <<<<<<<<<<<<<< + * if start == u"/": + * path = u"." + path + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1788 + * if _isString(path): + * start = path[:1] + * if start == u"/": # <<<<<<<<<<<<<< + * path = u"." + path + * elif start == "/": + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_364), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __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 = 1788; __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-2.2/src/lxml/lxml.etree.pyx":1789 + * start = path[:1] + * if start == u"/": + * path = u"." + path # <<<<<<<<<<<<<< + * elif start == "/": + * path = "." + path + */ + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_365), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __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_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1790 + * if start == u"/": + * path = u"." + path + * elif start == "/": # <<<<<<<<<<<<<< + * path = "." + path + * return root.findall(path) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_kp_366, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __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 = 1790; __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-2.2/src/lxml/lxml.etree.pyx":1791 + * path = u"." + path + * elif start == "/": + * path = "." + path # <<<<<<<<<<<<<< + * return root.findall(path) + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_kp_367, __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __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_L6; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1792 + * elif start == "/": + * path = "." + path + * return root.findall(path) # <<<<<<<<<<<<<< + * + * def iterfind(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_kp_findall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __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 = 1792; __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_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1794 + * return root.findall(path) + * + * def iterfind(self, path): # <<<<<<<<<<<<<< + * u"""iterfind(self, path) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_iterfind(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_iterfind[] = "iterfind(self, path)\n\n Iterates over all elements matching the ElementPath expression.\n Same as getroot().finditer(path).\n "; +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_iterfind(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_root; + PyObject *__pyx_v_start; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("iterfind"); + __Pyx_INCREF(__pyx_v_path); + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_start = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1800 + * Same as getroot().finditer(path). + * """ + * 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 = 1800; __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-2.2/src/lxml/lxml.etree.pyx":1801 + * """ + * self._assertHasRoot() + * root = self.getroot() # <<<<<<<<<<<<<< + * if _isString(path): + * start = path[:1] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __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 = 1801; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1802 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1803 + * root = self.getroot() + * if _isString(path): + * start = path[:1] # <<<<<<<<<<<<<< + * if start == u"/": + * path = u"." + path + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_path, 0, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1804 + * if _isString(path): + * start = path[:1] + * if start == u"/": # <<<<<<<<<<<<<< + * path = u"." + path + * elif start == "/": + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, ((PyObject *)__pyx_kp_368), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __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 = 1804; __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-2.2/src/lxml/lxml.etree.pyx":1805 + * start = path[:1] + * if start == u"/": + * path = u"." + path # <<<<<<<<<<<<<< + * elif start == "/": + * path = "." + path + */ + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_369), __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __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_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1806 + * if start == u"/": + * path = u"." + path + * elif start == "/": # <<<<<<<<<<<<<< + * path = "." + path + * return root.iterfind(path) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_kp_370, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __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 = 1806; __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-2.2/src/lxml/lxml.etree.pyx":1807 + * path = u"." + path + * elif start == "/": + * path = "." + path # <<<<<<<<<<<<<< + * return root.iterfind(path) + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_kp_371, __pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __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_L6; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1808 + * elif start == "/": + * path = "." + path + * return root.iterfind(path) # <<<<<<<<<<<<<< + * + * def xpath(self, _path, *, namespaces=None, extensions=None, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_root, __pyx_kp_iterfind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __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 = 1808; __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_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1810 + * return root.iterfind(path) + * + * 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_xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_xpath[] = "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_xpath(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp__path,&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = Py_None; + values[3] = __pyx_k_94; + 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_kp__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 = 1810; __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 = Py_None; + __pyx_v_extensions = Py_None; + __pyx_v_smart_strings = __pyx_k_94; + } + 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 = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__variables); + __Pyx_AddTraceback("lxml.etree._ElementTree.xpath"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_evaluator = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1829 + * 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 = 1829; __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-2.2/src/lxml/lxml.etree.pyx":1830 + * """ + * 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 = 1830; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1831 + * self._assertHasRoot() + * evaluator = XPathDocumentEvaluator(self, namespaces=namespaces, + * extensions=extensions, # <<<<<<<<<<<<<< + * smart_strings=smart_strings) + * return evaluator(_path, **_variables) + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1832 + * evaluator = XPathDocumentEvaluator(self, namespaces=namespaces, + * extensions=extensions, + * smart_strings=smart_strings) # <<<<<<<<<<<<<< + * return evaluator(_path, **_variables) + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1830; __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_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_evaluator); + __pyx_v_evaluator = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1833 + * 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __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_t_1 = PyEval_CallObjectWithKeywords(__pyx_v_evaluator, ((PyObject *)__pyx_t_2), __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1835 + * 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_xslt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_xslt[] = "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_xslt(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp__xslt,&__pyx_kp_extensions,&__pyx_kp_access_control,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = 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_kp__xslt); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_access_control); + if (unlikely(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 = 1835; __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 = Py_None; + __pyx_v_access_control = 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 = 1835; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__kw); + __Pyx_AddTraceback("lxml.etree._ElementTree.xslt"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_style = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1849 + * 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 = 1849; __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-2.2/src/lxml/lxml.etree.pyx":1850 + * """ + * 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 = 1850; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1851 + * self._assertHasRoot() + * style = XSLT(_xslt, extensions=extensions, + * access_control=access_control) # <<<<<<<<<<<<<< + * return style(self, **_kw) + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_access_control, __pyx_v_access_control) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLT)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __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_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_style); + __pyx_v_style = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1852 + * style = XSLT(_xslt, extensions=extensions, + * access_control=access_control) + * return style(self, **_kw) # <<<<<<<<<<<<<< + * + * def relaxng(self, relaxng): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __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_1 = PyEval_CallObjectWithKeywords(__pyx_v_style, ((PyObject *)__pyx_t_2), __pyx_v__kw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1854 + * return style(self, **_kw) + * + * def relaxng(self, relaxng): # <<<<<<<<<<<<<< + * u"""relaxng(self, relaxng) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_relaxng(PyObject *__pyx_v_self, PyObject *__pyx_v_relaxng); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_relaxng[] = "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_relaxng(PyObject *__pyx_v_self, PyObject *__pyx_v_relaxng) { + PyObject *__pyx_v_schema; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("relaxng"); + __pyx_v_schema = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1868 + * 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 = 1868; __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-2.2/src/lxml/lxml.etree.pyx":1869 + * """ + * 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 = 1869; __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 = 1869; __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_schema); + __pyx_v_schema = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1870 + * self._assertHasRoot() + * schema = RelaxNG(relaxng) + * return schema.validate(self) # <<<<<<<<<<<<<< + * + * def xmlschema(self, xmlschema): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_schema, __pyx_kp_validate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1870; __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 = 1870; __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 = 1870; __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(__pyx_v_schema); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1872 + * return schema.validate(self) + * + * def xmlschema(self, xmlschema): # <<<<<<<<<<<<<< + * u"""xmlschema(self, xmlschema) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_xmlschema(PyObject *__pyx_v_self, PyObject *__pyx_v_xmlschema); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_xmlschema[] = "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_xmlschema(PyObject *__pyx_v_self, PyObject *__pyx_v_xmlschema) { + PyObject *__pyx_v_schema; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("xmlschema"); + __pyx_v_schema = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1886 + * 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 = 1886; __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-2.2/src/lxml/lxml.etree.pyx":1887 + * """ + * 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 = 1887; __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 = 1887; __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_schema); + __pyx_v_schema = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1888 + * self._assertHasRoot() + * schema = XMLSchema(xmlschema) + * return schema.validate(self) # <<<<<<<<<<<<<< + * + * def xinclude(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_schema, __pyx_kp_validate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; __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 = 1888; __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 = 1888; __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(__pyx_v_schema); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1890 + * return schema.validate(self) + * + * def xinclude(self): # <<<<<<<<<<<<<< + * u"""xinclude(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_xinclude(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_xinclude[] = "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_xinclude(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("xinclude"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1903 + * """ + * cdef int result + * 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 = 1903; __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-2.2/src/lxml/lxml.etree.pyx":1904 + * cdef int result + * 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 = 1904; __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 = 1904; __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 = 1904; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1906 + * 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_write_c14n(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_12_ElementTree_write_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_write_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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_file,&__pyx_kp_exclusive,&__pyx_kp_with_comments,&__pyx_kp_compression,0}; + __Pyx_SetupRefcountContext("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_95; + values[2] = __pyx_k_96; + values[3] = __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_kp_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_kp_exclusive); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_with_comments); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 1906; __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_95; + __pyx_v_with_comments = __pyx_k_96; + __pyx_v_compression = __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_compression); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1915 + * The ``compression`` option enables GZip compression level 1-9. + * """ + * self._assertHasRoot() # <<<<<<<<<<<<<< + * if compression is None or compression < 0: + * 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 = 1915; __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-2.2/src/lxml/lxml.etree.pyx":1916 + * """ + * self._assertHasRoot() + * if compression is None or compression < 0: # <<<<<<<<<<<<<< + * compression = 0 + * _tofilelikeC14N(file, self._context_node, exclusive, with_comments, + */ + __pyx_t_2 = (__pyx_v_compression == Py_None); + if (!__pyx_t_2) { + __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 = 1916; __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[0]; __pyx_lineno = 1916; __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-2.2/src/lxml/lxml.etree.pyx":1917 + * self._assertHasRoot() + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1918 + * if compression is None or compression < 0: + * compression = 0 + * _tofilelikeC14N(file, self._context_node, exclusive, with_comments, # <<<<<<<<<<<<<< + * compression) + * + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_exclusive); if (unlikely((__pyx_t_4 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1919 + * compression = 0 + * _tofilelikeC14N(file, self._context_node, exclusive, with_comments, + * compression) # <<<<<<<<<<<<<< + * + * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node): + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_compression); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElementTree *)__pyx_v_self)->_context_node, __pyx_t_4, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __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._ElementTree.write_c14n"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_compression); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1921 + * 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_SetupRefcountContext("_elementTreeFactory"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1922 + * + * 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 = 1922; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1924 + * 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; + __Pyx_SetupRefcountContext("_newElementTree"); + __Pyx_INCREF((PyObject *)__pyx_v_context_node); + __pyx_v_result = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1927 + * 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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ElementTree))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1927; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1928 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1929 + * result = baseclass() + * if context_node is None and doc is not None: + * context_node = doc.getroot() # <<<<<<<<<<<<<< + * if context_node is None: + * result._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 = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1929; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1930 + * if context_node is None and doc is not None: + * context_node = doc.getroot() + * if context_node is None: # <<<<<<<<<<<<<< + * result._doc = doc + * result._context_node = context_node + */ + __pyx_t_4 = (((PyObject *)__pyx_v_context_node) == Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1931 + * context_node = doc.getroot() + * if context_node is None: + * result._doc = doc # <<<<<<<<<<<<<< + * result._context_node = context_node + * return result + */ + __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; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1932 + * if context_node is None: + * result._doc = doc + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1933 + * result._doc = doc + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1940 + * """ + * cdef _Element _element + * def __init__(self, _Element element not None): # <<<<<<<<<<<<<< + * self._element = element + * + */ + +static int __pyx_pf_4lxml_5etree_7_Attrib___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_Attrib___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct LxmlElement *__pyx_v_element = 0; + int __pyx_r; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_element,0}; + __Pyx_SetupRefcountContext("__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_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1940; __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("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Attrib.__init__"); + 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 = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1941 + * cdef _Element _element + * def __init__(self, _Element element not None): + * 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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1944 + * + * # MANIPULATORS + * def __setitem__(self, key, value): # <<<<<<<<<<<<<< + * _setAttributeValue(self._element, key, value) + * + */ + +static int __pyx_pf_4lxml_5etree_7_Attrib___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_Attrib___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__setitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1945 + * # MANIPULATORS + * def __setitem__(self, key, value): + * _setAttributeValue(self._element, key, value) # <<<<<<<<<<<<<< + * + * def __delitem__(self, key): + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._Attrib.__setitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1947 + * _setAttributeValue(self._element, key, value) + * + * def __delitem__(self, key): # <<<<<<<<<<<<<< + * _delAttribute(self._element, key) + * + */ + +static int __pyx_pf_4lxml_5etree_7_Attrib___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_Attrib___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__delitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1948 + * + * def __delitem__(self, key): + * _delAttribute(self._element, key) # <<<<<<<<<<<<<< + * + * def update(self, sequence_or_dict): + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__delAttribute(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._Attrib.__delitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1950 + * _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_update(PyObject *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_update(PyObject *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict) { + PyObject *__pyx_v_key; + PyObject *__pyx_v_value; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1951 + * + * 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 = PyObject_TypeCheck(__pyx_v_sequence_or_dict, ((PyTypeObject *)((PyObject*)&PyDict_Type))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1952 + * 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_kp_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __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 = 1952; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1953 + * 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 = 1953; __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 = 1953; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1954 + * 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_5 = __pyx_f_4lxml_5etree__setAttributeValue(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1956 + * _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_pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_pop(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_kp_key,0}; + __Pyx_SetupRefcountContext("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_kp_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 = 1956; __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 = 1956; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_default); + __Pyx_AddTraceback("lxml.etree._Attrib.pop"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1957 + * + * 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(__pyx_v_default) > 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1959 + * 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(__pyx_v_default) + 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_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_372), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1960 + * 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 = __pyx_f_4lxml_5etree__getAttributeValue(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.etree.pyx":1961 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1962 + * 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(__pyx_v_default) == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1963 + * 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 = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1965 + * raise KeyError, key + * else: + * result = python.PyTuple_GET_ITEM(default, 0) # <<<<<<<<<<<<<< + * python.Py_INCREF(result) + * else: + */ + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_default, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.etree.pyx":1966 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1968 + * python.Py_INCREF(result) + * else: + * _delAttribute(self._element, key) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__delAttribute(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1969 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1971 + * return result + * + * def clear(self): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * c_node = self._element._c_node + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_clear(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_clear(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1973 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1974 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1975 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1978 + * + * # ACCESSORS + * def __repr__(self): # <<<<<<<<<<<<<< + * return repr(dict( _attributeIteratorFactory(self._element, 3) )) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1979 + * # ACCESSORS + * def __repr__(self): + * return repr(dict( _attributeIteratorFactory(self._element, 3) )) # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__attributeIteratorFactory(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __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 = 1979; __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*)&PyDict_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Repr(__pyx_t_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_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.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1981 + * 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___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__getitem__"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1982 + * + * def __getitem__(self, key): + * result = _getAttributeValue(self._element, key, None) # <<<<<<<<<<<<<< + * if result is None: + * raise KeyError, key + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__getAttributeValue(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.etree.pyx":1983 + * def __getitem__(self, key): + * result = _getAttributeValue(self._element, key, None) + * if result is None: # <<<<<<<<<<<<<< + * raise KeyError, key + * else: + */ + __pyx_t_2 = (__pyx_v_result == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1984 + * 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 = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1986 + * 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_AddTraceback("lxml.etree._Attrib.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1988 + * return result + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * cdef xmlAttr* c_attr + * c_attr = self._element._c_node.properties + */ + +static int __pyx_pf_4lxml_5etree_7_Attrib___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_Attrib___nonzero__(PyObject *__pyx_v_self) { + xmlAttr *__pyx_v_c_attr; + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__nonzero__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1990 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1991 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1992 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1993 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1994 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1995 + * return 1 + * c_attr = c_attr.next + * return 0 # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1997 + * return 0 + * + * def __len__(self): # <<<<<<<<<<<<<< + * cdef xmlAttr* c_attr + * cdef Py_ssize_t c + */ + +static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib___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_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2000 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2001 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2002 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2003 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2004 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2005 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2006 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2008 + * return c + * + * def get(self, key, default=None): # <<<<<<<<<<<<<< + * return _getAttributeValue(self._element, key, default) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_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; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_key,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("get"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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 = 2008; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_key = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = 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 = 2008; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._Attrib.get"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2009 + * + * def get(self, key, default=None): + * return _getAttributeValue(self._element, key, default) # <<<<<<<<<<<<<< + * + * def keys(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_5etree__getAttributeValue(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self)->_element, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; __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.get"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2011 + * return _getAttributeValue(self._element, key, default) + * + * def keys(self): # <<<<<<<<<<<<<< + * return _collectAttributes(self._element._c_node, 1) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_keys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_keys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("keys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2012 + * + * def keys(self): + * return _collectAttributes(self._element._c_node, 1) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2012; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2014 + * 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___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2015 + * + * def __iter__(self): + * return iter(_collectAttributes(self._element._c_node, 1)) # <<<<<<<<<<<<<< + * + * def iterkeys(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2015; __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 = 2015; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2017 + * 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_iterkeys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_iterkeys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("iterkeys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2018 + * + * def iterkeys(self): + * return iter(_collectAttributes(self._element._c_node, 1)) # <<<<<<<<<<<<<< + * + * def values(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2018; __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 = 2018; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2020 + * 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_values(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_values(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("values"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2021 + * + * def values(self): + * return _collectAttributes(self._element._c_node, 2) # <<<<<<<<<<<<<< + * + * def itervalues(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2021; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2023 + * 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_itervalues(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_itervalues(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("itervalues"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2024 + * + * def itervalues(self): + * return iter(_collectAttributes(self._element._c_node, 2)) # <<<<<<<<<<<<<< + * + * def items(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2024; __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 = 2024; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2026 + * 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_items(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_items(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("items"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2027 + * + * def items(self): + * return _collectAttributes(self._element._c_node, 3) # <<<<<<<<<<<<<< + * + * def iteritems(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2027; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2029 + * 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_iteritems(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_iteritems(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("iteritems"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2030 + * + * def iteritems(self): + * return iter(_collectAttributes(self._element._c_node, 3)) # <<<<<<<<<<<<<< + * + * def has_key(self, key): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = 2030; __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 = 2030; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2032 + * 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_has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("has_key"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2033 + * + * 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 = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2034 + * 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 = 2034; __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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2036 + * 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 = 2036; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2038 + * return False + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * cdef char* c_href + */ + +static int __pyx_pf_4lxml_5etree_7_Attrib___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_Attrib___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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + void *__pyx_4; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__contains__"); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2041 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2042 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2043 + * 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_2 = (__pyx_v_ns == Py_None); + if (__pyx_t_2) { + __pyx_4 = NULL; + } else { + __pyx_4 = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_v_c_href = __pyx_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2044 + * 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_2 = (xmlHasNsProp(__pyx_v_c_node, PyString_AS_STRING(__pyx_v_tag), __pyx_v_c_href) != 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2045 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2047 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._Attrib.__contains__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2049 + * 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___richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_Attrib___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_SetupRefcountContext("__richcmp__"); + __Pyx_INCREF(__pyx_v_one); + __Pyx_INCREF(__pyx_v_other); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2050 + * + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2051 + * 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 = 2051; __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 = 2051; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2052 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2053 + * 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 = 2053; __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 = 2053; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2054 + * if not python.PyDict_Check(other): + * other = dict(other) + * return python.PyObject_RichCompare(one, other, op) # <<<<<<<<<<<<<< + * + * cdef class _AttribIterator: + */ + __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 = 2054; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2063 + * 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_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2064 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2066 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef xmlAttr* c_attr + * if self._node is None: + */ + +static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___next__(PyObject *__pyx_v_self) { + xmlAttr *__pyx_v_c_attr; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__next__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2068 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2069 + * 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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2070 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2071 + * 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) { + if ((__pyx_v_c_attr != NULL)) { + __pyx_t_1 = (__pyx_v_c_attr->type != XML_ATTRIBUTE_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_attr != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2072 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2073 + * 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_1 = (__pyx_v_c_attr == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2074 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2075 + * 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 = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2077 + * raise StopIteration + * + * self._c_attr = c_attr.next # <<<<<<<<<<<<<< + * if self._keysvalues == 1: + * return _namespacedName(c_attr) + */ + ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_c_attr = __pyx_v_c_attr->next; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2078 + * + * self._c_attr = c_attr.next + * if self._keysvalues == 1: # <<<<<<<<<<<<<< + * return _namespacedName(c_attr) + * elif self._keysvalues == 2: + */ + switch (((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self)->_keysvalues) { + case 1: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2079 + * self._c_attr = c_attr.next + * if self._keysvalues == 1: + * return _namespacedName(c_attr) # <<<<<<<<<<<<<< + * elif self._keysvalues == 2: + * return _attributeValue(self._node._c_node, c_attr) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2080 + * if self._keysvalues == 1: + * return _namespacedName(c_attr) + * elif self._keysvalues == 2: # <<<<<<<<<<<<<< + * return _attributeValue(self._node._c_node, c_attr) + * else: + */ + case 2: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2081 + * return _namespacedName(c_attr) + * elif self._keysvalues == 2: + * return _attributeValue(self._node._c_node, c_attr) # <<<<<<<<<<<<<< + * else: + * return (_namespacedName(c_attr), + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __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_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + break; + default: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2083 + * return _attributeValue(self._node._c_node, c_attr) + * else: + * return (_namespacedName(c_attr), # <<<<<<<<<<<<<< + * _attributeValue(self._node._c_node, c_attr)) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2084 + * else: + * return (_namespacedName(c_attr), + * _attributeValue(self._node._c_node, c_attr)) # <<<<<<<<<<<<<< + * + * cdef object _attributeIteratorFactory(_Element element, int keysvalues): + */ + __pyx_t_3 = __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_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __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 = 2083; __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_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + break; + } + + __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._AttribIterator.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2086 + * _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_SetupRefcountContext("_attributeIteratorFactory"); + __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2088 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2089 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2090 + * 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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__AttribIterator))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_attribs)); + __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2091 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2092 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2093 + * attribs._node = element + * attribs._c_attr = element._c_node.properties + * attribs._keysvalues = keysvalues # <<<<<<<<<<<<<< + * return attribs + * + */ + __pyx_v_attribs->_keysvalues = __pyx_v_keysvalues; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2094 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2103 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_initTagMatch"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2104 + * cdef char* _name + * cdef _initTagMatch(self, tag): + * self._href = NULL # <<<<<<<<<<<<<< + * self._name = NULL + * if tag is None: + */ + __pyx_v_self->_href = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2105 + * cdef _initTagMatch(self, tag): + * self._href = NULL + * self._name = NULL # <<<<<<<<<<<<<< + * if tag is None: + * self._node_type = 0 + */ + __pyx_v_self->_name = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2106 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2107 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2108 + * if tag is None: + * self._node_type = 0 + * elif tag is Comment: # <<<<<<<<<<<<<< + * self._node_type = tree.XML_COMMENT_NODE + * elif tag is ProcessingInstruction: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Comment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag == __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2109 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2110 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_101); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag == __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2111 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2112 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Entity); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag == __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2113 + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2114 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Element); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag == __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2115 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2117 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2118 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2119 + * 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_1 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_1 != Py_None); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2120 + * 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_1 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_v_self->_href = PyString_AS_STRING(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2121 + * 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_1 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_v_self->_name = PyString_AS_STRING(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2122 + * 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 + * + */ + if (((__pyx_v_self->_name[0]) == '*')) { + __pyx_t_1 = ((__pyx_v_self->_name[1]) == '\x00'); + } else { + __pyx_t_1 = ((__pyx_v_self->_name[0]) == '*'); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2123 + * 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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._ElementTagMatcher._initTagMatch"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2130 + * 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_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2131 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2133 + * 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; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_storeNext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2135 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2136 + * 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) { + if ((__pyx_v_c_node != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2137 + * 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)): + */ + if ((__pyx_v_self->__pyx_base._node_type != 0)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2138 + * 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) + */ + if (!(__pyx_v_self->__pyx_base._node_type != __pyx_v_c_node->type)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2139 + * 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_1 = (!__pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_self->__pyx_base._href, __pyx_v_self->__pyx_base._name)); + } else { + __pyx_t_1 = (__pyx_v_self->__pyx_base._node_type != __pyx_v_c_node->type); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_self->__pyx_base._node_type != 0); + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2140 + * (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); + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2141 + * 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2142 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2145 + * else: + * # Python ref: + * self._node = _elementFactory(node._doc, c_node) # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_node->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->_node); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_node)); + __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L5:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("lxml.etree._ElementIterator._storeNext"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2147 + * 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___next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___next__(PyObject *__pyx_v_self) { + struct LxmlElement *__pyx_v_current_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__next__"); + __pyx_v_current_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2150 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2151 + * 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 = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2153 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2154 + * # 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2155 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2161 + * Iterates over the children of an element. + * """ + * def __init__(self, _Element node not None, tag=None, *, reversed=False): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * self._initTagMatch(tag) + */ + +static int __pyx_pf_4lxml_5etree_20ElementChildIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_20ElementChildIterator___init__(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; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_node,&__pyx_kp_tag,&__pyx_kp_reversed,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = Py_None; + values[2] = __pyx_k_97; + 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_kp_node); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __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 = Py_None; + __pyx_v_reversed = __pyx_k_97; + 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("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__init__"); + 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 = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2163 + * def __init__(self, _Element node not None, tag=None, *, reversed=False): + * cdef xmlNode* c_node + * self._initTagMatch(tag) # <<<<<<<<<<<<<< + * if reversed: + * c_node = _findChildBackwards(node._c_node, 0) + */ + __pyx_t_1 = ((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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __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-2.2/src/lxml/lxml.etree.pyx":2164 + * cdef xmlNode* c_node + * self._initTagMatch(tag) + * if reversed: # <<<<<<<<<<<<<< + * c_node = _findChildBackwards(node._c_node, 0) + * self._next_element = _previousElement + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reversed); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2165 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2166 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2168 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2169 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2170 + * 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_2 = (__pyx_v_tag != Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2171 + * 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) { + if ((__pyx_v_c_node != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2172 + * 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)): + */ + if ((((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._node_type != 0)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2173 + * 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) + */ + if (!(((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._node_type != __pyx_v_c_node->type)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2174 + * 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_2 = (!__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)); + } else { + __pyx_t_2 = (((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._node_type != __pyx_v_c_node->type); + } + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = (((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self)->__pyx_base.__pyx_base._node_type != 0); + } + __pyx_t_2 = __pyx_t_3; + } else { + __pyx_t_2 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2175 + * (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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2176 + * 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_2 = (__pyx_v_c_node != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2178 + * if c_node is not NULL: + * # store Python ref: + * self._node = _elementFactory(node._doc, c_node) # <<<<<<<<<<<<<< + * + * cdef class SiblingsIterator(_ElementIterator): + */ + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_node->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __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_1); + __pyx_t_1 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2186 + * You can pass the boolean keyword ``preceding`` to specify the direction. + * """ + * def __init__(self, _Element node not None, tag=None, *, preceding=False): # <<<<<<<<<<<<<< + * self._initTagMatch(tag) + * if preceding: + */ + +static int __pyx_pf_4lxml_5etree_16SiblingsIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_16SiblingsIterator___init__(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; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_node,&__pyx_kp_tag,&__pyx_kp_preceding,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = Py_None; + values[2] = __pyx_k_98; + 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_kp_node); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __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 = Py_None; + __pyx_v_preceding = __pyx_k_98; + 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("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__init__"); + 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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2187 + * """ + * def __init__(self, _Element node not None, tag=None, *, preceding=False): + * self._initTagMatch(tag) # <<<<<<<<<<<<<< + * if preceding: + * self._next_element = _previousElement + */ + __pyx_t_1 = ((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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __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-2.2/src/lxml/lxml.etree.pyx":2188 + * def __init__(self, _Element node not None, tag=None, *, preceding=False): + * self._initTagMatch(tag) + * if preceding: # <<<<<<<<<<<<<< + * self._next_element = _previousElement + * else: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_preceding); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2189 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2191 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2192 + * 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_1); + __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2198 + * Iterates over the ancestors of an element (from parent to parent). + * """ + * def __init__(self, _Element node not None, tag=None): # <<<<<<<<<<<<<< + * self._initTagMatch(tag) + * self._next_element = _parentElement + */ + +static int __pyx_pf_4lxml_5etree_17AncestorsIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_17AncestorsIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct LxmlElement *__pyx_v_node = 0; + PyObject *__pyx_v_tag = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_node,&__pyx_kp_tag,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_node); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 2198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_node = ((struct LxmlElement *)values[0]); + __pyx_v_tag = values[1]; + } else { + __pyx_v_tag = 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("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__init__"); + 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 = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2199 + * """ + * def __init__(self, _Element node not None, tag=None): + * self._initTagMatch(tag) # <<<<<<<<<<<<<< + * self._next_element = _parentElement + * self._storeNext(node) + */ + __pyx_t_1 = ((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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2199; __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-2.2/src/lxml/lxml.etree.pyx":2200 + * def __init__(self, _Element node not None, tag=None): + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2201 + * 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_1); + __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2227 + * cdef _Element _next_node + * cdef _Element _top_node + * def __init__(self, _Element node not None, tag=None, *, inclusive=True): # <<<<<<<<<<<<<< + * self._top_node = node + * self._next_node = node + */ + +static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___init__(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; + 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_kp_node,&__pyx_kp_tag,&__pyx_kp_inclusive,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = Py_None; + values[2] = __pyx_k_99; + 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_kp_node); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __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 = Py_None; + __pyx_v_inclusive = __pyx_k_99; + 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("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__init__"); + 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 = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2228 + * cdef _Element _top_node + * def __init__(self, _Element node not None, tag=None, *, inclusive=True): + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2229 + * def __init__(self, _Element node not None, tag=None, *, inclusive=True): + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2230 + * self._top_node = node + * self._next_node = node + * self._initTagMatch(tag) # <<<<<<<<<<<<<< + * if not inclusive or \ + * tag is not None and \ + */ + __pyx_t_1 = ((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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; __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-2.2/src/lxml/lxml.etree.pyx":2231 + * self._next_node = node + * self._initTagMatch(tag) + * if not inclusive or \ # <<<<<<<<<<<<<< + * tag is not None and \ + * self._node_type != 0 and \ + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(!__pyx_t_2)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2232 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2233 + * 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)): + */ + if ((((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._node_type != 0)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2234 + * 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 + */ + if (!(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._node_type != __pyx_v_node->_c_node->type)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2235 + * 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_4 = (!__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)); + } else { + __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._node_type != __pyx_v_node->_c_node->type); + } + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._node_type != 0); + } + __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-2.2/src/lxml/lxml.etree.pyx":2237 + * not _tagMatches(node._c_node, self._href, self._name)): + * # this cannot raise StopIteration, self._next_node != None + * self.__next__() # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___next__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __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; + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2239 + * self.__next__() + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2240 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2242 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * cdef _Element current_node + */ + +static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___next__(PyObject *__pyx_v_self) { + xmlNode *__pyx_v_c_node; + struct LxmlElement *__pyx_v_current_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__next__"); + __pyx_v_current_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2245 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2246 + * 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 = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2247 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2248 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2249 + * 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: + */ + if ((((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._name == NULL)) { + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._href == NULL); + } else { + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self)->__pyx_base._name == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2250 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2252 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2253 + * else: + * c_node = self._nextNodeMatchTag(c_node) + * if c_node is NULL: # <<<<<<<<<<<<<< + * self._next_node = None + * else: + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2254 + * 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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2256 + * self._next_node = None + * else: + * self._next_node = _elementFactory(current_node._doc, c_node) # <<<<<<<<<<<<<< + * return current_node + * + */ + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_current_node->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __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_2); + __pyx_t_2 = 0; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2257 + * 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_2); + __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_current_node); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2259 + * 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; + __Pyx_SetupRefcountContext("_nextNodeAnyTag"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2260 + * + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2261 + * 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) + */ + if (!(__pyx_v_self->__pyx_base._node_type == 0)) { + __pyx_t_1 = (__pyx_v_self->__pyx_base._node_type == __pyx_v_c_node->type); + } else { + __pyx_t_1 = (__pyx_v_self->__pyx_base._node_type == 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2262 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2263 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2264 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2266 + * 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; + __Pyx_SetupRefcountContext("_nextNodeMatchTag"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2267 + * + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2268 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2269 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2270 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2272 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2273 + * # 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2274 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2275 + * 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 + */ + if (!(__pyx_v_c_name == NULL)) { + __pyx_t_1 = (__pyx_v_c_name == __pyx_v_c_node->name); + } else { + __pyx_t_1 = (__pyx_v_c_name == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2276 + * 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_2 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_self->__pyx_base._href, __pyx_v_self->__pyx_base._name); + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2277 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2278 + * _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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2279 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2293 + * cdef object _nextEvent + * cdef _Element _start_element + * def __init__(self, _Element element not None, tag=None, *, with_tail=True): # <<<<<<<<<<<<<< + * if with_tail: + * events = (u"start", u"end") + */ + +static int __pyx_pf_4lxml_5etree_19ElementTextIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_19ElementTextIterator___init__(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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_element,&__pyx_kp_tag,&__pyx_kp_with_tail,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = Py_None; + values[2] = __pyx_k_100; + 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_kp_element); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __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 = Py_None; + __pyx_v_with_tail = __pyx_k_100; + 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("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_events = 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 = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2294 + * cdef _Element _start_element + * def __init__(self, _Element element not None, tag=None, *, with_tail=True): + * if with_tail: # <<<<<<<<<<<<<< + * events = (u"start", u"end") + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2295 + * def __init__(self, _Element element not None, tag=None, *, with_tail=True): + * if with_tail: + * events = (u"start", u"end") # <<<<<<<<<<<<<< + * else: + * events = (u"start",) + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_373)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_373)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_373)); + __Pyx_INCREF(((PyObject *)__pyx_kp_374)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_374)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_374)); + __Pyx_DECREF(__pyx_v_events); + __pyx_v_events = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2297 + * events = (u"start", u"end") + * else: + * events = (u"start",) # <<<<<<<<<<<<<< + * self._start_element = element + * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_375)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_375)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_375)); + __Pyx_DECREF(__pyx_v_events); + __pyx_v_events = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2298 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2299 + * events = (u"start",) + * self._start_element = element + * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_element)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_element)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_element)); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_events, __pyx_v_events) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_iterwalk)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __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_1)); __pyx_1 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_kp___next__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __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_2; + __pyx_t_2 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_events); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2301 + * self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2302 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2304 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef _Element element + * while result is None: + */ + +static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator___next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator___next__(PyObject *__pyx_v_self) { + struct LxmlElement *__pyx_v_element; + PyObject *__pyx_v_event; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2306 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2307 + * 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 = 2307; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __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_2; + __pyx_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_3); + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_event); + __pyx_v_event = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_3); + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2308 + * 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_2 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_376), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2309 + * 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_kp_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2310 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2311 + * 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_kp_tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2312 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2314 + * 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_SetupRefcountContext("_createElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2316 + * 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, PyString_AS_STRING(__pyx_v_name_utf), NULL); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2317 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2319 + * 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_SetupRefcountContext("_createComment"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2321 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2322 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2324 + * 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_SetupRefcountContext("_createPI"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2326 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2327 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2329 + * 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_SetupRefcountContext("_createEntity"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2331 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2332 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2336 + * # 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_Element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_Element[] = "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 PyObject *__pyx_pf_4lxml_5etree_Element(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_kp__tag,&__pyx_kp_attrib,&__pyx_kp_nsmap,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = 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_kp__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_kp_attrib); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_nsmap); + if (unlikely(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 = 2336; __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 = Py_None; + __pyx_v_nsmap = 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 = 2336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__extra); + __Pyx_AddTraceback("lxml.etree.Element"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2346 + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2347 + * """ + * 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, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2349 + * attrib, nsmap, _extra) + * + * def Comment(text=None): # <<<<<<<<<<<<<< + * u"""Comment(text=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_Comment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_Comment[] = "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 PyObject *__pyx_pf_4lxml_5etree_Comment(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_kp_text,0}; + __Pyx_SetupRefcountContext("Comment"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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_kp_text); + if (unlikely(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 = 2349; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_text = values[0]; + } else { + __pyx_v_text = 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 = 2349; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Comment"); + return NULL; + __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-2.2/src/lxml/lxml.etree.pyx":2358 + * cdef xmlNode* c_node + * cdef xmlDoc* c_doc + * if text is None: # <<<<<<<<<<<<<< + * text = '' + * else: + */ + __pyx_t_1 = (__pyx_v_text == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2359 + * cdef xmlDoc* c_doc + * if text is None: + * text = '' # <<<<<<<<<<<<<< + * else: + * text = _utf8(text) + */ + __Pyx_INCREF(__pyx_kp_377); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_kp_377; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2361 + * text = '' + * else: + * text = _utf8(text) # <<<<<<<<<<<<<< + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __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-2.2/src/lxml/lxml.etree.pyx":2362 + * 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 = 2362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2363 + * text = _utf8(text) + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) # <<<<<<<<<<<<<< + * c_node = _createComment(c_doc, _cstr(text)) + * tree.xmlAddChild(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 = 2363; __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-2.2/src/lxml/lxml.etree.pyx":2364 + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) + * c_node = _createComment(c_doc, _cstr(text)) # <<<<<<<<<<<<<< + * tree.xmlAddChild(c_doc, c_node) + * return _elementFactory(doc, c_node) + */ + __pyx_v_c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, PyString_AS_STRING(__pyx_v_text)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2365 + * doc = _documentFactory(c_doc, None) + * c_node = _createComment(c_doc, _cstr(text)) + * tree.xmlAddChild(c_doc, c_node) # <<<<<<<<<<<<<< + * return _elementFactory(doc, c_node) + * + */ + xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2366 + * c_node = _createComment(c_doc, _cstr(text)) + * tree.xmlAddChild(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 = 2366; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2368 + * return _elementFactory(doc, c_node) + * + * def ProcessingInstruction(target, text=None): # <<<<<<<<<<<<<< + * u"""ProcessingInstruction(target, text=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_ProcessingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_ProcessingInstruction[] = "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 PyObject *__pyx_pf_4lxml_5etree_ProcessingInstruction(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_kp_target,&__pyx_kp_text,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_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_kp_text); + if (unlikely(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 = 2368; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_target = values[0]; + __pyx_v_text = values[1]; + } else { + __pyx_v_text = 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 = 2368; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ProcessingInstruction"); + 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2377 + * cdef xmlNode* c_node + * cdef xmlDoc* c_doc + * target = _utf8(target) # <<<<<<<<<<<<<< + * if text is None: + * text = '' + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2377; __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-2.2/src/lxml/lxml.etree.pyx":2378 + * cdef xmlDoc* c_doc + * target = _utf8(target) + * if text is None: # <<<<<<<<<<<<<< + * text = '' + * else: + */ + __pyx_t_2 = (__pyx_v_text == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2379 + * target = _utf8(target) + * if text is None: + * text = '' # <<<<<<<<<<<<<< + * else: + * text = _utf8(text) + */ + __Pyx_INCREF(__pyx_kp_378); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_kp_378; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2381 + * text = '' + * else: + * text = _utf8(text) # <<<<<<<<<<<<<< + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __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-2.2/src/lxml/lxml.etree.pyx":2382 + * 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 = 2382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2383 + * text = _utf8(text) + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) # <<<<<<<<<<<<<< + * c_node = _createPI(c_doc, _cstr(target), _cstr(text)) + * tree.xmlAddChild(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 = 2383; __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-2.2/src/lxml/lxml.etree.pyx":2384 + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) + * c_node = _createPI(c_doc, _cstr(target), _cstr(text)) # <<<<<<<<<<<<<< + * tree.xmlAddChild(c_doc, c_node) + * return _elementFactory(doc, c_node) + */ + __pyx_v_c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, PyString_AS_STRING(__pyx_v_target), PyString_AS_STRING(__pyx_v_text)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2385 + * doc = _documentFactory(c_doc, None) + * c_node = _createPI(c_doc, _cstr(target), _cstr(text)) + * tree.xmlAddChild(c_doc, c_node) # <<<<<<<<<<<<<< + * return _elementFactory(doc, c_node) + * + */ + xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2386 + * c_node = _createPI(c_doc, _cstr(target), _cstr(text)) + * tree.xmlAddChild(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 = 2386; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2401 + * """ + * 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_kp_data,0}; + __Pyx_SetupRefcountContext("__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_kp_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 = 2401; __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 = 2401; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.CDATA.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2402 + * cdef object _utf8_data + * def __init__(self, data): + * self._utf8_data = _utf8(data) # <<<<<<<<<<<<<< + * + * def Entity(name): + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2404 + * self._utf8_data = _utf8(data) + * + * def Entity(name): # <<<<<<<<<<<<<< + * u"""Entity(name) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_Entity(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/ +static char __pyx_doc_4lxml_5etree_Entity[] = "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 PyObject *__pyx_pf_4lxml_5etree_Entity(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_SetupRefcountContext("Entity"); + __pyx_self = __pyx_self; + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2417 + * 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; __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-2.2/src/lxml/lxml.etree.pyx":2418 + * 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 = PyString_AS_STRING(__pyx_v_name_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2419 + * 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-2.2/src/lxml/lxml.etree.pyx":2420 + * 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-2.2/src/lxml/lxml.etree.pyx":2421 + * 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_379), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2422 + * 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-2.2/src/lxml/lxml.etree.pyx":2423 + * 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_380), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2424 + * 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 = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2425 + * 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(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 = 2425; __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-2.2/src/lxml/lxml.etree.pyx":2426 + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, None) + * c_node = _createEntity(c_doc, c_name) # <<<<<<<<<<<<<< + * tree.xmlAddChild(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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2427 + * doc = _documentFactory(c_doc, None) + * c_node = _createEntity(c_doc, c_name) + * tree.xmlAddChild(c_doc, c_node) # <<<<<<<<<<<<<< + * return _elementFactory(doc, c_node) + * + */ + xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2428 + * c_node = _createEntity(c_doc, c_name) + * tree.xmlAddChild(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 = 2428; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2430 + * 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_SubElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_SubElement[] = "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 PyObject *__pyx_pf_4lxml_5etree_SubElement(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_kp__parent,&__pyx_kp__tag,&__pyx_kp_attrib,&__pyx_kp_nsmap,0}; + __Pyx_SetupRefcountContext("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}; + values[2] = Py_None; + values[3] = 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_kp__parent); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp__tag); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_attrib); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_nsmap); + if (unlikely(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 = 2430; __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 = Py_None; + __pyx_v_nsmap = 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 = 2430; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__extra); + __Pyx_AddTraceback("lxml.etree.SubElement"); + 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 = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2437 + * 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, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2437; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2439 + * 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_ElementTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_ElementTree[] = "ElementTree(element=None, file=None, parser=None)\n\n ElementTree wrapper class.\n "; +static PyObject *__pyx_pf_4lxml_5etree_ElementTree(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; + PyObject *__pyx_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + xmlDoc *__pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_element,&__pyx_kp_file,&__pyx_kp_parser,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_element); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_file); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 2439; __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 = 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 = 2439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ElementTree"); + 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 = 2439; __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 = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2451 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2452 + * + * 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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2453 + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2454 + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2455 + * 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 = 2455; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2456 + * try: + * doc = _parseDocument(file, parser, None) + * except _TargetParserResult, result_container: # <<<<<<<<<<<<<< + * return result_container.result + * else: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyErr_ExceptionMatches(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.ElementTree"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_result_container); + __pyx_v_result_container = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2457 + * doc = _parseDocument(file, parser, None) + * except _TargetParserResult, result_container: + * return result_container.result # <<<<<<<<<<<<<< + * else: + * c_doc = _newXMLDoc() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_result_container, __pyx_kp_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L10_except_return; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2459 + * return result_container.result + * else: + * c_doc = _newXMLDoc() # <<<<<<<<<<<<<< + * doc = _documentFactory(c_doc, parser) + * + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2460 + * else: + * c_doc = _newXMLDoc() + * doc = _documentFactory(c_doc, parser) # <<<<<<<<<<<<<< + * + * return _elementTreeFactory(doc, element) + */ + __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[0]; __pyx_lineno = 2460; __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; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2462 + * doc = _documentFactory(c_doc, parser) + * + * return _elementTreeFactory(doc, element) # <<<<<<<<<<<<<< + * + * def HTML(text, _BaseParser parser=None, *, base_url=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, __pyx_v_element)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2464 + * 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_HTML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_HTML[] = "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 PyObject *__pyx_pf_4lxml_5etree_HTML(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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_text,&__pyx_kp_parser,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_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_kp_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 2464; __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 = 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 = 2464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.HTML"); + 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 = 2464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2479 + * """ + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2480 + * 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 = 2480; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2481 + * if parser is None: + * parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + * if not isinstance(parser, HTMLParser): # <<<<<<<<<<<<<< + * parser = __DEFAULT_HTML_PARSER + * try: + */ + __pyx_t_1 = PyObject_TypeCheck(((PyObject *)__pyx_v_parser), ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser))); + __pyx_t_3 = (!__pyx_t_1); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2482 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2483 + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2484 + * 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 = 2484; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2485 + * 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 = 2485; __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_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_L0; + __pyx_L8_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2486 + * doc = _parseMemoryDocument(text, base_url, parser) + * return doc.getroot() + * except _TargetParserResult, result_container: # <<<<<<<<<<<<<< + * return result_container.result + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2486; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyErr_ExceptionMatches(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.HTML"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2486; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_result_container); + __pyx_v_result_container = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2487 + * 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_2 = PyObject_GetAttr(__pyx_v_result_container, __pyx_kp_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2487; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L11_except_return; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L9_exception_handled; + } + __pyx_L10_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2489 + * 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_XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_XML[] = "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(\"\")\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 PyObject *__pyx_pf_4lxml_5etree_XML(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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_text,&__pyx_kp_parser,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_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_kp_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 2489; __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 = 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 = 2489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XML"); + 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 = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2507 + * """ + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2508 + * 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 = 2508; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2509 + * if parser is None: + * parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + * if not isinstance(parser, XMLParser): # <<<<<<<<<<<<<< + * parser = __DEFAULT_XML_PARSER + * try: + */ + __pyx_t_1 = PyObject_TypeCheck(((PyObject *)__pyx_v_parser), ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser))); + __pyx_t_3 = (!__pyx_t_1); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2510 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2511 + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2512 + * 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 = 2512; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2513 + * 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 = 2513; __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_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_L0; + __pyx_L8_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2514 + * doc = _parseMemoryDocument(text, base_url, parser) + * return doc.getroot() + * except _TargetParserResult, result_container: # <<<<<<<<<<<<<< + * return result_container.result + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2514; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyErr_ExceptionMatches(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.XML"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2514; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_result_container); + __pyx_v_result_container = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2515 + * 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_2 = PyObject_GetAttr(__pyx_v_result_container, __pyx_kp_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2515; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L11_except_return; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L9_exception_handled; + } + __pyx_L10_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2517 + * 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_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_fromstring[] = "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 PyObject *__pyx_pf_4lxml_5etree_fromstring(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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_text,&__pyx_kp_parser,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_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_kp_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 2517; __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 = 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 = 2517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.fromstring"); + 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 = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2531 + * """ + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2532 + * 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 = 2532; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2533 + * 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 = 2533; __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_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_L0; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2534 + * doc = _parseMemoryDocument(text, base_url, parser) + * return doc.getroot() + * except _TargetParserResult, result_container: # <<<<<<<<<<<<<< + * return result_container.result + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2534; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyErr_ExceptionMatches(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.fromstring"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2534; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_result_container); + __pyx_v_result_container = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2535 + * return doc.getroot() + * except _TargetParserResult, result_container: + * return result_container.result # <<<<<<<<<<<<<< + * + * def fromstringlist(strings, _BaseParser parser=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_result_container, __pyx_kp_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2535; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L9_except_return; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2537 + * return result_container.result + * + * def fromstringlist(strings, _BaseParser parser=None): # <<<<<<<<<<<<<< + * u"""fromstringlist(strings, parser=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_fromstringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_fromstringlist[] = "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 PyObject *__pyx_pf_4lxml_5etree_fromstringlist(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_kp_strings,&__pyx_kp_parser,0}; + __Pyx_SetupRefcountContext("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_kp_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_kp_parser); + if (unlikely(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 = 2537; __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 = 2537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.fromstringlist"); + 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 = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2547 + * """ + * 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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2548 + * 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 = 2548; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2549 + * 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_kp_feed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2550 + * 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 = 2550; __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 = 2550; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2551 + * 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 = 2551; __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 = 2551; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2552 + * 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_kp_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __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 = 2552; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2554 + * return parser.close() + * + * def iselement(element): # <<<<<<<<<<<<<< + * u"""iselement(element) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_iselement(PyObject *__pyx_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_iselement[] = "iselement(element)\n\n Checks if an object appears to be a valid element object.\n "; +static PyObject *__pyx_pf_4lxml_5etree_iselement(PyObject *__pyx_self, PyObject *__pyx_v_element) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("iselement"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2559 + * Checks if an object appears to be a valid element object. + * """ + * return isinstance(element, _Element) # <<<<<<<<<<<<<< + * + * def dump(_Element elem not None, *, pretty_print=True, with_tail=True): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; __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.iselement"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2561 + * return isinstance(element, _Element) + * + * 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_dump(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_dump[] = "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 PyObject *__pyx_pf_4lxml_5etree_dump(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; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_elem,&__pyx_kp_pretty_print,&__pyx_kp_with_tail,0}; + __Pyx_SetupRefcountContext("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_102; + values[2] = __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_kp_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_kp_pretty_print); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 2561; __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_102; + __pyx_v_with_tail = __pyx_k_103; + } + 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 = 2561; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.dump"); + 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 = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2567 + * should be used for debugging only. + * """ + * _dumpToFile(sys.stdout, elem._c_node, pretty_print, with_tail) # <<<<<<<<<<<<<< + * + * def tostring(element_or_tree, *, encoding=None, method=u"xml", + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_kp_stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_3 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_f_4lxml_5etree__dumpToFile(__pyx_t_1, __pyx_v_elem->_c_node, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __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; + + __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.dump"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2569 + * _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): + */ + +static PyObject *__pyx_pf_4lxml_5etree_tostring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_tostring[] = "tostring(element_or_tree, encoding=None, method=\"xml\",\n xml_declaration=None, pretty_print=False, with_tail=True,\n standalone=None)\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 behaviour can be\n configured with the keyword arguments 'encoding' (string) and\n 'xml_declaration' (bool). Note that changing the encoding to a non UTF-8\n compatible encoding will enable a declaration by default.\n\n You can also serialise to a Unicode string without declaration by\n passing the ``unicode`` function as encoding.\n\n The keyword argument 'pretty_print' (bool) enables formatted XML.\n\n The keyword argument 'method' selects the output method: 'xml',\n 'html' or plain 'text'.\n\n Passing a boolean value to the ``standalone`` option will output\n an XML declaration with the corresponding ``standalone`` flag.\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 PyObject *__pyx_pf_4lxml_5etree_tostring(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; + int __pyx_v_write_declaration; + int __pyx_v_is_standalone; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_element_or_tree,&__pyx_kp_encoding,&__pyx_kp_method,&__pyx_kp_xml_declaration,&__pyx_kp_pretty_print,&__pyx_kp_with_tail,&__pyx_kp_standalone,0}; + __Pyx_SetupRefcountContext("tostring"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[1] = Py_None; + values[2] = ((PyObject *)__pyx_kp_104); + values[3] = Py_None; + values[4] = __pyx_k_105; + values[5] = __pyx_k_106; + values[6] = 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_kp_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_kp_encoding); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_method); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_xml_declaration); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_pretty_print); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_with_tail); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_standalone); + if (value) { values[6] = 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 = 2569; __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]; + } 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_encoding = Py_None; + __pyx_v_method = ((PyObject *)__pyx_kp_104); + __pyx_v_xml_declaration = Py_None; + __pyx_v_pretty_print = __pyx_k_105; + __pyx_v_with_tail = __pyx_k_106; + __pyx_v_standalone = Py_None; + } + 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 = 2569; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.tostring"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_encoding); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2601 + * cdef bint write_declaration + * cdef int is_standalone + * if encoding is _unicode: # <<<<<<<<<<<<<< + * if xml_declaration: + * raise ValueError, \ + */ + __pyx_t_1 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2602 + * cdef int is_standalone + * if encoding is _unicode: + * if xml_declaration: # <<<<<<<<<<<<<< + * raise ValueError, \ + * u"Serialisation to unicode must not request an XML declaration" + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2604 + * if xml_declaration: + * raise ValueError, \ + * u"Serialisation to unicode must not request an XML declaration" # <<<<<<<<<<<<<< + * write_declaration = 0 + * elif xml_declaration is None: + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_381), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2605 + * raise ValueError, \ + * u"Serialisation to unicode must not request an XML declaration" + * write_declaration = 0 # <<<<<<<<<<<<<< + * elif xml_declaration is None: + * # by default, write an XML declaration only for non-standard encodings + */ + __pyx_v_write_declaration = 0; + goto __pyx_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2606 + * u"Serialisation to unicode must not request an XML declaration" + * write_declaration = 0 + * 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_1 = (__pyx_v_xml_declaration == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2608 + * 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_1 = (__pyx_v_encoding != Py_None); + if (__pyx_t_1) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_encoding, __pyx_kp_upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __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 = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2609 + * # 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: + * write_declaration = xml_declaration + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_382), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (((int)__pyx_t_4)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2608 + * 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_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_383), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = ((int)__pyx_t_5); + } else { + __pyx_t_6 = ((int)__pyx_t_4); + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2609 + * # 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: + * write_declaration = xml_declaration + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_384), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((int)__pyx_t_4); + } else { + __pyx_t_5 = __pyx_t_6; + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2608 + * 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_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_385), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = ((int)__pyx_t_6); + } else { + __pyx_t_4 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_5 = __pyx_t_1; + } + __pyx_v_write_declaration = __pyx_t_5; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2611 + * (u'ASCII', u'UTF-8', u'UTF8', u'US-ASCII') + * else: + * 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))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_write_declaration = __pyx_t_5; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2612 + * else: + * write_declaration = xml_declaration + * if encoding is None: # <<<<<<<<<<<<<< + * encoding = u'ASCII' + * if standalone is None: + */ + __pyx_t_5 = (__pyx_v_encoding == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2613 + * write_declaration = xml_declaration + * if encoding is None: + * encoding = u'ASCII' # <<<<<<<<<<<<<< + * if standalone is None: + * is_standalone = -1 + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_386)); + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = ((PyObject *)__pyx_kp_386); + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2614 + * if encoding is None: + * encoding = u'ASCII' + * if standalone is None: # <<<<<<<<<<<<<< + * is_standalone = -1 + * elif standalone: + */ + __pyx_t_5 = (__pyx_v_standalone == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2615 + * encoding = u'ASCII' + * if standalone is None: + * is_standalone = -1 # <<<<<<<<<<<<<< + * elif standalone: + * write_declaration = 1 + */ + __pyx_v_is_standalone = -1; + goto __pyx_L9; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2616 + * 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 = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2617 + * is_standalone = -1 + * elif standalone: + * write_declaration = 1 # <<<<<<<<<<<<<< + * is_standalone = 1 + * else: + */ + __pyx_v_write_declaration = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2618 + * elif standalone: + * write_declaration = 1 + * is_standalone = 1 # <<<<<<<<<<<<<< + * else: + * write_declaration = 1 + */ + __pyx_v_is_standalone = 1; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2620 + * is_standalone = 1 + * else: + * write_declaration = 1 # <<<<<<<<<<<<<< + * is_standalone = 0 + * + */ + __pyx_v_write_declaration = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2621 + * else: + * write_declaration = 1 + * is_standalone = 0 # <<<<<<<<<<<<<< + * + * if isinstance(element_or_tree, _Element): + */ + __pyx_v_is_standalone = 0; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2623 + * is_standalone = 0 + * + * if isinstance(element_or_tree, _Element): # <<<<<<<<<<<<<< + * return _tostring(<_Element>element_or_tree, encoding, method, + * write_declaration, 0, pretty_print, with_tail, + */ + __pyx_t_5 = PyObject_TypeCheck(__pyx_v_element_or_tree, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2624 + * + * if isinstance(element_or_tree, _Element): + * return _tostring(<_Element>element_or_tree, encoding, method, # <<<<<<<<<<<<<< + * write_declaration, 0, pretty_print, with_tail, + * is_standalone) + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2625 + * if isinstance(element_or_tree, _Element): + * return _tostring(<_Element>element_or_tree, encoding, method, + * write_declaration, 0, pretty_print, with_tail, # <<<<<<<<<<<<<< + * is_standalone) + * elif isinstance(element_or_tree, _ElementTree): + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2626 + * return _tostring(<_Element>element_or_tree, encoding, 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_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), __pyx_v_encoding, __pyx_v_method, __pyx_v_write_declaration, 0, __pyx_t_5, __pyx_t_1, __pyx_v_is_standalone); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __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_L10; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2627 + * write_declaration, 0, pretty_print, with_tail, + * is_standalone) + * elif isinstance(element_or_tree, _ElementTree): # <<<<<<<<<<<<<< + * return _tostring((<_ElementTree>element_or_tree)._context_node, + * encoding, method, write_declaration, 1, pretty_print, + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element_or_tree, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2628 + * is_standalone) + * elif isinstance(element_or_tree, _ElementTree): + * return _tostring((<_ElementTree>element_or_tree)._context_node, # <<<<<<<<<<<<<< + * encoding, method, write_declaration, 1, pretty_print, + * with_tail, is_standalone) + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2629 + * elif isinstance(element_or_tree, _ElementTree): + * return _tostring((<_ElementTree>element_or_tree)._context_node, + * encoding, method, write_declaration, 1, pretty_print, # <<<<<<<<<<<<<< + * with_tail, is_standalone) + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2630 + * return _tostring((<_ElementTree>element_or_tree)._context_node, + * encoding, method, write_declaration, 1, pretty_print, + * with_tail, is_standalone) # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"Type '%s' cannot be serialized." % \ + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node, __pyx_v_encoding, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_t_1, __pyx_t_5, __pyx_v_is_standalone); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __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_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2633 + * else: + * raise TypeError, u"Type '%s' cannot be serialized." % \ + * python._fqtypename(element_or_tree) # <<<<<<<<<<<<<< + * + * def tostringlist(element_or_tree, *args, **kwargs): + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_387), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L10:; + + __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.tostring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_encoding); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2635 + * 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_tostringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_tostringlist[] = "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 PyObject *__pyx_pf_4lxml_5etree_tostringlist(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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_element_or_tree,0}; + __Pyx_SetupRefcountContext("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_kp_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 = 2635; __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 = 2635; __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"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2644 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_tostring); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_element_or_tree); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_element_or_tree); + __Pyx_GIVEREF(__pyx_v_element_or_tree); + __pyx_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_2)); + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __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_2)); __pyx_2 = 0; + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_t_2, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2646 + * return [tostring(element_or_tree, *args, **kwargs)] + * + * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False, # <<<<<<<<<<<<<< + * with_tail=True): + * u"""tounicode(element_or_tree, method="xml", pretty_print=False, + */ + +static PyObject *__pyx_pf_4lxml_5etree_tounicode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_tounicode[] = "tounicode(element_or_tree, method=\"xml\", pretty_print=False,\n with_tail=True)\n\n Serialize an element to the Python unicode representation of its XML\n tree.\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\n :deprecated: use ``tostring(el, encoding=unicode)`` instead.\n "; +static PyObject *__pyx_pf_4lxml_5etree_tounicode(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_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_kp_element_or_tree,&__pyx_kp_method,&__pyx_kp_pretty_print,&__pyx_kp_with_tail,0}; + __Pyx_SetupRefcountContext("tounicode"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = ((PyObject *)__pyx_kp_107); + values[2] = __pyx_k_108; + values[3] = __pyx_k_109; + 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_kp_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_kp_method); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_pretty_print); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_with_tail); + 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), "tounicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __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]; + } 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_kp_107); + __pyx_v_pretty_print = __pyx_k_108; + __pyx_v_with_tail = __pyx_k_109; + } + 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 = 2646; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.tounicode"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2669 + * :deprecated: use ``tostring(el, encoding=unicode)`` instead. + * """ + * if isinstance(element_or_tree, _Element): # <<<<<<<<<<<<<< + * return _tostring(<_Element>element_or_tree, _unicode, method, + * 0, 0, pretty_print, with_tail, -1) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element_or_tree, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2670 + * """ + * if isinstance(element_or_tree, _Element): + * return _tostring(<_Element>element_or_tree, _unicode, method, # <<<<<<<<<<<<<< + * 0, 0, pretty_print, with_tail, -1) + * elif isinstance(element_or_tree, _ElementTree): + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2671 + * if isinstance(element_or_tree, _Element): + * return _tostring(<_Element>element_or_tree, _unicode, 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))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __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_method, 0, 0, __pyx_t_1, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2672 + * return _tostring(<_Element>element_or_tree, _unicode, method, + * 0, 0, pretty_print, with_tail, -1) + * elif isinstance(element_or_tree, _ElementTree): # <<<<<<<<<<<<<< + * return _tostring((<_ElementTree>element_or_tree)._context_node, + * _unicode, method, 0, 1, pretty_print, with_tail, + */ + __pyx_t_2 = PyObject_TypeCheck(__pyx_v_element_or_tree, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2673 + * 0, 0, pretty_print, with_tail, -1) + * elif isinstance(element_or_tree, _ElementTree): + * return _tostring((<_ElementTree>element_or_tree)._context_node, # <<<<<<<<<<<<<< + * _unicode, method, 0, 1, pretty_print, with_tail, + * -1) + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2674 + * elif isinstance(element_or_tree, _ElementTree): + * return _tostring((<_ElementTree>element_or_tree)._context_node, + * _unicode, 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))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2675 + * return _tostring((<_ElementTree>element_or_tree)._context_node, + * _unicode, method, 0, 1, pretty_print, with_tail, + * -1) # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"Type '%s' cannot be serialized." % \ + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node, __pyx_v_4lxml_5etree__unicode, __pyx_v_method, 0, 1, __pyx_t_2, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __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; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2678 + * else: + * raise TypeError, u"Type '%s' cannot be serialized." % \ + * type(element_or_tree) # <<<<<<<<<<<<<< + * + * def parse(source, _BaseParser parser=None, *, base_url=None): + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_element_or_tree); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_element_or_tree); + __Pyx_GIVEREF(__pyx_v_element_or_tree); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyType_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_388), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2680 + * 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_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_parse[] = "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 ``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 PyObject *__pyx_pf_4lxml_5etree_parse(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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_source,&__pyx_kp_parser,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("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] = 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_kp_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_kp_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 2680; __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 = 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 = 2680; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.parse"); + 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 = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2691 + * """ + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2692 + * 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 = 2692; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2693 + * 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 = 2693; __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_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_L0; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2694 + * doc = _parseDocument(source, parser, base_url) + * return _elementTreeFactory(doc, None) + * except _TargetParserResult, result_container: # <<<<<<<<<<<<<< + * return result_container.result + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyErr_ExceptionMatches(__pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.parse"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_result_container); + __pyx_v_result_container = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2695 + * return _elementTreeFactory(doc, None) + * except _TargetParserResult, result_container: + * return result_container.result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_result_container, __pyx_kp_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L9_except_return; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":10 + * cdef list _dependent_proxies + * + * cdef int _assertNode(self) except -1: # <<<<<<<<<<<<<< + * u"""This is our way of saying: this proxy is invalid! + * """ + */ + +static int __pyx_f_4lxml_5etree_21_ReadOnlyElementProxy__assertNode(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) { + int __pyx_r; + __Pyx_SetupRefcountContext("_assertNode"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":13 + * u"""This is our way of saying: this proxy is invalid! + * """ + * assert self._c_node is not NULL, u"Proxy invalidated!" # <<<<<<<<<<<<<< + * return 0 + * + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_self->_c_node != NULL))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_389)); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":14 + * """ + * assert self._c_node is not NULL, u"Proxy invalidated!" + * return 0 # <<<<<<<<<<<<<< + * + * cdef void free_after_use(self): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy._assertNode"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":16 + * return 0 + * + * cdef void free_after_use(self): # <<<<<<<<<<<<<< + * u"""Should the xmlNode* be freed when releasing the proxy? + * """ + */ + +static void __pyx_f_4lxml_5etree_21_ReadOnlyElementProxy_free_after_use(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) { + __Pyx_SetupRefcountContext("free_after_use"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":19 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":24 + * u"""Element tag + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * self._assertNode() + * return _namespacedName(self._c_node) + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_3tag___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_3tag___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":25 + * """ + * def __get__(self): + * self._assertNode() # <<<<<<<<<<<<<< + * return _namespacedName(self._c_node) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":26 + * def __get__(self): + * self._assertNode() + * return _namespacedName(self._c_node) # <<<<<<<<<<<<<< + * + * property text: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 26; __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.tag.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":32 + * the value None, if there was no text. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * self._assertNode() + * return _collectText(self._c_node.children) + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4text___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4text___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":33 + * """ + * def __get__(self): + * self._assertNode() # <<<<<<<<<<<<<< + * return _collectText(self._c_node.children) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":34 + * def __get__(self): + * self._assertNode() + * return _collectText(self._c_node.children) # <<<<<<<<<<<<<< + * + * property tail: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 34; __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.text.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":41 + * there was no text. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * self._assertNode() + * return _collectText(self._c_node.next) + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4tail___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4tail___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":42 + * """ + * def __get__(self): + * self._assertNode() # <<<<<<<<<<<<<< + * return _collectText(self._c_node.next) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":43 + * def __get__(self): + * self._assertNode() + * return _collectText(self._c_node.next) # <<<<<<<<<<<<<< + * + * property attrib: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 43; __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.tail.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":46 + * + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":47 + * 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_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":48 + * def __get__(self): + * self._assertNode() + * return dict(_collectAttributes(self._c_node, 3)) # <<<<<<<<<<<<<< + * + * property prefix: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 48; __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 = 48; __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 = 48; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":53 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":54 + * """ + * 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_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":55 + * 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)->_c_node->ns != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":56 + * 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)->_c_node->ns->prefix != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":57 + * 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)->_c_node->ns->prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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-2.2/src/lxml/readonlytree.pxi":58 + * if self._c_node.ns.prefix is not NULL: + * return funicode(self._c_node.ns.prefix) + * return None # <<<<<<<<<<<<<< + * + * property sourceline: + */ + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":63 + * 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_21_ReadOnlyElementProxy_10sourceline___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":65 + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":66 + * 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__ReadOnlyElementProxy *)__pyx_v_self)->_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":67 + * 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-2.2/src/lxml/readonlytree.pxi":68 + * 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 = 68; __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-2.2/src/lxml/readonlytree.pxi":70 + * 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._ReadOnlyElementProxy.sourceline.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":72 + * return None + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return u"" % (self.tag, id(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___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_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":73 + * + * def __repr__(self): + * return u"" % (self.tag, id(self)) # <<<<<<<<<<<<<< + * + * def __getitem__(self, x): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __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[8]; __pyx_lineno = 73; __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[8]; __pyx_lineno = 73; __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[8]; __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); + 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_390), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":75 + * return u"" % (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_21_ReadOnlyElementProxy___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___getitem__[] = "Returns the subelement at the given position or the requested\n slice.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + __Pyx_SetupRefcountContext("__getitem__"); + __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":84 + * cdef _node_to_node_function next_element + * cdef list result + * if python.PySlice_Check(x): # <<<<<<<<<<<<<< + * # slicing + * if _isFullSlice(x): + */ + __pyx_t_1 = PySlice_Check(__pyx_v_x); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":86 + * if python.PySlice_Check(x): + * # slicing + * if _isFullSlice(x): # <<<<<<<<<<<<<< + * return _collectChildren(self) + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__isFullSlice(((PySliceObject *)__pyx_v_x)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":87 + * # slicing + * if _isFullSlice(x): + * return _collectChildren(self) # <<<<<<<<<<<<<< + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + * if c_node is NULL: + */ + __Pyx_XDECREF(__pyx_r); + if (!(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 87; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":88 + * if _isFullSlice(x): + * return _collectChildren(self) + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) # <<<<<<<<<<<<<< + * if c_node is NULL: + * return [] + */ + if (!(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_4lxml_6python_slice))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4lxml_5etree__findChildSlice(((PySliceObject *)__pyx_v_x), ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":89 + * return _collectChildren(self) + * _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + * if c_node is NULL: # <<<<<<<<<<<<<< + * return [] + * if step > 0: + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":90 + * _findChildSlice(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_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __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_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":91 + * if c_node is NULL: + * return [] + * if step > 0: # <<<<<<<<<<<<<< + * next_element = _nextElement + * else: + */ + __pyx_t_1 = (__pyx_v_step > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":92 + * 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-2.2/src/lxml/readonlytree.pxi":94 + * next_element = _nextElement + * else: + * step = -step # <<<<<<<<<<<<<< + * next_element = _previousElement + * result = [] + */ + __pyx_v_step = (-__pyx_v_step); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":95 + * 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-2.2/src/lxml/readonlytree.pxi":96 + * step = -step + * next_element = _previousElement + * result = [] # <<<<<<<<<<<<<< + * c = 0 + * while c_node is not NULL and c < slicelength: + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/readonlytree.pxi":97 + * 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-2.2/src/lxml/readonlytree.pxi":98 + * 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c < __pyx_v_slicelength); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":99 + * 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 (!(__Pyx_TypeTest(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy), __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":100 + * 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: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp__doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Document))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":101 + * 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-2.2/src/lxml/readonlytree.pxi":102 + * 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_5 = __pyx_v_step; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":103 + * 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-2.2/src/lxml/readonlytree.pxi":104 + * 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-2.2/src/lxml/readonlytree.pxi":107 + * else: + * # indexing + * c_node = _findChild(self._c_node, x) # <<<<<<<<<<<<<< + * if c_node is NULL: + * raise IndexError, u"list index out of range" + */ + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, __pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":108 + * # 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_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":109 + * 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_391), 0); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":110 + * 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); + if (!(__Pyx_TypeTest(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 110; __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_L5:; + + __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._ReadOnlyElementProxy.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":112 + * return _newReadOnlyProxy(self._source_proxy, c_node) + * + * def __len__(self): # <<<<<<<<<<<<<< + * u"""Returns the number of subelements. + * """ + */ + +static Py_ssize_t __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___len__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___len__[] = "Returns the number of subelements.\n "; +static Py_ssize_t __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___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_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":117 + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":118 + * 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-2.2/src/lxml/readonlytree.pxi":119 + * 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__ReadOnlyElementProxy *)__pyx_v_self)->_c_node->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":120 + * 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-2.2/src/lxml/readonlytree.pxi":121 + * 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-2.2/src/lxml/readonlytree.pxi":122 + * 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-2.2/src/lxml/readonlytree.pxi":123 + * 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-2.2/src/lxml/readonlytree.pxi":124 + * 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._ReadOnlyElementProxy.__len__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":126 + * return c + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * self._assertNode() + */ + +static int __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___nonzero__(PyObject *__pyx_v_self) { + xmlNode *__pyx_v_c_node; + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__nonzero__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":128 + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":129 + * 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__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, 0); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":130 + * 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._ReadOnlyElementProxy.__nonzero__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":132 + * return c_node != NULL + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * u"__deepcopy__(self, memo)" + * return self.__copy__() + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___deepcopy__[] = "__deepcopy__(self, memo)"; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__deepcopy__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":134 + * 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_kp___copy__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 134; __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[8]; __pyx_lineno = 134; __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._ReadOnlyElementProxy.__deepcopy__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":136 + * return self.__copy__() + * + * def __copy__(self): # <<<<<<<<<<<<<< + * u"__copy__(self)" + * cdef xmlDoc* c_doc + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___copy__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___copy__[] = "__copy__(self)"; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___copy__(PyObject *__pyx_v_self, 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; + xmlDoc *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__copy__"); + __pyx_v_new_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":141 + * cdef xmlNode* c_node + * cdef _Document new_doc + * c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive # <<<<<<<<<<<<<< + * new_doc = _documentFactory(c_doc, None) + * root = new_doc.getroot() + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__copyDocRoot(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node->doc, ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":142 + * cdef _Document new_doc + * 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_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[8]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_new_doc)); + __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":143 + * 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_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_new_doc->__pyx_vtab)->getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 143; __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-2.2/src/lxml/readonlytree.pxi":144 + * 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-2.2/src/lxml/readonlytree.pxi":145 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":147 + * 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-2.2/src/lxml/readonlytree.pxi":148 + * # 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_3 = (__pyx_v_c_node->type != ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node->type); + } else { + __pyx_t_3 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":149 + * 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-2.2/src/lxml/readonlytree.pxi":150 + * 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_3 = (__pyx_v_c_node == NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":151 + * 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":152 + * if c_node is NULL: + * return None + * return _elementFactory(new_doc, c_node) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 152; __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.__copy__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_new_doc); + __Pyx_DECREF(__pyx_v_root); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":154 + * return _elementFactory(new_doc, c_node) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return iter(self.getchildren()) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":155 + * + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 155; __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 = 155; __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._ReadOnlyElementProxy.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":157 + * return iter(self.getchildren()) + * + * def iterchildren(self, tag=None, *, reversed=False): # <<<<<<<<<<<<<< + * u"""iterchildren(self, tag=None, reversed=False) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_iterchildren[] = "iterchildren(self, tag=None, reversed=False)\n\n Iterate over the children of this element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_iterchildren(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_1 = 0; + PyObject *__pyx_2 = 0; + 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; + int __pyx_t_9; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tag,&__pyx_kp_reversed,0}; + __Pyx_SetupRefcountContext("iterchildren"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = __pyx_k_110; + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + __pyx_v_reversed = values[1]; + } else { + __pyx_v_tag = Py_None; + __pyx_v_reversed = __pyx_k_110; + 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 = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.iterchildren"); + 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-2.2/src/lxml/readonlytree.pxi":162 + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self), 0); 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_DECREF(__pyx_v_children); + __pyx_v_children = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":163 + * """ + * 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, __pyx_kp_392, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 163; __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 = 163; __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-2.2/src/lxml/readonlytree.pxi":164 + * 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 = 164; __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 = 164; __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 = 164; __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_kp_tag); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 164; __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 = 164; __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 = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_4) { + __pyx_t_9 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_el); if (unlikely(__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 164; __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-2.2/src/lxml/readonlytree.pxi":165 + * 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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":166 + * children = [ el for el in children if el.tag == tag ] + * if reversed: + * children = children[::-1] # <<<<<<<<<<<<<< + * return iter(children) + * + */ + __pyx_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyObject_GetItem(__pyx_v_children, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_children); + __pyx_v_children = __pyx_2; + __pyx_2 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":167 + * if reversed: + * children = children[::-1] + * return iter(children) # <<<<<<<<<<<<<< + * + * def get(self, key, default=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 167; __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.iterchildren"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_children); + __Pyx_DECREF(__pyx_v_el); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":169 + * return iter(children) + * + * 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_kp_key,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("get"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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 = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_key = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = 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 = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":172 + * 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_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":173 + * """ + * 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)->_c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 173; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":175 + * 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_keys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_keys[] = "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_keys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("keys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":179 + * 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_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":180 + * """ + * self._assertNode() + * return _collectAttributes(self._c_node, 1) # <<<<<<<<<<<<<< + * + * def values(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 180; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":182 + * 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_values(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_values[] = "Gets element attributes, as a sequence. The attributes are returned\n in an arbitrary order.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_values(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("values"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":186 + * 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_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":187 + * """ + * self._assertNode() + * return _collectAttributes(self._c_node, 2) # <<<<<<<<<<<<<< + * + * def items(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 187; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":189 + * 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_items(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_items[] = "Gets element attributes, as a sequence. The attributes are returned\n in an arbitrary order.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_items(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("items"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":193 + * 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_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":194 + * """ + * self._assertNode() + * return _collectAttributes(self._c_node, 3) # <<<<<<<<<<<<<< + * + * cpdef getchildren(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node, 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 194; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":196 + * return _collectAttributes(self._c_node, 3) + * + * cpdef getchildren(self): # <<<<<<<<<<<<<< + * u"""Returns all subelements. The elements are returned in document + * order. + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getchildren(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy_getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self, int __pyx_skip_dispatch) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_SetupRefcountContext("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_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_getchildren); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getchildren)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":202 + * cdef xmlNode* c_node + * cdef list result + * self._assertNode() # <<<<<<<<<<<<<< + * result = [] + * c_node = self._c_node.children + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":203 + * 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 = 203; __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-2.2/src/lxml/readonlytree.pxi":204 + * 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-2.2/src/lxml/readonlytree.pxi":205 + * 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_3 = (__pyx_v_c_node != NULL); + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":206 + * 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_3 = _isElement(__pyx_v_c_node); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":207 + * 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 (!(__Pyx_TypeTest(__pyx_v_self->_source_proxy, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->_source_proxy), __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":208 + * 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-2.2/src/lxml/readonlytree.pxi":209 + * 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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.getchildren"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":196 + * return _collectAttributes(self._c_node, 3) + * + * cpdef getchildren(self): # <<<<<<<<<<<<<< + * u"""Returns all subelements. The elements are returned in document + * order. + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getchildren(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getchildren[] = "Returns all subelements. The elements are returned in document\n order.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getchildren(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("getchildren"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 196; __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._ReadOnlyElementProxy.getchildren"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":211 + * return result + * + * def getparent(self): # <<<<<<<<<<<<<< + * u"""Returns the parent of this element or None for the root element. + * """ + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getparent(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getparent[] = "Returns the parent of this element or None for the root element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getparent(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_parent; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("getparent"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":215 + * """ + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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): + * return None + */ + __pyx_v_c_parent = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_c_node->parent; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":217 + * self._assertNode() + * c_parent = self._c_node.parent + * if c_parent is NULL or not tree._isElement(c_parent): # <<<<<<<<<<<<<< + * return None + * else: + */ + if (!(__pyx_v_c_parent == NULL)) { + __pyx_t_2 = (!_isElement(__pyx_v_c_parent)); + } else { + __pyx_t_2 = (__pyx_v_c_parent == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":218 + * 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-2.2/src/lxml/readonlytree.pxi":220 + * return None + * else: + * return _newReadOnlyProxy(self._source_proxy, c_parent) # <<<<<<<<<<<<<< + * + * def getnext(self): + */ + __Pyx_XDECREF(__pyx_r); + if (!(__Pyx_TypeTest(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy), __pyx_v_c_parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 220; __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._ReadOnlyElementProxy.getparent"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":222 + * 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_21_ReadOnlyElementProxy_getnext(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getnext[] = "Returns the following sibling of this element or None.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getnext(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("getnext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":226 + * """ + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":227 + * 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__ReadOnlyElementProxy *)__pyx_v_self)->_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":228 + * 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-2.2/src/lxml/readonlytree.pxi":229 + * 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); + if (!(__Pyx_TypeTest(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 229; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":230 + * 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_AddTraceback("lxml.etree._ReadOnlyElementProxy.getnext"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":232 + * return None + * + * def getprevious(self): # <<<<<<<<<<<<<< + * u"""Returns the preceding sibling of this element or None. + * """ + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getprevious(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getprevious[] = "Returns the preceding sibling of this element or None.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getprevious(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("getprevious"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":236 + * """ + * 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__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->__pyx_vtab)->_assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":237 + * 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__ReadOnlyElementProxy *)__pyx_v_self)->_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":238 + * 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-2.2/src/lxml/readonlytree.pxi":239 + * 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); + if (!(__Pyx_TypeTest(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)->_source_proxy), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 239; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":240 + * 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_AddTraceback("lxml.etree._ReadOnlyElementProxy.getprevious"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":247 + * cdef _ReadOnlyElementProxy NEW_RO_PROXY "PY_NEW" (object t) + * + * cdef _ReadOnlyElementProxy _newReadOnlyProxy( # <<<<<<<<<<<<<< + * _ReadOnlyElementProxy source_proxy, xmlNode* c_node): + * cdef _ReadOnlyElementProxy el + */ + +static struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) { + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_el; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_newReadOnlyProxy"); + __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":250 + * _ReadOnlyElementProxy source_proxy, xmlNode* c_node): + * cdef _ReadOnlyElementProxy el + * el = NEW_RO_PROXY(_ReadOnlyElementProxy) # <<<<<<<<<<<<<< + * el._c_node = c_node + * _initReadOnlyProxy(el, source_proxy) + */ + __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_el)); + __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":251 + * cdef _ReadOnlyElementProxy el + * el = NEW_RO_PROXY(_ReadOnlyElementProxy) + * 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-2.2/src/lxml/readonlytree.pxi":252 + * el = NEW_RO_PROXY(_ReadOnlyElementProxy) + * el._c_node = c_node + * _initReadOnlyProxy(el, source_proxy) # <<<<<<<<<<<<<< + * return el + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 252; __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-2.2/src/lxml/readonlytree.pxi":253 + * el._c_node = c_node + * _initReadOnlyProxy(el, source_proxy) + * return el # <<<<<<<<<<<<<< + * + * cdef inline _initReadOnlyProxy(_ReadOnlyElementProxy 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__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._newReadOnlyProxy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_el); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":255 + * return el + * + * cdef inline _initReadOnlyProxy(_ReadOnlyElementProxy el, # <<<<<<<<<<<<<< + * _ReadOnlyElementProxy source_proxy): + * el._free_after_use = 0 + */ + +static INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_el, struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_source_proxy) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_initReadOnlyProxy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":257 + * cdef inline _initReadOnlyProxy(_ReadOnlyElementProxy el, + * _ReadOnlyElementProxy source_proxy): + * el._free_after_use = 0 # <<<<<<<<<<<<<< + * if source_proxy is None: + * el._source_proxy = el + */ + __pyx_v_el->_free_after_use = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":258 + * _ReadOnlyElementProxy source_proxy): + * el._free_after_use = 0 + * 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-2.2/src/lxml/readonlytree.pxi":259 + * el._free_after_use = 0 + * 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(__pyx_v_el->_source_proxy); + __pyx_v_el->_source_proxy = ((PyObject *)__pyx_v_el); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":260 + * 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 = 260; __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-2.2/src/lxml/readonlytree.pxi":262 + * 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(__pyx_v_el->_source_proxy); + __pyx_v_el->_source_proxy = ((PyObject *)__pyx_v_source_proxy); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":263 + * else: + * el._source_proxy = source_proxy + * source_proxy._dependent_proxies.append(el) # <<<<<<<<<<<<<< + * + * cdef _freeReadOnlyProxies(_ReadOnlyElementProxy sourceProxy): + */ + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_source_proxy->_dependent_proxies), ((PyObject *)__pyx_v_el)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 263; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":265 + * source_proxy._dependent_proxies.append(el) + * + * cdef _freeReadOnlyProxies(_ReadOnlyElementProxy sourceProxy): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * cdef _ReadOnlyElementProxy el + */ + +static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_sourceProxy) { + xmlNode *__pyx_v_c_node; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__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_SetupRefcountContext("_freeReadOnlyProxies"); + __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":268 + * cdef xmlNode* c_node + * cdef _ReadOnlyElementProxy 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-2.2/src/lxml/readonlytree.pxi":269 + * cdef _ReadOnlyElementProxy 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-2.2/src/lxml/readonlytree.pxi":270 + * 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-2.2/src/lxml/readonlytree.pxi":271 + * 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-2.2/src/lxml/readonlytree.pxi":272 + * if sourceProxy._dependent_proxies is None: + * return + * for el in sourceProxy._dependent_proxies: # <<<<<<<<<<<<<< + * c_node = el._c_node + * el._c_node = NULL + */ + if (likely(((PyObject *)__pyx_v_sourceProxy->_dependent_proxies) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_sourceProxy->_dependent_proxies); __Pyx_INCREF(__pyx_t_3); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_el)); + __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":273 + * 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-2.2/src/lxml/readonlytree.pxi":274 + * 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-2.2/src/lxml/readonlytree.pxi":275 + * c_node = el._c_node + * el._c_node = NULL + * if el._free_after_use: # <<<<<<<<<<<<<< + * tree.xmlFreeNode(c_node) + * del sourceProxy._dependent_proxies[:] + */ + __pyx_t_1 = __pyx_v_el->_free_after_use; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":276 + * 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-2.2/src/lxml/readonlytree.pxi":277 + * if el._free_after_use: + * tree.xmlFreeNode(c_node) + * del sourceProxy._dependent_proxies[:] # <<<<<<<<<<<<<< + * + * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy): + */ + if (PySequence_DelSlice(((PyObject *)__pyx_v_sourceProxy->_dependent_proxies), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":283 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + xmlNode *__pyx_t_4; + xmlNode *__pyx_t_5; + __Pyx_SetupRefcountContext("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_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_append); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_other_element); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_other_element); + __Pyx_GIVEREF(__pyx_v_other_element); + __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":288 + * 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_3 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":289 + * 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_4 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_t_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":290 + * 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_5 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, __pyx_v_self->__pyx_base._c_node->doc); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":291 + * 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-2.2/src/lxml/readonlytree.pxi":292 + * 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._c_node, __pyx_v_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":293 + * 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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":283 + * 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_SetupRefcountContext("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_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 = 283; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":295 + * _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_extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/ +static char __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_extend[] = "Append a copy of all Elements from a sequence to the list of\n children.\n "; +static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_extend(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_SetupRefcountContext("extend"); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":299 + * 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_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":300 + * """ + * 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 = 300; __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 = 300; __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-2.2/src/lxml/readonlytree.pxi":301 + * 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_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 = 301; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":307 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":308 + * """ + * 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_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":309 + * 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._c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 309; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":311 + * 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___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___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_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":312 + * + * 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_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":313 + * def __set__(self, value): + * self._assertNode() + * if isinstance(value, QName): # <<<<<<<<<<<<<< + * value = python.PyUnicode_FromEncodedObject( + * _resolveQNameText(self, value), 'UTF-8', 'strict') + */ + __pyx_t_2 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName))); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":315 + * if isinstance(value, QName): + * value = python.PyUnicode_FromEncodedObject( + * _resolveQNameText(self, value), 'UTF-8', 'strict') # <<<<<<<<<<<<<< + * _setNodeText(self._c_node, value) + * + */ + if (!(__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __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 = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyUnicode_FromEncodedObject(__pyx_t_3, __pyx_k_393, __pyx_k_394); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __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-2.2/src/lxml/readonlytree.pxi":316 + * value = python.PyUnicode_FromEncodedObject( + * _resolveQNameText(self, value), 'UTF-8', 'strict') + * _setNodeText(self._c_node, value) # <<<<<<<<<<<<<< + * + * cdef _AppendOnlyElementProxy _newAppendOnlyProxy( + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self)->__pyx_base._c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":318 + * _setNodeText(self._c_node, value) + * + * cdef _AppendOnlyElementProxy _newAppendOnlyProxy( # <<<<<<<<<<<<<< + * _ReadOnlyElementProxy source_proxy, xmlNode* c_node): + * cdef _AppendOnlyElementProxy el + */ + +static struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) { + struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_el; + struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_newAppendOnlyProxy"); + __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":321 + * _ReadOnlyElementProxy source_proxy, xmlNode* c_node): + * cdef _AppendOnlyElementProxy el + * el = <_AppendOnlyElementProxy>NEW_RO_PROXY(_AppendOnlyElementProxy) # <<<<<<<<<<<<<< + * el._c_node = c_node + * _initReadOnlyProxy(el, source_proxy) + */ + __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_t_1))); + __Pyx_DECREF(((PyObject *)__pyx_v_el)); + __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":322 + * cdef _AppendOnlyElementProxy el + * el = <_AppendOnlyElementProxy>NEW_RO_PROXY(_AppendOnlyElementProxy) + * el._c_node = c_node # <<<<<<<<<<<<<< + * _initReadOnlyProxy(el, source_proxy) + * return el + */ + __pyx_v_el->__pyx_base._c_node = __pyx_v_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":323 + * el = <_AppendOnlyElementProxy>NEW_RO_PROXY(_AppendOnlyElementProxy) + * el._c_node = c_node + * _initReadOnlyProxy(el, source_proxy) # <<<<<<<<<<<<<< + * return el + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__initReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_el), __pyx_v_source_proxy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 323; __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-2.2/src/lxml/readonlytree.pxi":324 + * 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__AppendOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._newAppendOnlyProxy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_el); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":326 + * 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; + __Pyx_SetupRefcountContext("_roNodeOf"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":328 + * cdef xmlNode* _roNodeOf(element) except NULL: + * cdef xmlNode* c_node + * if isinstance(element, _Element): # <<<<<<<<<<<<<< + * c_node = (<_Element>element)._c_node + * elif isinstance(element, _ReadOnlyElementProxy): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":329 + * cdef xmlNode* c_node + * if isinstance(element, _Element): + * c_node = (<_Element>element)._c_node # <<<<<<<<<<<<<< + * elif isinstance(element, _ReadOnlyElementProxy): + * c_node = (<_ReadOnlyElementProxy>element)._c_node + */ + __pyx_v_c_node = ((struct LxmlElement *)__pyx_v_element)->_c_node; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":330 + * if isinstance(element, _Element): + * c_node = (<_Element>element)._c_node + * elif isinstance(element, _ReadOnlyElementProxy): # <<<<<<<<<<<<<< + * c_node = (<_ReadOnlyElementProxy>element)._c_node + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":331 + * c_node = (<_Element>element)._c_node + * elif isinstance(element, _ReadOnlyElementProxy): + * c_node = (<_ReadOnlyElementProxy>element)._c_node # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"invalid value to append()" + */ + __pyx_v_c_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_element)->_c_node; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":333 + * c_node = (<_ReadOnlyElementProxy>element)._c_node + * else: + * raise TypeError, u"invalid value to append()" # <<<<<<<<<<<<<< + * + * if c_node is NULL: + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_395), 0); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":335 + * raise TypeError, u"invalid value to append()" + * + * 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-2.2/src/lxml/readonlytree.pxi":336 + * + * if c_node is NULL: + * raise TypeError, u"invalid element" # <<<<<<<<<<<<<< + * return c_node + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_396), 0); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":337 + * 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_AddTraceback("lxml.etree._roNodeOf"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 "; +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_namespace; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_tag; + PyObject *__pyx_v_child; + int __pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_attrib,&__pyx_kp_nsmap,0}; + __Pyx_SetupRefcountContext("__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] = Py_None; + values[1] = 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 = Py_None; + __pyx_v_nsmap = 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__"); + 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_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-2.2/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-2.2/src/lxml/classlookup.pxi":48 + * cdef _BaseParser parser + * cdef _Element last_child + * try: # <<<<<<<<<<<<<< + * namespace = _utf8(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-2.2/src/lxml/classlookup.pxi":49 + * cdef _Element last_child + * try: + * namespace = _utf8(self.NAMESPACE) # <<<<<<<<<<<<<< + * except AttributeError: + * namespace = None + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_NAMESPACE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_namespace); + __pyx_v_namespace = __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_L13_try_end; + __pyx_L6_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-2.2/src/lxml/classlookup.pxi":50 + * try: + * namespace = _utf8(self.NAMESPACE) + * except AttributeError: # <<<<<<<<<<<<<< + * namespace = None + * try: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree.__init__"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":51 + * namespace = _utf8(self.NAMESPACE) + * except AttributeError: + * namespace = None # <<<<<<<<<<<<<< + * try: + * ns, tag = _getNsTag(self.TAG) + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_namespace); + __pyx_v_namespace = Py_None; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/classlookup.pxi":52 + * except AttributeError: + * namespace = None + * try: # <<<<<<<<<<<<<< + * ns, tag = _getNsTag(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-2.2/src/lxml/classlookup.pxi":53 + * namespace = None + * try: + * ns, tag = _getNsTag(self.TAG) # <<<<<<<<<<<<<< + * if ns is not None: + * namespace = ns + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_TAG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { + PyObject* tuple = __pyx_t_1; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_4; + __pyx_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":54 + * try: + * ns, tag = _getNsTag(self.TAG) + * if ns is not None: # <<<<<<<<<<<<<< + * namespace = ns + * except AttributeError: + */ + __pyx_t_4 = (__pyx_v_ns != Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":55 + * ns, tag = _getNsTag(self.TAG) + * if ns is not None: + * namespace = ns # <<<<<<<<<<<<<< + * except AttributeError: + * tag = _utf8(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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_4); __pyx_4 = 0; + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":56 + * if ns is not None: + * namespace = ns + * except AttributeError: # <<<<<<<<<<<<<< + * tag = _utf8(self.__class__.__name__) + * if '.' in tag: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree.__init__"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":57 + * namespace = ns + * except AttributeError: + * tag = _utf8(self.__class__.__name__) # <<<<<<<<<<<<<< + * if '.' in tag: + * tag = tag.split('.')[-1] + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___class__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_kp___name__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":58 + * except AttributeError: + * tag = _utf8(self.__class__.__name__) + * if '.' in tag: # <<<<<<<<<<<<<< + * tag = tag.split('.')[-1] + * try: + */ + __pyx_t_4 = (PySequence_Contains(__pyx_v_tag, __pyx_kp_397)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":59 + * tag = _utf8(self.__class__.__name__) + * if '.' in tag: + * tag = tag.split('.')[-1] # <<<<<<<<<<<<<< + * try: + * parser = self.PARSER + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_tag, __pyx_kp_split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); 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_kp_398); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_398); + __Pyx_GIVEREF(__pyx_kp_398); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((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(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_2 = __Pyx_GetItemInt(__pyx_t_7, -1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_2; + __pyx_2 = 0; + goto __pyx_L27; + } + __pyx_L27:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L17_exception_handled; + } + __pyx_L18_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/classlookup.pxi":60 + * if '.' in tag: + * tag = tag.split('.')[-1] + * try: # <<<<<<<<<<<<<< + * parser = 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-2.2/src/lxml/classlookup.pxi":61 + * tag = tag.split('.')[-1] + * try: + * parser = self.PARSER # <<<<<<<<<<<<<< + * except AttributeError: + * parser = None + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_PARSER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L28_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseParser))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L28_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_parser)); + __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__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_L35_try_end; + __pyx_L28_error:; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_4); __pyx_4 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 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-2.2/src/lxml/classlookup.pxi":62 + * try: + * parser = self.PARSER + * except AttributeError: # <<<<<<<<<<<<<< + * parser = None + * for child in children: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree.__init__"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":63 + * parser = 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-2.2/src/lxml/classlookup.pxi":64 + * except AttributeError: + * parser = None + * for child in children: # <<<<<<<<<<<<<< + * if isinstance(child, _Element): + * parser = (<_Element>child)._doc._parser + */ + if (PyList_CheckExact(__pyx_v_children) || PyTuple_CheckExact(__pyx_v_children)) { + __pyx_t_8 = 0; __pyx_t_7 = __pyx_v_children; __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;} + __Pyx_GOTREF(__pyx_t_7); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break; + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_7))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; + } else { + __pyx_t_6 = PyIter_Next(__pyx_t_7); + if (!__pyx_t_6) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":65 + * parser = None + * for child in children: + * if isinstance(child, _Element): # <<<<<<<<<<<<<< + * parser = (<_Element>child)._doc._parser + * break + */ + __pyx_t_4 = PyObject_TypeCheck(__pyx_v_child, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":66 + * 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-2.2/src/lxml/classlookup.pxi":67 + * 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_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L29_exception_handled; + } + __pyx_L30_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/classlookup.pxi":68 + * parser = (<_Element>child)._doc._parser + * break + * if isinstance(parser, HTMLParser): # <<<<<<<<<<<<<< + * is_html = 1 + * if namespace is None: + */ + __pyx_t_4 = PyObject_TypeCheck(((PyObject *)__pyx_v_parser), ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser))); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":69 + * 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-2.2/src/lxml/classlookup.pxi":70 + * if isinstance(parser, HTMLParser): + * is_html = 1 + * if namespace is None: # <<<<<<<<<<<<<< + * try: + * is_html = self.HTML + */ + __pyx_t_4 = (__pyx_v_namespace == Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":71 + * is_html = 1 + * if namespace is None: + * try: # <<<<<<<<<<<<<< + * is_html = 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-2.2/src/lxml/classlookup.pxi":72 + * if namespace is None: + * try: + * is_html = self.HTML # <<<<<<<<<<<<<< + * except AttributeError: + * pass + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_HTML); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L43_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L43_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_is_html = __pyx_t_4; + } + __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_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_4); __pyx_4 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":73 + * try: + * is_html = self.HTML + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * _initNewElement(self, is_html, tag, namespace, parser, + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L44_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/classlookup.pxi":76 + * pass + * _initNewElement(self, is_html, tag, namespace, parser, + * attrib, nsmap, _extra) # <<<<<<<<<<<<<< + * last_child = None + * for child in children: + */ + __pyx_t_9 = __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, __pyx_v__extra); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":77 + * _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-2.2/src/lxml/classlookup.pxi":78 + * attrib, nsmap, _extra) + * last_child = None + * for child in children: # <<<<<<<<<<<<<< + * if _isString(child): + * if last_child is None: + */ + if (PyList_CheckExact(__pyx_v_children) || PyTuple_CheckExact(__pyx_v_children)) { + __pyx_t_8 = 0; __pyx_t_1 = __pyx_v_children; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":79 + * last_child = None + * for child in children: + * if _isString(child): # <<<<<<<<<<<<<< + * if last_child is None: + * if _hasText(self._c_node): + */ + __pyx_t_4 = _isString(__pyx_v_child); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":80 + * for child in children: + * if _isString(child): + * if last_child is None: # <<<<<<<<<<<<<< + * if _hasText(self._c_node): + * self.text += child + */ + __pyx_t_4 = (((PyObject *)__pyx_v_last_child) == Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":81 + * if _isString(child): + * if last_child is None: + * if _hasText(self._c_node): # <<<<<<<<<<<<<< + * self.text += child + * else: + */ + __pyx_t_9 = __pyx_f_4lxml_5etree__hasText(((struct LxmlElementBase *)__pyx_v_self)->__pyx_base._c_node); + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":82 + * if last_child is None: + * if _hasText(self._c_node): + * self.text += child # <<<<<<<<<<<<<< + * else: + * self.text = child + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_3 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_v_child); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_text, __pyx_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + goto __pyx_L55; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":84 + * self.text += child + * else: + * self.text = child # <<<<<<<<<<<<<< + * else: + * if _hasTail(last_child._c_node): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_text, __pyx_v_child) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L55:; + goto __pyx_L54; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":86 + * self.text = child + * else: + * if _hasTail(last_child._c_node): # <<<<<<<<<<<<<< + * last_child.tail += child + * else: + */ + __pyx_t_9 = __pyx_f_4lxml_5etree__hasTail(__pyx_v_last_child->_c_node); + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":87 + * else: + * if _hasTail(last_child._c_node): + * last_child.tail += child # <<<<<<<<<<<<<< + * else: + * last_child.tail = child + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_last_child), __pyx_kp_tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_v_child); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetAttr(((PyObject *)__pyx_v_last_child), __pyx_kp_tail, __pyx_4) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L56; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":89 + * 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_kp_tail, __pyx_v_child) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L56:; + } + __pyx_L54:; + goto __pyx_L53; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":90 + * else: + * last_child.tail = child + * elif isinstance(child, _Element): # <<<<<<<<<<<<<< + * last_child = child + * _appendChild(self, last_child) + */ + __pyx_t_4 = PyObject_TypeCheck(__pyx_v_child, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":91 + * last_child.tail = child + * elif isinstance(child, _Element): + * last_child = child # <<<<<<<<<<<<<< + * _appendChild(self, last_child) + * elif isinstance(child, type) and issubclass(child, ElementBase): + */ + if (!(__Pyx_TypeTest(__pyx_v_child, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 91; __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-2.2/src/lxml/classlookup.pxi":92 + * elif isinstance(child, _Element): + * last_child = child + * _appendChild(self, last_child) # <<<<<<<<<<<<<< + * elif isinstance(child, type) and issubclass(child, ElementBase): + * last_child = child() + */ + __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L53; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":93 + * last_child = child + * _appendChild(self, last_child) + * elif isinstance(child, type) and issubclass(child, ElementBase): # <<<<<<<<<<<<<< + * last_child = child() + * _appendChild(self, last_child) + */ + __pyx_t_4 = PyObject_TypeCheck(__pyx_v_child, ((PyTypeObject *)((PyObject*)&PyType_Type))); + if (__pyx_t_4) { + __pyx_t_10 = PyObject_IsSubclass(__pyx_v_child, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_t_10; + } else { + __pyx_t_11 = __pyx_t_4; + } + if (__pyx_t_11) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":94 + * _appendChild(self, last_child) + * elif isinstance(child, type) and issubclass(child, ElementBase): + * last_child = child() # <<<<<<<<<<<<<< + * _appendChild(self, last_child) + * else: + */ + __pyx_t_3 = PyObject_Call(__pyx_v_child, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_last_child)); + __pyx_v_last_child = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":95 + * 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_9 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L53; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":97 + * _appendChild(self, last_child) + * else: + * raise TypeError, "Invalid child type: %r" % type(child) # <<<<<<<<<<<<<< + * + * cdef class CommentBase(_Comment): + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_child); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_child); + __Pyx_GIVEREF(__pyx_v_child); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyType_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(__pyx_kp_399, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L53:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __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.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_namespace); + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_child); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":154 + * """ + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":155 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":166 + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":168 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":170 + * 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___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___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_kp_fallback,0}; + __Pyx_SetupRefcountContext("__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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_fallback); + if (unlikely(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 = 170; __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.__init__"); + 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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":171 + * + * 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-2.2/src/lxml/classlookup.pxi":172 + * 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-2.2/src/lxml/classlookup.pxi":174 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":176 + * 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_SetupRefcountContext("_setFallback"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":179 + * 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-2.2/src/lxml/classlookup.pxi":180 + * """ + * 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-2.2/src/lxml/classlookup.pxi":181 + * 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-2.2/src/lxml/classlookup.pxi":182 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":184 + * self._fallback_function = _lookupDefaultElementClass + * + * def set_fallback(self, ElementClassLookup lookup not None): # <<<<<<<<<<<<<< + * u"""set_fallback(self, lookup) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_set_fallback(PyObject *__pyx_v_self, PyObject *__pyx_v_lookup); /*proto*/ +static char __pyx_doc_4lxml_5etree_26FallbackElementClassLookup_set_fallback[] = "set_fallback(self, lookup)\n\n Sets the fallback scheme for this lookup method.\n "; +static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_set_fallback(PyObject *__pyx_v_self, PyObject *__pyx_v_lookup) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":189 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":191 + * self._setFallback(lookup) + * + * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup, # <<<<<<<<<<<<<< + * _Document doc, xmlNode* c_node): + * return lookup._fallback_function(lookup.fallback, doc, c_node) + */ + +static 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; + __Pyx_SetupRefcountContext("_callLookupFallback"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":193 + * 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 = __pyx_v_lookup->_fallback_function(((PyObject *)__pyx_v_lookup->fallback), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 193; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":211 + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":212 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":214 + * 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___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___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_kp_element,&__pyx_kp_comment,&__pyx_kp_pi,&__pyx_kp_entity,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[0] = Py_None; + values[1] = Py_None; + values[2] = Py_None; + values[3] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_element); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_comment); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_pi); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_entity); + if (unlikely(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 = 214; __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 = Py_None; + __pyx_v_comment = Py_None; + __pyx_v_pi = Py_None; + __pyx_v_entity = 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 = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":215 + * + * 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-2.2/src/lxml/classlookup.pxi":216 + * 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-2.2/src/lxml/classlookup.pxi":217 + * 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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":218 + * 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-2.2/src/lxml/classlookup.pxi":220 + * 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_400), 0); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":222 + * 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-2.2/src/lxml/classlookup.pxi":223 + * + * 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-2.2/src/lxml/classlookup.pxi":224 + * 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 = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":225 + * 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-2.2/src/lxml/classlookup.pxi":227 + * 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_401), 0); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":229 + * 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-2.2/src/lxml/classlookup.pxi":230 + * + * 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-2.2/src/lxml/classlookup.pxi":231 + * 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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":232 + * 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-2.2/src/lxml/classlookup.pxi":234 + * 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_402), 0); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":236 + * 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-2.2/src/lxml/classlookup.pxi":237 + * + * 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-2.2/src/lxml/classlookup.pxi":238 + * 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 = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":239 + * 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-2.2/src/lxml/classlookup.pxi":241 + * 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_403), 0); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 241; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":243 + * 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; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_lookupDefaultElementClass"); + __pyx_v_cls = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":245 + * 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 (state).element_class + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":246 + * 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 (state).element_class + * else: + */ + __pyx_t_1 = (__pyx_v_state != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":247 + * if c_node.type == tree.XML_ELEMENT_NODE: + * if state is not None: + * return (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-2.2/src/lxml/classlookup.pxi":249 + * return (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-2.2/src/lxml/classlookup.pxi":250 + * else: + * return _Element + * elif c_node.type == tree.XML_COMMENT_NODE: # <<<<<<<<<<<<<< + * if state is not None: + * return (state).comment_class + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_COMMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":251 + * return _Element + * elif c_node.type == tree.XML_COMMENT_NODE: + * if state is not None: # <<<<<<<<<<<<<< + * return (state).comment_class + * else: + */ + __pyx_t_1 = (__pyx_v_state != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":252 + * elif c_node.type == tree.XML_COMMENT_NODE: + * if state is not None: + * return (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-2.2/src/lxml/classlookup.pxi":254 + * return (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-2.2/src/lxml/classlookup.pxi":255 + * else: + * return _Comment + * elif c_node.type == tree.XML_ENTITY_REF_NODE: # <<<<<<<<<<<<<< + * if state is not None: + * return (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-2.2/src/lxml/classlookup.pxi":256 + * return _Comment + * elif c_node.type == tree.XML_ENTITY_REF_NODE: + * if state is not None: # <<<<<<<<<<<<<< + * return (state).entity_class + * else: + */ + __pyx_t_1 = (__pyx_v_state != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":257 + * elif c_node.type == tree.XML_ENTITY_REF_NODE: + * if state is not None: + * return (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-2.2/src/lxml/classlookup.pxi":259 + * return (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-2.2/src/lxml/classlookup.pxi":260 + * else: + * return _Entity + * elif c_node.type == tree.XML_PI_NODE: # <<<<<<<<<<<<<< + * if state is not None: + * cls = (state).pi_class + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_PI_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":261 + * return _Entity + * elif c_node.type == tree.XML_PI_NODE: + * if state is not None: # <<<<<<<<<<<<<< + * cls = (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-2.2/src/lxml/classlookup.pxi":262 + * elif c_node.type == tree.XML_PI_NODE: + * if state is not None: + * cls = (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-2.2/src/lxml/classlookup.pxi":263 + * if state is not None: + * cls = (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-2.2/src/lxml/classlookup.pxi":265 + * 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 \ + */ + if ((__pyx_v_c_node->name != NULL)) { + __pyx_t_1 = (__pyx_v_c_node->content != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_node->name != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":266 + * # 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_1 = (strcmp(__pyx_v_c_node->name, __pyx_k_404) == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":267 + * 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 + */ + if (!(strstr(__pyx_v_c_node->content, __pyx_k_405) != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":268 + * 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_406) != NULL); + } else { + __pyx_t_1 = (strstr(__pyx_v_c_node->content, __pyx_k_405) != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":269 + * 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-2.2/src/lxml/classlookup.pxi":270 + * 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-2.2/src/lxml/classlookup.pxi":272 + * 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-2.2/src/lxml/classlookup.pxi":274 + * return cls + * else: + * assert 0, u"Unknown node type: %s" % c_node.type # <<<<<<<<<<<<<< + * + * + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + if (unlikely(!0)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_407), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 274; __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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._lookupDefaultElementClass"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_cls); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":297 + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":298 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":300 + * 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___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_attribute_name,&__pyx_kp_class_mapping,&__pyx_kp_fallback,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + 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_kp_attribute_name); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_class_mapping); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_fallback); + if (unlikely(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 = 300; __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 = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__"); + 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 = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":302 + * 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 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_attribute_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 302; __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-2.2/src/lxml/classlookup.pxi":303 + * 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self)->_pytag); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":304 + * self._pytag = _getNsTag(attribute_name) + * ns, name = self._pytag + * if ns is None: # <<<<<<<<<<<<<< + * self._c_ns = NULL + * else: + */ + __pyx_t_2 = (__pyx_v_ns == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":305 + * 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-2.2/src/lxml/classlookup.pxi":307 + * 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 = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":308 + * 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 = PyString_AS_STRING(__pyx_v_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":309 + * self._c_ns = _cstr(ns) + * self._c_name = _cstr(name) + * self._class_mapping = dict(class_mapping) # <<<<<<<<<<<<<< + * + * FallbackElementClassLookup.__init__(self, fallback) + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_class_mapping); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_class_mapping); + __Pyx_GIVEREF(__pyx_v_class_mapping); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __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_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":311 + * self._class_mapping = dict(class_mapping) + * + * FallbackElementClassLookup.__init__(self, fallback) # <<<<<<<<<<<<<< + * + * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node): + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)), __pyx_kp___init__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 311; __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[9]; __pyx_lineno = 311; __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(((PyObject *)__pyx_v_fallback)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_fallback)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fallback)); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 311; __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_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_name); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":313 + * 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_SetupRefcountContext("_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-2.2/src/lxml/classlookup.pxi":317 + * cdef python.PyObject* dict_result + * + * lookup = 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-2.2/src/lxml/classlookup.pxi":318 + * + * lookup = 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-2.2/src/lxml/classlookup.pxi":320 + * 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 = 319; __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-2.2/src/lxml/classlookup.pxi":321 + * 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 dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(__pyx_v_lookup->_class_mapping, __pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":322 + * c_node, lookup._c_ns, lookup._c_name) + * dict_result = python.PyDict_GetItem(lookup._class_mapping, value) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * return 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-2.2/src/lxml/classlookup.pxi":323 + * dict_result = python.PyDict_GetItem(lookup._class_mapping, value) + * if dict_result is not NULL: + * return 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-2.2/src/lxml/classlookup.pxi":324 + * if dict_result is not NULL: + * return 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 = 324; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":334 + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":335 + * """ + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":337 + * 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; + __Pyx_SetupRefcountContext("_parser_class_lookup"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":338 + * + * 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-2.2/src/lxml/classlookup.pxi":339 + * 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(state, doc, c_node) + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":340 + * if doc._parser._class_lookup is not None: + * return doc._parser._class_lookup._lookup_function( + * doc._parser._class_lookup, doc, c_node) # <<<<<<<<<<<<<< + * return _callLookupFallback(state, doc, c_node) + * + */ + __pyx_t_2 = __pyx_v_doc->_parser->_class_lookup->_lookup_function(((PyObject *)__pyx_v_doc->_parser->_class_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 339; __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-2.2/src/lxml/classlookup.pxi":341 + * return doc._parser._class_lookup._lookup_function( + * doc._parser._class_lookup, doc, c_node) + * return _callLookupFallback(state, doc, c_node) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_state), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 341; __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._parser_class_lookup"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":363 + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":364 + * """ + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":366 + * 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_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_24CustomElementClassLookup_lookup[] = "lookup(self, type, doc, namespace, name)"; +static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_lookup(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_kp_type,&__pyx_kp_doc,&__pyx_kp_namespace,&__pyx_kp_name,0}; + __Pyx_SetupRefcountContext("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_kp_type); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_doc); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_namespace); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_name); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 366; __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 = 366; __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 = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.CustomElementClassLookup.lookup"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":368 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":370 + * 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_SetupRefcountContext("_custom_class_lookup"); + __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_element_type = 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-2.2/src/lxml/classlookup.pxi":374 + * cdef char* c_str + * + * lookup = 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-2.2/src/lxml/classlookup.pxi":376 + * lookup = 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-2.2/src/lxml/classlookup.pxi":377 + * + * 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_kp_408)); + __Pyx_DECREF(__pyx_v_element_type); + __pyx_v_element_type = ((PyObject *)__pyx_kp_408); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":378 + * 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-2.2/src/lxml/classlookup.pxi":379 + * 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_kp_409)); + __Pyx_DECREF(__pyx_v_element_type); + __pyx_v_element_type = ((PyObject *)__pyx_kp_409); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":380 + * 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-2.2/src/lxml/classlookup.pxi":381 + * 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_kp_410)); + __Pyx_DECREF(__pyx_v_element_type); + __pyx_v_element_type = ((PyObject *)__pyx_kp_410); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":382 + * 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-2.2/src/lxml/classlookup.pxi":383 + * 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_kp_411)); + __Pyx_DECREF(__pyx_v_element_type); + __pyx_v_element_type = ((PyObject *)__pyx_kp_411); + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":385 + * element_type = u"entity" + * else: + * element_type = u"element" # <<<<<<<<<<<<<< + * if c_node.name is NULL: + * name = None + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_412)); + __Pyx_DECREF(__pyx_v_element_type); + __pyx_v_element_type = ((PyObject *)__pyx_kp_412); + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":386 + * 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-2.2/src/lxml/classlookup.pxi":387 + * 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-2.2/src/lxml/classlookup.pxi":389 + * 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 = 389; __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-2.2/src/lxml/classlookup.pxi":390 + * 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-2.2/src/lxml/classlookup.pxi":391 + * 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-2.2/src/lxml/classlookup.pxi":392 + * 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-2.2/src/lxml/classlookup.pxi":394 + * 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 = 394; __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-2.2/src/lxml/classlookup.pxi":396 + * 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_kp_lookup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 396; __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 = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_element_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_element_type); + __Pyx_GIVEREF(__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 = 396; __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-2.2/src/lxml/classlookup.pxi":397 + * + * 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-2.2/src/lxml/classlookup.pxi":398 + * 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-2.2/src/lxml/classlookup.pxi":399 + * 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 = 399; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":448 + * 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_SetupRefcountContext("__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-2.2/src/lxml/classlookup.pxi":449 + * """ + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":451 + * self._lookup_function = _python_class_lookup + * + * def lookup(self, doc, element): # <<<<<<<<<<<<<< + * u"""lookup(self, doc, element) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_24PythonElementClassLookup_lookup[] = "lookup(self, doc, element)\n\n Override this method to implement your own lookup scheme.\n "; +static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_lookup(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_kp_doc,&__pyx_kp_element,0}; + __Pyx_SetupRefcountContext("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_kp_doc); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_element); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 451; __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 = 451; __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 = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.PythonElementClassLookup.lookup"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":456 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":458 + * 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_SetupRefcountContext("_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-2.2/src/lxml/classlookup.pxi":461 + * cdef PythonElementClassLookup lookup + * cdef _ReadOnlyElementProxy proxy + * lookup = 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-2.2/src/lxml/classlookup.pxi":463 + * lookup = 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__ReadOnlyElementProxy *)Py_None), __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __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-2.2/src/lxml/classlookup.pxi":464 + * + * proxy = _newReadOnlyProxy(None, c_node) + * cls = lookup.lookup(doc, proxy) # <<<<<<<<<<<<<< + * _freeReadOnlyProxies(proxy) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_lookup), __pyx_kp_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 464; __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 = 464; __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 = 464; __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-2.2/src/lxml/classlookup.pxi":465 + * 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(__pyx_v_proxy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 465; __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-2.2/src/lxml/classlookup.pxi":467 + * _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-2.2/src/lxml/classlookup.pxi":468 + * + * 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-2.2/src/lxml/classlookup.pxi":469 + * 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 = 469; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":477 + * 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_SetupRefcountContext("_setElementClassLookupFunction"); + __Pyx_INCREF(__pyx_v_state); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":480 + * _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-2.2/src/lxml/classlookup.pxi":481 + * 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-2.2/src/lxml/classlookup.pxi":482 + * 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-2.2/src/lxml/classlookup.pxi":484 + * 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-2.2/src/lxml/classlookup.pxi":485 + * + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":487 + * 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_set_element_class_lookup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_set_element_class_lookup[] = "set_element_class_lookup(lookup = None)\n\n Set the global default element class lookup method.\n "; +static PyObject *__pyx_pf_4lxml_5etree_set_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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_lookup,0}; + __Pyx_SetupRefcountContext("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_kp_lookup); + if (unlikely(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 = 487; __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.set_element_class_lookup"); + 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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":492 + * 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); + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":493 + * """ + * 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-2.2/src/lxml/classlookup.pxi":495 + * _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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":20 + * cdef dict _entries + * cdef char* _c_ns_uri_utf + * def __init__(self, ns_uri): # <<<<<<<<<<<<<< + * self._ns_uri = ns_uri + * if ns_uri is None: + */ + +static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ns_uri = 0; + int __pyx_r; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_ns_uri,0}; + __Pyx_SetupRefcountContext("__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_kp_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), "__init__") < 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("__init__", 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.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":21 + * cdef char* _c_ns_uri_utf + * def __init__(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-2.2/src/lxml/nsclasses.pxi":22 + * def __init__(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-2.2/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-2.2/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-2.2/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 = __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-2.2/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 = {} + * + */ + ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_c_ns_uri_utf = PyString_AS_STRING(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_ns_uri_utf); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __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_1; + __pyx_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_update(PyObject *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable); /*proto*/ +static char __pyx_doc_4lxml_5etree_18_NamespaceRegistry_update[] = "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_update(PyObject *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable) { + PyObject *__pyx_v_name; + PyObject *__pyx_v_item; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + __Pyx_SetupRefcountContext("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-2.2/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_kp_413)); 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-2.2/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_kp_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-2.2/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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PySequence_GetSlice(__pyx_v_name, 0, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_1, ((PyObject *)__pyx_kp_414), Py_NE); 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_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 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_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_1; + } + if (__pyx_t_6) { + __pyx_t_7 = PyCallable_Check(__pyx_v_item); + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_6; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__getitem__"); + __Pyx_INCREF(__pyx_v_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/nsclasses.pxi":47 + * def __getitem__(self, name): + * if name is not None: + * name = _utf8(name) # <<<<<<<<<<<<<< + * return self._get(name) + * + */ + __pyx_t_2 = __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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ +static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__delitem__"); + __Pyx_INCREF(__pyx_v_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/nsclasses.pxi":52 + * def __delitem__(self, name): + * if name is not None: + * name = _utf8(name) # <<<<<<<<<<<<<< + * del self._entries[name] + * + */ + __pyx_t_2 = __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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_get"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_self->_entries), __pyx_v_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 dict_result + */ + __pyx_t_1 = (__pyx_v_dict_result == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 dict_result + * + */ + __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_415), 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-2.2/src/lxml/nsclasses.pxi":60 + * if dict_result is NULL: + * raise KeyError, u"Name not registered." + * return 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_AddTraceback("lxml.etree._NamespaceRegistry._get"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":62 + * return 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; + int __pyx_t_2; + __Pyx_SetupRefcountContext("_getForString"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_self->_entries), __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 dict_result + */ + __pyx_t_2 = (__pyx_v_dict_result == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 dict_result + * + */ + __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_416), 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-2.2/src/lxml/nsclasses.pxi":67 + * if dict_result is NULL: + * raise KeyError, u"Name not registered." + * return 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_AddTraceback("lxml.etree._NamespaceRegistry._getForString"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":69 + * return dict_result + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return iter(self._entries) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":70 + * + * def __iter__(self): + * return iter(self._entries) # <<<<<<<<<<<<<< + * + * def items(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 70; __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._NamespaceRegistry.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_items(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_items(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("items"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":73 + * + * def items(self): + * return list(self._entries.items()) # <<<<<<<<<<<<<< + * + * def iteritems(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_Items(((PyObject *)((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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_iteritems(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_iteritems(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("iteritems"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":76 + * + * def iteritems(self): + * return iter(self._entries.items()) # <<<<<<<<<<<<<< + * + * def clear(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_Items(((PyObject *)((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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_clear(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_clear(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":79 + * + * def clear(self): + * python.PyDict_Clear(self._entries) # <<<<<<<<<<<<<< + * + * cdef class _ClassNamespaceRegistry(_NamespaceRegistry): + */ + PyDict_Clear(((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self)->_entries)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__setitem__"); + __Pyx_INCREF(__pyx_v_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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" + */ + if (!(!PyType_Check(__pyx_v_item))) { + __pyx_t_1 = PyObject_IsSubclass(__pyx_v_item, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + } else { + __pyx_t_2 = (!PyType_Check(__pyx_v_item)); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_112); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":86 + * 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: + * name = _utf8(name) + */ + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_417), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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-2.2/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-2.2/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_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__setitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_name); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_418), ((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(__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._ClassNamespaceRegistry.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":102 + * """ + * cdef object _namespace_registries + * def __init__(self, ElementClassLookup fallback=None): # <<<<<<<<<<<<<< + * self._namespace_registries = {} + * FallbackElementClassLookup.__init__(self, fallback) + */ + +static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct LxmlElementClassLookup *__pyx_v_fallback = 0; + int __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_fallback,0}; + __Pyx_SetupRefcountContext("__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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_fallback); + if (unlikely(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 = 102; __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__"); + 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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":103 + * cdef object _namespace_registries + * def __init__(self, ElementClassLookup fallback=None): + * self._namespace_registries = {} # <<<<<<<<<<<<<< + * FallbackElementClassLookup.__init__(self, fallback) + * self._lookup_function = _find_nselement_class + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries); + __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries); + ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":104 + * def __init__(self, ElementClassLookup fallback=None): + * self._namespace_registries = {} + * FallbackElementClassLookup.__init__(self, fallback) # <<<<<<<<<<<<<< + * self._lookup_function = _find_nselement_class + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __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 = 104; __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 = 104; __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-2.2/src/lxml/nsclasses.pxi":105 + * self._namespace_registries = {} + * 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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":107 + * 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_get_namespace(PyObject *__pyx_v_self, PyObject *__pyx_v_ns_uri); /*proto*/ +static char __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_get_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_get_namespace(PyObject *__pyx_v_self, PyObject *__pyx_v_ns_uri) { + PyObject *__pyx_v_ns_utf; + PyObject *__pyx_v_registry; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_2; + int __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_SetupRefcountContext("get_namespace"); + __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_registry = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":113 + * + * 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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":114 + * 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 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __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-2.2/src/lxml/nsclasses.pxi":116 + * 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-2.2/src/lxml/nsclasses.pxi":117 + * 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-2.2/src/lxml/nsclasses.pxi":118 + * ns_utf = None + * try: + * return self._namespace_registries[ns_utf] # <<<<<<<<<<<<<< + * except KeyError: + * registry = self._namespace_registries[ns_utf] = \ + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = PyObject_GetItem(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries, __pyx_v_ns_utf); if (!__pyx_1) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_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_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_L0; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":119 + * try: + * return self._namespace_registries[ns_utf] + * except KeyError: # <<<<<<<<<<<<<< + * registry = self._namespace_registries[ns_utf] = \ + * _ClassNamespaceRegistry(ns_uri) + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.get_namespace"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":121 + * except KeyError: + * registry = self._namespace_registries[ns_utf] = \ + * _ClassNamespaceRegistry(ns_uri) # <<<<<<<<<<<<<< + * return registry + * + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_ns_uri); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns_uri); + __Pyx_GIVEREF(__pyx_v_ns_uri); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_registry); + __pyx_v_registry = __pyx_t_6; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":120 + * return self._namespace_registries[ns_utf] + * except KeyError: + * registry = self._namespace_registries[ns_utf] = \ # <<<<<<<<<<<<<< + * _ClassNamespaceRegistry(ns_uri) + * return registry + */ + if (PyObject_SetItem(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self)->_namespace_registries, __pyx_v_ns_utf, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":122 + * 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(__pyx_v_registry); + __pyx_r = __pyx_v_registry; + __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_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_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_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.ElementNamespaceClassLookup.get_namespace"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns_utf); + __Pyx_DECREF(__pyx_v_registry); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":124 + * 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; + __Pyx_SetupRefcountContext("_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 = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":129 + * 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-2.2/src/lxml/nsclasses.pxi":130 + * cdef char* c_namespace_utf + * if state is None: + * return _lookupDefaultElementClass(None, doc, c_node) # <<<<<<<<<<<<<< + * + * lookup = 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 = 130; __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-2.2/src/lxml/nsclasses.pxi":132 + * return _lookupDefaultElementClass(None, doc, c_node) + * + * lookup = 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-2.2/src/lxml/nsclasses.pxi":133 + * + * lookup = 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-2.2/src/lxml/nsclasses.pxi":134 + * lookup = 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 = 134; __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-2.2/src/lxml/nsclasses.pxi":136 + * 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-2.2/src/lxml/nsclasses.pxi":137 + * + * 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-2.2/src/lxml/nsclasses.pxi":139 + * 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 = __Pyx_PyBytes_FromString(__pyx_v_c_namespace_utf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_dict_result = PyDict_GetItem(__pyx_v_lookup->_namespace_registries, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":142 + * else: + * dict_result = python.PyDict_GetItem( + * lookup._namespace_registries, None) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * registry = <_NamespaceRegistry>dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(__pyx_v_lookup->_namespace_registries, Py_None); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":143 + * 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-2.2/src/lxml/nsclasses.pxi":144 + * 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-2.2/src/lxml/nsclasses.pxi":145 + * 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(__pyx_v_classes); + __pyx_v_classes = ((PyObject *)__pyx_v_registry->_entries); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":147 + * 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-2.2/src/lxml/nsclasses.pxi":149 + * if c_node.name is not NULL: + * dict_result = python.PyDict_GetItem( + * classes, c_node.name) # <<<<<<<<<<<<<< + * else: + * dict_result = NULL + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_dict_result = PyDict_GetItem(__pyx_v_classes, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":151 + * 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-2.2/src/lxml/nsclasses.pxi":153 + * 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-2.2/src/lxml/nsclasses.pxi":154 + * + * if dict_result is NULL: + * dict_result = python.PyDict_GetItem(classes, None) # <<<<<<<<<<<<<< + * + * if dict_result is not NULL: + */ + __pyx_v_dict_result = PyDict_GetItem(__pyx_v_classes, Py_None); + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":156 + * dict_result = python.PyDict_GetItem(classes, None) + * + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * return 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-2.2/src/lxml/nsclasses.pxi":157 + * + * if dict_result is not NULL: + * return 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-2.2/src/lxml/nsclasses.pxi":158 + * if dict_result is not NULL: + * return 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[10]; __pyx_lineno = 158; __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._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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":167 + * __FUNCTION_NAMESPACE_REGISTRIES = {} + * + * def FunctionNamespace(ns_uri): # <<<<<<<<<<<<<< + * u"""FunctionNamespace(ns_uri) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_FunctionNamespace(PyObject *__pyx_self, PyObject *__pyx_v_ns_uri); /*proto*/ +static char __pyx_doc_4lxml_5etree_FunctionNamespace[] = "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 PyObject *__pyx_pf_4lxml_5etree_FunctionNamespace(PyObject *__pyx_self, PyObject *__pyx_v_ns_uri) { + PyObject *__pyx_v_ns_utf; + PyObject *__pyx_v_registry; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_2; + int __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_SetupRefcountContext("FunctionNamespace"); + __pyx_self = __pyx_self; + __pyx_v_ns_utf = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_registry = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":175 + * 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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":176 + * can only be used to register extension functions.""" + * if ns_uri: + * ns_utf = _utf8(ns_uri) # <<<<<<<<<<<<<< + * else: + * ns_utf = None + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 176; __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-2.2/src/lxml/nsclasses.pxi":178 + * 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-2.2/src/lxml/nsclasses.pxi":179 + * 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-2.2/src/lxml/nsclasses.pxi":180 + * ns_utf = None + * try: + * return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] # <<<<<<<<<<<<<< + * except KeyError: + * registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \ + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = PyObject_GetItem(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES), __pyx_v_ns_utf); if (!__pyx_1) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_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_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_L0; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":181 + * try: + * return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] + * except KeyError: # <<<<<<<<<<<<<< + * registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \ + * _XPathFunctionNamespaceRegistry(ns_uri) + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree.FunctionNamespace"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":183 + * except KeyError: + * registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \ + * _XPathFunctionNamespaceRegistry(ns_uri) # <<<<<<<<<<<<<< + * return registry + * + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_ns_uri); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns_uri); + __Pyx_GIVEREF(__pyx_v_ns_uri); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_registry); + __pyx_v_registry = __pyx_t_6; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":182 + * 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_6) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":184 + * registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \ + * _XPathFunctionNamespaceRegistry(ns_uri) + * return registry # <<<<<<<<<<<<<< + * + * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_registry); + __pyx_r = __pyx_v_registry; + __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_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_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_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.FunctionNamespace"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns_utf); + __Pyx_DECREF(__pyx_v_registry); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":187 + * + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__setitem__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":188 + * 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-2.2/src/lxml/nsclasses.pxi":189 + * def __setitem__(self, name, item): + * if not callable(item): + * raise NamespaceRegistryError, \ # <<<<<<<<<<<<<< + * u"Registered functions must be callable." + * if not name: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_112); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":190 + * if not callable(item): + * raise NamespaceRegistryError, \ + * u"Registered functions must be callable." # <<<<<<<<<<<<<< + * if not name: + * raise ValueError, \ + */ + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_419), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":191 + * 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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":193 + * 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_420), 0); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":194 + * raise ValueError, \ + * u"extensions must have non empty names" + * self._entries[_utf8(name)] = item # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self)->__pyx_base._entries), __pyx_t_3, __pyx_v_item) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__setitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":196 + * self._entries[_utf8(name)] = item + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return u"FunctionNamespace(%r)" % self._ns_uri + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":197 + * + * 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_421), ((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 = 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._FunctionNamespaceRegistry.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":205 + * 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_SetupRefcountContext("__del__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":206 + * 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-2.2/src/lxml/nsclasses.pxi":207 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":208 + * 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___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":209 + * 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-2.2/src/lxml/nsclasses.pxi":210 + * def __get__(self): + * if self._prefix is None: + * return '' # <<<<<<<<<<<<<< + * else: + * return self._prefix + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_422); + __pyx_r = __pyx_kp_422; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":212 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":213 + * else: + * return self._prefix + * def __set__(self, prefix): # <<<<<<<<<<<<<< + * if prefix == '': + * prefix = None # empty prefix + */ + +static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /*proto*/ +static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__set__"); + __Pyx_INCREF(__pyx_v_prefix); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":214 + * 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, __pyx_kp_423, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 214; __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 = 214; __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-2.2/src/lxml/nsclasses.pxi":215 + * 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-2.2/src/lxml/nsclasses.pxi":216 + * 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-2.2/src/lxml/nsclasses.pxi":217 + * 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-2.2/src/lxml/nsclasses.pxi":219 + * self._prefix_utf = None + * else: + * self._prefix_utf = _utf8(prefix) # <<<<<<<<<<<<<< + * self._prefix = prefix + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 219; __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-2.2/src/lxml/nsclasses.pxi":220 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":222 + * 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_SetupRefcountContext("_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-2.2/src/lxml/nsclasses.pxi":225 + * 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 = 225; __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-2.2/src/lxml/nsclasses.pxi":226 + * 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 (!(__Pyx_TypeTest(((PyObject *)__pyx_t_3), __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 226; __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-2.2/src/lxml/nsclasses.pxi":227 + * 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-2.2/src/lxml/nsclasses.pxi":228 + * 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-2.2/src/lxml/nsclasses.pxi":230 + * 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 = 230; __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(((PyObject *)__pyx_v_ns_prefixes), ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 229; __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-2.2/src/lxml/nsclasses.pxi":231 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":233 + * 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_SetupRefcountContext("_find_extension"); + __pyx_v_extensions = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":236 + * 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-2.2/src/lxml/nsclasses.pxi":237 + * 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-2.2/src/lxml/nsclasses.pxi":238 + * __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-2.2/src/lxml/nsclasses.pxi":239 + * 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(__pyx_v_extensions); + __pyx_v_extensions = ((PyObject *)((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_dict_result)->_entries); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":240 + * 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(__pyx_v_extensions, __pyx_v_name_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":241 + * 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-2.2/src/lxml/nsclasses.pxi":242 + * dict_result = python.PyDict_GetItem(extensions, name_utf) + * if dict_result is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return 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-2.2/src/lxml/nsclasses.pxi":244 + * return None + * else: + * return 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":17 + * 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_kp_system_url,&__pyx_kp_public_id,&__pyx_kp_context,0}; + __Pyx_SetupRefcountContext("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_kp_system_url); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_public_id); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_context); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 17; __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 = 17; __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 = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Resolver.resolve"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":26 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":28 + * return None + * + * def resolve_empty(self, context): # <<<<<<<<<<<<<< + * u"""resolve_empty(self, context) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve_empty(PyObject *__pyx_v_self, PyObject *__pyx_v_context); /*proto*/ +static char __pyx_doc_4lxml_5etree_8Resolver_resolve_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_resolve_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_SetupRefcountContext("resolve_empty"); + __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":36 + * """ + * 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 = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__InputDocument))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/docloader.pxi":37 + * 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-2.2/src/lxml/docloader.pxi":38 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":40 + * 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_resolve_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8Resolver_resolve_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_resolve_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_kp_string,&__pyx_kp_context,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("resolve_string"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[2] = 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_kp_string); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_context); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 40; __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 = 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 = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string"); + 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-2.2/src/lxml/docloader.pxi":50 + * """ + * cdef _InputDocument doc_ref + * if python.PyUnicode_Check(string): # <<<<<<<<<<<<<< + * string = python.PyUnicode_AsUTF8String(string) + * elif not python.PyString_Check(string): + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_string); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":51 + * cdef _InputDocument doc_ref + * if python.PyUnicode_Check(string): + * string = python.PyUnicode_AsUTF8String(string) # <<<<<<<<<<<<<< + * elif not python.PyString_Check(string): + * raise TypeError, "argument must be a byte string or unicode string" + */ + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 51; __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-2.2/src/lxml/docloader.pxi":52 + * if python.PyUnicode_Check(string): + * string = python.PyUnicode_AsUTF8String(string) + * elif not python.PyString_Check(string): # <<<<<<<<<<<<<< + * raise TypeError, "argument must be a byte string or unicode string" + * doc_ref = _InputDocument() + */ + __pyx_t_1 = (!PyString_Check(__pyx_v_string)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":53 + * string = python.PyUnicode_AsUTF8String(string) + * elif not python.PyString_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, __pyx_kp_424, 0); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":54 + * elif not python.PyString_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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__InputDocument))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/docloader.pxi":55 + * 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-2.2/src/lxml/docloader.pxi":56 + * 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-2.2/src/lxml/docloader.pxi":57 + * 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-2.2/src/lxml/docloader.pxi":58 + * 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 = 58; __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-2.2/src/lxml/docloader.pxi":59 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":61 + * return doc_ref + * + * def resolve_filename(self, filename, context): # <<<<<<<<<<<<<< + * u"""resolve_filename(self, filename, context) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve_filename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8Resolver_resolve_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_resolve_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_kp_filename,&__pyx_kp_context,0}; + __Pyx_SetupRefcountContext("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_kp_filename); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_context); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 61; __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 = 61; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename"); + 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-2.2/src/lxml/docloader.pxi":70 + * """ + * 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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__InputDocument))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/docloader.pxi":71 + * 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-2.2/src/lxml/docloader.pxi":72 + * 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 = 72; __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-2.2/src/lxml/docloader.pxi":73 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":75 + * 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_resolve_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8Resolver_resolve_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_resolve_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; + int __pyx_1; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_f,&__pyx_kp_context,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("resolve_file"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[2] = 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_kp_f); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_context); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 75; __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 = 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 = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file"); + 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-2.2/src/lxml/docloader.pxi":88 + * """ + * 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-2.2/src/lxml/docloader.pxi":89 + * 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_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 89; __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-2.2/src/lxml/docloader.pxi":90 + * try: + * f.read + * except AttributeError: # <<<<<<<<<<<<<< + * raise TypeError, u"Argument is not a file-like object" + * doc_ref = _InputDocument() + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree.resolve_file"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":91 + * 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_425), 0); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __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; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/docloader.pxi":92 + * 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_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__InputDocument))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_doc_ref)); + __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":93 + * 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-2.2/src/lxml/docloader.pxi":94 + * doc_ref = _InputDocument() + * doc_ref._type = PARSER_DATA_FILE + * if base_url is not None: # <<<<<<<<<<<<<< + * doc_ref._filename = _encodeFilename(base_url) + * else: + */ + __pyx_t_4 = (__pyx_v_base_url != Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":95 + * 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_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_doc_ref->_filename); + __Pyx_DECREF(__pyx_v_doc_ref->_filename); + __pyx_v_doc_ref->_filename = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L16; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":97 + * doc_ref._filename = _encodeFilename(base_url) + * else: + * doc_ref._filename = _getFilenameForFile(f) # <<<<<<<<<<<<<< + * doc_ref._file = f + * return doc_ref + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_doc_ref->_filename); + __Pyx_DECREF(__pyx_v_doc_ref->_filename); + __pyx_v_doc_ref->_filename = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":98 + * 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-2.2/src/lxml/docloader.pxi":99 + * 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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_doc_ref); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":104 + * cdef object _resolvers + * cdef Resolver _default_resolver + * def __init__(self, Resolver default_resolver=None): # <<<<<<<<<<<<<< + * self._resolvers = set() + * self._default_resolver = default_resolver + */ + +static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___init__(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_kp_default_resolver,0}; + __Pyx_SetupRefcountContext("__init__"); + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default_resolver); + if (unlikely(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[11]; __pyx_lineno = 104; __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("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__init__"); + 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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":105 + * cdef Resolver _default_resolver + * def __init__(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 = 105; __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-2.2/src/lxml/docloader.pxi":106 + * def __init__(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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":108 + * self._default_resolver = default_resolver + * + * def add(self, Resolver resolver not None): # <<<<<<<<<<<<<< + * u"""add(self, resolver) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_add(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver); /*proto*/ +static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_add[] = "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_add(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_SetupRefcountContext("add"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_resolver), __pyx_ptype_4lxml_5etree_Resolver, 0, "resolver", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":119 + * 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_kp_add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 119; __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 = 119; __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 = 119; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":121 + * self._resolvers.add(resolver) + * + * def remove(self, resolver): # <<<<<<<<<<<<<< + * u"remove(self, resolver)" + * self._resolvers.discard(resolver) + */ + +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_remove(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver); /*proto*/ +static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_remove[] = "remove(self, resolver)"; +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_remove(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_SetupRefcountContext("remove"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":123 + * 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_kp_discard); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 123; __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 = 123; __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 = 123; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":125 + * 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_SetupRefcountContext("_copy"); + __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":127 + * 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 = 127; __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ResolverRegistry))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/docloader.pxi":128 + * 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_kp_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 128; __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 = 128; __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-2.2/src/lxml/docloader.pxi":129 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":131 + * return registry + * + * def copy(self): # <<<<<<<<<<<<<< + * u"copy(self)" + * return self._copy() + */ + +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_copy[] = "copy(self)"; +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":133 + * 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 = 133; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":135 + * 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_resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_resolve[] = "resolve(self, system_url, public_id, context)"; +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_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_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_kp_system_url,&__pyx_kp_public_id,&__pyx_kp_context,0}; + __Pyx_SetupRefcountContext("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_kp_system_url); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_public_id); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_context); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 135; __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 = 135; __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve"); + 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-2.2/src/lxml/docloader.pxi":137 + * 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 = 137; __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 = 137; __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-2.2/src/lxml/docloader.pxi":138 + * 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_kp_resolve); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 138; __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 = 138; __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 = 138; __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-2.2/src/lxml/docloader.pxi":139 + * 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-2.2/src/lxml/docloader.pxi":140 + * 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-2.2/src/lxml/docloader.pxi":141 + * 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-2.2/src/lxml/docloader.pxi":142 + * 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-2.2/src/lxml/docloader.pxi":143 + * 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_kp_resolve); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 143; __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 = 143; __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 = 143; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":145 + * 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___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":146 + * + * def __repr__(self): + * return repr(self._resolvers) # <<<<<<<<<<<<<< + * + * cdef class _ResolverContext(_ExceptionContext): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_Repr(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self)->_resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 146; __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.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":152 + * 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_SetupRefcountContext("clear"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":153 + * + * 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-2.2/src/lxml/docloader.pxi":154 + * 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 = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("lxml.etree._ResolverContext.clear"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":156 + * 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_SetupRefcountContext("_initResolverContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/docloader.pxi":158 + * 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-2.2/src/lxml/docloader.pxi":159 + * _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 = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ResolverRegistry))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/docloader.pxi":161 + * 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-2.2/src/lxml/docloader.pxi":162 + * 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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__TempStore))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":23 + * u"""Syntax error while parsing an XML document. + * """ + * 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_14XMLSyntaxError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4lxml_5etree_14XMLSyntaxError___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_4lxml_5etree_14XMLSyntaxError___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4lxml_5etree_14XMLSyntaxError___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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_self,&__pyx_kp_message,&__pyx_kp_code,&__pyx_kp_line,&__pyx_kp_column,0}; + __Pyx_SetupRefcountContext("__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_kp_self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_message); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_code); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_line); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_column); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __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[2]; __pyx_lineno = 23; __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[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XMLSyntaxError.__init__"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":24 + * """ + * def __init__(self, message, code, line, column): + * if python.PY_VERSION_HEX >= 0x02050000: # <<<<<<<<<<<<<< + * # Python >= 2.5 uses new style class exceptions + * super(_XMLSyntaxError, self).__init__(message) + */ + __pyx_t_1 = (PY_VERSION_HEX >= 0x02050000); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":26 + * if python.PY_VERSION_HEX >= 0x02050000: + * # Python >= 2.5 uses new style class exceptions + * super(_XMLSyntaxError, self).__init__(message) # <<<<<<<<<<<<<< + * else: + * ParseError.__init__(self, message) + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_4lxml_5etree__XMLSyntaxError); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XMLSyntaxError); + __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XMLSyntaxError); + __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[2]; __pyx_lineno = 26; __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_kp___init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __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[2]; __pyx_lineno = 26; __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[2]; __pyx_lineno = 26; __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-2.2/src/lxml/parser.pxi":28 + * super(_XMLSyntaxError, self).__init__(message) + * else: + * ParseError.__init__(self, message) # <<<<<<<<<<<<<< + * self.position = (line, column) + * self.code = code + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp___init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __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[2]; __pyx_lineno = 28; __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-2.2/src/lxml/parser.pxi":29 + * else: + * ParseError.__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[2]; __pyx_lineno = 29; __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_kp_position, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":30 + * ParseError.__init__(self, message) + * self.position = (line, column) + * self.code = code # <<<<<<<<<<<<<< + * + * cdef object _XMLSyntaxError + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_code, __pyx_v_code) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree.XMLSyntaxError.__init__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":54 + * cdef list _implied_parser_contexts + * + * def __init__(self): # <<<<<<<<<<<<<< + * self._implied_parser_contexts = [] + * + */ + +static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/parser.pxi":55 + * + * def __init__(self): + * self._implied_parser_contexts = [] # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __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__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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":57 + * 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___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":58 + * + * 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-2.2/src/lxml/parser.pxi":59 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":61 + * 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_SetupRefcountContext("initMainParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":66 + * cdef python.PyObject* thread_dict + * cdef python.PyObject* result + * thread_dict = python.PyThreadState_GetDict() # <<<<<<<<<<<<<< + * if thread_dict is not NULL: + * (thread_dict)[u"_ParserDictionaryContext"] = self + */ + __pyx_v_thread_dict = PyThreadState_GetDict(); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":67 + * cdef python.PyObject* result + * thread_dict = python.PyThreadState_GetDict() + * if thread_dict is not NULL: # <<<<<<<<<<<<<< + * (thread_dict)[u"_ParserDictionaryContext"] = self + * + */ + __pyx_t_1 = (__pyx_v_thread_dict != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":68 + * thread_dict = python.PyThreadState_GetDict() + * if thread_dict is not NULL: + * (thread_dict)[u"_ParserDictionaryContext"] = self # <<<<<<<<<<<<<< + * + * cdef _ParserDictionaryContext _findThreadParserContext(self): + */ + if (PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), ((PyObject *)__pyx_kp_426), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":70 + * (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_SetupRefcountContext("_findThreadParserContext"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_d = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":75 + * 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-2.2/src/lxml/parser.pxi":76 + * cdef _ParserDictionaryContext context + * thread_dict = python.PyThreadState_GetDict() + * if thread_dict is NULL: # <<<<<<<<<<<<<< + * return self + * d = thread_dict + */ + __pyx_t_1 = (__pyx_v_thread_dict == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":77 + * thread_dict = python.PyThreadState_GetDict() + * if thread_dict is NULL: + * return self # <<<<<<<<<<<<<< + * d = 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-2.2/src/lxml/parser.pxi":78 + * if thread_dict is NULL: + * return self + * d = thread_dict # <<<<<<<<<<<<<< + * result = python.PyDict_GetItem(d, u"_ParserDictionaryContext") + * if result is not NULL: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_thread_dict)); + __Pyx_DECREF(__pyx_v_d); + __pyx_v_d = ((PyObject *)__pyx_v_thread_dict); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":79 + * return self + * d = thread_dict + * result = python.PyDict_GetItem(d, u"_ParserDictionaryContext") # <<<<<<<<<<<<<< + * if result is not NULL: + * return result + */ + __pyx_v_result = PyDict_GetItem(__pyx_v_d, ((PyObject *)__pyx_kp_427)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":80 + * d = thread_dict + * result = python.PyDict_GetItem(d, u"_ParserDictionaryContext") + * if result is not NULL: # <<<<<<<<<<<<<< + * return result + * context = _ParserDictionaryContext() + */ + __pyx_t_1 = (__pyx_v_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":81 + * result = python.PyDict_GetItem(d, u"_ParserDictionaryContext") + * if result is not NULL: + * return result # <<<<<<<<<<<<<< + * context = _ParserDictionaryContext() + * d[u"_ParserDictionaryContext"] = context + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_4lxml_5etree__ParserDictionaryContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __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-2.2/src/lxml/parser.pxi":82 + * if result is not NULL: + * return 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[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ParserDictionaryContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/parser.pxi":83 + * return result + * context = _ParserDictionaryContext() + * d[u"_ParserDictionaryContext"] = context # <<<<<<<<<<<<<< + * return context + * + */ + if (PyObject_SetItem(__pyx_v_d, ((PyObject *)__pyx_kp_428), ((PyObject *)__pyx_v_context)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":84 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":86 + * 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_SetupRefcountContext("setDefaultParser"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":89 + * 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[2]; __pyx_lineno = 89; __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-2.2/src/lxml/parser.pxi":90 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":92 + * 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_SetupRefcountContext("getDefaultParser"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":95 + * 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[2]; __pyx_lineno = 95; __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-2.2/src/lxml/parser.pxi":96 + * 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-2.2/src/lxml/parser.pxi":97 + * 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-2.2/src/lxml/parser.pxi":98 + * 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[2]; __pyx_lineno = 98; __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-2.2/src/lxml/parser.pxi":99 + * 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-2.2/src/lxml/parser.pxi":100 + * 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[2]; __pyx_lineno = 100; __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-2.2/src/lxml/parser.pxi":101 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":103 + * 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_SetupRefcountContext("_getThreadDict"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":106 + * 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[2]; __pyx_lineno = 106; __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-2.2/src/lxml/parser.pxi":107 + * 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-2.2/src/lxml/parser.pxi":109 + * 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-2.2/src/lxml/parser.pxi":110 + * # 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-2.2/src/lxml/parser.pxi":111 + * 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-2.2/src/lxml/parser.pxi":112 + * 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-2.2/src/lxml/parser.pxi":113 + * 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-2.2/src/lxml/parser.pxi":114 + * 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-2.2/src/lxml/parser.pxi":115 + * 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-2.2/src/lxml/parser.pxi":116 + * 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-2.2/src/lxml/parser.pxi":117 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":119 + * 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_SetupRefcountContext("initThreadDictRef"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":122 + * 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-2.2/src/lxml/parser.pxi":123 + * 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-2.2/src/lxml/parser.pxi":124 + * 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-2.2/src/lxml/parser.pxi":125 + * 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-2.2/src/lxml/parser.pxi":126 + * 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-2.2/src/lxml/parser.pxi":127 + * 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-2.2/src/lxml/parser.pxi":128 + * 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-2.2/src/lxml/parser.pxi":129 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":131 + * 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_SetupRefcountContext("initParserDict"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":133 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":135 + * 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_SetupRefcountContext("initXPathParserDict"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":137 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":139 + * 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_SetupRefcountContext("initDocDict"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":144 + * # 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":146 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/parser.pxi":156 + * + * # 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[2]; __pyx_lineno = 156; __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-2.2/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] + * return implied_context + */ + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_context->_implied_parser_contexts)); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":158 + * 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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_context->_implied_parser_contexts), -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4lxml_5etree__ParserContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __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_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":159 + * 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-2.2/src/lxml/parser.pxi":160 + * 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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":162 + * 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_SetupRefcountContext("pushImpliedContextFromParser"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":164 + * 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-2.2/src/lxml/parser.pxi":165 + * 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[2]; __pyx_lineno = 165; __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-2.2/src/lxml/parser.pxi":167 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":169 + * 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_SetupRefcountContext("pushImpliedContext"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":172 + * 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[2]; __pyx_lineno = 172; __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-2.2/src/lxml/parser.pxi":173 + * cdef _ParserDictionaryContext context + * context = self._findThreadParserContext() + * context._implied_parser_contexts.append(parser_context) # <<<<<<<<<<<<<< + * + * cdef void popImpliedContext(self): + */ + __pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_context->_implied_parser_contexts), ((PyObject *)__pyx_v_parser_context)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":175 + * 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; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("popImpliedContext"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":178 + * 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[2]; __pyx_lineno = 178; __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-2.2/src/lxml/parser.pxi":179 + * cdef _ParserDictionaryContext context + * context = self._findThreadParserContext() + * context._implied_parser_contexts.pop() # <<<<<<<<<<<<<< + * + * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_implied_parser_contexts), __pyx_kp_pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __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 = 179; __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_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.popImpliedContext"); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":185 + * __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_SetupRefcountContext("_checkThreadDict"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":191 + * #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-2.2/src/lxml/parser.pxi":192 + * # 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-2.2/src/lxml/parser.pxi":193 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":203 + * _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; + __Pyx_SetupRefcountContext("_setupPythonUnicode"); + __pyx_v_utext = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":213 + * cdef char* buffer + * cdef char* enc + * utext = python.PyUnicode_DecodeUTF8("", 7, NULL) # <<<<<<<<<<<<<< + * l = python.PyUnicode_GET_DATA_SIZE(utext) + * buffer = python.PyUnicode_AS_DATA(utext) + */ + __pyx_t_1 = PyUnicode_DecodeUTF8(__pyx_k_429, 7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_utext); + __pyx_v_utext = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":214 + * cdef char* enc + * utext = python.PyUnicode_DecodeUTF8("", 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(__pyx_v_utext); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":215 + * utext = python.PyUnicode_DecodeUTF8("", 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(__pyx_v_utext); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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': + */ + if ((__pyx_v_l >= 4)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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" + */ + if (((__pyx_v_buffer[0]) == '<')) { + if (((__pyx_v_buffer[1]) == '\x00')) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 \ + */ + if (((__pyx_v_buffer[2]) == 't')) { + __pyx_t_2 = ((__pyx_v_buffer[3]) == '\x00'); + } else { + __pyx_t_2 = ((__pyx_v_buffer[2]) == 't'); + } + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = ((__pyx_v_buffer[1]) == '\x00'); + } + __pyx_t_2 = __pyx_t_3; + } else { + __pyx_t_2 = ((__pyx_v_buffer[0]) == '<'); + } + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = (__pyx_v_l >= 4); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_430; + goto __pyx_L4; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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': + */ + if ((__pyx_v_l >= 4)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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" + */ + if (((__pyx_v_buffer[0]) == '\x00')) { + if (((__pyx_v_buffer[1]) == '<')) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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: + */ + if (((__pyx_v_buffer[2]) == '\x00')) { + __pyx_t_3 = ((__pyx_v_buffer[3]) == 't'); + } else { + __pyx_t_3 = ((__pyx_v_buffer[2]) == '\x00'); + } + __pyx_t_2 = __pyx_t_3; + } else { + __pyx_t_2 = ((__pyx_v_buffer[1]) == '<'); + } + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = ((__pyx_v_buffer[0]) == '\x00'); + } + __pyx_t_2 = __pyx_t_3; + } else { + __pyx_t_2 = (__pyx_v_l >= 4); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_431; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_findEncodingName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_432; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_433; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_434; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_435; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/parser.pxi":249 + * return "UCS-4BE" + * elif enc == tree.XML_CHAR_ENCODING_NONE: + * return NULL # <<<<<<<<<<<<<< + * else: + * return tree.xmlGetCharEncodingName(enc) + */ + __pyx_r = NULL; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":251 + * return NULL + * else: + * return tree.xmlGetCharEncodingName(enc) # <<<<<<<<<<<<<< + * + * _setupPythonUnicode() + */ + __pyx_r = xmlGetCharEncodingName(__pyx_v_enc); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":267 + * cdef Py_ssize_t _bytes_read + * cdef char* _c_url + * def __init__(self, filelike, exc_context, url, encoding): # <<<<<<<<<<<<<< + * self._exc_context = exc_context + * self._filelike = filelike + */ + +static int __pyx_pf_4lxml_5etree_18_FileReaderContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_18_FileReaderContext___init__(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_kp_filelike,&__pyx_kp_exc_context,&__pyx_kp_url,&__pyx_kp_encoding,0}; + __Pyx_SetupRefcountContext("__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_kp_filelike); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_exc_context); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_url); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_encoding); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __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[2]; __pyx_lineno = 267; __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("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._FileReaderContext.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":268 + * cdef char* _c_url + * def __init__(self, filelike, exc_context, url, encoding): + * self._exc_context = exc_context # <<<<<<<<<<<<<< + * self._filelike = filelike + * self._encoding = encoding + */ + if (!(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __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-2.2/src/lxml/parser.pxi":269 + * def __init__(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-2.2/src/lxml/parser.pxi":270 + * 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-2.2/src/lxml/parser.pxi":271 + * 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-2.2/src/lxml/parser.pxi":272 + * 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-2.2/src/lxml/parser.pxi":274 + * 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[2]; __pyx_lineno = 274; __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-2.2/src/lxml/parser.pxi":275 + * else: + * url = _encodeFilename(url) + * self._c_url = _cstr(url) # <<<<<<<<<<<<<< + * self._url = url + * self._bytes = '' + */ + ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self)->_c_url = PyString_AS_STRING(__pyx_v_url); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":276 + * url = _encodeFilename(url) + * self._c_url = _cstr(url) + * self._url = url # <<<<<<<<<<<<<< + * self._bytes = '' + * 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-2.2/src/lxml/parser.pxi":277 + * self._c_url = _cstr(url) + * self._url = url + * self._bytes = '' # <<<<<<<<<<<<<< + * self._bytes_read = 0 + * + */ + __Pyx_INCREF(__pyx_kp_436); + __Pyx_GIVEREF(__pyx_kp_436); + __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 = __pyx_kp_436; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":278 + * self._url = url + * self._bytes = '' + * self._bytes_read = 0 # <<<<<<<<<<<<<< + * + * cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_url); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":280 + * self._bytes_read = 0 + * + * 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; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_createParserInputBuffer"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":283 + * 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-2.2/src/lxml/parser.pxi":284 + * 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_v_c_stream = PyFile_AsFile(__pyx_v_self->_filelike); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":285 + * c_buffer = xmlparser.xmlAllocParserInputBuffer(0) + * c_stream = python.PyFile_AsFile(self._filelike) + * if c_stream is NULL: # <<<<<<<<<<<<<< + * c_buffer.readcallback = _readFilelikeParser + * c_buffer.context = self + */ + __pyx_t_1 = (__pyx_v_c_stream == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":286 + * c_stream = python.PyFile_AsFile(self._filelike) + * if c_stream is NULL: + * c_buffer.readcallback = _readFilelikeParser # <<<<<<<<<<<<<< + * c_buffer.context = self + * else: + */ + __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFilelikeParser; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":287 + * if c_stream is NULL: + * c_buffer.readcallback = _readFilelikeParser + * c_buffer.context = 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-2.2/src/lxml/parser.pxi":289 + * c_buffer.context = 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-2.2/src/lxml/parser.pxi":290 + * 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-2.2/src/lxml/parser.pxi":291 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":293 + * 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_SetupRefcountContext("_createParserInput"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":296 + * 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-2.2/src/lxml/parser.pxi":297 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":299 + * 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_SetupRefcountContext("_readDtd"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":301 + * 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-2.2/src/lxml/parser.pxi":302 + * cdef xmlparser.xmlParserInputBuffer* c_buffer + * c_buffer = self._createParserInputBuffer() + * with nogil: # <<<<<<<<<<<<<< + * return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0) + * + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":303 + * 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; + } + /*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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":305 + * 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; + __Pyx_SetupRefcountContext("_readDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":313 + * 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-2.2/src/lxml/parser.pxi":314 + * + * 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-2.2/src/lxml/parser.pxi":316 + * c_encoding = NULL + * else: + * c_encoding = _cstr(self._encoding) # <<<<<<<<<<<<<< + * + * c_stream = python.PyFile_AsFile(self._filelike) + */ + __pyx_v_c_encoding = PyString_AS_STRING(__pyx_v_self->_encoding); + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":318 + * c_encoding = _cstr(self._encoding) + * + * c_stream = python.PyFile_AsFile(self._filelike) # <<<<<<<<<<<<<< + * if c_stream is NULL: + * c_read_callback = _readFilelikeParser + */ + __pyx_v_c_stream = PyFile_AsFile(__pyx_v_self->_filelike); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":319 + * + * c_stream = python.PyFile_AsFile(self._filelike) + * if c_stream is NULL: # <<<<<<<<<<<<<< + * c_read_callback = _readFilelikeParser + * c_callback_context = self + */ + __pyx_t_1 = (__pyx_v_c_stream == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":320 + * c_stream = python.PyFile_AsFile(self._filelike) + * if c_stream is NULL: + * c_read_callback = _readFilelikeParser # <<<<<<<<<<<<<< + * c_callback_context = self + * else: + */ + __pyx_v_c_read_callback = __pyx_f_4lxml_5etree__readFilelikeParser; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":321 + * if c_stream is NULL: + * c_read_callback = _readFilelikeParser + * c_callback_context = 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-2.2/src/lxml/parser.pxi":323 + * c_callback_context = 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-2.2/src/lxml/parser.pxi":324 + * 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-2.2/src/lxml/parser.pxi":326 + * c_callback_context = c_stream + * + * with nogil: # <<<<<<<<<<<<<< + * if ctxt.html: + * result = htmlparser.htmlCtxtReadIO( + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":327 + * + * with nogil: + * if ctxt.html: # <<<<<<<<<<<<<< + * result = htmlparser.htmlCtxtReadIO( + * ctxt, c_read_callback, NULL, c_callback_context, + */ + __pyx_t_1 = __pyx_v_ctxt->html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":330 + * 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-2.2/src/lxml/parser.pxi":331 + * 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-2.2/src/lxml/parser.pxi":332 + * 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-2.2/src/lxml/parser.pxi":333 + * 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-2.2/src/lxml/parser.pxi":334 + * 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-2.2/src/lxml/parser.pxi":338 + * result = xmlparser.xmlCtxtReadIO( + * ctxt, c_read_callback, NULL, c_callback_context, + * self._c_url, c_encoding, options) # <<<<<<<<<<<<<< + * + * 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:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":340 + * self._c_url, c_encoding, options) + * + * return result # <<<<<<<<<<<<<< + * + * cdef int copyToBuffer(self, char* c_buffer, int c_requested): + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":342 + * 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; + __Pyx_SetupRefcountContext("copyToBuffer"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":346 + * 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-2.2/src/lxml/parser.pxi":347 + * 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-2.2/src/lxml/parser.pxi":348 + * if self._bytes_read < 0: + * return 0 + * try: # <<<<<<<<<<<<<< + * c_byte_count = 0 + * byte_count = python.PyString_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-2.2/src/lxml/parser.pxi":349 + * return 0 + * try: + * c_byte_count = 0 # <<<<<<<<<<<<<< + * byte_count = python.PyString_GET_SIZE(self._bytes) + * remaining = byte_count - self._bytes_read + */ + __pyx_v_c_byte_count = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":350 + * try: + * c_byte_count = 0 + * byte_count = python.PyString_GET_SIZE(self._bytes) # <<<<<<<<<<<<<< + * remaining = byte_count - self._bytes_read + * while c_requested > remaining: + */ + __pyx_v_byte_count = PyString_GET_SIZE(__pyx_v_self->_bytes); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":351 + * c_byte_count = 0 + * byte_count = python.PyString_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-2.2/src/lxml/parser.pxi":352 + * byte_count = python.PyString_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-2.2/src/lxml/parser.pxi":353 + * 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_v_c_start = (PyString_AS_STRING(__pyx_v_self->_bytes) + __pyx_v_self->_bytes_read); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":354 + * 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-2.2/src/lxml/parser.pxi":355 + * 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_remaining; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":356 + * cstd.memcpy(c_buffer, c_start, remaining) + * c_byte_count += remaining + * c_buffer += remaining # <<<<<<<<<<<<<< + * c_requested -= remaining + * + */ + __pyx_v_c_buffer += __pyx_v_remaining; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":357 + * c_byte_count += remaining + * c_buffer += remaining + * c_requested -= remaining # <<<<<<<<<<<<<< + * + * self._bytes = self._filelike.read(c_requested) + */ + __pyx_v_c_requested -= __pyx_v_remaining; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":359 + * c_requested -= remaining + * + * self._bytes = self._filelike.read(c_requested) # <<<<<<<<<<<<<< + * if not python.PyString_Check(self._bytes): + * if python.PyUnicode_Check(self._bytes): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_filelike, __pyx_kp_read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 359; __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[2]; __pyx_lineno = 359; __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[2]; __pyx_lineno = 359; __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[2]; __pyx_lineno = 359; __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-2.2/src/lxml/parser.pxi":360 + * + * self._bytes = self._filelike.read(c_requested) + * if not python.PyString_Check(self._bytes): # <<<<<<<<<<<<<< + * if python.PyUnicode_Check(self._bytes): + * if self._encoding is None: + */ + __pyx_t_1 = (!PyString_Check(__pyx_v_self->_bytes)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":361 + * self._bytes = self._filelike.read(c_requested) + * if not python.PyString_Check(self._bytes): + * if python.PyUnicode_Check(self._bytes): # <<<<<<<<<<<<<< + * if self._encoding is None: + * self._bytes = python.PyUnicode_AsUTF8String(self._bytes) + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_self->_bytes); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":362 + * if not python.PyString_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-2.2/src/lxml/parser.pxi":363 + * 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 = PyUnicode_AsUTF8String(__pyx_v_self->_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __Pyx_GOTREF(__pyx_t_3); + __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; + goto __pyx_L16; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":366 + * else: + * self._bytes = python.PyUnicode_AsEncodedString( + * self._bytes, _cstr(self._encoding), NULL) # <<<<<<<<<<<<<< + * else: + * raise TypeError, \ + */ + __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_self->_bytes, PyString_AS_STRING(__pyx_v_self->_encoding), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":365 + * self._bytes = python.PyUnicode_AsUTF8String(self._bytes) + * else: + * self._bytes = python.PyUnicode_AsEncodedString( # <<<<<<<<<<<<<< + * self._bytes, _cstr(self._encoding), NULL) + * else: + */ + __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; + } + __pyx_L16:; + goto __pyx_L15; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":369 + * else: + * raise TypeError, \ + * u"reading from file-like objects must return byte strings or unicode strings" # <<<<<<<<<<<<<< + * + * remaining = python.PyString_GET_SIZE(self._bytes) + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_437), 0); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":371 + * u"reading from file-like objects must return byte strings or unicode strings" + * + * remaining = python.PyString_GET_SIZE(self._bytes) # <<<<<<<<<<<<<< + * if remaining == 0: + * self._bytes_read = -1 + */ + __pyx_v_remaining = PyString_GET_SIZE(__pyx_v_self->_bytes); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":372 + * + * remaining = python.PyString_GET_SIZE(self._bytes) + * if remaining == 0: # <<<<<<<<<<<<<< + * self._bytes_read = -1 + * return c_byte_count + */ + __pyx_t_1 = (__pyx_v_remaining == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":373 + * remaining = python.PyString_GET_SIZE(self._bytes) + * if remaining == 0: + * self._bytes_read = -1 # <<<<<<<<<<<<<< + * return c_byte_count + * self._bytes_read = 0 + */ + __pyx_v_self->_bytes_read = -1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":374 + * if remaining == 0: + * self._bytes_read = -1 + * 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-2.2/src/lxml/parser.pxi":375 + * self._bytes_read = -1 + * return c_byte_count + * self._bytes_read = 0 # <<<<<<<<<<<<<< + * + * if c_requested > 0: + */ + __pyx_v_self->_bytes_read = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":377 + * 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-2.2/src/lxml/parser.pxi":378 + * + * 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_v_c_start = (PyString_AS_STRING(__pyx_v_self->_bytes) + __pyx_v_self->_bytes_read); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":379 + * 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-2.2/src/lxml/parser.pxi":380 + * 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_requested; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":381 + * 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_c_requested; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":382 + * 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_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_L0; + __pyx_L4_error:; + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":383 + * self._bytes_read += c_requested + * return c_byte_count + * except: # <<<<<<<<<<<<<< + * self._exc_context._store_raised() + * return -1 + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree.copyToBuffer"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":384 + * return c_byte_count + * 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-2.2/src/lxml/parser.pxi":385 + * except: + * self._exc_context._store_raised() + * 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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L5_exception_handled; + } + __pyx_L6_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_WriteUnraisable("lxml.etree._FileReaderContext.copyToBuffer"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":387 + * 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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_readFilelikeParser"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":388 + * + * 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_FinishRefcountContext(); + PyGILState_Release(_save); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":390 + * 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, 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-2.2/src/lxml/parser.pxi":391 + * + * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil: + * return cstd.fread(c_buffer, 1, c_size, 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-2.2/src/lxml/parser.pxi":397 + * ############################################################ + * + * 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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/parser.pxi":406 + * # 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-2.2/src/lxml/parser.pxi":407 + * # 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-2.2/src/lxml/parser.pxi":409 + * 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[2]; __pyx_lineno = 409; __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-2.2/src/lxml/parser.pxi":411 + * 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-2.2/src/lxml/parser.pxi":412 + * + * 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-2.2/src/lxml/parser.pxi":413 + * 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-2.2/src/lxml/parser.pxi":414 + * 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-2.2/src/lxml/parser.pxi":416 + * 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-2.2/src/lxml/parser.pxi":417 + * + * 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-2.2/src/lxml/parser.pxi":418 + * 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-2.2/src/lxml/parser.pxi":421 + * 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[2]; __pyx_lineno = 421; __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-2.2/src/lxml/parser.pxi":422 + * # 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-2.2/src/lxml/parser.pxi":423 + * 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-2.2/src/lxml/parser.pxi":425 + * 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[2]; __pyx_lineno = 425; __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-2.2/src/lxml/parser.pxi":427 + * 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_kp_resolve); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 427; __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[2]; __pyx_lineno = 427; __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[2]; __pyx_lineno = 427; __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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__InputDocument))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 427; __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-2.2/src/lxml/parser.pxi":428 + * + * 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[2]; __pyx_lineno = 428; __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-2.2/src/lxml/parser.pxi":429 + * 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-2.2/src/lxml/parser.pxi":430 + * 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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/parser.pxi":432 + * 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-2.2/src/lxml/parser.pxi":433 + * + * 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-2.2/src/lxml/parser.pxi":434 + * 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-2.2/src/lxml/parser.pxi":435 + * 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-2.2/src/lxml/parser.pxi":436 + * 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.PyString_GET_SIZE(data) + */ + __pyx_t_1 = (__pyx_v_c_input != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":437 + * c_input = xmlparser.xmlNewInputStream(c_context) + * if c_input is not NULL: + * c_input.base = _cstr(data) # <<<<<<<<<<<<<< + * c_input.length = python.PyString_GET_SIZE(data) + * c_input.cur = c_input.base + */ + __pyx_v_c_input->base = PyString_AS_STRING(__pyx_v_data); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":438 + * if c_input is not NULL: + * c_input.base = _cstr(data) + * c_input.length = python.PyString_GET_SIZE(data) # <<<<<<<<<<<<<< + * c_input.cur = c_input.base + * c_input.end = &c_input.base[c_input.length] + */ + __pyx_v_c_input->length = PyString_GET_SIZE(__pyx_v_data); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":439 + * c_input.base = _cstr(data) + * c_input.length = python.PyString_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-2.2/src/lxml/parser.pxi":440 + * c_input.length = python.PyString_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-2.2/src/lxml/parser.pxi":441 + * 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-2.2/src/lxml/parser.pxi":443 + * 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_v_c_input = xmlNewInputFromFile(__pyx_v_c_context, PyString_AS_STRING(__pyx_v_doc_ref->_filename)); + goto __pyx_L19; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":444 + * 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-2.2/src/lxml/parser.pxi":445 + * 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[2]; __pyx_lineno = 445; __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[2]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__FileReaderContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/parser.pxi":446 + * 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-2.2/src/lxml/parser.pxi":447 + * 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-2.2/src/lxml/parser.pxi":449 + * 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-2.2/src/lxml/parser.pxi":450 + * else: + * data = None + * c_input = NULL # <<<<<<<<<<<<<< + * + * if data is not None: + */ + __pyx_v_c_input = NULL; + } + __pyx_L19:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":452 + * 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-2.2/src/lxml/parser.pxi":453 + * + * 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[2]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L21; + } + __pyx_L21:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":454 + * 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-2.2/src/lxml/parser.pxi":455 + * 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-2.2/src/lxml/parser.pxi":457 + * 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-2.2/src/lxml/parser.pxi":458 + * + * 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-2.2/src/lxml/parser.pxi":459 + * 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_FinishRefcountContext(); + PyGILState_Release(_save); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":476 + * cdef python.PyThread_type_lock _lock + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self._validator is not None: + * self._validator.disconnect() + */ + +static void __pyx_pf_4lxml_5etree_14_ParserContext___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_14_ParserContext___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":477 + * + * 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-2.2/src/lxml/parser.pxi":478 + * 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-2.2/src/lxml/parser.pxi":479 + * 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-2.2/src/lxml/parser.pxi":480 + * 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-2.2/src/lxml/parser.pxi":481 + * 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-2.2/src/lxml/parser.pxi":482 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":484 + * 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_SetupRefcountContext("_copy"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":486 + * 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_kp___class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 486; __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 = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ParserContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 486; __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-2.2/src/lxml/parser.pxi":487 + * 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[2]; __pyx_lineno = 487; __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-2.2/src/lxml/parser.pxi":488 + * 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[2]; __pyx_lineno = 488; __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[2]; __pyx_lineno = 488; __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-2.2/src/lxml/parser.pxi":489 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":491 + * return context + * + * cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt): # <<<<<<<<<<<<<< + * self._c_ctxt = c_ctxt + * c_ctxt._private = 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_SetupRefcountContext("_initParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":492 + * + * cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt): + * self._c_ctxt = c_ctxt # <<<<<<<<<<<<<< + * c_ctxt._private = self + * + */ + __pyx_v_self->_c_ctxt = __pyx_v_c_ctxt; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":493 + * cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt): + * self._c_ctxt = c_ctxt + * c_ctxt._private = self # <<<<<<<<<<<<<< + * + * cdef void _resetParserContext(self): + */ + __pyx_v_c_ctxt->_private = ((void *)__pyx_v_self); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":495 + * c_ctxt._private = 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; + __Pyx_SetupRefcountContext("_resetParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":496 + * + * 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-2.2/src/lxml/parser.pxi":497 + * cdef void _resetParserContext(self): + * if self._c_ctxt is not NULL: + * if self._c_ctxt.html: # <<<<<<<<<<<<<< + * htmlparser.htmlCtxtReset(self._c_ctxt) + * elif self._c_ctxt.spaceTab is not NULL or \ + */ + __pyx_t_1 = __pyx_v_self->_c_ctxt->html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":498 + * if self._c_ctxt is not NULL: + * if self._c_ctxt.html: + * htmlparser.htmlCtxtReset(self._c_ctxt) # <<<<<<<<<<<<<< + * elif self._c_ctxt.spaceTab is not NULL or \ + * _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2 + */ + htmlCtxtReset(__pyx_v_self->_c_ctxt); + goto __pyx_L4; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":499 + * if self._c_ctxt.html: + * htmlparser.htmlCtxtReset(self._c_ctxt) + * elif self._c_ctxt.spaceTab is not NULL or \ # <<<<<<<<<<<<<< + * _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2 + * xmlparser.xmlClearParserCtxt(self._c_ctxt) + */ + if (!(__pyx_v_self->_c_ctxt->spaceTab != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":500 + * htmlparser.htmlCtxtReset(self._c_ctxt) + * 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_4lxml_5etree__LIBXML_VERSION_INT >= 20629); + } else { + __pyx_t_1 = (__pyx_v_self->_c_ctxt->spaceTab != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":501 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":503 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("prepare"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":505 + * 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); + } else { + __pyx_t_1 = ENABLE_THREADING; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":506 + * 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) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":508 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":509 + * 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_1 = (__pyx_v_result == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":510 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ParserError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_438), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":511 + * 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-2.2/src/lxml/parser.pxi":512 + * 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_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":513 + * self._error_log.connect() + * if self._validator is not None: + * self._validator.connect(self._c_ctxt) # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_2 = ((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_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":514 + * 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_1); + __Pyx_AddTraceback("lxml.etree._ParserContext.prepare"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":516 + * 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; + __Pyx_SetupRefcountContext("cleanup"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":517 + * + * 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-2.2/src/lxml/parser.pxi":518 + * 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-2.2/src/lxml/parser.pxi":519 + * 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-2.2/src/lxml/parser.pxi":520 + * 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-2.2/src/lxml/parser.pxi":521 + * 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-2.2/src/lxml/parser.pxi":522 + * 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); + } else { + __pyx_t_1 = ENABLE_THREADING; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":523 + * 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-2.2/src/lxml/parser.pxi":524 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":526 + * 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_SetupRefcountContext("_handleParseResult"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":530 + * 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-2.2/src/lxml/parser.pxi":532 + * 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[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":533 + * 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[2]; __pyx_lineno = 533; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":535 + * 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_SetupRefcountContext("_handleParseResultDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":538 + * 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-2.2/src/lxml/parser.pxi":540 + * 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[2]; __pyx_lineno = 539; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":542 + * 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_SetupRefcountContext("_initParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":545 + * _ResolverRegistry resolvers, + * xmlparser.xmlParserCtxt* c_ctxt): + * _initResolverContext(context, resolvers) # <<<<<<<<<<<<<< + * if not config.ENABLE_THREADING: + * context._lock = NULL + */ + __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[2]; __pyx_lineno = 545; __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-2.2/src/lxml/parser.pxi":546 + * xmlparser.xmlParserCtxt* c_ctxt): + * _initResolverContext(context, resolvers) + * if not config.ENABLE_THREADING: # <<<<<<<<<<<<<< + * context._lock = NULL + * else: + */ + __pyx_t_2 = (!ENABLE_THREADING); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":547 + * _initResolverContext(context, resolvers) + * if not config.ENABLE_THREADING: + * context._lock = NULL # <<<<<<<<<<<<<< + * else: + * context._lock = python.PyThread_allocate_lock() + */ + __pyx_v_context->_lock = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":549 + * context._lock = NULL + * else: + * context._lock = python.PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if c_ctxt is not NULL: + * context._initParserContext(c_ctxt) + */ + __pyx_v_context->_lock = PyThread_allocate_lock(); + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":550 + * else: + * context._lock = python.PyThread_allocate_lock() + * if c_ctxt is not NULL: # <<<<<<<<<<<<<< + * context._initParserContext(c_ctxt) + * context._error_log = _ErrorLog() + */ + __pyx_t_2 = (__pyx_v_c_ctxt != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":551 + * context._lock = python.PyThread_allocate_lock() + * if c_ctxt is not NULL: + * context._initParserContext(c_ctxt) # <<<<<<<<<<<<<< + * context._error_log = _ErrorLog() + * + */ + ((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_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":552 + * if c_ctxt is not NULL: + * context._initParserContext(c_ctxt) + * context._error_log = _ErrorLog() # <<<<<<<<<<<<<< + * + * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename, + */ + __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[2]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_context->_error_log); + __Pyx_DECREF(((PyObject *)__pyx_v_context->_error_log)); + __pyx_v_context->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__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._initParserContext"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":554 + * context._error_log = _ErrorLog() + * + * 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; + PyObject *__pyx_v_code; + PyObject *__pyx_v_line; + PyObject *__pyx_v_column; + int __pyx_r; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_raiseParseError"); + __pyx_v_message = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_code = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_line = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_column = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":556 + * 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-2.2/src/lxml/parser.pxi":557 + * _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); + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":558 + * 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_2 = (__pyx_v_ctxt->lastError.message != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":560 + * 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_3 = __Pyx_PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __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_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + 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_439), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __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_message); + __pyx_v_message = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":562 + * filename, (ctxt.lastError.message).strip()) + * else: + * message = u"Error reading '%s'" % filename # <<<<<<<<<<<<<< + * raise IOError, message + * elif error_log: + */ + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_440), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __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; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":563 + * 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[2]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":564 + * 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_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_error_log)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":566 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = ((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_1, ((PyObject *)__pyx_kp_441)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":567 + * 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_2 = (__pyx_v_ctxt->lastError.message != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":568 + * 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_3 = __Pyx_PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 568; __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_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 568; __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_message); + __pyx_v_message = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":569 + * 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_t_3 = PyInt_FromLong(__pyx_v_ctxt->lastError.code); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_code); + __pyx_v_code = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":570 + * message = (ctxt.lastError.message).strip() + * code = ctxt.lastError.code + * line = ctxt.lastError.line # <<<<<<<<<<<<<< + * column = ctxt.lastError.int2 + * if ctxt.lastError.line > 0: + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_ctxt->lastError.line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":571 + * 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_t_3 = PyInt_FromLong(__pyx_v_ctxt->lastError.int2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_column); + __pyx_v_column = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":572 + * 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_2 = (__pyx_v_ctxt->lastError.line > 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":573 + * 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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_message); + __Pyx_GIVEREF(__pyx_v_message); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_442), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 573; __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_message); + __pyx_v_message = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":574 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 574; __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); + __Pyx_INCREF(__pyx_v_code); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_code); + __Pyx_GIVEREF(__pyx_v_code); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_column); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_column); + __Pyx_GIVEREF(__pyx_v_column); + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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[2]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":576 + * raise XMLSyntaxError(message, code, line, column) + * else: + * raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0) # <<<<<<<<<<<<<< + * + * cdef xmlDoc* _handleParseResult(_ParserContext context, + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __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[2]; __pyx_lineno = 576; __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_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_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree._raiseParseError"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_message); + __Pyx_DECREF(__pyx_v_code); + __Pyx_DECREF(__pyx_v_line); + __Pyx_DECREF(__pyx_v_column); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":578 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + 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; + int __pyx_t_9; + __Pyx_SetupRefcountContext("_handleParseResult"); + __pyx_v_error = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":583 + * 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-2.2/src/lxml/parser.pxi":584 + * 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-2.2/src/lxml/parser.pxi":586 + * __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-2.2/src/lxml/parser.pxi":587 + * + * 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-2.2/src/lxml/parser.pxi":588 + * 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-2.2/src/lxml/parser.pxi":589 + * 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-2.2/src/lxml/parser.pxi":590 + * __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-2.2/src/lxml/parser.pxi":592 + * 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-2.2/src/lxml/parser.pxi":593 + * + * 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-2.2/src/lxml/parser.pxi":594 + * 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)); + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":595 + * 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-2.2/src/lxml/parser.pxi":596 + * 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-2.2/src/lxml/parser.pxi":597 + * 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_2 = (__pyx_v_c_ctxt->lastError.level < XML_ERR_ERROR); + } else { + __pyx_t_2 = __pyx_v_c_ctxt->wellFormed; + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = __pyx_v_recover; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":598 + * 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-2.2/src/lxml/parser.pxi":599 + * 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 + */ + if ((!__pyx_v_c_ctxt->replaceEntities)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":600 + * 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(): + */ + if ((!__pyx_v_c_ctxt->validate)) { + __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (!__pyx_v_c_ctxt->validate); + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = (!__pyx_v_c_ctxt->replaceEntities); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":602 + * 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_4 = PyObject_GetAttr(((PyObject *)__pyx_v_context->_error_log), __pyx_kp_filter_from_errors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __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 = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_3 = 0; __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + 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[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_error); + __pyx_v_error = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":603 + * # 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_5 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_type); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_6 = PyObject_GetAttr(__pyx_1, __pyx_kp_443); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":604 + * 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_7 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_type); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_6 = PyObject_GetAttr(__pyx_1, __pyx_kp_444); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __pyx_t_2; + } else { + __pyx_t_8 = __pyx_t_1; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":605 + * 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-2.2/src/lxml/parser.pxi":606 + * 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-2.2/src/lxml/parser.pxi":608 + * break + * else: + * well_formed = 1 # <<<<<<<<<<<<<< + * else: + * well_formed = 0 + */ + __pyx_v_well_formed = 1; + } + __pyx_L9_break:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":610 + * well_formed = 1 + * else: + * well_formed = 0 # <<<<<<<<<<<<<< + * + * if not well_formed: + */ + __pyx_v_well_formed = 0; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":612 + * well_formed = 0 + * + * if not well_formed: # <<<<<<<<<<<<<< + * # free broken document + * tree.xmlFreeDoc(result) + */ + __pyx_t_8 = (!__pyx_v_well_formed); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":614 + * if not well_formed: + * # free broken document + * tree.xmlFreeDoc(result) # <<<<<<<<<<<<<< + * result = NULL + * + */ + xmlFreeDoc(__pyx_v_result); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":615 + * # free broken document + * tree.xmlFreeDoc(result) + * result = NULL # <<<<<<<<<<<<<< + * + * if context is not None and context._has_raised(): + */ + __pyx_v_result = NULL; + goto __pyx_L11; + } + __pyx_L11:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":617 + * result = NULL + * + * if context is not None and context._has_raised(): # <<<<<<<<<<<<<< + * if result is not NULL: + * tree.xmlFreeDoc(result) + */ + __pyx_t_8 = (((PyObject *)__pyx_v_context) != Py_None); + if (__pyx_t_8) { + __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)); + } else { + __pyx_t_1 = __pyx_t_8; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":618 + * + * if context is not None and context._has_raised(): + * if result is not NULL: # <<<<<<<<<<<<<< + * tree.xmlFreeDoc(result) + * result = NULL + */ + __pyx_t_1 = (__pyx_v_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":619 + * 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-2.2/src/lxml/parser.pxi":620 + * if result is not NULL: + * tree.xmlFreeDoc(result) + * result = NULL # <<<<<<<<<<<<<< + * context._raise_if_stored() + * + */ + __pyx_v_result = NULL; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":621 + * tree.xmlFreeDoc(result) + * result = NULL + * context._raise_if_stored() # <<<<<<<<<<<<<< + * + * if result is NULL: + */ + __pyx_t_9 = ((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_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":623 + * context._raise_if_stored() + * + * if result is NULL: # <<<<<<<<<<<<<< + * if context is not None: + * _raiseParseError(c_ctxt, filename, context._error_log) + */ + __pyx_t_1 = (__pyx_v_result == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":624 + * + * if result is NULL: + * if context is not None: # <<<<<<<<<<<<<< + * _raiseParseError(c_ctxt, filename, context._error_log) + * else: + */ + __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":625 + * if result is NULL: + * if context is not None: + * _raiseParseError(c_ctxt, filename, context._error_log) # <<<<<<<<<<<<<< + * else: + * _raiseParseError(c_ctxt, filename, None) + */ + __pyx_t_9 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, __pyx_v_context->_error_log); if (unlikely(__pyx_t_9 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L15; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":627 + * _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_9 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None)); if (unlikely(__pyx_t_9 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L15:; + goto __pyx_L14; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":629 + * _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: + */ + if ((__pyx_v_result->URL == NULL)) { + __pyx_t_1 = (__pyx_v_filename != Py_None); + __pyx_t_8 = __pyx_t_1; + } else { + __pyx_t_8 = (__pyx_v_result->URL == NULL); + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":630 + * 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(PyString_AS_STRING(__pyx_v_filename)); + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":631 + * 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_8 = (__pyx_v_result->encoding == NULL); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":632 + * 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_445); + goto __pyx_L17; + } + __pyx_L17:; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":634 + * 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_8 = (((PyObject *)__pyx_v_context->_validator) != Py_None); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":635 + * + * 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_1 = __pyx_v_context->_validator->_add_default_attributes; + } else { + __pyx_t_1 = __pyx_t_8; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":639 + * # 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_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":641 + * 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_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._handleParseResult"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_error); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":643 + * 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-2.2/src/lxml/parser.pxi":645 + * 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-2.2/src/lxml/parser.pxi":646 + * cdef xmlNode* c_node + * if c_doc is NULL: + * return 0 # <<<<<<<<<<<<<< + * c_node = c_doc.children + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_doc, c_node, 0) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":647 + * if c_doc is NULL: + * return 0 + * c_node = c_doc.children # <<<<<<<<<<<<<< + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(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-2.2/src/lxml/parser.pxi":648 + * return 0 + * c_node = c_doc.children + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(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-2.2/src/lxml/parser.pxi":649 + * c_node = c_doc.children + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(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-2.2/src/lxml/parser.pxi":650 + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(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-2.2/src/lxml/parser.pxi":651 + * 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-2.2/src/lxml/parser.pxi":652 + * 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-2.2/src/lxml/parser.pxi":653 + * 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-2.2/src/lxml/parser.pxi":655 + * return 0 + * + * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict, # <<<<<<<<<<<<<< + * xmlNode* c_node) nogil: + * cdef xmlNode* c_attr + */ + +static 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-2.2/src/lxml/parser.pxi":659 + * 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-2.2/src/lxml/parser.pxi":660 + * 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-2.2/src/lxml/parser.pxi":661 + * 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-2.2/src/lxml/parser.pxi":662 + * 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-2.2/src/lxml/parser.pxi":663 + * return -1 + * if c_name is not c_node.name: + * tree.xmlFree(c_node.name) # <<<<<<<<<<<<<< + * c_node.name = c_name + * c_attr = c_node.properties + */ + xmlFree(__pyx_v_c_node->name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":664 + * if c_name is not c_node.name: + * tree.xmlFree(c_node.name) + * c_node.name = c_name # <<<<<<<<<<<<<< + * c_attr = 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-2.2/src/lxml/parser.pxi":665 + * tree.xmlFree(c_node.name) + * c_node.name = c_name + * c_attr = 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-2.2/src/lxml/parser.pxi":666 + * c_node.name = c_name + * c_attr = 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-2.2/src/lxml/parser.pxi":667 + * c_attr = 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-2.2/src/lxml/parser.pxi":668 + * 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-2.2/src/lxml/parser.pxi":669 + * 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-2.2/src/lxml/parser.pxi":670 + * 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-2.2/src/lxml/parser.pxi":671 + * 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-2.2/src/lxml/parser.pxi":672 + * 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-2.2/src/lxml/parser.pxi":673 + * 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-2.2/src/lxml/parser.pxi":674 + * 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-2.2/src/lxml/parser.pxi":691 + * 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_kp_parse_options,&__pyx_kp_for_html,&__pyx_kp_schema,&__pyx_kp_remove_comments,&__pyx_kp_remove_pis,&__pyx_kp_strip_cdata,&__pyx_kp_target,&__pyx_kp_filename,&__pyx_kp_encoding,0}; + __Pyx_SetupRefcountContext("__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_kp_parse_options); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_for_html); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_schema); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_comments); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_pis); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_strip_cdata); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 5); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_kp_target); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 6); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_kp_filename); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 7); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_kp_encoding); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 8); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __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[2]; __pyx_lineno = 691; __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[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_for_html = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_for_html == (int)-1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __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[2]; __pyx_lineno = 691; __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))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 691; __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[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._BaseParser.__init__"); + 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[2]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":696 + * 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 = PyObject_TypeCheck(__pyx_v_self, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser))); + if ((!__pyx_t_1)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":697 + * 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_2 = PyObject_TypeCheck(__pyx_v_self, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser))); + if ((!__pyx_t_2)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":698 + * 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_3 = PyObject_TypeCheck(__pyx_v_self, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_iterparse))); + __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-2.2/src/lxml/parser.pxi":699 + * 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_446), 0); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":701 + * 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-2.2/src/lxml/parser.pxi":702 + * + * 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-2.2/src/lxml/parser.pxi":703 + * 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-2.2/src/lxml/parser.pxi":704 + * 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-2.2/src/lxml/parser.pxi":705 + * 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_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_comments); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_remove_comments = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":706 + * 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_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_pis); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_remove_pis = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":707 + * self._remove_comments = remove_comments + * self._remove_pis = remove_pis + * self._strip_cdata = strip_cdata # <<<<<<<<<<<<<< + * self._schema = schema + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self)->_strip_cdata = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":708 + * 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-2.2/src/lxml/parser.pxi":710 + * 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[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__ResolverRegistry))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/parser.pxi":712 + * self._resolvers = _ResolverRegistry() + * + * if encoding is None: # <<<<<<<<<<<<<< + * self._default_encoding = None + * else: + */ + __pyx_t_2 = (__pyx_v_encoding == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":713 + * + * 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-2.2/src/lxml/parser.pxi":715 + * self._default_encoding = None + * else: + * encoding = _utf8(encoding) # <<<<<<<<<<<<<< + * enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding)) + * if enchandler is NULL: + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 715; __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-2.2/src/lxml/parser.pxi":716 + * else: + * encoding = _utf8(encoding) + * enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding)) # <<<<<<<<<<<<<< + * if enchandler is NULL: + * raise LookupError, u"unknown encoding: '%s'" % encoding + */ + __pyx_v_enchandler = xmlFindCharEncodingHandler(PyString_AS_STRING(__pyx_v_encoding)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":717 + * encoding = _utf8(encoding) + * enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding)) + * if enchandler is NULL: # <<<<<<<<<<<<<< + * raise LookupError, u"unknown encoding: '%s'" % encoding + * tree.xmlCharEncCloseFunc(enchandler) + */ + __pyx_t_2 = (__pyx_v_enchandler == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":718 + * 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_447), __pyx_v_encoding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_5, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":719 + * 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-2.2/src/lxml/parser.pxi":720 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":722 + * 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; + __Pyx_SetupRefcountContext("_getParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":724 + * 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-2.2/src/lxml/parser.pxi":725 + * 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 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_v_self->_target)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __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_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":726 + * 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-2.2/src/lxml/parser.pxi":729 + * self._parser_context._validator = \ + * self._schema._newSaxValidator( + * self._parse_options & xmlparser.XML_PARSE_DTDATTR) # <<<<<<<<<<<<<< + * pctxt = self._newParserCtxt() + * if pctxt is NULL: + */ + __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":727 + * 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_2); + __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_2); + __pyx_t_2 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":730 + * 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-2.2/src/lxml/parser.pxi":731 + * 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-2.2/src/lxml/parser.pxi":732 + * pctxt = self._newParserCtxt() + * if pctxt is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * _initParserContext(self._parser_context, self._resolvers, pctxt) + * if self._remove_comments: + */ + __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 732; __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-2.2/src/lxml/parser.pxi":733 + * if pctxt is NULL: + * python.PyErr_NoMemory() + * _initParserContext(self._parser_context, self._resolvers, pctxt) # <<<<<<<<<<<<<< + * if self._remove_comments: + * pctxt.sax.comment = NULL + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__initParserContext(__pyx_v_self->_parser_context, __pyx_v_self->_resolvers, __pyx_v_pctxt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 733; __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-2.2/src/lxml/parser.pxi":734 + * python.PyErr_NoMemory() + * _initParserContext(self._parser_context, self._resolvers, pctxt) + * if self._remove_comments: # <<<<<<<<<<<<<< + * pctxt.sax.comment = NULL + * if self._remove_pis: + */ + __pyx_t_1 = __pyx_v_self->_remove_comments; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":735 + * _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-2.2/src/lxml/parser.pxi":736 + * if self._remove_comments: + * pctxt.sax.comment = NULL + * if self._remove_pis: # <<<<<<<<<<<<<< + * pctxt.sax.processingInstruction = NULL + * if self._strip_cdata: + */ + __pyx_t_1 = __pyx_v_self->_remove_pis; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":737 + * 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-2.2/src/lxml/parser.pxi":738 + * 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 + */ + __pyx_t_1 = __pyx_v_self->_strip_cdata; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":740 + * 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-2.2/src/lxml/parser.pxi":741 + * # 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_AddTraceback("lxml.etree._BaseParser._getParserContext"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":743 + * 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; + __Pyx_SetupRefcountContext("_getPushParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":745 + * 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-2.2/src/lxml/parser.pxi":746 + * 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 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_v_self->_target)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __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_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":747 + * 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-2.2/src/lxml/parser.pxi":750 + * self._push_parser_context._validator = \ + * self._schema._newSaxValidator( + * self._parse_options & xmlparser.XML_PARSE_DTDATTR) # <<<<<<<<<<<<<< + * pctxt = self._newPushParserCtxt() + * if pctxt is NULL: + */ + __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":748 + * 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_2); + __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_2); + __pyx_t_2 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":751 + * 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-2.2/src/lxml/parser.pxi":752 + * 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-2.2/src/lxml/parser.pxi":753 + * pctxt = self._newPushParserCtxt() + * if pctxt is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * _initParserContext( + * self._push_parser_context, self._resolvers, pctxt) + */ + __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 753; __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-2.2/src/lxml/parser.pxi":755 + * python.PyErr_NoMemory() + * _initParserContext( + * self._push_parser_context, self._resolvers, pctxt) # <<<<<<<<<<<<<< + * if self._remove_comments: + * pctxt.sax.comment = NULL + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__initParserContext(__pyx_v_self->_push_parser_context, __pyx_v_self->_resolvers, __pyx_v_pctxt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 754; __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-2.2/src/lxml/parser.pxi":756 + * _initParserContext( + * self._push_parser_context, self._resolvers, pctxt) + * if self._remove_comments: # <<<<<<<<<<<<<< + * pctxt.sax.comment = NULL + * if self._remove_pis: + */ + __pyx_t_1 = __pyx_v_self->_remove_comments; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":757 + * 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-2.2/src/lxml/parser.pxi":758 + * if self._remove_comments: + * pctxt.sax.comment = NULL + * if self._remove_pis: # <<<<<<<<<<<<<< + * pctxt.sax.processingInstruction = NULL + * if self._strip_cdata: + */ + __pyx_t_1 = __pyx_v_self->_remove_pis; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":759 + * 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-2.2/src/lxml/parser.pxi":760 + * 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 + */ + __pyx_t_1 = __pyx_v_self->_strip_cdata; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":762 + * 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-2.2/src/lxml/parser.pxi":763 + * # 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_AddTraceback("lxml.etree._BaseParser._getPushParserContext"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":765 + * 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_SetupRefcountContext("_createContext"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":767 + * 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-2.2/src/lxml/parser.pxi":768 + * 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[2]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ParserContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/parser.pxi":769 + * 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[2]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__TargetParserContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/parser.pxi":770 + * 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[2]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":771 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":773 + * 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; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_newParserCtxt"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":774 + * + * cdef xmlparser.xmlParserCtxt* _newParserCtxt(self): + * if self._for_html: # <<<<<<<<<<<<<< + * return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5) + * else: + */ + __pyx_t_1 = __pyx_v_self->_for_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":775 + * cdef xmlparser.xmlParserCtxt* _newParserCtxt(self): + * if self._for_html: + * return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5) # <<<<<<<<<<<<<< + * else: + * return xmlparser.xmlNewParserCtxt() + */ + __pyx_r = htmlCreateMemoryParserCtxt(__pyx_k_448, 5); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":777 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":779 + * 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; + __Pyx_SetupRefcountContext("_newPushParserCtxt"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":782 + * 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-2.2/src/lxml/parser.pxi":783 + * cdef char* c_filename + * if self._filename is not None: + * c_filename = _cstr(self._filename) # <<<<<<<<<<<<<< + * else: + * c_filename = NULL + */ + __pyx_v_c_filename = PyString_AS_STRING(__pyx_v_self->_filename); + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":785 + * 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-2.2/src/lxml/parser.pxi":786 + * else: + * c_filename = NULL + * if self._for_html: # <<<<<<<<<<<<<< + * c_ctxt = htmlparser.htmlCreatePushParserCtxt( + * NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE) + */ + __pyx_t_1 = __pyx_v_self->_for_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":788 + * 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-2.2/src/lxml/parser.pxi":789 + * 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-2.2/src/lxml/parser.pxi":790 + * 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-2.2/src/lxml/parser.pxi":793 + * 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-2.2/src/lxml/parser.pxi":794 + * 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-2.2/src/lxml/parser.pxi":795 + * 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-2.2/src/lxml/parser.pxi":796 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":801 + * 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_SetupRefcountContext("__get__"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":803 + * 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[2]; __pyx_lineno = 803; __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-2.2/src/lxml/parser.pxi":804 + * 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_kp_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 804; __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 = 804; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":808 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":809 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":813 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":814 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LIBXML_VERSION); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_449), __pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._BaseParser.version.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":816 + * 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_setElementClassLookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_11_BaseParser_setElementClassLookup[] = ":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead."; +static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_setElementClassLookup(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_kp_lookup,0}; + __Pyx_SetupRefcountContext("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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_lookup); + if (unlikely(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[2]; __pyx_lineno = 816; __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[2]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._BaseParser.setElementClassLookup"); + 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[2]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":818 + * 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_kp_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 818; __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[2]; __pyx_lineno = 818; __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[2]; __pyx_lineno = 818; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":820 + * 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_set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_11_BaseParser_set_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_set_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_kp_lookup,0}; + __Pyx_SetupRefcountContext("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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_lookup); + if (unlikely(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[2]; __pyx_lineno = 820; __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[2]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._BaseParser.set_element_class_lookup"); + 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[2]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":827 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":829 + * 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_SetupRefcountContext("_copy"); + __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":832 + * 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_kp___class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseParser))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __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-2.2/src/lxml/parser.pxi":833 + * 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-2.2/src/lxml/parser.pxi":834 + * 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-2.2/src/lxml/parser.pxi":835 + * 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-2.2/src/lxml/parser.pxi":836 + * 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-2.2/src/lxml/parser.pxi":837 + * 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-2.2/src/lxml/parser.pxi":838 + * 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-2.2/src/lxml/parser.pxi":839 + * 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-2.2/src/lxml/parser.pxi":840 + * parser._filename = self._filename + * parser._resolvers = self._resolvers + * parser._target = self._target # <<<<<<<<<<<<<< + * parser._class_lookup = self._class_lookup + * return parser + */ + __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-2.2/src/lxml/parser.pxi":841 + * parser._resolvers = self._resolvers + * parser._target = self._target + * parser._class_lookup = self._class_lookup # <<<<<<<<<<<<<< + * return parser + * + */ + __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-2.2/src/lxml/parser.pxi":842 + * parser._target = self._target + * parser._class_lookup = self._class_lookup + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":844 + * return parser + * + * def copy(self): # <<<<<<<<<<<<<< + * u"""copy(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_11_BaseParser_copy[] = "copy(self)\n\n Create a new parser with the same configuration.\n "; +static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":849 + * 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[2]; __pyx_lineno = 849; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":851 + * 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_makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_11_BaseParser_makeelement[] = "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_makeelement(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_kp__tag,&__pyx_kp_attrib,&__pyx_kp_nsmap,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = 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_kp__tag); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_attrib); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_nsmap); + if (unlikely(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[2]; __pyx_lineno = 851; __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 = Py_None; + __pyx_v_nsmap = 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[2]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__extra); + __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":856 + * 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-2.2/src/lxml/parser.pxi":857 + * """ + * 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, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 856; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":861 + * # 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; + PyObject *__pyx_t_2 = NULL; + xmlDoc *__pyx_t_3; + int __pyx_t_4; + xmlDoc *__pyx_t_5; + __Pyx_SetupRefcountContext("_parseUnicodeDoc"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_text_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":870 + * 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-2.2/src/lxml/parser.pxi":871 + * 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.PyString_GET_SIZE(text_utf) + */ + if (!(__pyx_v_py_buffer_len > INT_MAX)) { + __pyx_t_1 = (__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL); + } else { + __pyx_t_1 = (__pyx_v_py_buffer_len > INT_MAX); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":872 + * 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.PyString_GET_SIZE(text_utf) + * return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename) + */ + __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_utext); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_text_utf); + __pyx_v_text_utf = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":873 + * if py_buffer_len > python.INT_MAX or _UNICODE_ENCODING is NULL: + * text_utf = python.PyUnicode_AsUTF8String(utext) + * py_buffer_len = python.PyString_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 = PyString_GET_SIZE(__pyx_v_text_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":874 + * text_utf = python.PyUnicode_AsUTF8String(utext) + * py_buffer_len = python.PyString_GET_SIZE(text_utf) + * return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename) # <<<<<<<<<<<<<< + * buffer_len = py_buffer_len + * + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_parseDoc(__pyx_v_self, PyString_AS_STRING(__pyx_v_text_utf), __pyx_v_py_buffer_len, __pyx_v_c_filename); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_3; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":875 + * py_buffer_len = python.PyString_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-2.2/src/lxml/parser.pxi":877 + * buffer_len = py_buffer_len + * + * 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[2]; __pyx_lineno = 877; __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-2.2/src/lxml/parser.pxi":878 + * + * 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[2]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":879 + * context = self._getParserContext() + * context.prepare() + * try: # <<<<<<<<<<<<<< + * pctxt = context._c_ctxt + * __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":880 + * 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-2.2/src/lxml/parser.pxi":881 + * 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-2.2/src/lxml/parser.pxi":883 + * __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-2.2/src/lxml/parser.pxi":884 + * + * c_text = python.PyUnicode_AS_DATA(utext) + * with nogil: # <<<<<<<<<<<<<< + * if self._for_html: + * result = htmlparser.htmlCtxtReadMemory( + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":885 + * 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, + */ + __pyx_t_1 = __pyx_v_self->_for_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":888 + * 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-2.2/src/lxml/parser.pxi":889 + * 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_1 = (__pyx_v_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":890 + * 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-2.2/src/lxml/parser.pxi":891 + * 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-2.2/src/lxml/parser.pxi":892 + * 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-2.2/src/lxml/parser.pxi":896 + * 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:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":898 + * self._parse_options) + * + * return context._handleParseResultDoc(self, result, None) # <<<<<<<<<<<<<< + * finally: + * context.cleanup() + */ + __pyx_t_5 = ((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_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_r = __pyx_t_5; + goto __pyx_L4; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":900 + * return context._handleParseResultDoc(self, result, None) + * finally: + * context.cleanup() # <<<<<<<<<<<<<< + * + * cdef xmlDoc* _parseDoc(self, char* c_text, Py_ssize_t c_len, + */ + __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[2]; __pyx_lineno = 900; __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_2); + __Pyx_AddTraceback("lxml.etree._BaseParser._parseUnicodeDoc"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_DECREF(__pyx_v_text_utf); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":902 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + xmlDoc *__pyx_t_4; + __Pyx_SetupRefcountContext("_parseDoc"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":910 + * 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-2.2/src/lxml/parser.pxi":911 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ParserError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_450), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":913 + * 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[2]; __pyx_lineno = 913; __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-2.2/src/lxml/parser.pxi":914 + * + * 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[2]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":915 + * context = self._getParserContext() + * context.prepare() + * try: # <<<<<<<<<<<<<< + * pctxt = context._c_ctxt + * __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":916 + * 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-2.2/src/lxml/parser.pxi":917 + * 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-2.2/src/lxml/parser.pxi":919 + * __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-2.2/src/lxml/parser.pxi":920 + * + * 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-2.2/src/lxml/parser.pxi":922 + * c_encoding = NULL + * else: + * c_encoding = _cstr(self._default_encoding) # <<<<<<<<<<<<<< + * + * with nogil: + */ + __pyx_v_c_encoding = PyString_AS_STRING(__pyx_v_self->_default_encoding); + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":924 + * c_encoding = _cstr(self._default_encoding) + * + * with nogil: # <<<<<<<<<<<<<< + * if self._for_html: + * result = htmlparser.htmlCtxtReadMemory( + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":925 + * + * with nogil: + * if self._for_html: # <<<<<<<<<<<<<< + * result = htmlparser.htmlCtxtReadMemory( + * pctxt, c_text, c_len, c_filename, + */ + __pyx_t_1 = __pyx_v_self->_for_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":928 + * 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-2.2/src/lxml/parser.pxi":929 + * 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-2.2/src/lxml/parser.pxi":930 + * 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-2.2/src/lxml/parser.pxi":931 + * 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-2.2/src/lxml/parser.pxi":932 + * 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-2.2/src/lxml/parser.pxi":936 + * 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:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":938 + * 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[2]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_r = __pyx_t_4; + goto __pyx_L4; + } + /*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_1); __pyx_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_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":940 + * return context._handleParseResultDoc(self, result, None) + * finally: + * context.cleanup() # <<<<<<<<<<<<<< + * + * cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL: + */ + __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[2]; __pyx_lineno = 940; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._BaseParser._parseDoc"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":942 + * 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_SetupRefcountContext("_parseDocFromFile"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":948 + * cdef int orig_options + * cdef char* c_encoding + * result = NULL # <<<<<<<<<<<<<< + * + * context = self._getParserContext() + */ + __pyx_v_result = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":950 + * 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[2]; __pyx_lineno = 950; __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-2.2/src/lxml/parser.pxi":951 + * + * 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[2]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":952 + * context = self._getParserContext() + * context.prepare() + * try: # <<<<<<<<<<<<<< + * pctxt = context._c_ctxt + * __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":953 + * 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-2.2/src/lxml/parser.pxi":954 + * 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-2.2/src/lxml/parser.pxi":956 + * __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-2.2/src/lxml/parser.pxi":957 + * + * 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-2.2/src/lxml/parser.pxi":959 + * c_encoding = NULL + * else: + * c_encoding = _cstr(self._default_encoding) # <<<<<<<<<<<<<< + * + * orig_options = pctxt.options + */ + __pyx_v_c_encoding = PyString_AS_STRING(__pyx_v_self->_default_encoding); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":961 + * 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-2.2/src/lxml/parser.pxi":962 + * + * orig_options = pctxt.options + * with nogil: # <<<<<<<<<<<<<< + * if self._for_html: + * result = htmlparser.htmlCtxtReadFile( + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":963 + * orig_options = pctxt.options + * with nogil: + * if self._for_html: # <<<<<<<<<<<<<< + * result = htmlparser.htmlCtxtReadFile( + * pctxt, c_filename, c_encoding, self._parse_options) + */ + __pyx_t_3 = __pyx_v_self->_for_html; + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":965 + * 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-2.2/src/lxml/parser.pxi":966 + * 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-2.2/src/lxml/parser.pxi":967 + * 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-2.2/src/lxml/parser.pxi":968 + * 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-2.2/src/lxml/parser.pxi":969 + * 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-2.2/src/lxml/parser.pxi":972 + * 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:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":973 + * 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-2.2/src/lxml/parser.pxi":975 + * pctxt.options = orig_options # work around libxml2 problem + * + * return context._handleParseResultDoc(self, result, c_filename) # <<<<<<<<<<<<<< + * finally: + * context.cleanup() + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_GOTREF(__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, __pyx_t_1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + goto __pyx_L3; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":977 + * return context._handleParseResultDoc(self, result, c_filename) + * finally: + * context.cleanup() # <<<<<<<<<<<<<< + * + * cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename) except NULL: + */ + __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[2]; __pyx_lineno = 977; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":979 + * 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_SetupRefcountContext("_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-2.2/src/lxml/parser.pxi":985 + * 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[2]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":986 + * 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-2.2/src/lxml/parser.pxi":988 + * 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[2]; __pyx_lineno = 988; __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-2.2/src/lxml/parser.pxi":989 + * + * 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[2]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":990 + * context = self._getParserContext() + * context.prepare() + * try: # <<<<<<<<<<<<<< + * pctxt = context._c_ctxt + * __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":991 + * 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-2.2/src/lxml/parser.pxi":992 + * 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-2.2/src/lxml/parser.pxi":994 + * __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[2]; __pyx_lineno = 993; __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[2]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L5;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__FileReaderContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L5;} + __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-2.2/src/lxml/parser.pxi":995 + * 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-2.2/src/lxml/parser.pxi":998 + * + * 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[2]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L5;} + __pyx_r = __pyx_t_6; + goto __pyx_L4; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1000 + * self, result, filename) + * finally: + * context.cleanup() # <<<<<<<<<<<<<< + * + * ############################################################ + */ + __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[2]; __pyx_lineno = 1000; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1015 + * 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_SetupRefcountContext("__get__"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1017 + * 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[2]; __pyx_lineno = 1017; __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-2.2/src/lxml/parser.pxi":1018 + * 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_kp_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1018; __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 = 1018; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1020 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + char *__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; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/parser.pxi":1045 + * cdef int buffer_len + * cdef int error + * cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER # <<<<<<<<<<<<<< + * if python.PyString_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-2.2/src/lxml/parser.pxi":1046 + * cdef int error + * cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER + * if python.PyString_Check(data): # <<<<<<<<<<<<<< + * if self._default_encoding is None: + * c_encoding = NULL + */ + __pyx_t_1 = PyString_Check(__pyx_v_data); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1047 + * cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER + * if python.PyString_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-2.2/src/lxml/parser.pxi":1048 + * if python.PyString_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-2.2/src/lxml/parser.pxi":1050 + * c_encoding = NULL + * else: + * c_encoding = self._default_encoding # <<<<<<<<<<<<<< + * c_data = _cstr(data) + * py_buffer_len = python.PyString_GET_SIZE(data) + */ + __pyx_t_2 = __Pyx_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[2]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_encoding = __pyx_t_2; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1051 + * else: + * c_encoding = self._default_encoding + * c_data = _cstr(data) # <<<<<<<<<<<<<< + * py_buffer_len = python.PyString_GET_SIZE(data) + * elif python.PyUnicode_Check(data): + */ + __pyx_v_c_data = PyString_AS_STRING(__pyx_v_data); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1052 + * c_encoding = self._default_encoding + * c_data = _cstr(data) + * py_buffer_len = python.PyString_GET_SIZE(data) # <<<<<<<<<<<<<< + * elif python.PyUnicode_Check(data): + * if _UNICODE_ENCODING is NULL: + */ + __pyx_v_py_buffer_len = PyString_GET_SIZE(__pyx_v_data); + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1053 + * c_data = _cstr(data) + * py_buffer_len = python.PyString_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-2.2/src/lxml/parser.pxi":1054 + * py_buffer_len = python.PyString_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-2.2/src/lxml/parser.pxi":1055 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ParserError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1056 + * if _UNICODE_ENCODING is NULL: + * raise ParserError, \ + * u"Unicode parsing is not supported on this platform" # <<<<<<<<<<<<<< + * c_encoding = _UNICODE_ENCODING + * c_data = python.PyUnicode_AS_DATA(data) + */ + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_451), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1057 + * 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-2.2/src/lxml/parser.pxi":1058 + * 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-2.2/src/lxml/parser.pxi":1059 + * 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-2.2/src/lxml/parser.pxi":1061 + * 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_452), 0); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1063 + * 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[2]; __pyx_lineno = 1063; __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-2.2/src/lxml/parser.pxi":1064 + * + * 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-2.2/src/lxml/parser.pxi":1065 + * 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-2.2/src/lxml/parser.pxi":1066 + * 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-2.2/src/lxml/parser.pxi":1067 + * 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[2]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1068 + * 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-2.2/src/lxml/parser.pxi":1069 + * 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-2.2/src/lxml/parser.pxi":1071 + * __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-2.2/src/lxml/parser.pxi":1072 + * + * if py_buffer_len > python.INT_MAX: + * buffer_len = python.INT_MAX # <<<<<<<<<<<<<< + * else: + * buffer_len = py_buffer_len + */ + __pyx_v_buffer_len = INT_MAX; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1074 + * buffer_len = python.INT_MAX + * else: + * buffer_len = 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-2.2/src/lxml/parser.pxi":1075 + * else: + * buffer_len = py_buffer_len + * if self._for_html: # <<<<<<<<<<<<<< + * error = _htmlCtxtResetPush(pctxt, c_data, buffer_len, + * c_encoding, self._parse_options) + */ + __pyx_t_1 = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._for_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1077 + * 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[2]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_error = __pyx_t_4; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1079 + * 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-2.2/src/lxml/parser.pxi":1081 + * 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-2.2/src/lxml/parser.pxi":1082 + * 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_buffer_len; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1083 + * pctxt, c_data, buffer_len, NULL, c_encoding) + * py_buffer_len -= buffer_len + * c_data += buffer_len # <<<<<<<<<<<<<< + * + * while (recover or error == 0) and py_buffer_len > 0: + */ + __pyx_v_c_data += __pyx_v_buffer_len; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1085 + * c_data += buffer_len + * + * while (recover or error == 0) and py_buffer_len > 0: # <<<<<<<<<<<<<< + * if py_buffer_len > python.INT_MAX: + * buffer_len = python.INT_MAX + */ + while (1) { + if (!__pyx_v_recover) { + __pyx_t_1 = (__pyx_v_error == 0); + } else { + __pyx_t_1 = __pyx_v_recover; + } + if (__pyx_t_1) { + __pyx_t_5 = (__pyx_v_py_buffer_len > 0); + } else { + __pyx_t_5 = __pyx_t_1; + } + if (!__pyx_t_5) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1086 + * + * while (recover or error == 0) and py_buffer_len > 0: + * 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-2.2/src/lxml/parser.pxi":1087 + * while (recover or error == 0) and py_buffer_len > 0: + * if py_buffer_len > python.INT_MAX: + * buffer_len = python.INT_MAX # <<<<<<<<<<<<<< + * else: + * buffer_len = py_buffer_len + */ + __pyx_v_buffer_len = INT_MAX; + goto __pyx_L13; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1089 + * buffer_len = python.INT_MAX + * else: + * buffer_len = 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_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1090 + * else: + * buffer_len = py_buffer_len + * if self._for_html: # <<<<<<<<<<<<<< + * error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0) + * else: + */ + __pyx_t_5 = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._for_html; + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1091 + * buffer_len = 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_L14; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1093 + * 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_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1094 + * 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_buffer_len; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1095 + * 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_buffer_len; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1097 + * 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) { + if ((!__pyx_v_pctxt->replaceEntities)) { + __pyx_t_5 = (!__pyx_v_pctxt->validate); + } else { + __pyx_t_5 = (!__pyx_v_pctxt->replaceEntities); + } + __pyx_t_1 = __pyx_t_5; + } else { + __pyx_t_1 = __pyx_v_error; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1099 + * 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_kp_filter_from_errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_6 = 0; __pyx_t_3 = __pyx_t_7; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + 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[2]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_v_entry); + __pyx_v_entry = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1100 + * # 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_7 = PyObject_GetAttr(__pyx_v_entry, __pyx_kp_type); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_8 = PyObject_GetAttr(__pyx_1, __pyx_kp_443); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_t_8, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1101 + * 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_kp_type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_8 = PyObject_GetAttr(__pyx_1, __pyx_kp_444); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_9, __pyx_t_8, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __pyx_t_5; + } else { + __pyx_t_10 = __pyx_t_1; + } + if (__pyx_t_10) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1102 + * if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \ + * entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY: + * break # <<<<<<<<<<<<<< + * else: + * error = 0 + */ + goto __pyx_L17_break; + goto __pyx_L18; + } + __pyx_L18:; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1104 + * break + * else: + * error = 0 # <<<<<<<<<<<<<< + * + * if not recover and (error or not pctxt.wellFormed): + */ + __pyx_v_error = 0; + } + __pyx_L17_break:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L15; + } + __pyx_L15:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1106 + * error = 0 + * + * if not recover and (error or not pctxt.wellFormed): # <<<<<<<<<<<<<< + * self._feed_parser_running = 0 + * try: + */ + if ((!__pyx_v_recover)) { + if (!__pyx_v_error) { + __pyx_t_10 = (!__pyx_v_pctxt->wellFormed); + } else { + __pyx_t_10 = __pyx_v_error; + } + __pyx_t_1 = __pyx_t_10; + } else { + __pyx_t_1 = (!__pyx_v_recover); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1107 + * + * 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-2.2/src/lxml/parser.pxi":1108 + * 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-2.2/src/lxml/parser.pxi":1109 + * 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[2]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L21;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + /*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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 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_L22; + } + __pyx_L22:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1111 + * context._handleParseResult(self, NULL, None) + * finally: + * context.cleanup() # <<<<<<<<<<<<<< + * + * def close(self): + */ + __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[2]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L23_error;} + goto __pyx_L24; + __pyx_L23_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_L24:; + 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_L19; + } + __pyx_L19:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1113 + * context.cleanup() + * + * def close(self): # <<<<<<<<<<<<<< + * u"""close(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_11_FeedParser_close[] = "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_close(PyObject *__pyx_v_self, PyObject *unused) { + struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context; + xmlParserCtxt *__pyx_v_pctxt; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/parser.pxi":1128 + * 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-2.2/src/lxml/parser.pxi":1129 + * cdef _Document doc + * if not self._feed_parser_running: + * raise XMLSyntaxError(u"no element found", # <<<<<<<<<<<<<< + * xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1130 + * if not self._feed_parser_running: + * raise XMLSyntaxError(u"no element found", + * xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0) # <<<<<<<<<<<<<< + * + * context = self._getPushParserContext() + */ + __pyx_t_2 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1130; __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[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_453)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_453)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_453)); + 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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_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[2]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1132 + * xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0) + * + * context = self._getPushParserContext() # <<<<<<<<<<<<<< + * pctxt = context._c_ctxt + * + */ + __pyx_t_2 = ((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_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1132; __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-2.2/src/lxml/parser.pxi":1133 + * + * 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-2.2/src/lxml/parser.pxi":1135 + * 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-2.2/src/lxml/parser.pxi":1136 + * + * self._feed_parser_running = 0 + * if self._for_html: # <<<<<<<<<<<<<< + * htmlparser.htmlParseChunk(pctxt, NULL, 0, 1) + * else: + */ + __pyx_t_1 = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self)->__pyx_base._for_html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1137 + * 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-2.2/src/lxml/parser.pxi":1139 + * 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-2.2/src/lxml/parser.pxi":1140 + * else: + * xmlparser.xmlParseChunk(pctxt, NULL, 0, 1) + * try: # <<<<<<<<<<<<<< + * result = context._handleParseResult(self, pctxt.myDoc, None) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1141 + * xmlparser.xmlParseChunk(pctxt, NULL, 0, 1) + * try: + * result = context._handleParseResult(self, pctxt.myDoc, None) # <<<<<<<<<<<<<< + * finally: + * context.cleanup() + */ + __pyx_t_2 = ((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_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L8;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + } + /*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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1143 + * result = context._handleParseResult(self, pctxt.myDoc, None) + * finally: + * context.cleanup() # <<<<<<<<<<<<<< + * + * if isinstance(result, _Document): + */ + __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[2]; __pyx_lineno = 1143; __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-2.2/src/lxml/parser.pxi":1145 + * context.cleanup() + * + * if isinstance(result, _Document): # <<<<<<<<<<<<<< + * return (<_Document>result).getroot() + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_result, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1146 + * + * if isinstance(result, _Document): + * return (<_Document>result).getroot() # <<<<<<<<<<<<<< + * else: + * return result + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)((struct LxmlDocument *)__pyx_v_result)->__pyx_vtab)->getroot(((struct LxmlDocument *)__pyx_v_result)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1146; __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_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1148 + * 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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1150 + * 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) { + PyObject *__pyx_v_error; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_htmlCtxtResetPush"); + __pyx_v_error = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1155 + * 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 = tree.xmlMalloc(10 * sizeof(int)) + * c_ctxt.spaceMax = 10 + */ + if ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20629)) { + __pyx_t_1 = (__pyx_v_c_ctxt->spaceTab == NULL); + } else { + __pyx_t_1 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20629); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1156 + * # libxml2 crashes if spaceTab is not initialised + * if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL: + * c_ctxt.spaceTab = 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-2.2/src/lxml/parser.pxi":1157 + * if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL: + * c_ctxt.spaceTab = 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-2.2/src/lxml/parser.pxi":1160 + * + * # libxml2 lacks an HTML push parser setup function + * error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding) # <<<<<<<<<<<<<< + * if error: + * return error + */ + __pyx_t_2 = PyInt_FromLong(xmlCtxtResetPush(__pyx_v_c_ctxt, NULL, 0, NULL, __pyx_v_c_encoding)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_error); + __pyx_v_error = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1161 + * # libxml2 lacks an HTML push parser setup function + * error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding) + * if error: # <<<<<<<<<<<<<< + * return error + * + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_error); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1162 + * error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding) + * if error: + * return error # <<<<<<<<<<<<<< + * + * # fix libxml2 setup for HTML + */ + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_error); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_3; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1165 + * + * # 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-2.2/src/lxml/parser.pxi":1166 + * # 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-2.2/src/lxml/parser.pxi":1167 + * 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-2.2/src/lxml/parser.pxi":1169 + * 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 + */ + if ((__pyx_v_c_data != NULL)) { + __pyx_t_1 = (__pyx_v_buffer_len > 0); + } else { + __pyx_t_1 = (__pyx_v_c_data != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1170 + * + * 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-2.2/src/lxml/parser.pxi":1171 + * 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; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._htmlCtxtResetPush"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_error); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1229 + * 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_kp_encoding,&__pyx_kp_attribute_defaults,&__pyx_kp_dtd_validation,&__pyx_kp_load_dtd,&__pyx_kp_no_network,&__pyx_kp_ns_clean,&__pyx_kp_recover,&__pyx_kp_schema,&__pyx_kp_huge_tree,&__pyx_kp_remove_blank_text,&__pyx_kp_resolve_entities,&__pyx_kp_remove_comments,&__pyx_kp_remove_pis,&__pyx_kp_strip_cdata,&__pyx_kp_target,&__pyx_kp_compact,0}; + __Pyx_SetupRefcountContext("__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] = Py_None; + values[1] = __pyx_k_117; + values[2] = __pyx_k_118; + values[3] = __pyx_k_119; + values[4] = __pyx_k_120; + values[5] = __pyx_k_121; + values[6] = __pyx_k_122; + values[7] = (PyObject*)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); + values[8] = __pyx_k_123; + values[9] = __pyx_k_124; + values[10] = __pyx_k_125; + values[11] = __pyx_k_126; + values[12] = __pyx_k_127; + values[13] = __pyx_k_128; + values[14] = Py_None; + values[15] = __pyx_k_129; + 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_kp_encoding); + if (value) { values[0] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_attribute_defaults); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_dtd_validation); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_load_dtd); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_no_network); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_ns_clean); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_recover); + if (value) { values[6] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_schema); + if (value) { values[7] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_huge_tree); + if (value) { values[8] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_blank_text); + if (value) { values[9] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_resolve_entities); + if (value) { values[10] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_comments); + if (value) { values[11] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_pis); + if (value) { values[12] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_strip_cdata); + if (value) { values[13] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_target); + if (value) { values[14] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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[2]; __pyx_lineno = 1229; __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 { + __pyx_v_encoding = Py_None; + __pyx_v_attribute_defaults = __pyx_k_117; + __pyx_v_dtd_validation = __pyx_k_118; + __pyx_v_load_dtd = __pyx_k_119; + __pyx_v_no_network = __pyx_k_120; + __pyx_v_ns_clean = __pyx_k_121; + __pyx_v_recover = __pyx_k_122; + __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); + __pyx_v_huge_tree = __pyx_k_123; + __pyx_v_remove_blank_text = __pyx_k_124; + __pyx_v_resolve_entities = __pyx_k_125; + __pyx_v_remove_comments = __pyx_k_126; + __pyx_v_remove_pis = __pyx_k_127; + __pyx_v_strip_cdata = __pyx_k_128; + __pyx_v_target = Py_None; + __pyx_v_compact = __pyx_k_129; + } + 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[2]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XMLParser.__init__"); + 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[2]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1236 + * 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-2.2/src/lxml/parser.pxi":1237 + * 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[2]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1238 + * 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-2.2/src/lxml/parser.pxi":1239 + * 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[2]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1241 + * 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-2.2/src/lxml/parser.pxi":1242 + * 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[2]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1243 + * 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-2.2/src/lxml/parser.pxi":1244 + * 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-2.2/src/lxml/parser.pxi":1245 + * 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-2.2/src/lxml/parser.pxi":1246 + * 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[2]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1247 + * 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-2.2/src/lxml/parser.pxi":1248 + * 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[2]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1249 + * 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-2.2/src/lxml/parser.pxi":1250 + * 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[2]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1251 + * 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-2.2/src/lxml/parser.pxi":1252 + * 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[2]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1253 + * 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-2.2/src/lxml/parser.pxi":1254 + * 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[2]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1255 + * 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-2.2/src/lxml/parser.pxi":1256 + * 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[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (!__pyx_t_2); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1257 + * 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-2.2/src/lxml/parser.pxi":1258 + * 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[2]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1259 + * 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-2.2/src/lxml/parser.pxi":1260 + * 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[2]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (!__pyx_t_2); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1261 + * 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-2.2/src/lxml/parser.pxi":1263 + * 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_kp___init__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1263; __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[2]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1265 + * _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[2]; __pyx_lineno = 1263; __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[2]; __pyx_lineno = 1263; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1282 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_encoding,&__pyx_kp_attribute_defaults,&__pyx_kp_dtd_validation,&__pyx_kp_load_dtd,&__pyx_kp_no_network,&__pyx_kp_ns_clean,&__pyx_kp_recover,&__pyx_kp_schema,&__pyx_kp_huge_tree,&__pyx_kp_remove_blank_text,&__pyx_kp_resolve_entities,&__pyx_kp_remove_comments,&__pyx_kp_remove_pis,&__pyx_kp_strip_cdata,&__pyx_kp_target,&__pyx_kp_compact,0}; + __Pyx_SetupRefcountContext("__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] = Py_None; + values[1] = __pyx_k_130; + values[2] = __pyx_k_131; + values[3] = __pyx_k_132; + values[4] = __pyx_k_133; + values[5] = __pyx_k_134; + values[6] = __pyx_k_135; + values[7] = Py_None; + values[8] = __pyx_k_136; + values[9] = __pyx_k_137; + values[10] = __pyx_k_138; + values[11] = __pyx_k_139; + values[12] = __pyx_k_140; + values[13] = __pyx_k_141; + values[14] = Py_None; + values[15] = __pyx_k_142; + 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_kp_encoding); + if (value) { values[0] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_attribute_defaults); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_dtd_validation); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_load_dtd); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_no_network); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_ns_clean); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_recover); + if (value) { values[6] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_schema); + if (value) { values[7] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_huge_tree); + if (value) { values[8] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_blank_text); + if (value) { values[9] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_resolve_entities); + if (value) { values[10] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_comments); + if (value) { values[11] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_pis); + if (value) { values[12] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_strip_cdata); + if (value) { values[13] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_target); + if (value) { values[14] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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[2]; __pyx_lineno = 1282; __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 { + __pyx_v_encoding = Py_None; + __pyx_v_attribute_defaults = __pyx_k_130; + __pyx_v_dtd_validation = __pyx_k_131; + __pyx_v_load_dtd = __pyx_k_132; + __pyx_v_no_network = __pyx_k_133; + __pyx_v_ns_clean = __pyx_k_134; + __pyx_v_recover = __pyx_k_135; + __pyx_v_schema = Py_None; + __pyx_v_huge_tree = __pyx_k_136; + __pyx_v_remove_blank_text = __pyx_k_137; + __pyx_v_resolve_entities = __pyx_k_138; + __pyx_v_remove_comments = __pyx_k_139; + __pyx_v_remove_pis = __pyx_k_140; + __pyx_v_strip_cdata = __pyx_k_141; + __pyx_v_target = Py_None; + __pyx_v_compact = __pyx_k_142; + } + 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[2]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1288 + * 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_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __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[2]; __pyx_lineno = 1288; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1289 + * target=None, compact=True): + * XMLParser.__init__(self, + * attribute_defaults=attribute_defaults, # <<<<<<<<<<<<<< + * dtd_validation=dtd_validation, + * load_dtd=load_dtd, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_attribute_defaults, __pyx_v_attribute_defaults) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1290 + * XMLParser.__init__(self, + * attribute_defaults=attribute_defaults, + * dtd_validation=dtd_validation, # <<<<<<<<<<<<<< + * load_dtd=load_dtd, + * no_network=no_network, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_dtd_validation, __pyx_v_dtd_validation) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1291 + * attribute_defaults=attribute_defaults, + * dtd_validation=dtd_validation, + * load_dtd=load_dtd, # <<<<<<<<<<<<<< + * no_network=no_network, + * ns_clean=ns_clean, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_load_dtd, __pyx_v_load_dtd) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1292 + * dtd_validation=dtd_validation, + * load_dtd=load_dtd, + * no_network=no_network, # <<<<<<<<<<<<<< + * ns_clean=ns_clean, + * recover=recover, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_no_network, __pyx_v_no_network) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1293 + * load_dtd=load_dtd, + * no_network=no_network, + * ns_clean=ns_clean, # <<<<<<<<<<<<<< + * recover=recover, + * remove_blank_text=remove_blank_text, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_ns_clean, __pyx_v_ns_clean) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1294 + * no_network=no_network, + * ns_clean=ns_clean, + * recover=recover, # <<<<<<<<<<<<<< + * remove_blank_text=remove_blank_text, + * huge_tree=huge_tree, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_recover, __pyx_v_recover) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1295 + * ns_clean=ns_clean, + * recover=recover, + * remove_blank_text=remove_blank_text, # <<<<<<<<<<<<<< + * huge_tree=huge_tree, + * compact=compact, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_remove_blank_text, __pyx_v_remove_blank_text) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1296 + * recover=recover, + * remove_blank_text=remove_blank_text, + * huge_tree=huge_tree, # <<<<<<<<<<<<<< + * compact=compact, + * resolve_entities=resolve_entities, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_huge_tree, __pyx_v_huge_tree) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1297 + * remove_blank_text=remove_blank_text, + * huge_tree=huge_tree, + * compact=compact, # <<<<<<<<<<<<<< + * resolve_entities=resolve_entities, + * remove_comments=remove_comments, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_compact, __pyx_v_compact) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1298 + * huge_tree=huge_tree, + * compact=compact, + * resolve_entities=resolve_entities, # <<<<<<<<<<<<<< + * remove_comments=remove_comments, + * remove_pis=remove_pis, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_resolve_entities, __pyx_v_resolve_entities) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1299 + * compact=compact, + * resolve_entities=resolve_entities, + * remove_comments=remove_comments, # <<<<<<<<<<<<<< + * remove_pis=remove_pis, + * strip_cdata=strip_cdata, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_remove_comments, __pyx_v_remove_comments) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1300 + * resolve_entities=resolve_entities, + * remove_comments=remove_comments, + * remove_pis=remove_pis, # <<<<<<<<<<<<<< + * strip_cdata=strip_cdata, + * target=target, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_remove_pis, __pyx_v_remove_pis) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1301 + * remove_comments=remove_comments, + * remove_pis=remove_pis, + * strip_cdata=strip_cdata, # <<<<<<<<<<<<<< + * target=target, + * encoding=encoding, + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_strip_cdata, __pyx_v_strip_cdata) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1302 + * remove_pis=remove_pis, + * strip_cdata=strip_cdata, + * target=target, # <<<<<<<<<<<<<< + * encoding=encoding, + * schema=schema) + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_target, __pyx_v_target) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1303 + * strip_cdata=strip_cdata, + * target=target, + * encoding=encoding, # <<<<<<<<<<<<<< + * schema=schema) + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_encoding, __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1304 + * target=target, + * encoding=encoding, + * schema=schema) # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_schema, __pyx_v_schema) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __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(((PyObject *)__pyx_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1312 + * __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_set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_set_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 PyObject *__pyx_pf_4lxml_5etree_set_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_kp_parser,0}; + __Pyx_SetupRefcountContext("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_kp_parser); + if (unlikely(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[2]; __pyx_lineno = 1312; __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[2]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.set_default_parser"); + 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[2]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1324 + * 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-2.2/src/lxml/parser.pxi":1325 + * """ + * 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-2.2/src/lxml/parser.pxi":1326 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1328 + * __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser) + * + * def get_default_parser(): # <<<<<<<<<<<<<< + * u"get_default_parser()" + * return __GLOBAL_PARSER_CONTEXT.getDefaultParser() + */ + +static PyObject *__pyx_pf_4lxml_5etree_get_default_parser(PyObject *__pyx_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_get_default_parser[] = "get_default_parser()"; +static PyObject *__pyx_pf_4lxml_5etree_get_default_parser(PyObject *__pyx_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("get_default_parser"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1330 + * 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[2]; __pyx_lineno = 1330; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1375 + * 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_kp_encoding,&__pyx_kp_remove_blank_text,&__pyx_kp_remove_comments,&__pyx_kp_remove_pis,&__pyx_kp_strip_cdata,&__pyx_kp_no_network,&__pyx_kp_target,&__pyx_kp_schema,&__pyx_kp_recover,&__pyx_kp_compact,0}; + __Pyx_SetupRefcountContext("__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] = Py_None; + values[1] = __pyx_k_143; + values[2] = __pyx_k_144; + values[3] = __pyx_k_145; + values[4] = __pyx_k_146; + values[5] = __pyx_k_147; + values[6] = Py_None; + values[7] = (PyObject*)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); + values[8] = __pyx_k_148; + values[9] = __pyx_k_149; + 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_kp_encoding); + if (value) { values[0] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_blank_text); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_comments); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_pis); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_strip_cdata); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_no_network); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_target); + if (value) { values[6] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_schema); + if (value) { values[7] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_recover); + if (value) { values[8] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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[2]; __pyx_lineno = 1375; __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 { + __pyx_v_encoding = Py_None; + __pyx_v_remove_blank_text = __pyx_k_143; + __pyx_v_remove_comments = __pyx_k_144; + __pyx_v_remove_pis = __pyx_k_145; + __pyx_v_strip_cdata = __pyx_k_146; + __pyx_v_no_network = __pyx_k_147; + __pyx_v_target = Py_None; + __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); + __pyx_v_recover = __pyx_k_148; + __pyx_v_compact = __pyx_k_149; + } + 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[2]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__"); + 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[2]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1380 + * 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-2.2/src/lxml/parser.pxi":1381 + * 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[2]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1382 + * 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-2.2/src/lxml/parser.pxi":1383 + * 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[2]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1384 + * 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-2.2/src/lxml/parser.pxi":1385 + * 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[2]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (!__pyx_t_2); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1386 + * 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-2.2/src/lxml/parser.pxi":1387 + * 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[2]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1388 + * 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-2.2/src/lxml/parser.pxi":1390 + * 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_kp___init__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1390; __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[2]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1392 + * _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[2]; __pyx_lineno = 1390; __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[2]; __pyx_lineno = 1390; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1401 + * ############################################################ + * + * 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_SetupRefcountContext("_parseDoc"); + __Pyx_INCREF((PyObject *)__pyx_v_parser); + __pyx_v_filename_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1405 + * 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-2.2/src/lxml/parser.pxi":1406 + * 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[2]; __pyx_lineno = 1406; __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-2.2/src/lxml/parser.pxi":1407 + * 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[2]; __pyx_lineno = 1407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_1); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1408 + * 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-2.2/src/lxml/parser.pxi":1410 + * 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[2]; __pyx_lineno = 1410; __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-2.2/src/lxml/parser.pxi":1411 + * 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 = PyString_AS_STRING(__pyx_v_filename_utf); + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1412 + * 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-2.2/src/lxml/parser.pxi":1413 + * 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-2.2/src/lxml/parser.pxi":1414 + * 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-2.2/src/lxml/parser.pxi":1416 + * 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[2]; __pyx_lineno = 1416; __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[2]; __pyx_lineno = 1416; __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[2]; __pyx_lineno = 1415; __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-2.2/src/lxml/parser.pxi":1417 + * return (<_BaseParser>parser)._parseDocFromFilelike( + * StringIO(text), filename) + * return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename) # <<<<<<<<<<<<<< + * else: + * c_len = python.PyString_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[2]; __pyx_lineno = 1417; __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-2.2/src/lxml/parser.pxi":1419 + * return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename) + * else: + * c_len = python.PyString_GET_SIZE(text) # <<<<<<<<<<<<<< + * if c_len > python.INT_MAX: + * return (<_BaseParser>parser)._parseDocFromFilelike( + */ + __pyx_v_c_len = PyString_GET_SIZE(__pyx_v_text); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1420 + * else: + * c_len = python.PyString_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-2.2/src/lxml/parser.pxi":1422 + * 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[2]; __pyx_lineno = 1422; __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[2]; __pyx_lineno = 1422; __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[2]; __pyx_lineno = 1421; __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-2.2/src/lxml/parser.pxi":1423 + * 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 = PyString_AS_STRING(__pyx_v_text); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1424 + * 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[2]; __pyx_lineno = 1424; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1426 + * 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_SetupRefcountContext("_parseDocFromFile"); + __Pyx_INCREF((PyObject *)__pyx_v_parser); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1427 + * + * 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-2.2/src/lxml/parser.pxi":1428 + * 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[2]; __pyx_lineno = 1428; __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-2.2/src/lxml/parser.pxi":1429 + * 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), PyString_AS_STRING(__pyx_v_filename8)); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1429; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1431 + * 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_SetupRefcountContext("_parseDocFromFilelike"); + __Pyx_INCREF((PyObject *)__pyx_v_parser); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1433 + * 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-2.2/src/lxml/parser.pxi":1434 + * _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[2]; __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-2.2/src/lxml/parser.pxi":1435 + * 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[2]; __pyx_lineno = 1435; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1437 + * 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_SetupRefcountContext("_newXMLDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1439 + * 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-2.2/src/lxml/parser.pxi":1440 + * 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-2.2/src/lxml/parser.pxi":1441 + * 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[2]; __pyx_lineno = 1441; __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-2.2/src/lxml/parser.pxi":1442 + * 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-2.2/src/lxml/parser.pxi":1443 + * 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_454); + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1444 + * 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-2.2/src/lxml/parser.pxi":1445 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1447 + * 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_SetupRefcountContext("_newHTMLDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1449 + * 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-2.2/src/lxml/parser.pxi":1450 + * 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-2.2/src/lxml/parser.pxi":1451 + * 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[2]; __pyx_lineno = 1451; __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-2.2/src/lxml/parser.pxi":1452 + * 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-2.2/src/lxml/parser.pxi":1453 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1455 + * 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; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_copyDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1457 + * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL: + * cdef xmlDoc* result + * if recursive: # <<<<<<<<<<<<<< + * with nogil: + * result = tree.xmlCopyDoc(c_doc, recursive) + */ + __pyx_t_1 = __pyx_v_recursive; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1458 + * cdef xmlDoc* result + * if recursive: + * with nogil: # <<<<<<<<<<<<<< + * result = tree.xmlCopyDoc(c_doc, recursive) + * else: + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1459 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1461 + * 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-2.2/src/lxml/parser.pxi":1462 + * else: + * result = tree.xmlCopyDoc(c_doc, 0) + * if result is NULL: # <<<<<<<<<<<<<< + * python.PyErr_NoMemory() + * __GLOBAL_PARSER_CONTEXT.initDocDict(result) + */ + __pyx_t_2 = (__pyx_v_result == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1463 + * result = tree.xmlCopyDoc(c_doc, 0) + * if result is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * __GLOBAL_PARSER_CONTEXT.initDocDict(result) + * return result + */ + __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1463; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1464 + * 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-2.2/src/lxml/parser.pxi":1465 + * 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_3); + __Pyx_AddTraceback("lxml.etree._copyDoc"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1467 + * 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_SetupRefcountContext("_copyDocRoot"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1471 + * 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-2.2/src/lxml/parser.pxi":1472 + * 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-2.2/src/lxml/parser.pxi":1473 + * 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: + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1474 + * __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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1475 + * 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-2.2/src/lxml/parser.pxi":1476 + * 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[2]; __pyx_lineno = 1476; __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-2.2/src/lxml/parser.pxi":1477 + * 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-2.2/src/lxml/parser.pxi":1478 + * 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[2]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1479 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1481 + * 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_SetupRefcountContext("_copyNodeToDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1484 + * 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-2.2/src/lxml/parser.pxi":1485 + * 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-2.2/src/lxml/parser.pxi":1486 + * 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[2]; __pyx_lineno = 1486; __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-2.2/src/lxml/parser.pxi":1487 + * 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[2]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1488 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1496 + * ############################################################ + * + * 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_SetupRefcountContext("_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-2.2/src/lxml/parser.pxi":1498 + * 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-2.2/src/lxml/parser.pxi":1500 + * 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[2]; __pyx_lineno = 1500; __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[2]; __pyx_lineno = 1500; __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-2.2/src/lxml/parser.pxi":1502 + * 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-2.2/src/lxml/parser.pxi":1503 + * # 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[2]; __pyx_lineno = 1503; __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-2.2/src/lxml/parser.pxi":1504 + * 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-2.2/src/lxml/parser.pxi":1505 + * 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-2.2/src/lxml/parser.pxi":1506 + * 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(PyString_AS_STRING(__pyx_v_base_url)); + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1507 + * 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-2.2/src/lxml/parser.pxi":1509 + * 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-2.2/src/lxml/parser.pxi":1510 + * + * 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-2.2/src/lxml/parser.pxi":1512 + * 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[2]; __pyx_lineno = 1512; __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-2.2/src/lxml/parser.pxi":1514 + * 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_kp_455)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + __pyx_t_4 = PyObject_HasAttr(__pyx_v_source, ((PyObject *)__pyx_kp_456)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1514; __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-2.2/src/lxml/parser.pxi":1516 + * 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_kp_tell); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1516; __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[2]; __pyx_lineno = 1516; __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[2]; __pyx_lineno = 1516; __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[2]; __pyx_lineno = 1516; __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-2.2/src/lxml/parser.pxi":1517 + * # 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-2.2/src/lxml/parser.pxi":1518 + * 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_kp_getvalue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1518; __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[2]; __pyx_lineno = 1518; __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[2]; __pyx_lineno = 1518; __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[2]; __pyx_lineno = 1517; __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-2.2/src/lxml/parser.pxi":1521 + * + * # 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_kp_457)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1522 + * # 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-2.2/src/lxml/parser.pxi":1523 + * 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[2]; __pyx_lineno = 1523; __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[2]; __pyx_lineno = 1522; __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-2.2/src/lxml/parser.pxi":1525 + * 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[2]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_458), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_6, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1525; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1527 + * 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_SetupRefcountContext("_parseDocumentFromURL"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1529 + * 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[2]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1530 + * 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[2]; __pyx_lineno = 1530; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1532 + * 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; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + xmlDoc *__pyx_t_4; + __Pyx_SetupRefcountContext("_parseMemoryDocument"); + __Pyx_INCREF(__pyx_v_text); + __Pyx_INCREF(__pyx_v_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1534 + * 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-2.2/src/lxml/parser.pxi":1535 + * 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_2 = __pyx_f_4lxml_5etree__hasEncodingDeclaration(__pyx_v_text); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1537 + * if _hasEncodingDeclaration(text): + * raise ValueError, \ + * u"Unicode strings with encoding declaration are not supported." # <<<<<<<<<<<<<< + * # pass native unicode only if libxml2 can handle it + * if _UNICODE_ENCODING is NULL: + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_459), 0); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1539 + * 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.PyString_Check(text): + */ + __pyx_t_1 = (__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1540 + * # pass native unicode only if libxml2 can handle it + * if _UNICODE_ENCODING is NULL: + * text = python.PyUnicode_AsUTF8String(text) # <<<<<<<<<<<<<< + * elif not python.PyString_Check(text): + * raise ValueError, u"can only parse strings" + */ + __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1541 + * if _UNICODE_ENCODING is NULL: + * text = python.PyUnicode_AsUTF8String(text) + * elif not python.PyString_Check(text): # <<<<<<<<<<<<<< + * raise ValueError, u"can only parse strings" + * if python.PyUnicode_Check(url): + */ + __pyx_t_1 = (!PyString_Check(__pyx_v_text)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1542 + * text = python.PyUnicode_AsUTF8String(text) + * elif not python.PyString_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_460), 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-2.2/src/lxml/parser.pxi":1543 + * elif not python.PyString_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-2.2/src/lxml/parser.pxi":1544 + * 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_3 = PyUnicode_AsUTF8String(__pyx_v_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1544; __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; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1545 + * if python.PyUnicode_Check(url): + * url = python.PyUnicode_AsUTF8String(url) + * c_doc = _parseDoc(text, url, parser) # <<<<<<<<<<<<<< + * return _documentFactory(c_doc, parser) + * + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__parseDoc(__pyx_v_text, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1546 + * 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_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct LxmlDocument *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1548 + * 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_SetupRefcountContext("_parseFilelikeDocument"); + __Pyx_INCREF(__pyx_v_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1550 + * 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-2.2/src/lxml/parser.pxi":1551 + * 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 = PyUnicode_AsUTF8String(__pyx_v_url); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __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-2.2/src/lxml/parser.pxi":1552 + * 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[2]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1553 + * 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[2]; __pyx_lineno = 1553; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("__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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxStart"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxEnd"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxData"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxDoctype"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxPi"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxComment"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_setSaxParserTarget"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_initParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxException"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + 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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/saxparser.pxi":127 + * cdef _Element element + * cdef int i + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * if c_ctxt._private is NULL: + * return + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":128 + * cdef int i + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":129 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/src/lxml/saxparser.pxi":144 + * attrib = EMPTY_READ_ONLY_DICT + * else: + * attrib = {} # <<<<<<<<<<<<<< + * for i from 0 <= i < c_nb_attributes: + * name = _namespacedNameFromNsName( + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(__pyx_v_attrib); + __pyx_v_attrib = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/src/lxml/saxparser.pxi":149 + * c_attributes[2], c_attributes[0]) + * if c_attributes[3] is NULL: + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * value = u'' + * else: + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":150 + * if c_attributes[3] is NULL: + * if python.IS_PYTHON3: + * value = u'' # <<<<<<<<<<<<<< + * else: + * value = '' + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_461)); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = ((PyObject *)__pyx_kp_461); + goto __pyx_L19; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":152 + * value = u'' + * else: + * value = '' # <<<<<<<<<<<<<< + * else: + * value = python.PyUnicode_DecodeUTF8( + */ + __Pyx_INCREF(__pyx_kp_462); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_kp_462; + } + __pyx_L19:; + goto __pyx_L18; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":156 + * value = python.PyUnicode_DecodeUTF8( + * c_attributes[3], c_attributes[4] - c_attributes[3], + * "strict") # <<<<<<<<<<<<<< + * attrib[name] = value + * c_attributes += 5 + */ + __pyx_t_2 = PyUnicode_DecodeUTF8((__pyx_v_c_attributes[3]), ((__pyx_v_c_attributes[4]) - (__pyx_v_c_attributes[3])), __pyx_k_463); 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-2.2/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-2.2/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 += 5; + } + } + __pyx_L15:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(__pyx_v_nsmap); + __pyx_v_nsmap = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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 += 2; + } + } + __pyx_L20:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 (!(__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-2.2/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 = 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); + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = 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-2.2/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 = 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-2.2/src/lxml/saxparser.pxi":175 + * element._c_node.line = 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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_5, &__pyx_t_6) < 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_5); + __Pyx_GOTREF(__pyx_t_6); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/saxparser.pxi":184 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _Element element + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * if c_ctxt._private is NULL: + * return + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":185 + * cdef _Element element + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":186 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(__pyx_v_attrib); + __pyx_v_attrib = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/src/lxml/saxparser.pxi":199 + * name = funicode(c_attributes[0]) + * if c_attributes[1] is NULL: + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * value = u'' + * else: + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":200 + * if c_attributes[1] is NULL: + * if python.IS_PYTHON3: + * value = u'' # <<<<<<<<<<<<<< + * else: + * value = '' + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_464)); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = ((PyObject *)__pyx_kp_464); + goto __pyx_L17; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":202 + * value = u'' + * else: + * value = '' # <<<<<<<<<<<<<< + * else: + * value = funicode(c_attributes[1]) + */ + __Pyx_INCREF(__pyx_kp_465); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_kp_465; + } + __pyx_L17:; + goto __pyx_L16; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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 (!(__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-2.2/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 = 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); + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = c_ctxt.input.line + * else: + */ + __pyx_t_3 = (__pyx_v_c_ctxt->input->line < 65535); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = 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-2.2/src/lxml/saxparser.pxi":213 + * element._c_node.line = 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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4, &__pyx_t_5) < 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_4); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/saxparser.pxi":221 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * if c_ctxt._private is NULL: + * return + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":222 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":223 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_handleSaxEndNoNs"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":236 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * if c_ctxt._private is NULL: + * return + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":237 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":238 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_handleSaxData"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":250 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":251 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt + * if c_ctxt._private is NULL or c_ctxt.disableSAX: # <<<<<<<<<<<<<< + * return + * context = <_SaxParserContext>c_ctxt._private + */ + if (!(__pyx_v_c_ctxt->_private == NULL)) { + __pyx_t_1 = __pyx_v_c_ctxt->disableSAX; + } else { + __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":252 + * c_ctxt = 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-2.2/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-2.2/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_1 = (__pyx_v_context->_origSaxData != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/saxparser.pxi":258 + * try: + * context._target._handleSaxData( + * python.PyUnicode_DecodeUTF8(c_data, data_len, NULL)) # <<<<<<<<<<<<<< + * except: + * context._handleSaxException(c_ctxt) + */ + __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_c_data, __pyx_v_data_len, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 258; __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)->_handleSaxData(__pyx_v_context->_target, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __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-2.2/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_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_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_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("lxml.etree._handleSaxData"); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_handleSaxCData"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":265 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":266 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt + * if c_ctxt._private is NULL or c_ctxt.disableSAX: # <<<<<<<<<<<<<< + * return + * context = <_SaxParserContext>c_ctxt._private + */ + if (!(__pyx_v_c_ctxt->_private == NULL)) { + __pyx_t_1 = __pyx_v_c_ctxt->disableSAX; + } else { + __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":267 + * c_ctxt = 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-2.2/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-2.2/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_1 = (__pyx_v_context->_origSaxCData != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/saxparser.pxi":273 + * try: + * context._target._handleSaxData( + * python.PyUnicode_DecodeUTF8(c_data, data_len, NULL)) # <<<<<<<<<<<<<< + * except: + * context._handleSaxException(c_ctxt) + */ + __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_c_data, __pyx_v_data_len, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 273; __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)->_handleSaxData(__pyx_v_context->_target, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __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-2.2/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_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_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_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("lxml.etree._handleSaxCData"); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/saxparser.pxi":281 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":282 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt + * if c_ctxt._private is NULL or c_ctxt.disableSAX: # <<<<<<<<<<<<<< + * return + * context = <_SaxParserContext>c_ctxt._private + */ + if (!(__pyx_v_c_ctxt->_private == NULL)) { + __pyx_t_1 = __pyx_v_c_ctxt->disableSAX; + } else { + __pyx_t_1 = (__pyx_v_c_ctxt->_private == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":283 + * c_ctxt = 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-2.2/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-2.2/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_1 = (__pyx_v_context->_origSaxDoctype != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_1 = (__pyx_v_c_public != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_public); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L5_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_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_c_system != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_system); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_system_id); + __pyx_v_system_id = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 293; __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)->_handleSaxDoctype(__pyx_v_context->_target, __pyx_t_2, __pyx_v_public_id, __pyx_v_system_id); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __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-2.2/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_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_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_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_4); + __Pyx_XDECREF(__pyx_t_5); + __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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/saxparser.pxi":300 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * if c_ctxt._private is NULL: + * return + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":301 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":302 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_handleSaxComment"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":316 + * cdef _SaxParserContext context + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * if c_ctxt._private is NULL: + * return + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":317 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * c_ctxt = 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-2.2/src/lxml/saxparser.pxi":318 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_element_factory,&__pyx_kp_parser,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = 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_kp_element_factory); + if (value) { values[0] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = Py_None; + __pyx_v_parser = 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__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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_kp_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-2.2/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-2.2/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-2.2/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-2.2/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 (!(__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_flush"); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_data)) > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (((PyObject *)__pyx_v_self->_last) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_466), __pyx_kp_join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 361; __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 = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->_data)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_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 = 361; __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_text); + __pyx_v_text = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + */ + __pyx_t_1 = __pyx_v_self->_in_tail; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 PYREX_WITHOUT_ASSERTIONS + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_last), __pyx_kp_tail); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__pyx_t_4 == Py_None); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_467)); + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_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-2.2/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 PYREX_WITHOUT_ASSERTIONS + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_last), __pyx_kp_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__pyx_t_4 == Py_None); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_468)); + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_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-2.2/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 (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-2.2/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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree.TreeBuilder._flush"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_text); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":373 + * # Python level event handlers + * + * def close(self): # <<<<<<<<<<<<<< + * u"""close(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_5etree_11TreeBuilder_close[] = "close(self)\n\n Flushes the builder buffers, and returns the toplevel document\n element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_close(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("close"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 PYREX_WITHOUT_ASSERTIONS + if (unlikely(!(PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_element_stack)) == 0))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_469)); + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last) != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_470)); + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_AddTraceback("lxml.etree.TreeBuilder.close"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":383 + * return self._last + * + * def data(self, data): # <<<<<<<<<<<<<< + * u"""data(self, data) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ +static char __pyx_doc_4lxml_5etree_11TreeBuilder_data[] = "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_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("data"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_11TreeBuilder_start[] = "start(self, tag, attrs, nsmap=None)\n\n Opens a new element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_start(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_kp_tag,&__pyx_kp_attrs,&__pyx_kp_nsmap,0}; + __Pyx_SetupRefcountContext("start"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[2] = 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_kp_tag); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_nsmap); + if (unlikely(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 = 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"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_nsmap); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_end(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/ +static char __pyx_doc_4lxml_5etree_11TreeBuilder_end[] = "end(self, tag)\n\n Closes the current element.\n "; +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_end(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_SetupRefcountContext("end"); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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 PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self)->_last), __pyx_kp_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-2.2/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_kp_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_471), ((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(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + PyErr_SetObject(PyExc_AssertionError, __pyx_t_2); + __Pyx_DECREF(__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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":411 + * return element + * + * def pi(self, target, data): # <<<<<<<<<<<<<< + * u"""pi(self, target, data) + * """ + */ + +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_11TreeBuilder_pi[] = "pi(self, target, data)\n "; +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_pi(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_kp_target,&__pyx_kp_data,0}; + __Pyx_SetupRefcountContext("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_kp_target); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_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"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_comment(PyObject *__pyx_v_self, PyObject *__pyx_v_comment); /*proto*/ +static char __pyx_doc_4lxml_5etree_11TreeBuilder_comment[] = "comment(self, comment)\n "; +static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_comment(PyObject *__pyx_v_self, PyObject *__pyx_v_comment) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("comment"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_handleSaxStart"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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 (!(__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-2.2/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_2 = (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_element_stack)) > 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_1), __pyx_v_self->_last); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_element_stack)) > 0); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __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_1), __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_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, ((struct LxmlDocument *)Py_None), __pyx_v_self->_parser, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, Py_None)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_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; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + */ + __pyx_t_1 = PyList_Append(((PyObject *)__pyx_v_self->_element_stack), ((PyObject *)__pyx_v_self->_last)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxEnd"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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 (!(__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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxData"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/saxparser.pxi":446 + * + * cdef int _handleSaxData(self, data) except -1: + * self._data.append(data) # <<<<<<<<<<<<<< + * + * cdef _handleSaxPi(self, target, data): + */ + __pyx_t_1 = PyList_Append(((PyObject *)__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_handleSaxPi"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_101); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_target); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_target); + __Pyx_GIVEREF(__pyx_v_target); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_element_stack)) > 0); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_1), __pyx_v_self->_last); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxPi"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_handleSaxComment"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Comment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_comment); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_comment); + __Pyx_GIVEREF(__pyx_v_comment); + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_element_stack)) > 0); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_element_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_1), __pyx_v_self->_last); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxComment"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_self,&__pyx_kp_result,0}; + __Pyx_SetupRefcountContext("__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_kp_self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_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__"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":22 + * cdef bint _start_takes_nsmap + * + * def __init__(self, target): # <<<<<<<<<<<<<< + * cdef int event_filter + * event_filter = 0 + */ + +static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___init__(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; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_target,0}; + __Pyx_SetupRefcountContext("__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_kp_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), "__init__") < 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("__init__", 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.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_arguments = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":24 + * def __init__(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-2.2/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-2.2/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-2.2/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_kp_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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_2 = __Pyx_GetItemInt(__pyx_v_arguments, 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L15_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_4 = PyObject_Length(__pyx_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L15_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (!(__pyx_t_4 > 3)) { + __pyx_2 = __Pyx_GetItemInt(__pyx_v_arguments, 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L15_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = (__pyx_2 != Py_None); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_5 = __pyx_t_2; + } else { + __pyx_t_5 = (__pyx_t_4 > 3); + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L16_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/parsertarget.pxi":30 + * if self._target_start is not None: + * event_filter = event_filter | SAX_EVENT_START + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * else: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/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-2.2/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_kp_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-2.2/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_5 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_end != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":43 + * if self._target_end is not None: + * event_filter = event_filter | SAX_EVENT_END + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * try: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L25_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/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-2.2/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_kp_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-2.2/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_5 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_data != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":49 + * if self._target_data is not None: + * event_filter = event_filter | SAX_EVENT_DATA + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * try: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L34_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/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-2.2/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_kp_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-2.2/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_5 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_doctype != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":55 + * if self._target_doctype is not None: + * event_filter = event_filter | SAX_EVENT_DOCTYPE + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * try: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L43_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/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-2.2/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_kp_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-2.2/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_5 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_pi != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":61 + * if self._target_pi is not None: + * event_filter = event_filter | SAX_EVENT_PI + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * try: + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L52_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/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-2.2/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_kp_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-2.2/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_5 = (((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self)->_target_comment != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_1) { + PyErr_Restore(0,0,0); + goto __pyx_L61_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/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_2); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_arguments); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_handleSaxStart"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":72 + * + * cdef _handleSaxStart(self, tag, attrib, nsmap): + * if self._start_takes_nsmap: # <<<<<<<<<<<<<< + * return self._target_start(tag, attrib, nsmap) + * else: + */ + __pyx_t_1 = __pyx_v_self->_start_takes_nsmap; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 73; __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_INCREF(__pyx_v_nsmap); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_nsmap); + __Pyx_GIVEREF(__pyx_v_nsmap); + __pyx_t_3 = PyObject_Call(__pyx_v_self->_target_start, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 73; __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; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 75; __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_2 = PyObject_Call(__pyx_v_self->_target_start, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 75; __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._PythonSaxParserTarget._handleSaxStart"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxEnd"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxData"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxDoctype"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxPi"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_handleSaxComment"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_setTarget"); + __Pyx_INCREF(__pyx_v_target); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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 = PyObject_TypeCheck(__pyx_v_target, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__SaxParserTarget))); + if (!(!__pyx_t_1)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = PyObject_HasAttr(__pyx_v_target, ((PyObject *)__pyx_kp_472)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 100; __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-2.2/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-2.2/src/lxml/parsertarget.pxi":102 + * hasattr(target, u'__dict__'): + * target = _PythonSaxParserTarget(target) + * self._setSaxParserTarget(target) # <<<<<<<<<<<<<< + * return 0 + * + */ + if (!(__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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_copy"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 (!(__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-2.2/src/lxml/parsertarget.pxi":108 + * cdef _TargetParserContext context + * context = _ParserContext._copy(self) + * context._setTarget(self._python_target) # <<<<<<<<<<<<<< + * return context + * + */ + __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_v_self->_python_target); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + __Pyx_SetupRefcountContext("_cleanupTargetParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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 + */ + if ((__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != __pyx_v_result)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc->_private == NULL); + } else { + __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-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_handleParseResult"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":122 + * filename): + * cdef bint recover + * recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER # <<<<<<<<<<<<<< + * if self._has_raised(): + * self._cleanupTargetParserContext(result) + */ + __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":123 + * cdef bint recover + * recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER + * 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-2.2/src/lxml/parsertarget.pxi":124 + * recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER + * 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-2.2/src/lxml/parsertarget.pxi":125 + * 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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":126 + * self._cleanupTargetParserContext(result) + * self._raise_if_stored() + * if not self._c_ctxt.wellFormed and not recover: # <<<<<<<<<<<<<< + * _raiseParseError(self._c_ctxt, filename, self._error_log) + * return self._python_target.close() + */ + if ((!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed)) { + __pyx_t_1 = (!__pyx_v_recover); + } else { + __pyx_t_1 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":127 + * self._raise_if_stored() + * if not self._c_ctxt.wellFormed and not recover: + * _raiseParseError(self._c_ctxt, filename, self._error_log) # <<<<<<<<<<<<<< + * return self._python_target.close() + * + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, __pyx_v_self->__pyx_base.__pyx_base._error_log); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":128 + * if not self._c_ctxt.wellFormed and not recover: + * _raiseParseError(self._c_ctxt, filename, self._error_log) + * return self._python_target.close() # <<<<<<<<<<<<<< + * + * cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self->_python_target, __pyx_kp_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 128; __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[13]; __pyx_lineno = 128; __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; + + __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._TargetParserContext._handleParseResult"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":130 + * return self._python_target.close() + * + * 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; + xmlDoc *__pyx_r; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_handleParseResultDoc"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":133 + * 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-2.2/src/lxml/parsertarget.pxi":134 + * 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) + */ + if ((__pyx_v_result != NULL)) { + __pyx_t_1 = (__pyx_v_result->_private == NULL); + } else { + __pyx_t_1 = (__pyx_v_result != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":136 + * if result is not NULL and result._private is NULL: + * # no _Document proxy => orphen + * tree.xmlFreeDoc(result) # <<<<<<<<<<<<<< + * self._cleanupTargetParserContext(result) + * self._raise_if_stored() + */ + xmlFreeDoc(__pyx_v_result); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":137 + * # no _Document proxy => orphen + * tree.xmlFreeDoc(result) + * 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-2.2/src/lxml/parsertarget.pxi":138 + * tree.xmlFreeDoc(result) + * 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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":139 + * self._cleanupTargetParserContext(result) + * self._raise_if_stored() + * if not self._c_ctxt.wellFormed and not recover: # <<<<<<<<<<<<<< + * _raiseParseError(self._c_ctxt, filename, self._error_log) + * raise _TargetParserResult(self._python_target.close()) + */ + if ((!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed)) { + __pyx_t_1 = (!__pyx_v_recover); + } else { + __pyx_t_1 = (!__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":140 + * self._raise_if_stored() + * if not self._c_ctxt.wellFormed and not recover: + * _raiseParseError(self._c_ctxt, filename, self._error_log) # <<<<<<<<<<<<<< + * raise _TargetParserResult(self._python_target.close()) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, __pyx_v_self->__pyx_base.__pyx_base._error_log); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":141 + * if not self._c_ctxt.wellFormed and not recover: + * _raiseParseError(self._c_ctxt, filename, self._error_log) + * raise _TargetParserResult(self._python_target.close()) # <<<<<<<<<<<<<< + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__TargetParserResult); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self->_python_target, __pyx_kp_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 141; __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[13]; __pyx_lineno = 141; __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[13]; __pyx_lineno = 141; __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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_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[13]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_findOutputMethod"); + __Pyx_INCREF(__pyx_v_method); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_kp_lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __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[3]; __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-2.2/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_3 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_kp_473), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_3 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_kp_474), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_3 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_kp_475), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_476), __pyx_v_method); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[3]; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + char *__pyx_t_5; + __Pyx_SetupRefcountContext("_textToString"); + __Pyx_INCREF(__pyx_v_encoding); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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[3]; __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-2.2/src/lxml/serializer.pxi":35 + * return python.PyErr_NoMemory() + * + * with nogil: # <<<<<<<<<<<<<< + * error_result = tree.xmlNodeBufGetContent(c_buffer, c_node) + * if with_tail: + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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: + */ + __pyx_t_1 = __pyx_v_with_tail; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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?)" + */ + if (!(__pyx_v_error_result < 0)) { + __pyx_t_1 = (__pyx_v_c_text == NULL); + } else { + __pyx_t_1 = (__pyx_v_error_result < 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_SerialisationError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_477), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/serializer.pxi":50 + * try: + * needs_conversion = 0 + * if encoding is _unicode: # <<<<<<<<<<<<<< + * needs_conversion = 1 + * elif encoding is not None: + */ + __pyx_t_1 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1 = (__pyx_v_encoding != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L12;} + __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[3]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_encoding, ((PyObject *)__pyx_kp_478), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_encoding, ((PyObject *)__pyx_kp_479), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = __pyx_f_4lxml_5etree_isutf8(__pyx_v_c_text); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/serializer.pxi":62 + * needs_conversion = 1 + * + * if needs_conversion: # <<<<<<<<<<<<<< + * text = python.PyUnicode_DecodeUTF8( + * c_text, tree.xmlBufferLength(c_buffer), 'strict') + */ + __pyx_t_1 = __pyx_v_needs_conversion; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyUnicode_DecodeUTF8(__pyx_v_c_text, xmlBufferLength(__pyx_v_c_buffer), __pyx_k_480); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_encoding != __pyx_v_4lxml_5etree__unicode); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L12;} + __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-2.2/src/lxml/serializer.pxi":68 + * encoding = _utf8(encoding) + * text = python.PyUnicode_AsEncodedString( + * text, encoding, 'strict') # <<<<<<<<<<<<<< + * else: + * text = c_text + */ + __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L12;} + __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_text, __pyx_t_5, __pyx_k_481); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L19; + } + __pyx_L19:; + goto __pyx_L18; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":70 + * text, encoding, 'strict') + * else: + * text = c_text # <<<<<<<<<<<<<< + * finally: + * tree.xmlBufferFree(c_buffer) + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_c_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L12;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L18:; + } + /*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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 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_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":72 + * text = c_text + * finally: + * tree.xmlBufferFree(c_buffer) # <<<<<<<<<<<<<< + * return text + * + */ + 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-2.2/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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":76 + * + * + * cdef _tostring(_Element element, encoding, 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_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; + 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; + PyObject *__pyx_t_7 = NULL; + __Pyx_SetupRefcountContext("_tostring"); + __Pyx_INCREF(__pyx_v_encoding); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":89 + * cdef int c_method + * cdef int error_result + * if element is None: # <<<<<<<<<<<<<< + * return None + * c_method = _findOutputMethod(method) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_element) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":90 + * cdef int error_result + * if element is None: + * return None # <<<<<<<<<<<<<< + * c_method = _findOutputMethod(method) + * if c_method == OUTPUT_METHOD_TEXT: + */ + __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-2.2/src/lxml/serializer.pxi":91 + * if element is None: + * return None + * 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[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_method = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":92 + * return None + * 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-2.2/src/lxml/serializer.pxi":93 + * 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[3]; __pyx_lineno = 93; __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-2.2/src/lxml/serializer.pxi":94 + * 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-2.2/src/lxml/serializer.pxi":95 + * 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-2.2/src/lxml/serializer.pxi":97 + * c_enc = NULL + * else: + * encoding = _utf8(encoding) # <<<<<<<<<<<<<< + * c_enc = _cstr(encoding) + * # it is necessary to *and* find the encoding handler *and* use + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __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-2.2/src/lxml/serializer.pxi":98 + * else: + * encoding = _utf8(encoding) + * c_enc = _cstr(encoding) # <<<<<<<<<<<<<< + * # it is necessary to *and* find the encoding handler *and* use + * # encoding during output + */ + __pyx_v_c_enc = PyString_AS_STRING(__pyx_v_encoding); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":101 + * # 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-2.2/src/lxml/serializer.pxi":102 + * # 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') + */ + if ((__pyx_v_enchandler == NULL)) { + __pyx_t_5 = (__pyx_v_c_enc != NULL); + } else { + __pyx_t_5 = (__pyx_v_enchandler == NULL); + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":103 + * 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_5 = (__pyx_v_encoding != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":104 + * 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_kp_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_482)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_482)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_482)); + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __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_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_encoding); + __pyx_v_encoding = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":105 + * 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_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_483), __pyx_v_encoding); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_7, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":106 + * 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-2.2/src/lxml/serializer.pxi":107 + * 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_5 = (__pyx_v_c_buffer == NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":108 + * 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-2.2/src/lxml/serializer.pxi":109 + * if c_buffer is NULL: + * tree.xmlCharEncCloseFunc(enchandler) + * return python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * + * with nogil: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyErr_NoMemory(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 109; __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_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":111 + * return python.PyErr_NoMemory() + * + * with nogil: # <<<<<<<<<<<<<< + * _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_method, + * write_xml_declaration, write_complete_document, + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":114 + * _writeNodeToBuffer(c_buffer, element._c_node, c_enc, 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_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-2.2/src/lxml/serializer.pxi":115 + * 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-2.2/src/lxml/serializer.pxi":116 + * 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_5 = (__pyx_v_c_buffer->conv != NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":117 + * 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_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":119 + * 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_L12:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":121 + * 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-2.2/src/lxml/serializer.pxi":122 + * + * error_result = c_buffer.error + * if error_result != xmlerror.XML_ERR_OK: # <<<<<<<<<<<<<< + * tree.xmlOutputBufferClose(c_buffer) + * _raiseSerialisationError(error_result) + */ + __pyx_t_5 = (__pyx_v_error_result != XML_ERR_OK); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":123 + * 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-2.2/src/lxml/serializer.pxi":124 + * if error_result != xmlerror.XML_ERR_OK: + * tree.xmlOutputBufferClose(c_buffer) + * _raiseSerialisationError(error_result) # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_t_7 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":126 + * _raiseSerialisationError(error_result) + * + * try: # <<<<<<<<<<<<<< + * if encoding is _unicode: + * result = python.PyUnicode_DecodeUTF8( + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":127 + * + * try: + * if encoding is _unicode: # <<<<<<<<<<<<<< + * result = python.PyUnicode_DecodeUTF8( + * tree.xmlBufferContent(c_result_buffer), + */ + __pyx_t_5 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":131 + * tree.xmlBufferContent(c_result_buffer), + * tree.xmlBufferLength(c_result_buffer), + * 'strict') # <<<<<<<<<<<<<< + * else: + * result = python.PyString_FromStringAndSize( + */ + __pyx_t_7 = PyUnicode_DecodeUTF8(xmlBufferContent(__pyx_v_c_result_buffer), xmlBufferLength(__pyx_v_c_result_buffer), __pyx_k_484); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L15;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L17; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":135 + * result = python.PyString_FromStringAndSize( + * tree.xmlBufferContent(c_result_buffer), + * tree.xmlBufferLength(c_result_buffer)) # <<<<<<<<<<<<<< + * finally: + * error_result = tree.xmlOutputBufferClose(c_buffer) + */ + __pyx_t_7 = PyString_FromStringAndSize(xmlBufferContent(__pyx_v_c_result_buffer), xmlBufferLength(__pyx_v_c_result_buffer)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L15;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_7; + __pyx_t_7 = 0; + } + __pyx_L17:; + } + /*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_L16; + __pyx_L15: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":137 + * tree.xmlBufferLength(c_result_buffer)) + * finally: + * error_result = tree.xmlOutputBufferClose(c_buffer) # <<<<<<<<<<<<<< + * if error_result < 0: + * _raiseSerialisationError(error_result) + */ + __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-2.2/src/lxml/serializer.pxi":138 + * finally: + * error_result = tree.xmlOutputBufferClose(c_buffer) + * if error_result < 0: # <<<<<<<<<<<<<< + * _raiseSerialisationError(error_result) + * return result + */ + __pyx_t_5 = (__pyx_v_error_result < 0); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":139 + * error_result = tree.xmlOutputBufferClose(c_buffer) + * if error_result < 0: + * _raiseSerialisationError(error_result) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_7 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L19; + } + __pyx_L19:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":140 + * if error_result < 0: + * _raiseSerialisationError(error_result) + * return result # <<<<<<<<<<<<<< + * + * cdef _raiseSerialisationError(int error_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_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("lxml.etree._tostring"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_encoding); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":142 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_raiseSerialisationError"); + __pyx_v_message = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":143 + * + * 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-2.2/src/lxml/serializer.pxi":144 + * 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[3]; __pyx_lineno = 144; __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-2.2/src/lxml/serializer.pxi":146 + * return python.PyErr_NoMemory() + * else: + * message = ErrorTypes._getName(error_result) # <<<<<<<<<<<<<< + * if message is None: + * message = u"unknown error %d" % error_result + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ErrorTypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp__getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __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[3]; __pyx_lineno = 146; __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(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __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_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":147 + * 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-2.2/src/lxml/serializer.pxi":148 + * message = ErrorTypes._getName(error_result) + * if message is None: + * message = u"unknown error %d" % error_result # <<<<<<<<<<<<<< + * raise SerialisationError, message + * + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_error_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_485), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __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_message); + __pyx_v_message = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":149 + * if message is None: + * message = u"unknown error %d" % error_result + * raise SerialisationError, message # <<<<<<<<<<<<<< + * + * ############################################################ + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_SerialisationError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, __pyx_v_message, 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":154 + * # low-level serialisation functions + * + * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer, # <<<<<<<<<<<<<< + * xmlNode* c_node, char* encoding, 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, 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":162 + * 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-2.2/src/lxml/serializer.pxi":163 + * 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); + } else { + __pyx_t_1 = __pyx_v_write_xml_declaration; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":164 + * c_doc = c_node.doc + * if write_xml_declaration and c_method == OUTPUT_METHOD_XML: + * _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone) # <<<<<<<<<<<<<< + * + * # write internal DTD subset, preceding PIs/comments, etc. + */ + __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-2.2/src/lxml/serializer.pxi":167 + * + * # write internal DTD subset, preceding PIs/comments, etc. + * if write_complete_document: # <<<<<<<<<<<<<< + * _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding) + * _writePrevSiblings(c_buffer, c_node, encoding, pretty_print) + */ + __pyx_t_1 = __pyx_v_write_complete_document; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":168 + * # write internal DTD subset, preceding PIs/comments, etc. + * if write_complete_document: + * _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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":169 + * if write_complete_document: + * _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_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":171 + * _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-2.2/src/lxml/serializer.pxi":172 + * + * 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 + */ + if (!(__pyx_v_c_node->parent == NULL)) { + __pyx_t_1 = (__pyx_v_c_node->parent->type != XML_DOCUMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_node->parent == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":175 + * # 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-2.2/src/lxml/serializer.pxi":176 + * # 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_1 = (__pyx_v_c_nsdecl_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":177 + * 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-2.2/src/lxml/serializer.pxi":178 + * 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_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":179 + * 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-2.2/src/lxml/serializer.pxi":181 + * _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-2.2/src/lxml/serializer.pxi":182 + * + * 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-2.2/src/lxml/serializer.pxi":183 + * 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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":186 + * + * # write node + * if c_method == OUTPUT_METHOD_XML: # <<<<<<<<<<<<<< + * tree.xmlNodeDumpOutput( + * c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding) + */ + __pyx_t_1 = (__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":188 + * if c_method == OUTPUT_METHOD_XML: + * tree.xmlNodeDumpOutput( + * c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding) # <<<<<<<<<<<<<< + * else: + * tree.htmlNodeDumpFormatOutput( + */ + xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, 0, __pyx_v_pretty_print, __pyx_v_encoding); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":191 + * else: + * tree.htmlNodeDumpFormatOutput( + * c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print) # <<<<<<<<<<<<<< + * + * if c_nsdecl_node is not c_node: + */ + htmlNodeDumpFormatOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, __pyx_v_encoding, __pyx_v_pretty_print); + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":193 + * c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print) + * + * if c_nsdecl_node is not c_node: # <<<<<<<<<<<<<< + * # clean up + * c_nsdecl_node.children = c_nsdecl_node.last = NULL + */ + __pyx_t_1 = (__pyx_v_c_nsdecl_node != __pyx_v_c_node); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":195 + * 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-2.2/src/lxml/serializer.pxi":196 + * # 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_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":199 + * + * # write tail, trailing comments, etc. + * if with_tail: # <<<<<<<<<<<<<< + * _writeTail(c_buffer, c_node, encoding, pretty_print) + * if write_complete_document: + */ + __pyx_t_1 = __pyx_v_with_tail; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":200 + * # 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_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":201 + * 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: + */ + __pyx_t_1 = __pyx_v_write_complete_document; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":202 + * _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_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":203 + * if write_complete_document: + * _writeNextSiblings(c_buffer, c_node, encoding, pretty_print) + * if pretty_print: # <<<<<<<<<<<<<< + * tree.xmlOutputBufferWrite(c_buffer, 1, "\n") + * + */ + __pyx_t_1 = __pyx_v_pretty_print; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":204 + * _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_486); + goto __pyx_L11; + } + __pyx_L11:; + + __pyx_L0:; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":206 + * 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-2.2/src/lxml/serializer.pxi":209 + * char* version, char* encoding, + * int standalone) nogil: + * if version is NULL: # <<<<<<<<<<<<<< + * version = "1.0" + * tree.xmlOutputBufferWrite(c_buffer, 15, "\n") + */ + xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_encoding); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":215 + * 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: + */ + switch (__pyx_v_standalone) { + case 0: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":216 + * 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_490); + break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":217 + * 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-2.2/src/lxml/serializer.pxi":218 + * 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_491); + break; + default: + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":220 + * 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_492); + break; + } + +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":222 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":227 + * 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-2.2/src/lxml/serializer.pxi":228 + * 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: + */ + if (!(__pyx_v_c_dtd == NULL)) { + __pyx_t_1 = (__pyx_v_c_dtd->name == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_dtd == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":229 + * 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-2.2/src/lxml/serializer.pxi":230 + * 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, "name) != 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":231 + * return + * if cstd.strcmp(c_root_name, c_dtd.name) != 0: + * return # <<<<<<<<<<<<<< + * tree.xmlOutputBufferWrite(c_buffer, 10, "name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":234 + * tree.xmlOutputBufferWrite(c_buffer, 10, "SystemID != NULL)) { + __pyx_t_1 = ((__pyx_v_c_dtd->SystemID[0]) != '\x00'); + } else { + __pyx_t_1 = (__pyx_v_c_dtd->SystemID != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":235 + * 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) + */ + if ((__pyx_v_c_dtd->ExternalID != NULL)) { + __pyx_t_1 = ((__pyx_v_c_dtd->ExternalID[0]) != '\x00'); + } else { + __pyx_t_1 = (__pyx_v_c_dtd->ExternalID != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":236 + * 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_494); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":237 + * 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-2.2/src/lxml/serializer.pxi":238 + * 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_495); + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":240 + * 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_496); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":241 + * 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-2.2/src/lxml/serializer.pxi":242 + * 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_497); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":243 + * 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: + */ + if ((__pyx_v_c_dtd->entities == NULL)) { + if ((__pyx_v_c_dtd->elements == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":244 + * 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') + */ + if ((__pyx_v_c_dtd->attributes == NULL)) { + if ((__pyx_v_c_dtd->notations == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":245 + * 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_1 = (__pyx_v_c_dtd->pentities == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_dtd->notations == NULL); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_dtd->attributes == NULL); + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = (__pyx_v_c_dtd->elements == NULL); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_dtd->entities == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":246 + * 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_498); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":247 + * 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-2.2/src/lxml/serializer.pxi":248 + * 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_499); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":249 + * return + * tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n') + * if c_dtd.notations != NULL: # <<<<<<<<<<<<<< + * tree.xmlDumpNotationTable(c_buffer.buffer, + * c_dtd.notations) + */ + __pyx_t_2 = (__pyx_v_c_dtd->notations != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":251 + * if c_dtd.notations != NULL: + * tree.xmlDumpNotationTable(c_buffer.buffer, + * 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-2.2/src/lxml/serializer.pxi":252 + * tree.xmlDumpNotationTable(c_buffer.buffer, + * 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-2.2/src/lxml/serializer.pxi":253 + * 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-2.2/src/lxml/serializer.pxi":254 + * 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-2.2/src/lxml/serializer.pxi":255 + * 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-2.2/src/lxml/serializer.pxi":256 + * 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_500); + + __pyx_L0:; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":258 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":261 + * 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-2.2/src/lxml/serializer.pxi":262 + * 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) { + if ((__pyx_v_c_node != NULL)) { + __pyx_t_1 = (__pyx_v_c_node->type == XML_TEXT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_node != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":264 + * 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-2.2/src/lxml/serializer.pxi":265 + * 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-2.2/src/lxml/serializer.pxi":267 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":270 + * 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 + */ + if ((__pyx_v_c_node->parent != NULL)) { + __pyx_t_1 = _isElement(__pyx_v_c_node->parent); + } else { + __pyx_t_1 = (__pyx_v_c_node->parent != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":271 + * 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-2.2/src/lxml/serializer.pxi":273 + * 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-2.2/src/lxml/serializer.pxi":274 + * # 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) { + if ((__pyx_v_c_sibling->prev != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":275 + * 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 + */ + if (!(__pyx_v_c_sibling->prev->type == XML_PI_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":276 + * 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_1 = (__pyx_v_c_sibling->prev->type == XML_COMMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_sibling->prev->type == XML_PI_NODE); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_sibling->prev != NULL); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":277 + * (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-2.2/src/lxml/serializer.pxi":278 + * 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_2 = (__pyx_v_c_sibling != __pyx_v_c_node); + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":280 + * 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-2.2/src/lxml/serializer.pxi":281 + * 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 + */ + __pyx_t_2 = __pyx_v_pretty_print; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":282 + * pretty_print, encoding) + * if pretty_print: + * tree.xmlOutputBufferWriteString(c_buffer, "\n") # <<<<<<<<<<<<<< + * c_sibling = c_sibling.next + * + */ + xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k_501); + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":283 + * 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-2.2/src/lxml/serializer.pxi":285 + * 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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":288 + * 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 + */ + if ((__pyx_v_c_node->parent != NULL)) { + __pyx_t_1 = _isElement(__pyx_v_c_node->parent); + } else { + __pyx_t_1 = (__pyx_v_c_node->parent != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":289 + * 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-2.2/src/lxml/serializer.pxi":291 + * 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-2.2/src/lxml/serializer.pxi":292 + * # 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) { + if ((__pyx_v_c_sibling != NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":293 + * 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: + */ + if (!(__pyx_v_c_sibling->type == XML_PI_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":294 + * 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_1 = (__pyx_v_c_sibling->type == XML_COMMENT_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_sibling->type == XML_PI_NODE); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_sibling != NULL); + } + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":295 + * (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, + */ + __pyx_t_2 = __pyx_v_pretty_print; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":296 + * 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_502); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":298 + * 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-2.2/src/lxml/serializer.pxi":299 + * 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-2.2/src/lxml/serializer.pxi":309 + * cdef _ExceptionContext _exc_context + * cdef _ErrorLog error_log + * def __init__(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___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___init__(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; + PyObject *__pyx_1 = 0; + 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_kp_filelike,&__pyx_kp_exc_context,&__pyx_kp_compression,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = Py_None; + values[2] = 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_kp_filelike); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_exc_context); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_compression); + if (unlikely(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[3]; __pyx_lineno = 309; __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 = Py_None; + __pyx_v_compression = 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("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_filelike); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":310 + * cdef _ErrorLog error_log + * def __init__(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[3]; __pyx_lineno = 310; __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[3]; __pyx_lineno = 310; __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-2.2/src/lxml/serializer.pxi":311 + * def __init__(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_kp_GzipFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":312 + * 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_1, __pyx_kp_fileobj, __pyx_v_filelike) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_mode, ((PyObject *)__pyx_kp_503)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_compresslevel, __pyx_v_compression) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __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_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_filelike); + __pyx_v_filelike = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":313 + * 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_5 = PyObject_GetAttr(__pyx_v_filelike, __pyx_kp_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __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_5; + __pyx_t_5 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":314 + * 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-2.2/src/lxml/serializer.pxi":315 + * 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-2.2/src/lxml/serializer.pxi":316 + * self._filelike = filelike + * if exc_context is None: + * self._exc_context = _ExceptionContext() # <<<<<<<<<<<<<< + * else: + * self._exc_context = exc_context + */ + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__ExceptionContext))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); + __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_5); + __pyx_t_5 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":318 + * self._exc_context = _ExceptionContext() + * else: + * self._exc_context = exc_context # <<<<<<<<<<<<<< + * self.error_log = _ErrorLog() + * + */ + if (!(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 318; __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-2.2/src/lxml/serializer.pxi":319 + * else: + * self._exc_context = exc_context + * self.error_log = _ErrorLog() # <<<<<<<<<<<<<< + * + * cdef tree.xmlOutputBuffer* _createOutputBuffer( + */ + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); + __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_5); + __pyx_t_5 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_filelike); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":321 + * 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_SetupRefcountContext("_createOutputBuffer"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":326 + * c_buffer = tree.xmlOutputBufferCreateIO( + * _writeFilelikeWriter, _closeFilelikeWriter, + * 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-2.2/src/lxml/serializer.pxi":327 + * _writeFilelikeWriter, _closeFilelikeWriter, + * 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-2.2/src/lxml/serializer.pxi":328 + * 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_504), 0); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":329 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":331 + * 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_SetupRefcountContext("write"); + __pyx_v_py_buffer = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":332 + * + * 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-2.2/src/lxml/serializer.pxi":333 + * cdef int write(self, char* c_buffer, int size): + * try: + * if self._filelike is None: # <<<<<<<<<<<<<< + * raise IOError, u"File is already closed" + * py_buffer = python.PyString_FromStringAndSize(c_buffer, size) + */ + __pyx_t_1 = (__pyx_v_self->_filelike == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":334 + * try: + * if self._filelike is None: + * raise IOError, u"File is already closed" # <<<<<<<<<<<<<< + * py_buffer = python.PyString_FromStringAndSize(c_buffer, size) + * self._filelike.write(py_buffer) + */ + __Pyx_Raise(__pyx_builtin_IOError, ((PyObject *)__pyx_kp_505), 0); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":335 + * if self._filelike is None: + * raise IOError, u"File is already closed" + * py_buffer = python.PyString_FromStringAndSize(c_buffer, size) # <<<<<<<<<<<<<< + * self._filelike.write(py_buffer) + * return size + */ + __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_c_buffer, __pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_py_buffer); + __pyx_v_py_buffer = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":336 + * raise IOError, u"File is already closed" + * py_buffer = python.PyString_FromStringAndSize(c_buffer, size) + * self._filelike.write(py_buffer) # <<<<<<<<<<<<<< + * return size + * except: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_filelike, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 336; __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[3]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_py_buffer); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_py_buffer); + __Pyx_GIVEREF(__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[3]; __pyx_lineno = 336; __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-2.2/src/lxml/serializer.pxi":337 + * py_buffer = python.PyString_FromStringAndSize(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_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_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-2.2/src/lxml/serializer.pxi":338 + * self._filelike.write(py_buffer) + * return size + * except: # <<<<<<<<<<<<<< + * self._exc_context._store_raised() + * return -1 + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree.write"); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 338; __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-2.2/src/lxml/serializer.pxi":339 + * 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-2.2/src/lxml/serializer.pxi":340 + * 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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":342 + * 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_SetupRefcountContext("close"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":343 + * + * 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-2.2/src/lxml/serializer.pxi":344 + * 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-2.2/src/lxml/serializer.pxi":345 + * 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[3]; __pyx_lineno = 345; __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-2.2/src/lxml/serializer.pxi":347 + * 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-2.2/src/lxml/serializer.pxi":348 + * # 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_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_L0; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":349 + * self._filelike = None + * return 0 + * except: # <<<<<<<<<<<<<< + * self._exc_context._store_raised() + * return -1 + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree.close"); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 349; __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-2.2/src/lxml/serializer.pxi":350 + * 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-2.2/src/lxml/serializer.pxi":351 + * 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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":353 + * 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_SetupRefcountContext("_writeFilelikeWriter"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":354 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":356 + * 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_SetupRefcountContext("_closeFilelikeWriter"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":357 + * + * cdef int _closeFilelikeWriter(void* ctxt): + * return (<_FilelikeWriter>ctxt).close() # <<<<<<<<<<<<<< + * + * cdef _tofilelike(f, _Element element, encoding, 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":359 + * return (<_FilelikeWriter>ctxt).close() + * + * cdef _tofilelike(f, _Element element, encoding, 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_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; + int __pyx_v_error_result; + PyObject *__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; + PyObject *__pyx_1 = 0; + 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_SetupRefcountContext("_tofilelike"); + __Pyx_INCREF(__pyx_v_f); + __Pyx_INCREF(__pyx_v_encoding); + __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_c_method = 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-2.2/src/lxml/serializer.pxi":363 + * 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-2.2/src/lxml/serializer.pxi":369 + * cdef char* c_enc + * 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-2.2/src/lxml/serializer.pxi":370 + * 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-2.2/src/lxml/serializer.pxi":372 + * c_enc = NULL + * else: + * encoding = _utf8(encoding) # <<<<<<<<<<<<<< + * c_enc = _cstr(encoding) + * c_method = _findOutputMethod(method) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 372; __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-2.2/src/lxml/serializer.pxi":373 + * else: + * encoding = _utf8(encoding) + * c_enc = _cstr(encoding) # <<<<<<<<<<<<<< + * c_method = _findOutputMethod(method) + * if c_method == OUTPUT_METHOD_TEXT: + */ + __pyx_v_c_enc = PyString_AS_STRING(__pyx_v_encoding); + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":374 + * encoding = _utf8(encoding) + * c_enc = _cstr(encoding) + * 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[3]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_c_method); + __pyx_v_c_method = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":375 + * c_enc = _cstr(encoding) + * c_method = _findOutputMethod(method) + * if c_method == OUTPUT_METHOD_TEXT: # <<<<<<<<<<<<<< + * data = _textToString(element._c_node, encoding, with_tail) + * if compression: + */ + __pyx_t_2 = PyInt_FromLong(__pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_c_method, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":376 + * 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_4 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_data); + __pyx_v_data = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":377 + * if c_method == OUTPUT_METHOD_TEXT: + * data = _textToString(element._c_node, encoding, with_tail) + * if compression: # <<<<<<<<<<<<<< + * bytes_out = BytesIO() + * gzip_file = gzip.GzipFile( + */ + __pyx_t_3 = __pyx_v_compression; + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":378 + * 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_4 = PyObject_Call(__pyx_v_4lxml_5etree_BytesIO, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_bytes_out); + __pyx_v_bytes_out = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":379 + * if compression: + * bytes_out = BytesIO() + * gzip_file = gzip.GzipFile( # <<<<<<<<<<<<<< + * fileobj=bytes_out, mode=u'wb', compresslevel=compression) + * try: + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree_gzip, __pyx_kp_GzipFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":380 + * bytes_out = BytesIO() + * gzip_file = gzip.GzipFile( + * fileobj=bytes_out, mode=u'wb', compresslevel=compression) # <<<<<<<<<<<<<< + * try: + * gzip_file.write(data) + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_fileobj, __pyx_v_bytes_out) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_mode, ((PyObject *)__pyx_kp_506)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_1, __pyx_kp_compresslevel, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __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_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_gzip_file); + __pyx_v_gzip_file = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":381 + * 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-2.2/src/lxml/serializer.pxi":382 + * fileobj=bytes_out, mode=u'wb', compresslevel=compression) + * try: + * gzip_file.write(data) # <<<<<<<<<<<<<< + * finally: + * gzip_file.close() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_gzip_file, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7;} + __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[3]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7;} + __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; + } + /*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_1); __pyx_1 = 0; + __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_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":384 + * gzip_file.write(data) + * finally: + * gzip_file.close() # <<<<<<<<<<<<<< + * data = bytes_out + * if _isString(f): + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_gzip_file, __pyx_kp_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L9_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[3]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L9_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_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-2.2/src/lxml/serializer.pxi":385 + * 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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":386 + * 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-2.2/src/lxml/serializer.pxi":387 + * 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[3]; __pyx_lineno = 387; __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-2.2/src/lxml/serializer.pxi":388 + * 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[3]; __pyx_lineno = 388; __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_kp_507)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_507)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_507)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 388; __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_f); + __pyx_v_f = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":389 + * filename8 = _encodeFilename(f) + * f = open(filename8, u'wb') + * try: # <<<<<<<<<<<<<< + * f.write(data) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":390 + * f = open(filename8, u'wb') + * try: + * f.write(data) # <<<<<<<<<<<<<< + * finally: + * f.close() + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_kp_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13;} + __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[3]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13;} + __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; + } + /*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_1); __pyx_1 = 0; + __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_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":392 + * f.write(data) + * finally: + * f.close() # <<<<<<<<<<<<<< + * else: + * f.write(data) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_kp_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L15_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[3]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L15_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_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_L1_error; + __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_L1_error; + } + } + } + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":394 + * f.close() + * else: + * f.write(data) # <<<<<<<<<<<<<< + * return + * enchandler = tree.xmlFindCharEncodingHandler(c_enc) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_kp_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":395 + * 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_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":396 + * 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-2.2/src/lxml/serializer.pxi":397 + * 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-2.2/src/lxml/serializer.pxi":398 + * 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-2.2/src/lxml/serializer.pxi":399 + * if enchandler is NULL: + * if encoding is not None: + * encoding = encoding.decode(u'UTF-8') # <<<<<<<<<<<<<< + * raise LookupError, u"unknown encoding: '%s'" % encoding + * + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_encoding, __pyx_kp_decode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_508)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_508)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_508)); + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_v_encoding); + __pyx_v_encoding = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":400 + * if encoding is not None: + * encoding = encoding.decode(u'UTF-8') + * raise LookupError, u"unknown encoding: '%s'" % encoding # <<<<<<<<<<<<<< + * + * if _isString(f): + */ + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_509), __pyx_v_encoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":402 + * 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-2.2/src/lxml/serializer.pxi":403 + * + * if _isString(f): + * filename8 = _encodeFilename(f) # <<<<<<<<<<<<<< + * c_buffer = tree.xmlOutputBufferCreateFilename( + * _cstr(filename8), enchandler, compression) + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 403; __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-2.2/src/lxml/serializer.pxi":405 + * 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(PyString_AS_STRING(__pyx_v_filename8), __pyx_v_enchandler, __pyx_v_compression); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":406 + * 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-2.2/src/lxml/serializer.pxi":407 + * _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_4 = PyErr_SetFromErrno(__pyx_builtin_IOError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 407; __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_L20; + } + __pyx_L20:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":408 + * 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_L19; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":409 + * 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_kp_510)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":410 + * state = python.PyEval_SaveThread() + * elif hasattr(f, u'write'): + * writer = _FilelikeWriter(f, compression=compression) # <<<<<<<<<<<<<< + * c_buffer = writer._createOutputBuffer(enchandler) + * else: + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_1, __pyx_kp_compression, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FilelikeWriter)), ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __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_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__FilelikeWriter))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_writer)); + __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":411 + * 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[3]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_buffer = __pyx_t_6; + goto __pyx_L19; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":413 + * 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-2.2/src/lxml/serializer.pxi":415 + * 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_method, + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(_fqtypename(__pyx_v_f)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_511), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L19:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":417 + * u"File or filename expected, got '%s'" % funicode(python._fqtypename(f)) + * + * _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_method, # <<<<<<<<<<<<<< + * write_xml_declaration, write_doctype, + * pretty_print, with_tail, standalone) + */ + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_c_method); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":419 + * _writeNodeToBuffer(c_buffer, element._c_node, c_enc, 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_t_3, __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-2.2/src/lxml/serializer.pxi":420 + * 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-2.2/src/lxml/serializer.pxi":421 + * 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-2.2/src/lxml/serializer.pxi":422 + * 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-2.2/src/lxml/serializer.pxi":423 + * 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-2.2/src/lxml/serializer.pxi":424 + * 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_L22; + } + __pyx_L22:; + goto __pyx_L21; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":426 + * 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_L21:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":427 + * 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-2.2/src/lxml/serializer.pxi":428 + * 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_L23; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":430 + * 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[3]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L23:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":431 + * 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-2.2/src/lxml/serializer.pxi":432 + * 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_4 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L24; + } + __pyx_L24:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_c_method); + __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_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":434 + * _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; + PyObject *__pyx_v_errors; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + xmlDoc *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + xmlOutputBuffer *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_SetupRefcountContext("_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 = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":441 + * 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-2.2/src/lxml/serializer.pxi":443 + * 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-2.2/src/lxml/serializer.pxi":444 + * + * 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[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":445 + * 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-2.2/src/lxml/serializer.pxi":446 + * 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-2.2/src/lxml/serializer.pxi":447 + * 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[3]; __pyx_lineno = 447; __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-2.2/src/lxml/serializer.pxi":448 + * if _isString(f): + * filename8 = _encodeFilename(f) + * c_filename = _cstr(filename8) # <<<<<<<<<<<<<< + * with nogil: + * bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL, + */ + __pyx_v_c_filename = PyString_AS_STRING(__pyx_v_filename8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":449 + * filename8 = _encodeFilename(f) + * c_filename = _cstr(filename8) + * with nogil: # <<<<<<<<<<<<<< + * bytes = c14n.xmlC14NDocSave(c_doc, NULL, exclusive, NULL, + * with_comments, c_filename, compression) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":451 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + goto __pyx_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":452 + * 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_kp_512)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L4;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":453 + * 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[3]; __pyx_lineno = 453; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_4 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_1, __pyx_kp_compression, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FilelikeWriter)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__FilelikeWriter))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L4;} + __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-2.2/src/lxml/serializer.pxi":454 + * 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_5 = ((struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *)__pyx_v_writer->__pyx_vtab)->_createOutputBuffer(__pyx_v_writer, NULL); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L4;} + __pyx_v_c_buffer = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":455 + * 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-2.2/src/lxml/serializer.pxi":457 + * 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-2.2/src/lxml/serializer.pxi":458 + * 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-2.2/src/lxml/serializer.pxi":459 + * 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-2.2/src/lxml/serializer.pxi":460 + * 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-2.2/src/lxml/serializer.pxi":462 + * 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-2.2/src/lxml/serializer.pxi":465 + * else: + * raise TypeError, \ + * u"File or filename expected, got '%s'" % funicode(python._fqtypename(f)) # <<<<<<<<<<<<<< + * finally: + * _destroyFakeDoc(c_base_doc, c_doc) + */ + __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(_fqtypename(__pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_513), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L4;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L4;} + } + __pyx_L6:; + } + /*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_1); __pyx_1 = 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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":467 + * u"File or filename expected, got '%s'" % funicode(python._fqtypename(f)) + * finally: + * _destroyFakeDoc(c_base_doc, c_doc) # <<<<<<<<<<<<<< + * + * if writer is not None: + */ + __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-2.2/src/lxml/serializer.pxi":469 + * _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-2.2/src/lxml/serializer.pxi":470 + * + * if writer is not None: + * writer._exc_context._raise_if_stored() # <<<<<<<<<<<<<< + * + * if bytes < 0: + */ + __pyx_t_6 = ((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_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":472 + * 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-2.2/src/lxml/serializer.pxi":473 + * + * if bytes < 0: + * message = u"C14N failed" # <<<<<<<<<<<<<< + * if writer is not None: + * errors = writer.error_log + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_514)); + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = ((PyObject *)__pyx_kp_514); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":474 + * 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-2.2/src/lxml/serializer.pxi":475 + * 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(__pyx_v_errors); + __pyx_v_errors = ((PyObject *)__pyx_v_writer->error_log); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":476 + * if writer is not None: + * errors = writer.error_log + * if len(errors): # <<<<<<<<<<<<<< + * message = errors[0].message + * raise C14NError, message + */ + __pyx_t_7 = PyObject_Length(__pyx_v_errors); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":477 + * errors = writer.error_log + * if len(errors): + * message = errors[0].message # <<<<<<<<<<<<<< + * raise C14NError, message + * + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_errors, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":478 + * if len(errors): + * message = errors[0].message + * raise C14NError, message # <<<<<<<<<<<<<< + * + * # dump node to file (mainly for debug) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_60); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, __pyx_v_message, 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 478; __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_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __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(__pyx_v_errors); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":482 + * # 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_SetupRefcountContext("_dumpToFile"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":485 + * 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-2.2/src/lxml/serializer.pxi":486 + * 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-2.2/src/lxml/serializer.pxi":487 + * 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_515), 0); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":488 + * 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-2.2/src/lxml/serializer.pxi":489 + * 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-2.2/src/lxml/serializer.pxi":490 + * 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: + */ + __pyx_t_1 = __pyx_v_with_tail; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":491 + * 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-2.2/src/lxml/serializer.pxi":492 + * 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-2.2/src/lxml/serializer.pxi":494 + * if not pretty_print: + * # not written yet + * tree.xmlOutputBufferWriteString(c_buffer, '\n') # <<<<<<<<<<<<<< + * tree.xmlOutputBufferFlush(c_buffer) + */ + xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k_516); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":495 + * # 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_buildIterparseEventFilter"); + __pyx_v_event = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_3 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_517), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_e_4lxml_5etree_ITERPARSE_FILTER_START; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_518), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_e_4lxml_5etree_ITERPARSE_FILTER_END; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_519), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_e_4lxml_5etree_ITERPARSE_FILTER_START_NS; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_520), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_e_4lxml_5etree_ITERPARSE_FILTER_END_NS; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_521), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_e_4lxml_5etree_ITERPARSE_FILTER_COMMENT; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_522), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_e_4lxml_5etree_ITERPARSE_FILTER_PI; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_523), __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(__pyx_t_3); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_countNsDefs"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_appendStartNsEvents"); + __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ns_tuple = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/src/lxml/iterparse.pxi":50 + * while c_ns is not NULL: + * if c_ns.prefix is NULL: + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * prefix = u'' + * else: + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":51 + * if c_ns.prefix is NULL: + * if python.IS_PYTHON3: + * prefix = u'' # <<<<<<<<<<<<<< + * else: + * prefix = '' + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_524)); + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = ((PyObject *)__pyx_kp_524); + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":53 + * prefix = u'' + * else: + * prefix = '' # <<<<<<<<<<<<<< + * else: + * prefix = funicode(c_ns.prefix) + */ + __Pyx_INCREF(__pyx_kp_525); + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_kp_525; + } + __pyx_L6:; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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(__pyx_v_ns_tuple); + __pyx_v_ns_tuple = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + */ + __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_526)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_526)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_526)); + __Pyx_INCREF(__pyx_v_ns_tuple); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_ns_tuple); + __Pyx_GIVEREF(__pyx_v_ns_tuple); + __pyx_t_4 = PyList_Append(((PyObject *)__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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":82 + * cdef char* _tag_name + * + * def __init__(self): # <<<<<<<<<<<<<< + * self._ns_stack = [] + * self._pop_ns = self._ns_stack.pop + */ + +static int __pyx_pf_4lxml_5etree_17_IterparseContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_17_IterparseContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/iterparse.pxi":83 + * + * def __init__(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-2.2/src/lxml/iterparse.pxi":84 + * def __init__(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_kp_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-2.2/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-2.2/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_kp_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-2.2/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-2.2/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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + __Pyx_SetupRefcountContext("_initParserContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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 | \ + */ + if (!(__pyx_v_self->_event_filter == 0)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_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)); + } else { + __pyx_t_1 = (__pyx_v_self->_event_filter == 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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): + */ + if (!(__pyx_v_self->_event_filter == 0)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_v_self->_event_filter == 0); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/src/lxml/iterparse.pxi":115 + * + * self._origSaxComment = sax.comment + * if self._event_filter & ITERPARSE_FILTER_COMMENT: # <<<<<<<<<<<<<< + * sax.comment = _iterparseSaxComment + * + */ + __pyx_t_2 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_COMMENT); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/iterparse.pxi":119 + * + * self._origSaxPI = sax.processingInstruction + * if self._event_filter & ITERPARSE_FILTER_PI: # <<<<<<<<<<<<<< + * sax.processingInstruction = _iterparseSaxPI + * + */ + __pyx_t_2 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_PI); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("_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-2.2/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-2.2/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 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_kp_527), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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 == '*': + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->_tag_tuple); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_tag_tuple)); + __pyx_v_self->_tag_tuple = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":129 + * else: + * self._tag_tuple = _getNsTag(tag) + * href, name = self._tag_tuple # <<<<<<<<<<<<<< + * if href is None or href == '*': + * 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_href); + __pyx_v_href = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 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-2.2/src/lxml/iterparse.pxi":130 + * self._tag_tuple = _getNsTag(tag) + * href, name = self._tag_tuple + * if href is None or href == '*': # <<<<<<<<<<<<<< + * self._tag_href = NULL + * else: + */ + __pyx_t_5 = (__pyx_v_href == Py_None); + if (!__pyx_t_5) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_href, __pyx_kp_528, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); 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_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_t_2; + } else { + __pyx_t_4 = __pyx_t_5; + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":131 + * href, name = self._tag_tuple + * if href is None or href == '*': + * 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-2.2/src/lxml/iterparse.pxi":133 + * self._tag_href = NULL + * else: + * self._tag_href = _cstr(href) # <<<<<<<<<<<<<< + * if name is None or name == '*': + * self._tag_name = NULL + */ + __pyx_v_self->_tag_href = PyString_AS_STRING(__pyx_v_href); + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":134 + * else: + * self._tag_href = _cstr(href) + * if name is None or name == '*': # <<<<<<<<<<<<<< + * self._tag_name = NULL + * else: + */ + __pyx_t_4 = (__pyx_v_name == Py_None); + if (!__pyx_t_4) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_name, __pyx_kp_529, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_2 = __pyx_t_4; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":135 + * self._tag_href = _cstr(href) + * if name is None or name == '*': + * 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-2.2/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 = PyString_AS_STRING(__pyx_v_name); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + * + */ + if ((__pyx_v_self->_tag_href == NULL)) { + __pyx_t_2 = (__pyx_v_self->_tag_name == NULL); + } else { + __pyx_t_2 = (__pyx_v_self->_tag_href == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_v_node; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("startNode"); + __pyx_v_node = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_v_ns_count = __pyx_f_4lxml_5etree__appendStartNsEvents(__pyx_v_c_node, __pyx_v_self->_events); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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: + */ + __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(((PyObject *)__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-2.2/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-2.2/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-2.2/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-2.2/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 (!(__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-2.2/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-2.2/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); + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_f_4lxml_5etree__elementFactory(__pyx_v_self->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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) ) + */ + __pyx_t_1 = PyList_Append(((PyObject *)__pyx_v_self->_node_stack), __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-2.2/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-2.2/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 + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_530)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_530)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_530)); + __Pyx_INCREF(__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_node); + __Pyx_GIVEREF(__pyx_v_node); + __pyx_t_1 = PyList_Append(((PyObject *)__pyx_v_self->_events), ((PyObject *)__pyx_t_2)); 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_2)); __pyx_t_2 = 0; + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_AddTraceback("lxml.etree._IterparseContext.startNode"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_node); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_v_i; + int __pyx_r; + long __pyx_1; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_SetupRefcountContext("endNode"); + __pyx_v_node = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_event = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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); + } else { + __pyx_t_3 = __pyx_t_2; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_4 = PyObject_Call(__pyx_v_self->_pop_node, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = (((PyObject *)__pyx_v_self->_root) == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = (((PyObject *)__pyx_v_self->_doc) == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_node->doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_doc); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc)); + __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = ((struct __pyx_vtabstruct_4lxml_5etree__Document *)__pyx_v_self->_doc->__pyx_vtab)->getroot(__pyx_v_self->_doc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_root); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_root)); + __pyx_v_self->_root = ((struct LxmlElement *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_self->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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: + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_531)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_531)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_531)); + __Pyx_INCREF(__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_node); + __Pyx_GIVEREF(__pyx_v_node); + __pyx_t_1 = PyList_Append(((PyObject *)__pyx_v_self->_events), ((PyObject *)__pyx_t_4)); 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_4)); __pyx_t_4 = 0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_4 = PyObject_Call(__pyx_v_self->_pop_ns, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_t_4); 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_4); __pyx_t_4 = 0; + __pyx_v_ns_count = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = (__pyx_v_ns_count > 0); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_532)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_532)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_532)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_DECREF(__pyx_v_event); + __pyx_v_event = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = 0; __pyx_1 < __pyx_t_1; __pyx_1++) { + __pyx_t_4 = PyInt_FromLong(__pyx_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":186 + * event = (u"end-ns", None) + * for i from 0 <= i < ns_count: + * self._events.append(event) # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_self->_events), __pyx_v_event); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = PyInt_FromLong(__pyx_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4); + __Pyx_AddTraceback("lxml.etree._IterparseContext.endNode"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_node); + __Pyx_DECREF(__pyx_v_event); + __Pyx_DECREF(__pyx_v_i); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_v_node; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("pushEvent"); + __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_node = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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 (!(__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-2.2/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); + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_f_4lxml_5etree__elementFactory(__pyx_v_self->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":197 + * self._root = root + * node = _elementFactory(self._doc, c_node) + * self._events.append( (event, node) ) # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_event); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_event); + __Pyx_GIVEREF(__pyx_v_event); + __Pyx_INCREF(__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_node); + __Pyx_GIVEREF(__pyx_v_node); + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_self->_events), ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_AddTraceback("lxml.etree._IterparseContext.pushEvent"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_root); + __Pyx_DECREF(__pyx_v_node); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + __Pyx_SetupRefcountContext("_assureDocGetsFreed"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + */ + if ((__pyx_v_self->__pyx_base._c_ctxt->myDoc != NULL)) { + __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_self->__pyx_base._c_ctxt->myDoc != NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":206 + * + * + * cdef inline void _pushSaxStartEvent(_IterparseContext context, # <<<<<<<<<<<<<< + * xmlNode* c_node): + * try: + */ + +static 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; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("_pushSaxStartEvent"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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) + */ + __pyx_t_1 = __pyx_v_context->__pyx_base._c_ctxt->html; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_2 = ((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_2 == -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-2.2/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_3, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_context->__pyx_base._c_ctxt->errNo == XML_ERR_OK); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L4_exception_handled; + } + __pyx_L5_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("lxml.etree._pushSaxStartEvent"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":218 + * context._store_raised() + * + * cdef inline void _pushSaxEndEvent(_IterparseContext context, # <<<<<<<<<<<<<< + * xmlNode* c_node): + * try: + */ + +static 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_SetupRefcountContext("_pushSaxEndEvent"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":228 + * context._store_raised() + * + * cdef inline void _pushSaxEvent(_IterparseContext context, # <<<<<<<<<<<<<< + * event, xmlNode* c_node): + * try: + */ + +static 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_SetupRefcountContext("_pushSaxEvent"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_iterparseSaxStart"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":244 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _IterparseContext context + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * context = <_IterparseContext>c_ctxt._private + * context._origSaxStart( + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":245 + * cdef _IterparseContext context + * c_ctxt = 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-2.2/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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_iterparseSaxEnd"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":255 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":256 + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":257 + * c_ctxt = 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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_iterparseSaxStartNoNs"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":263 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":264 + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":265 + * c_ctxt = 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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_iterparseSaxEndNoNs"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":271 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":272 + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":273 + * c_ctxt = 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-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_iterparseSaxComment"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":280 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _IterparseContext context + * c_ctxt = ctxt # <<<<<<<<<<<<<< + * context = <_IterparseContext>c_ctxt._private + * context._origSaxComment(ctxt, text) + */ + __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":281 + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":282 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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_kp_533), __pyx_v_c_node); + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_iterparseSaxPI"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":291 + * cdef xmlparser.xmlParserCtxt* c_ctxt + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":292 + * cdef _IterparseContext context + * c_ctxt = 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-2.2/src/lxml/iterparse.pxi":293 + * c_ctxt = 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-2.2/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-2.2/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-2.2/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_kp_534), __pyx_v_c_node); + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 INLINE xmlNode *__pyx_f_4lxml_5etree__iterparseFindLastNode(xmlParserCtxt *__pyx_v_c_ctxt) { + xmlNode *__pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_iterparseFindLastNode"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":363 + * cdef int (*_parse_chunk)(xmlparser.xmlParserCtxt* ctxt, + * 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; + PyObject *__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_kp_source,&__pyx_kp_events,&__pyx_kp_tag,&__pyx_kp_attribute_defaults,&__pyx_kp_dtd_validation,&__pyx_kp_load_dtd,&__pyx_kp_no_network,&__pyx_kp_remove_blank_text,&__pyx_kp_compact,&__pyx_kp_resolve_entities,&__pyx_kp_remove_comments,&__pyx_kp_remove_pis,&__pyx_kp_strip_cdata,&__pyx_kp_encoding,&__pyx_kp_html,&__pyx_kp_huge_tree,&__pyx_kp_schema,0}; + __Pyx_SetupRefcountContext("__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] = __pyx_k_152; + values[2] = Py_None; + values[3] = __pyx_k_153; + values[4] = __pyx_k_154; + values[5] = __pyx_k_155; + values[6] = __pyx_k_156; + values[7] = __pyx_k_157; + values[8] = __pyx_k_158; + values[9] = __pyx_k_159; + values[10] = __pyx_k_160; + values[11] = __pyx_k_161; + values[12] = __pyx_k_162; + values[13] = Py_None; + values[14] = __pyx_k_163; + values[15] = __pyx_k_164; + 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_kp_source); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_events); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_attribute_defaults); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_dtd_validation); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_load_dtd); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_no_network); + if (value) { values[6] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_blank_text); + if (value) { values[7] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_compact); + if (value) { values[8] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_resolve_entities); + if (value) { values[9] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_comments); + if (value) { values[10] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_remove_pis); + if (value) { values[11] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_strip_cdata); + if (value) { values[12] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_encoding); + if (value) { values[13] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_html); + if (value) { values[14] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_huge_tree); + if (value) { values[15] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 363; __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 { + __pyx_v_events = __pyx_k_152; + __pyx_v_tag = Py_None; + __pyx_v_attribute_defaults = __pyx_k_153; + __pyx_v_dtd_validation = __pyx_k_154; + __pyx_v_load_dtd = __pyx_k_155; + __pyx_v_no_network = __pyx_k_156; + __pyx_v_remove_blank_text = __pyx_k_157; + __pyx_v_compact = __pyx_k_158; + __pyx_v_resolve_entities = __pyx_k_159; + __pyx_v_remove_comments = __pyx_k_160; + __pyx_v_remove_pis = __pyx_k_161; + __pyx_v_strip_cdata = __pyx_k_162; + __pyx_v_encoding = Py_None; + __pyx_v_html = __pyx_k_163; + __pyx_v_huge_tree = __pyx_k_164; + __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 = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.iterparse.__init__"); + 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_error = 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 = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":372 + * 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_kp_535)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":373 + * 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 = 373; __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-2.2/src/lxml/iterparse.pxi":374 + * 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-2.2/src/lxml/iterparse.pxi":375 + * 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-2.2/src/lxml/iterparse.pxi":376 + * 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 = 376; __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_kp_536)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_536)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_536)); + __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 = 376; __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-2.2/src/lxml/iterparse.pxi":378 + * 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 = 378; __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 = 378; __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-2.2/src/lxml/iterparse.pxi":380 + * 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-2.2/src/lxml/iterparse.pxi":381 + * + * 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 = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":383 + * 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 = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":384 + * # 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 = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + for (;;) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":383 + * 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 = 383; __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-2.2/src/lxml/iterparse.pxi":384 + * # 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_6 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_537), Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __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 = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { + __pyx_t_6 = PyObject_RichCompare(__pyx_v_event, ((PyObject *)__pyx_kp_538), Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __pyx_t_1; + } else { + __pyx_t_7 = __pyx_t_2; + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":383 + * 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_8 = PyList_Append(__pyx_t_3, (PyObject*)__pyx_v_event); if (unlikely(__pyx_t_8)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 383; __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 = 383; __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-2.2/src/lxml/iterparse.pxi":386 + * 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-2.2/src/lxml/iterparse.pxi":387 + * + * 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-2.2/src/lxml/iterparse.pxi":389 + * 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-2.2/src/lxml/iterparse.pxi":390 + * + * 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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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: + * 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-2.2/src/lxml/iterparse.pxi":392 + * 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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":394 + * 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-2.2/src/lxml/iterparse.pxi":395 + * 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 = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":397 + * 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-2.2/src/lxml/iterparse.pxi":398 + * 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 = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":399 + * 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-2.2/src/lxml/iterparse.pxi":400 + * 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 = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":401 + * 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-2.2/src/lxml/iterparse.pxi":402 + * 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 = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_7); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":403 + * 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-2.2/src/lxml/iterparse.pxi":404 + * 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 = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (!__pyx_t_2); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":405 + * 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-2.2/src/lxml/iterparse.pxi":406 + * 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 = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_7); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":407 + * 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-2.2/src/lxml/iterparse.pxi":408 + * 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 = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (!__pyx_t_2); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":409 + * 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-2.2/src/lxml/iterparse.pxi":411 + * 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_kp___init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 411; __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 = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":413 + * _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 = 411; __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 = 411; __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-2.2/src/lxml/iterparse.pxi":415 + * None, filename, encoding) + * + * if self._for_html: # <<<<<<<<<<<<<< + * self._parse_chunk = htmlparser.htmlParseChunk + * else: + */ + __pyx_t_7 = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._for_html; + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":416 + * + * 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-2.2/src/lxml/iterparse.pxi":418 + * 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-2.2/src/lxml/iterparse.pxi":420 + * 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 = 420; __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-2.2/src/lxml/iterparse.pxi":421 + * + * 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-2.2/src/lxml/iterparse.pxi":423 + * __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-2.2/src/lxml/iterparse.pxi":424 + * + * if self._default_encoding is not None: + * if self._for_html: # <<<<<<<<<<<<<< + * error = _htmlCtxtResetPush( + * context._c_ctxt, NULL, 0, + */ + __pyx_t_7 = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._for_html; + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":427 + * error = _htmlCtxtResetPush( + * context._c_ctxt, NULL, 0, + * _cstr(self._default_encoding), self._parse_options) # <<<<<<<<<<<<<< + * else: + * xmlparser.xmlCtxtUseOptions( + */ + __pyx_t_8 = __pyx_f_4lxml_5etree__htmlCtxtResetPush(__pyx_v_context->__pyx_base._c_ctxt, NULL, 0, PyString_AS_STRING(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._default_encoding), ((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 = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_error); + __pyx_v_error = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L23; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":430 + * 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-2.2/src/lxml/iterparse.pxi":433 + * error = xmlparser.xmlCtxtResetPush( + * context._c_ctxt, NULL, 0, NULL, + * _cstr(self._default_encoding)) # <<<<<<<<<<<<<< + * + * context.prepare() + */ + __pyx_t_3 = PyInt_FromLong(xmlCtxtResetPush(__pyx_v_context->__pyx_base._c_ctxt, NULL, 0, NULL, PyString_AS_STRING(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._default_encoding))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_error); + __pyx_v_error = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L23:; + goto __pyx_L22; + } + __pyx_L22:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":435 + * _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 = 435; __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_error); + __Pyx_DECREF(__pyx_v_event); + __Pyx_DECREF(__pyx_v_source); + __Pyx_DECREF(__pyx_v_events); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":441 + * 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_SetupRefcountContext("__get__"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":443 + * 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 = 443; __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-2.2/src/lxml/iterparse.pxi":444 + * 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_kp_copy); 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_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 444; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":446 + * 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; + __Pyx_SetupRefcountContext("_createContext"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__IterparseContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":448 + * 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 = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__IterparseContext))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/iterparse.pxi":449 + * cdef _IterparseContext context + * context = _IterparseContext() + * context._setEventFilter(self._events, self._tag) # <<<<<<<<<<<<<< + * return context + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IterparseContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_setEventFilter(__pyx_v_context, __pyx_v_self->_events, __pyx_v_self->_tag); 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(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":450 + * context = _IterparseContext() + * context._setEventFilter(self._events, self._tag) + * return context # <<<<<<<<<<<<<< + * + * def copy(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_AddTraceback("lxml.etree.iterparse._createContext"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":452 + * return context + * + * def copy(self): # <<<<<<<<<<<<<< + * raise TypeError, u"iterparse parsers cannot be copied" + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_9iterparse_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_9iterparse_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":453 + * + * def copy(self): + * raise TypeError, u"iterparse parsers cannot be copied" # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_539), 0); + {__pyx_filename = __pyx_f[14]; __pyx_lineno = 453; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":455 + * raise TypeError, u"iterparse parsers cannot be copied" + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_9iterparse___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_9iterparse___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":456 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":458 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef _IterparseContext context + * cdef xmlparser.xmlParserCtxt* pctxt + */ + +static PyObject *__pyx_pf_4lxml_5etree_9iterparse___next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_9iterparse___next__(PyObject *__pyx_v_self) { + struct __pyx_obj_4lxml_5etree__IterparseContext *__pyx_v_context; + xmlParserCtxt *__pyx_v_pctxt; + FILE *__pyx_v_c_stream; + char *__pyx_v_c_data; + Py_ssize_t __pyx_v_c_data_len; + int __pyx_v_error; + int __pyx_v_done; + PyObject *__pyx_v_item; + PyObject *__pyx_v_data; + PyObject *__pyx_v_element; + 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; + int __pyx_t_6; + __Pyx_SetupRefcountContext("__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); + __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":465 + * cdef Py_ssize_t c_data_len + * cdef int error, done + * 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-2.2/src/lxml/iterparse.pxi":466 + * cdef int error, done + * 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 = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":468 + * raise StopIteration + * + * context = <_IterparseContext>self._push_parser_context # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(context._events) > context._event_index: + * item = python.PyList_GET_ITEM(context._events, context._event_index) + */ + __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-2.2/src/lxml/iterparse.pxi":469 + * + * context = <_IterparseContext>self._push_parser_context + * if python.PyList_GET_SIZE(context._events) > context._event_index: # <<<<<<<<<<<<<< + * item = python.PyList_GET_ITEM(context._events, context._event_index) + * python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM + */ + __pyx_t_1 = (PyList_GET_SIZE(((PyObject *)__pyx_v_context->_events)) > __pyx_v_context->_event_index); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":470 + * context = <_IterparseContext>self._push_parser_context + * if python.PyList_GET_SIZE(context._events) > context._event_index: + * 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 = PyList_GET_ITEM(((PyObject *)__pyx_v_context->_events), __pyx_v_context->_event_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 470; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":471 + * if python.PyList_GET_SIZE(context._events) > context._event_index: + * 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-2.2/src/lxml/iterparse.pxi":472 + * 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 += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":473 + * python.Py_INCREF(item) # 'borrowed reference' from PyList_GET_ITEM + * context._event_index += 1 + * return item # <<<<<<<<<<<<<< + * + * del context._events[:] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_item); + __pyx_r = __pyx_v_item; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":475 + * return item + * + * del context._events[:] # <<<<<<<<<<<<<< + * pctxt = context._c_ctxt + * error = done = 0 + */ + if (PySequence_DelSlice(((PyObject *)__pyx_v_context->_events), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":476 + * + * del context._events[:] + * pctxt = context._c_ctxt # <<<<<<<<<<<<<< + * error = done = 0 + * c_stream = python.PyFile_AsFile(self._source) + */ + __pyx_v_pctxt = __pyx_v_context->__pyx_base._c_ctxt; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":477 + * del context._events[:] + * pctxt = context._c_ctxt + * error = done = 0 # <<<<<<<<<<<<<< + * c_stream = python.PyFile_AsFile(self._source) + * while python.PyList_GET_SIZE(context._events) == 0: + */ + __pyx_v_error = 0; + __pyx_v_done = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":478 + * pctxt = context._c_ctxt + * error = done = 0 + * c_stream = python.PyFile_AsFile(self._source) # <<<<<<<<<<<<<< + * while python.PyList_GET_SIZE(context._events) == 0: + * if c_stream is NULL: + */ + __pyx_v_c_stream = PyFile_AsFile(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_source); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":479 + * error = done = 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 = (PyList_GET_SIZE(((PyObject *)__pyx_v_context->_events)) == 0); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":480 + * 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.PyString_Check(data): + */ + __pyx_t_1 = (__pyx_v_c_stream == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":481 + * while python.PyList_GET_SIZE(context._events) == 0: + * if c_stream is NULL: + * data = self._source.read(__ITERPARSE_CHUNK_SIZE) # <<<<<<<<<<<<<< + * if not python.PyString_Check(data): + * self._source = None + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_source, __pyx_kp_read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 481; __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[14]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_32768); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_32768); + __Pyx_GIVEREF(__pyx_int_32768); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 481; __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_data); + __pyx_v_data = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":482 + * if c_stream is NULL: + * data = self._source.read(__ITERPARSE_CHUNK_SIZE) + * if not python.PyString_Check(data): # <<<<<<<<<<<<<< + * self._source = None + * raise TypeError, u"reading file objects must return plain strings" + */ + __pyx_t_1 = (!PyString_Check(__pyx_v_data)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":483 + * data = self._source.read(__ITERPARSE_CHUNK_SIZE) + * if not python.PyString_Check(data): + * self._source = None # <<<<<<<<<<<<<< + * raise TypeError, u"reading file objects must return plain strings" + * c_data_len = python.PyString_GET_SIZE(data) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __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 = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":484 + * if not python.PyString_Check(data): + * self._source = None + * raise TypeError, u"reading file objects must return plain strings" # <<<<<<<<<<<<<< + * c_data_len = python.PyString_GET_SIZE(data) + * c_data = _cstr(data) + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_540), 0); + {__pyx_filename = __pyx_f[14]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":485 + * self._source = None + * raise TypeError, u"reading file objects must return plain strings" + * c_data_len = python.PyString_GET_SIZE(data) # <<<<<<<<<<<<<< + * c_data = _cstr(data) + * done = (c_data_len == 0) + */ + __pyx_v_c_data_len = PyString_GET_SIZE(__pyx_v_data); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":486 + * raise TypeError, u"reading file objects must return plain strings" + * c_data_len = python.PyString_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 = PyString_AS_STRING(__pyx_v_data); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":487 + * c_data_len = python.PyString_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-2.2/src/lxml/iterparse.pxi":488 + * 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 = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_parse_chunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_c_data_len, __pyx_v_done); + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":490 + * error = self._parse_chunk(pctxt, c_data, c_data_len, done) + * else: + * if self._buffer is None: # <<<<<<<<<<<<<< + * self._buffer = python.PyString_FromStringAndSize( + * NULL, __ITERPARSE_CHUNK_SIZE) + */ + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":492 + * if self._buffer is None: + * self._buffer = python.PyString_FromStringAndSize( + * NULL, __ITERPARSE_CHUNK_SIZE) # <<<<<<<<<<<<<< + * c_data = _cstr(self._buffer) + * with nogil: + */ + __pyx_t_4 = PyString_FromStringAndSize(NULL, 32768); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":491 + * else: + * if self._buffer is None: + * self._buffer = python.PyString_FromStringAndSize( # <<<<<<<<<<<<<< + * NULL, __ITERPARSE_CHUNK_SIZE) + * c_data = _cstr(self._buffer) + */ + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer); + __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer); + ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":493 + * self._buffer = python.PyString_FromStringAndSize( + * NULL, __ITERPARSE_CHUNK_SIZE) + * c_data = _cstr(self._buffer) # <<<<<<<<<<<<<< + * with nogil: + * c_data_len = cstd.fread( + */ + __pyx_v_c_data = PyString_AS_STRING(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":494 + * NULL, __ITERPARSE_CHUNK_SIZE) + * c_data = _cstr(self._buffer) + * with nogil: # <<<<<<<<<<<<<< + * c_data_len = cstd.fread( + * c_data, 1, __ITERPARSE_CHUNK_SIZE, c_stream) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":496 + * 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-2.2/src/lxml/iterparse.pxi":497 + * 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_1 = (__pyx_v_c_data_len < 32768); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":498 + * 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_5 = ferror(__pyx_v_c_stream); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":499 + * 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_L18; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":500 + * if cstd.ferror(c_stream): + * error = 1 + * elif cstd.feof(c_stream): # <<<<<<<<<<<<<< + * done = 1 + * if not error: + */ + __pyx_t_5 = feof(__pyx_v_c_stream); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":501 + * error = 1 + * elif cstd.feof(c_stream): + * done = 1 # <<<<<<<<<<<<<< + * if not error: + * error = self._parse_chunk( + */ + __pyx_v_done = 1; + goto __pyx_L18; + } + __pyx_L18:; + goto __pyx_L17; + } + __pyx_L17:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":502 + * elif cstd.feof(c_stream): + * done = 1 + * if not error: # <<<<<<<<<<<<<< + * error = self._parse_chunk( + * pctxt, c_data, c_data_len, done) + */ + __pyx_t_1 = (!__pyx_v_error); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":504 + * if not error: + * error = self._parse_chunk( + * pctxt, c_data, c_data_len, done) # <<<<<<<<<<<<<< + * if error or done: + * self._buffer = None + */ + __pyx_v_error = ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_parse_chunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_c_data_len, __pyx_v_done); + goto __pyx_L19; + } + __pyx_L19:; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":505 + * 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_1 = __pyx_v_done; + } else { + __pyx_t_1 = __pyx_v_error; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":506 + * 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(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer); + __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer); + ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->_buffer = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":507 + * if error or done: + * self._buffer = None + * break # <<<<<<<<<<<<<< + * + * if not error and context._validator is not None: + */ + goto __pyx_L8_break; + goto __pyx_L20; + } + __pyx_L20:; + } + __pyx_L8_break:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":509 + * break + * + * if not error and context._validator is not None: # <<<<<<<<<<<<<< + * error = not context._validator.isvalid() + * if error: + */ + if ((!__pyx_v_error)) { + __pyx_t_1 = (((PyObject *)__pyx_v_context->__pyx_base._validator) != Py_None); + __pyx_t_6 = __pyx_t_1; + } else { + __pyx_t_6 = (!__pyx_v_error); + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":510 + * + * if not error and context._validator is not None: + * error = not context._validator.isvalid() # <<<<<<<<<<<<<< + * if error: + * self._source = None + */ + __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_L21; + } + __pyx_L21:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":511 + * if not error and context._validator is not None: + * error = not context._validator.isvalid() + * if error: # <<<<<<<<<<<<<< + * self._source = None + * del context._events[:] + */ + __pyx_t_5 = __pyx_v_error; + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":512 + * error = not context._validator.isvalid() + * if error: + * self._source = None # <<<<<<<<<<<<<< + * del context._events[:] + * context._assureDocGetsFreed() + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __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 = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":513 + * if error: + * self._source = None + * del context._events[:] # <<<<<<<<<<<<<< + * context._assureDocGetsFreed() + * _raiseParseError(pctxt, self._filename, context._error_log) + */ + if (PySequence_DelSlice(((PyObject *)__pyx_v_context->_events), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":514 + * self._source = None + * 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-2.2/src/lxml/iterparse.pxi":515 + * 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_5 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_pctxt, ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->__pyx_base._filename, __pyx_v_context->__pyx_base._error_log); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L22; + } + __pyx_L22:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":516 + * context._assureDocGetsFreed() + * _raiseParseError(pctxt, self._filename, context._error_log) + * if python.PyList_GET_SIZE(context._events) == 0: # <<<<<<<<<<<<<< + * self.root = context._root + * self._source = None + */ + __pyx_t_6 = (PyList_GET_SIZE(((PyObject *)__pyx_v_context->_events)) == 0); + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":517 + * _raiseParseError(pctxt, self._filename, context._error_log) + * if python.PyList_GET_SIZE(context._events) == 0: + * self.root = context._root # <<<<<<<<<<<<<< + * self._source = None + * raise StopIteration + */ + __Pyx_INCREF(((PyObject *)__pyx_v_context->_root)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_context->_root)); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->root); + __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->root); + ((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self)->root = ((PyObject *)__pyx_v_context->_root); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":518 + * if python.PyList_GET_SIZE(context._events) == 0: + * self.root = context._root + * self._source = None # <<<<<<<<<<<<<< + * raise StopIteration + * + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __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 = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":519 + * self.root = context._root + * self._source = None + * raise StopIteration # <<<<<<<<<<<<<< + * + * context._event_index = 1 + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[14]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L23; + } + __pyx_L23:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":521 + * raise StopIteration + * + * context._event_index = 1 # <<<<<<<<<<<<<< + * element = python.PyList_GET_ITEM(context._events, 0) + * python.Py_INCREF(element) # 'borrowed reference' from PyList_GET_ITEM + */ + __pyx_v_context->_event_index = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":522 + * + * context._event_index = 1 + * element = python.PyList_GET_ITEM(context._events, 0) # <<<<<<<<<<<<<< + * python.Py_INCREF(element) # 'borrowed reference' from PyList_GET_ITEM + * return element + */ + __pyx_t_4 = PyList_GET_ITEM(((PyObject *)__pyx_v_context->_events), 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/iterparse.pxi":523 + * context._event_index = 1 + * element = python.PyList_GET_ITEM(context._events, 0) + * python.Py_INCREF(element) # 'borrowed reference' from PyList_GET_ITEM # <<<<<<<<<<<<<< + * return element + * + */ + Py_INCREF(__pyx_v_element); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":524 + * element = python.PyList_GET_ITEM(context._events, 0) + * python.Py_INCREF(element) # 'borrowed reference' from PyList_GET_ITEM + * return element # <<<<<<<<<<<<<< + * + * + */ + __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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree.iterparse.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_DECREF(__pyx_v_item); + __Pyx_DECREF(__pyx_v_data); + __Pyx_DECREF(__pyx_v_element); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":543 + * 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_kp_element_or_tree,&__pyx_kp_events,&__pyx_kp_tag,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = __pyx_k_166; + values[2] = 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_kp_element_or_tree); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_events); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_tag); + if (unlikely(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 = 543; __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 = __pyx_k_166; + __pyx_v_tag = 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 = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.iterwalk.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":546 + * 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 = 546; __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-2.2/src/lxml/iterparse.pxi":547 + * 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 = 547; __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-2.2/src/lxml/iterparse.pxi":548 + * 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-2.2/src/lxml/iterparse.pxi":549 + * 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 = 549; __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-2.2/src/lxml/iterparse.pxi":550 + * 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_kp_pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 550; __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-2.2/src/lxml/iterparse.pxi":551 + * 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 = 551; __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-2.2/src/lxml/iterparse.pxi":552 + * 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_kp_pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 552; __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-2.2/src/lxml/iterparse.pxi":554 + * 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-2.2/src/lxml/iterparse.pxi":555 + * + * 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-2.2/src/lxml/iterparse.pxi":556 + * 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-2.2/src/lxml/iterparse.pxi":557 + * self._index = 0 + * ns_count = self._start_node(root) + * self._node_stack.append( (root, ns_count) ) # <<<<<<<<<<<<<< + * else: + * self._index = -1 + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_ns_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 557; __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 = 557; __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(((PyObject *)((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 = 557; __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-2.2/src/lxml/iterparse.pxi":559 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":561 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/iterparse.pxi":562 + * + * 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 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_kp_541), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 562; __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[14]; __pyx_lineno = 562; __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-2.2/src/lxml/iterparse.pxi":563 + * 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-2.2/src/lxml/iterparse.pxi":564 + * 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-2.2/src/lxml/iterparse.pxi":566 + * self._tag_name = NULL + * else: + * self._tag_tuple = _getNsTag(tag) # <<<<<<<<<<<<<< + * href, name = self._tag_tuple + * if href is None or href == u'*': + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyTuple_CheckExact(__pyx_t_2)) || (__pyx_t_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->_tag_tuple); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_tag_tuple)); + __pyx_v_self->_tag_tuple = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":567 + * else: + * self._tag_tuple = _getNsTag(tag) + * href, name = self._tag_tuple # <<<<<<<<<<<<<< + * if href is None or href == u'*': + * 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_href); + __pyx_v_href = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_3; + __pyx_3 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_self->_tag_tuple), 2); + {__pyx_filename = __pyx_f[14]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":568 + * self._tag_tuple = _getNsTag(tag) + * href, name = self._tag_tuple + * if href is None or href == u'*': # <<<<<<<<<<<<<< + * self._tag_href = NULL + * else: + */ + __pyx_t_4 = (__pyx_v_href == Py_None); + if (!__pyx_t_4) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_href, ((PyObject *)__pyx_kp_542), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_4; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":569 + * href, name = self._tag_tuple + * if href is None or href == u'*': + * 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-2.2/src/lxml/iterparse.pxi":571 + * self._tag_href = NULL + * else: + * self._tag_href = _cstr(href) # <<<<<<<<<<<<<< + * if name is None or name == u'*': + * self._tag_name = NULL + */ + __pyx_v_self->_tag_href = PyString_AS_STRING(__pyx_v_href); + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":572 + * else: + * self._tag_href = _cstr(href) + * if name is None or name == u'*': # <<<<<<<<<<<<<< + * self._tag_name = NULL + * else: + */ + __pyx_t_3 = (__pyx_v_name == Py_None); + if (!__pyx_t_3) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_kp_543), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_t_4; + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":573 + * self._tag_href = _cstr(href) + * if name is None or name == u'*': + * 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-2.2/src/lxml/iterparse.pxi":575 + * 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 = PyString_AS_STRING(__pyx_v_name); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":576 + * else: + * self._tag_name = _cstr(name) + * if self._tag_href is NULL and self._tag_name is NULL: # <<<<<<<<<<<<<< + * self._tag_tuple = None + * + */ + if ((__pyx_v_self->_tag_href == NULL)) { + __pyx_t_1 = (__pyx_v_self->_tag_name == NULL); + } else { + __pyx_t_1 = (__pyx_v_self->_tag_href == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":577 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("lxml.etree.iterwalk._setTagFilter"); + __pyx_L0:; + __Pyx_DECREF(__pyx_v_href); + __Pyx_DECREF(__pyx_v_name); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":579 + * self._tag_tuple = None + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_8iterwalk___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_8iterwalk___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":580 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":582 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef xmlNode* c_child + * cdef _Element node + */ + +static PyObject *__pyx_pf_4lxml_5etree_8iterwalk___next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_8iterwalk___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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/iterparse.pxi":587 + * cdef _Element next_node + * cdef int ns_count + * if python.PyList_GET_SIZE(self._events): # <<<<<<<<<<<<<< + * return self._pop_event(0) + * ns_count = 0 + */ + __pyx_t_1 = PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":588 + * cdef int ns_count + * if python.PyList_GET_SIZE(self._events): + * return self._pop_event(0) # <<<<<<<<<<<<<< + * ns_count = 0 + * # find next node + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_3 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 588; __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; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":589 + * if python.PyList_GET_SIZE(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-2.2/src/lxml/iterparse.pxi":591 + * ns_count = 0 + * # find next node + * while self._index >= 0: # <<<<<<<<<<<<<< + * node = self._node_stack[self._index][0] + * + */ + while (1) { + __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index >= 0); + if (!__pyx_t_4) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":592 + * # find next node + * while self._index >= 0: + * node = self._node_stack[self._index][0] # <<<<<<<<<<<<<< + * + * c_child = _findChildForwards(node._c_node, 0) + */ + __pyx_1 = __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_1) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(__pyx_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((struct LxmlElement *)__pyx_2); + __pyx_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":594 + * 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-2.2/src/lxml/iterparse.pxi":595 + * + * c_child = _findChildForwards(node._c_node, 0) + * if c_child is not NULL: # <<<<<<<<<<<<<< + * # try children + * next_node = _elementFactory(node._doc, c_child) + */ + __pyx_t_4 = (__pyx_v_c_child != NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":597 + * if c_child is not NULL: + * # try children + * next_node = _elementFactory(node._doc, c_child) # <<<<<<<<<<<<<< + * else: + * # back off + */ + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_node->_doc, __pyx_v_c_child)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_next_node)); + __pyx_v_next_node = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":600 + * 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-2.2/src/lxml/iterparse.pxi":601 + * # back off + * next_node = None + * while next_node is None: # <<<<<<<<<<<<<< + * # back off through parents + * self._index = self._index - 1 + */ + while (1) { + __pyx_t_4 = (((PyObject *)__pyx_v_next_node) == Py_None); + if (!__pyx_t_4) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":603 + * while next_node is None: + * # back off through parents + * self._index = 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-2.2/src/lxml/iterparse.pxi":604 + * # back off through parents + * self._index = self._index - 1 + * node = self._end_node() # <<<<<<<<<<<<<< + * if self._index < 0: + * break + */ + __pyx_t_3 = ((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_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":605 + * self._index = self._index - 1 + * node = self._end_node() + * if self._index < 0: # <<<<<<<<<<<<<< + * break + * next_node = node.getnext() + */ + __pyx_t_4 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_index < 0); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":606 + * 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-2.2/src/lxml/iterparse.pxi":607 + * if self._index < 0: + * break + * next_node = node.getnext() # <<<<<<<<<<<<<< + * if next_node is not None: + * if self._event_filter & (ITERPARSE_FILTER_START | \ + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_node), __pyx_kp_getnext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 607; __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[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; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_next_node)); + __pyx_v_next_node = ((struct LxmlElement *)__pyx_t_2); + __pyx_t_2 = 0; + } + __pyx_L10_break:; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":608 + * break + * next_node = node.getnext() + * if next_node is not None: # <<<<<<<<<<<<<< + * if self._event_filter & (ITERPARSE_FILTER_START | \ + * ITERPARSE_FILTER_START_NS): + */ + __pyx_t_4 = (((PyObject *)__pyx_v_next_node) != Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":610 + * 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_5 = (((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_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":611 + * 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-2.2/src/lxml/iterparse.pxi":612 + * 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_5 = (((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":613 + * 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 = 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-2.2/src/lxml/iterparse.pxi":614 + * 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 = self._index + 1 + * if python.PyList_GET_SIZE(self._events): + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_ns_count); 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_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_next_node)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_next_node)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_next_node)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_5 = PyList_Append(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_node_stack), ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":615 + * ns_count = _countNsDefs(next_node._c_node) + * self._node_stack.append( (next_node, ns_count) ) + * self._index = self._index + 1 # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(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-2.2/src/lxml/iterparse.pxi":616 + * self._node_stack.append( (next_node, ns_count) ) + * self._index = self._index + 1 + * if python.PyList_GET_SIZE(self._events): # <<<<<<<<<<<<<< + * return self._pop_event(0) + * raise StopIteration + */ + __pyx_t_1 = PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_events)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":617 + * self._index = self._index + 1 + * if python.PyList_GET_SIZE(self._events): + * return self._pop_event(0) # <<<<<<<<<<<<<< + * raise StopIteration + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_2 = PyObject_Call(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self)->_pop_event, ((PyObject *)__pyx_t_3), NULL); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L14; + } + __pyx_L14:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":618 + * if python.PyList_GET_SIZE(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 = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":620 + * 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; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_start_node"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":622 + * 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-2.2/src/lxml/iterparse.pxi":623 + * 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_v_ns_count = __pyx_f_4lxml_5etree__appendStartNsEvents(__pyx_v_node->_c_node, __pyx_v_self->_events); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":624 + * 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-2.2/src/lxml/iterparse.pxi":625 + * 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-2.2/src/lxml/iterparse.pxi":627 + * 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-2.2/src/lxml/iterparse.pxi":628 + * 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-2.2/src/lxml/iterparse.pxi":629 + * 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_2 = (__pyx_v_self->_tag_tuple == ((PyObject *)Py_None)); + if (!__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":630 + * 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_3 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_node->_c_node, __pyx_v_self->_tag_href, __pyx_v_self->_tag_name); + } else { + __pyx_t_3 = __pyx_t_2; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":631 + * 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 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_544)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_544)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_544)); + __Pyx_INCREF(((PyObject *)__pyx_v_node)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_node)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_node)); + __pyx_t_1 = PyList_Append(((PyObject *)__pyx_v_self->_events), ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":632 + * _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_4); + __Pyx_WriteUnraisable("lxml.etree.iterwalk._start_node"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":634 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("_end_node"); + __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_event = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":637 + * 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 = 637; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((struct LxmlElement *)__pyx_2); + __pyx_2 = 0; + __pyx_v_ns_count = __pyx_t_2; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((struct LxmlElement *)__pyx_2); + __pyx_2 = 0; + __pyx_v_ns_count = __pyx_t_2; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":638 + * 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_2 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":639 + * 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_3 = (__pyx_v_self->_tag_tuple == ((PyObject *)Py_None)); + if (!__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":640 + * 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_4 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_node->_c_node, __pyx_v_self->_tag_href, __pyx_v_self->_tag_name); + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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"end", node) ) # <<<<<<<<<<<<<< + * if self._event_filter & ITERPARSE_FILTER_END_NS: + * event = (u"end-ns", None) + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_545)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_545)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_545)); + __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_2 = PyList_Append(((PyObject *)__pyx_v_self->_events), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 641; __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-2.2/src/lxml/iterparse.pxi":642 + * _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_2 = (__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_ITERPARSE_FILTER_END_NS); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":643 + * 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_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_546)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_546)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_546)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_DECREF(__pyx_v_event); + __pyx_v_event = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":644 + * 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_2 = __pyx_v_ns_count; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":645 + * event = (u"end-ns", None) + * for i from 0 <= i < ns_count: + * self._events.append(event) # <<<<<<<<<<<<<< + * return node + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_self->_events), __pyx_v_event); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":646 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":3 + * cdef object _find_id_attributes + * + * def XMLID(text): # <<<<<<<<<<<<<< + * u"""XMLID(text) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_XMLID(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static char __pyx_doc_4lxml_5etree_XMLID[] = "XMLID(text)\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 PyObject *__pyx_pf_4lxml_5etree_XMLID(PyObject *__pyx_self, PyObject *__pyx_v_text) { + PyObject *__pyx_v_dic; + PyObject *__pyx_v_root; + PyObject *__pyx_v_elem; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + 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; + __Pyx_SetupRefcountContext("XMLID"); + __pyx_self = __pyx_self; + __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-2.2/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-2.2/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 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_547)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_547)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_547)); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_5etree__find_id_attributes); + __Pyx_DECREF(__pyx_v_4lxml_5etree__find_id_attributes); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_5etree__find_id_attributes = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":18 + * + * # ElementTree compatible implementation: parse and look for 'id' attributes + * root = XML(text) # <<<<<<<<<<<<<< + * dic = {} + * for elem in _find_id_attributes(root): + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XML); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyTuple_New(1); 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_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); 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_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_root); + __pyx_v_root = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":19 + * # ElementTree compatible implementation: parse and look for 'id' attributes + * root = XML(text) + * dic = {} # <<<<<<<<<<<<<< + * for elem in _find_id_attributes(root): + * dic[elem.get(u'id')] = elem + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_dic)); + __pyx_v_dic = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":20 + * root = XML(text) + * dic = {} + * for elem in _find_id_attributes(root): # <<<<<<<<<<<<<< + * dic[elem.get(u'id')] = elem + * return (root, dic) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_root); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_root); + __Pyx_GIVEREF(__pyx_v_root); + __pyx_t_3 = PyObject_Call(__pyx_v_4lxml_5etree__find_id_attributes, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __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_4 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __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_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_elem); + __pyx_v_elem = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":21 + * dic = {} + * for elem in _find_id_attributes(root): + * dic[elem.get(u'id')] = elem # <<<<<<<<<<<<<< + * return (root, dic) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_elem, __pyx_kp_get); 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_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_kp_548)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_548)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_548)); + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_dic), __pyx_t_6, __pyx_v_elem) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":22 + * for elem in _find_id_attributes(root): + * dic[elem.get(u'id')] = elem + * return (root, dic) # <<<<<<<<<<<<<< + * + * def XMLDTDID(text): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_root); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_root); + __Pyx_GIVEREF(__pyx_v_root); + __Pyx_INCREF(((PyObject *)__pyx_v_dic)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_dic)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dic)); + __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":24 + * return (root, dic) + * + * def XMLDTDID(text): # <<<<<<<<<<<<<< + * u"""XMLDTDID(text) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_XMLDTDID(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/ +static char __pyx_doc_4lxml_5etree_XMLDTDID[] = "XMLDTDID(text)\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 PyObject *__pyx_pf_4lxml_5etree_XMLDTDID(PyObject *__pyx_self, PyObject *__pyx_v_text) { + struct LxmlElement *__pyx_v_root; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("XMLDTDID"); + __pyx_self = __pyx_self; + __pyx_v_root = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":37 + * """ + * cdef _Element root + * root = XML(text) # <<<<<<<<<<<<<< + * # xml:id spec compatible implementation: use DTD ID attributes from libxml2 + * if root._doc._c_doc.ids is NULL: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XML); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_text); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_text); + __Pyx_GIVEREF(__pyx_v_text); + __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __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_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":39 + * root = XML(text) + * # xml:id spec compatible implementation: use DTD ID attributes from libxml2 + * if root._doc._c_doc.ids is NULL: # <<<<<<<<<<<<<< + * return (root, {}) + * else: + */ + __pyx_t_3 = (__pyx_v_root->_doc->_c_doc->ids == NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_root)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_root)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_root)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __pyx_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_root)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_root)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_root)); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_root)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_root)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_root)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree.XMLDTDID"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_root); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_parseid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_parseid[] = "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 PyObject *__pyx_pf_4lxml_5etree_parseid(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_kp_source,&__pyx_kp_parser,&__pyx_kp_base_url,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = 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_kp_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_kp_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = Py_None; + __pyx_v_base_url = 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"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":55 + * """ + * cdef _Document doc + * doc = _parseDocument(source, parser, base_url) # <<<<<<<<<<<<<< + * return (_elementTreeFactory(doc, None), _IDDict(doc)) + * + */ + if (!(__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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":69 + * cdef object _keys + * cdef object _items + * def __init__(self, etree): # <<<<<<<<<<<<<< + * cdef _Document doc + * doc = _documentOrRaise(etree) + */ + +static int __pyx_pf_4lxml_5etree_7_IDDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_IDDict___init__(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_kp_etree,0}; + __Pyx_SetupRefcountContext("__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_kp_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), "__init__") < 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("__init__", 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.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":71 + * def __init__(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-2.2/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-2.2/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_549), 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-2.2/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-2.2/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-2.2/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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_doc); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":78 + * self._items = None + * + * def copy(self): # <<<<<<<<<<<<<< + * return _IDDict(self._doc) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_copy(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_copy(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict___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; + __Pyx_SetupRefcountContext("__getitem__"); + __pyx_v_id_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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.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-2.2/src/lxml/xmlid.pxi":86 + * cdef xmlAttr* c_attr + * c_ids = self._doc._c_doc.ids + * id_utf = _utf8(id_name) # <<<<<<<<<<<<<< + * c_id = tree.xmlHashLookup(c_ids, _cstr(id_utf)) + * if c_id is NULL: + */ + __pyx_t_1 = __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(__pyx_v_id_utf); + __pyx_v_id_utf = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":87 + * c_ids = self._doc._c_doc.ids + * id_utf = _utf8(id_name) + * c_id = 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, PyString_AS_STRING(__pyx_v_id_utf))); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":88 + * id_utf = _utf8(id_name) + * c_id = 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-2.2/src/lxml/xmlid.pxi":89 + * c_id = 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_550), 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-2.2/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-2.2/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) + */ + if (!(__pyx_v_c_attr == NULL)) { + __pyx_t_2 = (__pyx_v_c_attr->parent == NULL); + } else { + __pyx_t_2 = (__pyx_v_c_attr == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_551), 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-2.2/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 *)__pyx_f_4lxml_5etree__elementFactory(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_doc, __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 93; __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.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_id_utf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_get(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_get(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + __Pyx_SetupRefcountContext("get"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":96 + * + * def get(self, id_name): + * return self[id_name] # <<<<<<<<<<<<<< + * + * def __contains__(self, id_name): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = PyObject_GetItem(__pyx_v_self, __pyx_v_id_name); if (!__pyx_1) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree._IDDict.get"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/ +static int __pyx_pf_4lxml_5etree_7_IDDict___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_SetupRefcountContext("__contains__"); + __pyx_v_id_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":100 + * def __contains__(self, id_name): + * cdef tree.xmlID* c_id + * id_utf = _utf8(id_name) # <<<<<<<<<<<<<< + * c_id = tree.xmlHashLookup( + * self._doc._c_doc.ids, _cstr(id_utf)) + */ + __pyx_t_1 = __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(__pyx_v_id_utf); + __pyx_v_id_utf = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":102 + * id_utf = _utf8(id_name) + * c_id = 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, PyString_AS_STRING(__pyx_v_id_utf))); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":103 + * c_id = 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("has_key"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_keys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_keys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("keys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_1 = PySequence_GetSlice(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._IDDict.keys"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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 = PyObject_GetIter(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 119; __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.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":121 + * return iter(self._keys) + * + * def iterkeys(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_iterkeys(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_iterkeys(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("iterkeys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict___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_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/xmlid.pxi":127 + * if self._keys is None: + * self._keys = self._build_keys() + * return len(self._keys) # <<<<<<<<<<<<<< + * + * def items(self): + */ + __pyx_t_3 = PyObject_Length(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_keys); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 127; __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._IDDict.__len__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_items(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_items(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("items"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_1 = PySequence_GetSlice(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._IDDict.items"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_iteritems(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_iteritems(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("iteritems"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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 = PyObject_GetIter(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self)->_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 137; __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.iteritems"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_values(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_values(PyObject *__pyx_v_self, 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_SetupRefcountContext("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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/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-2.2/src/lxml/xmlid.pxi":146 + * value = python.PyTuple_GET_ITEM(item, 1) + * python.Py_INCREF(value) + * values.append(value) # <<<<<<<<<<<<<< + * return values + * + */ + __pyx_t_5 = PyList_Append(((PyObject *)__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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":149 + * return values + * + * def itervalues(self): # <<<<<<<<<<<<<< + * return iter(self.values()) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_itervalues(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_itervalues(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("itervalues"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":152 + * return iter(self.values()) + * + * cdef object _build_keys(self): # <<<<<<<<<<<<<< + * keys = [] + * tree.xmlHashScan(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_SetupRefcountContext("_build_keys"); + __pyx_v_keys = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":153 + * + * cdef object _build_keys(self): + * keys = [] # <<<<<<<<<<<<<< + * tree.xmlHashScan(self._doc._c_doc.ids, + * _collectIdHashKeys, 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(__pyx_v_keys); + __pyx_v_keys = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":155 + * keys = [] + * tree.xmlHashScan(self._doc._c_doc.ids, + * _collectIdHashKeys, 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-2.2/src/lxml/xmlid.pxi":156 + * tree.xmlHashScan(self._doc._c_doc.ids, + * _collectIdHashKeys, keys) + * return keys # <<<<<<<<<<<<<< + * + * cdef object _build_items(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_keys); + __pyx_r = __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_build_items"); + __pyx_v_items = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_context = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":159 + * + * cdef object _build_items(self): + * items = [] # <<<<<<<<<<<<<< + * context = (items, self._doc) + * tree.xmlHashScan(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(__pyx_v_items); + __pyx_v_items = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":160 + * cdef object _build_items(self): + * items = [] + * context = (items, self._doc) # <<<<<<<<<<<<<< + * tree.xmlHashScan(self._doc._c_doc.ids, + * _collectIdHashItemList, 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(__pyx_v_items); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_items); + __Pyx_GIVEREF(__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(__pyx_v_context); + __pyx_v_context = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":162 + * context = (items, self._doc) + * tree.xmlHashScan(self._doc._c_doc.ids, + * _collectIdHashItemList, 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-2.2/src/lxml/xmlid.pxi":163 + * tree.xmlHashScan(self._doc._c_doc.ids, + * _collectIdHashItemList, context) + * return items # <<<<<<<<<<<<<< + * + * cdef void _collectIdHashItemDict(void* payload, void* context, char* name): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_items); + __pyx_r = __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_v_element; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_collectIdHashItemDict"); + __pyx_v_dic = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_doc = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":168 + * # collect elements from ID attribute hash table + * cdef tree.xmlID* c_id + * c_id = 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-2.2/src/lxml/xmlid.pxi":169 + * cdef tree.xmlID* c_id + * c_id = payload + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: # <<<<<<<<<<<<<< + * return + * dic, doc = context + */ + if (!(__pyx_v_c_id == NULL)) { + if (!(__pyx_v_c_id->attr == NULL)) { + __pyx_t_1 = (__pyx_v_c_id->attr->parent == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_id->attr == NULL); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_id == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":170 + * c_id = payload + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: + * return # <<<<<<<<<<<<<< + * dic, doc = context + * element = _elementFactory(doc, c_id.attr.parent) + */ + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_dic); + __pyx_v_dic = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_doc); + __pyx_v_doc = __pyx_3; + __pyx_3 = 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-2.2/src/lxml/xmlid.pxi":172 + * return + * dic, doc = context + * element = _elementFactory(doc, c_id.attr.parent) # <<<<<<<<<<<<<< + * dic[funicode(name)] = element + * + */ + if (!(__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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_element); + __pyx_v_element = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":173 + * dic, doc = context + * element = _elementFactory(doc, c_id.attr.parent) + * dic[funicode(name)] = element # <<<<<<<<<<<<<< + * + * cdef void _collectIdHashItemList(void* payload, void* context, char* name): + */ + __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_v_dic, __pyx_t_3, __pyx_v_element) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemDict"); + __pyx_L0:; + __Pyx_DECREF(__pyx_v_dic); + __Pyx_DECREF(__pyx_v_doc); + __Pyx_DECREF(__pyx_v_element); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_v_element; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_SetupRefcountContext("_collectIdHashItemList"); + __pyx_v_lst = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_doc = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":179 + * cdef tree.xmlID* c_id + * cdef list lst + * c_id = 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-2.2/src/lxml/xmlid.pxi":180 + * cdef list lst + * c_id = payload + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: # <<<<<<<<<<<<<< + * return + * lst, doc = context + */ + if (!(__pyx_v_c_id == NULL)) { + if (!(__pyx_v_c_id->attr == NULL)) { + __pyx_t_1 = (__pyx_v_c_id->attr->parent == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_id->attr == NULL); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_id == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":181 + * c_id = payload + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: + * return # <<<<<<<<<<<<<< + * lst, doc = context + * element = _elementFactory(doc, c_id.attr.parent) + */ + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + if (!(likely(PyList_CheckExact(__pyx_2)) || (__pyx_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_2)->tp_name), 0))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_v_lst)); + __pyx_v_lst = ((PyObject *)__pyx_2); + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_doc); + __pyx_v_doc = __pyx_3; + __pyx_3 = 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-2.2/src/lxml/xmlid.pxi":183 + * return + * lst, doc = context + * element = _elementFactory(doc, c_id.attr.parent) # <<<<<<<<<<<<<< + * lst.append( (funicode(name), element) ) + * + */ + if (!(__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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_element); + __pyx_v_element = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":184 + * lst, doc = context + * element = _elementFactory(doc, c_id.attr.parent) + * lst.append( (funicode(name), element) ) # <<<<<<<<<<<<<< + * + * cdef void _collectIdHashKeys(void* payload, void* collect_list, char* name): + */ + __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 184; __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[15]; __pyx_lineno = 184; __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_INCREF(__pyx_v_element); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_element); + __Pyx_GIVEREF(__pyx_v_element); + __pyx_t_3 = 0; + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_lst), ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemList"); + __pyx_L0:; + __Pyx_DECREF(__pyx_v_lst); + __Pyx_DECREF(__pyx_v_doc); + __Pyx_DECREF(__pyx_v_element); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 = 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; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_collectIdHashKeys"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":188 + * cdef void _collectIdHashKeys(void* payload, void* collect_list, char* name): + * cdef tree.xmlID* c_id + * c_id = 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-2.2/src/lxml/xmlid.pxi":189 + * cdef tree.xmlID* c_id + * c_id = payload + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: # <<<<<<<<<<<<<< + * return + * (collect_list).append(funicode(name)) + */ + if (!(__pyx_v_c_id == NULL)) { + if (!(__pyx_v_c_id->attr == NULL)) { + __pyx_t_1 = (__pyx_v_c_id->attr->parent == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_id->attr == NULL); + } + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_id == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":190 + * c_id = payload + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: + * return # <<<<<<<<<<<<<< + * (collect_list).append(funicode(name)) + */ + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlid.pxi":191 + * if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL: + * return + * (collect_list).append(funicode(name)) # <<<<<<<<<<<<<< + */ + __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyList_Append(((PyObject *)((PyObject *)__pyx_v_collect_list)), __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("lxml.etree._collectIdHashKeys"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("__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-2.2/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); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":22 + * + * property error_log: + * def __get__(self): # <<<<<<<<<<<<<< + * 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; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":23 + * property error_log: + * def __get__(self): + * return self._error_log.copy() # <<<<<<<<<<<<<< + * + * def __call__(self, _Element node not None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log), __pyx_kp_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 23; __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[16]; __pyx_lineno = 23; __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.XInclude.error_log.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":25 + * 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___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_8XInclude___call__[] = "__call__(self, node)"; +static PyObject *__pyx_pf_4lxml_5etree_8XInclude___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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_node,0}; + __Pyx_SetupRefcountContext("__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_kp_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 = 25; __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 = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XInclude.__call__"); + 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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":35 + * # i.e. as a sibling, which does not conflict with traversal. + * cdef int result + * 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-2.2/src/lxml/xinclude.pxi":37 + * self._error_log.connect() + * __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser( + * node._doc._parser) # <<<<<<<<<<<<<< + * with nogil: + * if node._doc._parser is not None: + */ + ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_node->_doc->_parser); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":38 + * __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser( + * node._doc._parser) + * with nogil: # <<<<<<<<<<<<<< + * if node._doc._parser is not None: + * result = xinclude.xmlXIncludeProcessTreeFlags( + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":39 + * 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_1 = (((PyObject *)__pyx_v_node->_doc->_parser) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":41 + * 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-2.2/src/lxml/xinclude.pxi":43 + * 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:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":44 + * 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-2.2/src/lxml/xinclude.pxi":45 + * 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-2.2/src/lxml/xinclude.pxi":47 + * self._error_log.disconnect() + * + * if result == -1: # <<<<<<<<<<<<<< + * raise XIncludeError( + * self._error_log._buildExceptionMessage( + */ + __pyx_t_1 = (__pyx_v_result == -1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":48 + * + * if result == -1: + * raise XIncludeError( # <<<<<<<<<<<<<< + * self._error_log._buildExceptionMessage( + * u"XInclude processing failed"), + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XIncludeError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":50 + * raise XIncludeError( + * self._error_log._buildExceptionMessage( + * u"XInclude processing failed"), # <<<<<<<<<<<<<< + * self._error_log) + */ + __pyx_t_2 = ((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_552)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":51 + * self._error_log._buildExceptionMessage( + * u"XInclude processing failed"), + * self._error_log) # <<<<<<<<<<<<<< + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 48; __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 *)((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self)->_error_log)); + PyTuple_SET_ITEM(__pyx_t_3, 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_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_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[16]; __pyx_lineno = 48; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.XInclude.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_cleanup_namespaces(PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element); /*proto*/ +static char __pyx_doc_4lxml_5etree_cleanup_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 PyObject *__pyx_pf_4lxml_5etree_cleanup_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_SetupRefcountContext("cleanup_namespaces"); + __pyx_self = __pyx_self; + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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[4]; __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-2.2/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[4]; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_strip_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_strip_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 PyObject *__pyx_pf_4lxml_5etree_strip_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_tree_or_element = 0; + PyObject *__pyx_v_attribute_names = 0; + xmlNode *__pyx_v_c_node; + xmlAttr *__pyx_v_c_attr; + struct LxmlElement *__pyx_v_element; + PyObject *__pyx_v_ns_tags; + char *__pyx_v_c_name; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_tag; + PyObject *__pyx_v_attr; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + void *__pyx_4; + 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; + int __pyx_t_7; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tree_or_element,0}; + __Pyx_SetupRefcountContext("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_kp_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[4]; __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[4]; __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"); + 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_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_attr = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":31 + * cdef char* c_name + * + * 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[4]; __pyx_lineno = 31; __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-2.2/src/lxml/cleanup.pxi":32 + * + * element = _rootNodeOrRaise(tree_or_element) + * if not attribute_names: return # <<<<<<<<<<<<<< + * + * ns_tags = _sortedTagList([ _getNsTag(attr) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_names); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/cleanup.pxi":34 + * if not attribute_names: return + * + * ns_tags = _sortedTagList([ _getNsTag(attr) # <<<<<<<<<<<<<< + * for attr in attribute_names ]) + * ns_tags = [ (ns, tag if tag != '*' else None) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":35 + * + * ns_tags = _sortedTagList([ _getNsTag(attr) + * for attr in attribute_names ]) # <<<<<<<<<<<<<< + * ns_tags = [ (ns, tag if tag != '*' else None) + * for ns, tag in ns_tags ] + */ + if (likely(__pyx_v_attribute_names != Py_None)) { + __pyx_t_4 = 0; __pyx_t_5 = __pyx_v_attribute_names; __Pyx_INCREF(__pyx_t_5); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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-2.2/src/lxml/cleanup.pxi":34 + * if not attribute_names: return + * + * ns_tags = _sortedTagList([ _getNsTag(attr) # <<<<<<<<<<<<<< + * for attr in attribute_names ]) + * ns_tags = [ (ns, tag if tag != '*' else None) + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_attr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6); if (unlikely(__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __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[4]; __pyx_lineno = 34; __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-2.2/src/lxml/cleanup.pxi":36 + * ns_tags = _sortedTagList([ _getNsTag(attr) + * for attr in attribute_names ]) + * ns_tags = [ (ns, tag if tag != '*' else None) # <<<<<<<<<<<<<< + * for ns, tag in ns_tags ] + * + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":37 + * for attr in attribute_names ]) + * ns_tags = [ (ns, tag if tag != '*' else None) + * for ns, tag in ns_tags ] # <<<<<<<<<<<<<< + * + * c_node = element._c_node + */ + if (likely(((PyObject *)__pyx_v_ns_tags) != Py_None)) { + __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":36 + * ns_tags = _sortedTagList([ _getNsTag(attr) + * for attr in attribute_names ]) + * ns_tags = [ (ns, tag if tag != '*' else None) # <<<<<<<<<<<<<< + * for ns, tag in ns_tags ] + * + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_tag, __pyx_kp_553, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_v_tag); + __pyx_1 = __pyx_v_tag; + } else { + __Pyx_INCREF(Py_None); + __pyx_1 = Py_None; + } + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __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); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_7 = PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_6); if (unlikely(__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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-2.2/src/lxml/cleanup.pxi":39 + * for ns, tag in ns_tags ] + * + * c_node = element._c_node # <<<<<<<<<<<<<< + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + * if c_node.type == tree.XML_ELEMENT_NODE: + */ + __pyx_v_c_node = __pyx_v_element->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":40 + * + * c_node = element._c_node + * 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-2.2/src/lxml/cleanup.pxi":41 + * c_node = element._c_node + * 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 ns, tag in ns_tags: + */ + __pyx_t_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":42 + * 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 ns, tag in ns_tags: + * # must search attributes manually to make sure we only + */ + __pyx_t_3 = (__pyx_v_c_node->properties != NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":43 + * if c_node.type == tree.XML_ELEMENT_NODE: + * if c_node.properties is not NULL: + * for ns, tag in ns_tags: # <<<<<<<<<<<<<< + * # must search attributes manually to make sure we only + * # match on blank tag names if there is no namespace + */ + if (likely(((PyObject *)__pyx_v_ns_tags) != Py_None)) { + __pyx_t_4 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_5); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { + PyObject* tuple = __pyx_t_1; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_1; + __pyx_1 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_1; + __pyx_1 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":46 + * # must search attributes manually to make sure we only + * # match on blank tag names if there is no namespace + * c_name = NULL if tag is None else _cstr(tag) # <<<<<<<<<<<<<< + * c_attr = c_node.properties + * while c_attr is not NULL: + */ + __pyx_t_3 = (__pyx_v_tag == Py_None); + if (__pyx_t_3) { + __pyx_4 = NULL; + } else { + __pyx_4 = PyString_AS_STRING(__pyx_v_tag); + } + __pyx_v_c_name = __pyx_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":47 + * # match on blank tag names if there is no namespace + * c_name = NULL if tag is None else _cstr(tag) + * c_attr = c_node.properties # <<<<<<<<<<<<<< + * while c_attr is not NULL: + * if ns is None: + */ + __pyx_v_c_attr = __pyx_v_c_node->properties; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":48 + * c_name = NULL if tag is None else _cstr(tag) + * c_attr = c_node.properties + * while c_attr is not NULL: # <<<<<<<<<<<<<< + * if ns is None: + * if c_attr.ns is NULL or c_attr.ns.href is NULL: + */ + while (1) { + __pyx_t_3 = (__pyx_v_c_attr != NULL); + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":49 + * c_attr = c_node.properties + * while c_attr is not NULL: + * if ns is None: # <<<<<<<<<<<<<< + * if c_attr.ns is NULL or c_attr.ns.href is NULL: + * if c_name is NULL or \ + */ + __pyx_t_3 = (__pyx_v_ns == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":50 + * while c_attr is not NULL: + * if ns is None: + * if c_attr.ns is NULL or c_attr.ns.href is NULL: # <<<<<<<<<<<<<< + * if c_name is NULL or \ + * cstd.strcmp(c_attr.name, c_name) == 0: + */ + if (!(__pyx_v_c_attr->ns == NULL)) { + __pyx_t_3 = (__pyx_v_c_attr->ns->href == NULL); + } else { + __pyx_t_3 = (__pyx_v_c_attr->ns == NULL); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":51 + * if ns is None: + * if c_attr.ns is NULL or c_attr.ns.href is NULL: + * if c_name is NULL or \ # <<<<<<<<<<<<<< + * cstd.strcmp(c_attr.name, c_name) == 0: + * tree.xmlRemoveProp(c_attr) + */ + if (!(__pyx_v_c_name == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":52 + * if c_attr.ns is NULL or c_attr.ns.href is NULL: + * if c_name is NULL or \ + * cstd.strcmp(c_attr.name, c_name) == 0: # <<<<<<<<<<<<<< + * tree.xmlRemoveProp(c_attr) + * break + */ + __pyx_t_3 = (strcmp(__pyx_v_c_attr->name, __pyx_v_c_name) == 0); + } else { + __pyx_t_3 = (__pyx_v_c_name == NULL); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":53 + * if c_name is NULL or \ + * cstd.strcmp(c_attr.name, c_name) == 0: + * 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-2.2/src/lxml/cleanup.pxi":54 + * cstd.strcmp(c_attr.name, c_name) == 0: + * 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, _cstr(ns)) == 0: + */ + goto __pyx_L16_break; + goto __pyx_L19; + } + __pyx_L19:; + goto __pyx_L18; + } + __pyx_L18:; + goto __pyx_L17; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":55 + * 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, _cstr(ns)) == 0: + * if c_name is NULL or \ + */ + if ((__pyx_v_c_attr->ns != NULL)) { + __pyx_t_3 = (__pyx_v_c_attr->ns->href != NULL); + } else { + __pyx_t_3 = (__pyx_v_c_attr->ns != NULL); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":56 + * break + * elif c_attr.ns is not NULL and c_attr.ns.href is not NULL: + * if cstd.strcmp(c_attr.ns.href, _cstr(ns)) == 0: # <<<<<<<<<<<<<< + * if c_name is NULL or \ + * cstd.strcmp(c_attr.name, c_name) == 0: + */ + __pyx_t_3 = (strcmp(__pyx_v_c_attr->ns->href, PyString_AS_STRING(__pyx_v_ns)) == 0); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":57 + * elif c_attr.ns is not NULL and c_attr.ns.href is not NULL: + * if cstd.strcmp(c_attr.ns.href, _cstr(ns)) == 0: + * if c_name is NULL or \ # <<<<<<<<<<<<<< + * cstd.strcmp(c_attr.name, c_name) == 0: + * tree.xmlRemoveProp(c_attr) + */ + if (!(__pyx_v_c_name == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":58 + * if cstd.strcmp(c_attr.ns.href, _cstr(ns)) == 0: + * if c_name is NULL or \ + * cstd.strcmp(c_attr.name, c_name) == 0: # <<<<<<<<<<<<<< + * tree.xmlRemoveProp(c_attr) + * break + */ + __pyx_t_3 = (strcmp(__pyx_v_c_attr->name, __pyx_v_c_name) == 0); + } else { + __pyx_t_3 = (__pyx_v_c_name == NULL); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":59 + * if c_name is NULL or \ + * cstd.strcmp(c_attr.name, c_name) == 0: + * tree.xmlRemoveProp(c_attr) # <<<<<<<<<<<<<< + * break + * c_attr = c_attr.next + */ + xmlRemoveProp(__pyx_v_c_attr); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":60 + * cstd.strcmp(c_attr.name, c_name) == 0: + * tree.xmlRemoveProp(c_attr) + * break # <<<<<<<<<<<<<< + * c_attr = c_attr.next + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + */ + goto __pyx_L16_break; + goto __pyx_L21; + } + __pyx_L21:; + goto __pyx_L20; + } + __pyx_L20:; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":61 + * 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_L16_break:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L12; + } + __pyx_L12:; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":62 + * 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); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __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_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_attr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":64 + * 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_strip_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_strip_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 PyObject *__pyx_pf_4lxml_5etree_strip_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; + xmlNode *__pyx_v_c_node; + xmlNode *__pyx_v_c_child; + xmlNode *__pyx_v_c_next; + char *__pyx_v_c_href; + char *__pyx_v_c_name; + 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; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_tag; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + void *__pyx_4; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tree_or_element,&__pyx_kp_with_tail,0}; + __Pyx_SetupRefcountContext("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_kp_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_kp_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[4]; __pyx_lineno = 64; __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))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_with_tail = 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 = 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[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_tag_names); + __Pyx_AddTraceback("lxml.etree.strip_elements"); + 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); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":97 + * 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[4]; __pyx_lineno = 97; __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-2.2/src/lxml/cleanup.pxi":98 + * + * 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[4]; __pyx_lineno = 98; __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-2.2/src/lxml/cleanup.pxi":99 + * doc = _documentOrRaise(tree_or_element) + * element = _rootNodeOrRaise(tree_or_element) + * if not tag_names: return # <<<<<<<<<<<<<< + * + * ns_tags = _filterSpecialTagNames( + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_tag_names); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/cleanup.pxi":102 + * + * ns_tags = _filterSpecialTagNames( + * tag_names, &strip_comments, &strip_pis, &strip_entities) # <<<<<<<<<<<<<< + * + * c_node = element._c_node + */ + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__filterSpecialTagNames(__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[4]; __pyx_lineno = 101; __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-2.2/src/lxml/cleanup.pxi":104 + * tag_names, &strip_comments, &strip_pis, &strip_entities) + * + * c_node = element._c_node # <<<<<<<<<<<<<< + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + * if c_node.type == tree.XML_ELEMENT_NODE: + */ + __pyx_v_c_node = __pyx_v_element->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":105 + * + * c_node = element._c_node + * 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-2.2/src/lxml/cleanup.pxi":106 + * c_node = element._c_node + * 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_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":110 + * # 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-2.2/src/lxml/cleanup.pxi":111 + * # c_node itself + * c_child = _findChildForwards(c_node, 0) + * while c_child is not NULL: # <<<<<<<<<<<<<< + * if c_child.type == tree.XML_ELEMENT_NODE: + * for ns, tag in ns_tags: + */ + while (1) { + __pyx_t_3 = (__pyx_v_c_child != NULL); + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":112 + * c_child = _findChildForwards(c_node, 0) + * while c_child is not NULL: + * if c_child.type == tree.XML_ELEMENT_NODE: # <<<<<<<<<<<<<< + * for ns, tag in ns_tags: + * if ns is None: + */ + __pyx_t_3 = (__pyx_v_c_child->type == XML_ELEMENT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":113 + * while c_child is not NULL: + * if c_child.type == tree.XML_ELEMENT_NODE: + * for ns, tag in ns_tags: # <<<<<<<<<<<<<< + * if ns is None: + * # _tagMatches() considers NULL a wildcard + */ + if (likely(((PyObject *)__pyx_v_ns_tags) != Py_None)) { + __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { + PyObject* tuple = __pyx_t_5; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":114 + * if c_child.type == tree.XML_ELEMENT_NODE: + * for ns, tag in ns_tags: + * if ns is None: # <<<<<<<<<<<<<< + * # _tagMatches() considers NULL a wildcard + * # match but we don't + */ + __pyx_t_3 = (__pyx_v_ns == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":117 + * # _tagMatches() considers NULL a wildcard + * # match but we don't + * if c_child.ns is not NULL and c_child.ns.href is not NULL: # <<<<<<<<<<<<<< + * continue + * c_href = NULL + */ + if ((__pyx_v_c_child->ns != NULL)) { + __pyx_t_3 = (__pyx_v_c_child->ns->href != NULL); + } else { + __pyx_t_3 = (__pyx_v_c_child->ns != NULL); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":118 + * # match but we don't + * if c_child.ns is not NULL and c_child.ns.href is not NULL: + * continue # <<<<<<<<<<<<<< + * c_href = NULL + * else: + */ + goto __pyx_L11_continue; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":119 + * if c_child.ns is not NULL and c_child.ns.href is not NULL: + * continue + * c_href = NULL # <<<<<<<<<<<<<< + * else: + * c_href = _cstr(ns) + */ + __pyx_v_c_href = NULL; + goto __pyx_L13; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":121 + * c_href = NULL + * else: + * c_href = _cstr(ns) # <<<<<<<<<<<<<< + * c_name = NULL if tag is None else _cstr(tag) + * if _tagMatches(c_child, c_href, c_name): + */ + __pyx_v_c_href = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":122 + * else: + * c_href = _cstr(ns) + * c_name = NULL if tag is None else _cstr(tag) # <<<<<<<<<<<<<< + * if _tagMatches(c_child, c_href, c_name): + * c_next = _nextElement(c_child) + */ + __pyx_t_3 = (__pyx_v_tag == Py_None); + if (__pyx_t_3) { + __pyx_4 = NULL; + } else { + __pyx_4 = PyString_AS_STRING(__pyx_v_tag); + } + __pyx_v_c_name = __pyx_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":123 + * c_href = _cstr(ns) + * c_name = NULL if tag is None else _cstr(tag) + * if _tagMatches(c_child, c_href, c_name): # <<<<<<<<<<<<<< + * c_next = _nextElement(c_child) + * if not with_tail: + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_child, __pyx_v_c_href, __pyx_v_c_name); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":124 + * c_name = NULL if tag is None else _cstr(tag) + * if _tagMatches(c_child, c_href, c_name): + * c_next = _nextElement(c_child) # <<<<<<<<<<<<<< + * if not with_tail: + * tree.xmlUnlinkNode(c_child) + */ + __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":125 + * if _tagMatches(c_child, c_href, c_name): + * c_next = _nextElement(c_child) + * if not with_tail: # <<<<<<<<<<<<<< + * tree.xmlUnlinkNode(c_child) + * _removeNode(doc, c_child) + */ + __pyx_t_3 = (!__pyx_v_with_tail); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":126 + * c_next = _nextElement(c_child) + * if not with_tail: + * tree.xmlUnlinkNode(c_child) # <<<<<<<<<<<<<< + * _removeNode(doc, c_child) + * c_child = c_next + */ + xmlUnlinkNode(__pyx_v_c_child); + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":127 + * if not with_tail: + * tree.xmlUnlinkNode(c_child) + * _removeNode(doc, c_child) # <<<<<<<<<<<<<< + * c_child = c_next + * break + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":128 + * tree.xmlUnlinkNode(c_child) + * _removeNode(doc, c_child) + * c_child = c_next # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_v_c_child = __pyx_v_c_next; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":129 + * _removeNode(doc, c_child) + * c_child = c_next + * break # <<<<<<<<<<<<<< + * else: + * c_child = _nextElement(c_child) + */ + goto __pyx_L12_break; + goto __pyx_L15; + } + __pyx_L15:; + __pyx_L11_continue:; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":131 + * break + * else: + * c_child = _nextElement(c_child) # <<<<<<<<<<<<<< + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + */ + __pyx_v_c_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + } + __pyx_L12_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L10; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":132 + * else: + * c_child = _nextElement(c_child) + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ # <<<<<<<<<<<<<< + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + */ + if (__pyx_v_strip_comments) { + __pyx_t_3 = (__pyx_v_c_child->type == XML_COMMENT_NODE); + } else { + __pyx_t_3 = __pyx_v_strip_comments; + } + if (!__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":133 + * c_child = _nextElement(c_child) + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ + * strip_pis and c_child.type == tree.XML_PI_NODE or \ # <<<<<<<<<<<<<< + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + * c_next = _nextElement(c_child) + */ + if (__pyx_v_strip_pis) { + __pyx_t_2 = (__pyx_v_c_child->type == XML_PI_NODE); + } else { + __pyx_t_2 = __pyx_v_strip_pis; + } + if (!__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":134 + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: # <<<<<<<<<<<<<< + * c_next = _nextElement(c_child) + * if with_tail: + */ + if (__pyx_v_strip_entities) { + __pyx_t_7 = (__pyx_v_c_child->type == XML_ENTITY_REF_NODE); + } else { + __pyx_t_7 = __pyx_v_strip_entities; + } + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_8; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":135 + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + * c_next = _nextElement(c_child) # <<<<<<<<<<<<<< + * if with_tail: + * _removeText(c_next) + */ + __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":136 + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + * c_next = _nextElement(c_child) + * if with_tail: # <<<<<<<<<<<<<< + * _removeText(c_next) + * tree.xmlUnlinkNode(c_child) + */ + __pyx_t_2 = __pyx_v_with_tail; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":137 + * c_next = _nextElement(c_child) + * if with_tail: + * _removeText(c_next) # <<<<<<<<<<<<<< + * tree.xmlUnlinkNode(c_child) + * attemptDeallocation(c_child) + */ + __pyx_f_4lxml_5etree__removeText(__pyx_v_c_next); + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":138 + * if with_tail: + * _removeText(c_next) + * tree.xmlUnlinkNode(c_child) # <<<<<<<<<<<<<< + * attemptDeallocation(c_child) + * c_child = c_next + */ + xmlUnlinkNode(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":139 + * _removeText(c_next) + * tree.xmlUnlinkNode(c_child) + * attemptDeallocation(c_child) # <<<<<<<<<<<<<< + * c_child = c_next + * else: + */ + __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":140 + * tree.xmlUnlinkNode(c_child) + * attemptDeallocation(c_child) + * c_child = c_next # <<<<<<<<<<<<<< + * else: + * c_child = _nextElement(c_child) + */ + __pyx_v_c_child = __pyx_v_c_next; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":142 + * c_child = c_next + * else: + * c_child = _nextElement(c_child) # <<<<<<<<<<<<<< + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + * + */ + __pyx_v_c_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + } + __pyx_L10:; + } + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":143 + * else: + * c_child = _nextElement(c_child) + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) # <<<<<<<<<<<<<< + * + * def strip_tags(tree_or_element, *tag_names): + */ + END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __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_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":145 + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + * + * def strip_tags(tree_or_element, *tag_names): # <<<<<<<<<<<<<< + * u"""strip_tags(tree_or_element, *tag_names) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_strip_tags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_strip_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 PyObject *__pyx_pf_4lxml_5etree_strip_tags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_tree_or_element = 0; + PyObject *__pyx_v_tag_names = 0; + xmlNode *__pyx_v_c_node; + xmlNode *__pyx_v_c_child; + xmlNode *__pyx_v_c_next; + char *__pyx_v_c_href; + char *__pyx_v_c_name; + 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; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_tag; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + void *__pyx_4; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tree_or_element,0}; + __Pyx_SetupRefcountContext("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_kp_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[4]; __pyx_lineno = 145; __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[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_tag_names); + __Pyx_AddTraceback("lxml.etree.strip_tags"); + 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); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":177 + * 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[4]; __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-2.2/src/lxml/cleanup.pxi":178 + * + * 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[4]; __pyx_lineno = 178; __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-2.2/src/lxml/cleanup.pxi":179 + * doc = _documentOrRaise(tree_or_element) + * element = _rootNodeOrRaise(tree_or_element) + * if not tag_names: return # <<<<<<<<<<<<<< + * + * ns_tags = _filterSpecialTagNames( + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_tag_names); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/cleanup.pxi":182 + * + * ns_tags = _filterSpecialTagNames( + * tag_names, &strip_comments, &strip_pis, &strip_entities) # <<<<<<<<<<<<<< + * + * c_node = element._c_node + */ + __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__filterSpecialTagNames(__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[4]; __pyx_lineno = 181; __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-2.2/src/lxml/cleanup.pxi":184 + * tag_names, &strip_comments, &strip_pis, &strip_entities) + * + * c_node = element._c_node # <<<<<<<<<<<<<< + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + * if c_node.type == tree.XML_ELEMENT_NODE: + */ + __pyx_v_c_node = __pyx_v_element->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":185 + * + * c_node = element._c_node + * 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-2.2/src/lxml/cleanup.pxi":186 + * c_node = element._c_node + * 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_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":190 + * # 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-2.2/src/lxml/cleanup.pxi":191 + * # c_node itself + * c_child = _findChildForwards(c_node, 0) + * while c_child is not NULL: # <<<<<<<<<<<<<< + * if c_child.type == tree.XML_ELEMENT_NODE: + * for ns, tag in ns_tags: + */ + while (1) { + __pyx_t_3 = (__pyx_v_c_child != NULL); + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":192 + * c_child = _findChildForwards(c_node, 0) + * while c_child is not NULL: + * if c_child.type == tree.XML_ELEMENT_NODE: # <<<<<<<<<<<<<< + * for ns, tag in ns_tags: + * if ns is None: + */ + __pyx_t_3 = (__pyx_v_c_child->type == XML_ELEMENT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":193 + * while c_child is not NULL: + * if c_child.type == tree.XML_ELEMENT_NODE: + * for ns, tag in ns_tags: # <<<<<<<<<<<<<< + * if ns is None: + * # _tagMatches() considers NULL a wildcard + */ + if (likely(((PyObject *)__pyx_v_ns_tags) != Py_None)) { + __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { + PyObject* tuple = __pyx_t_5; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":194 + * if c_child.type == tree.XML_ELEMENT_NODE: + * for ns, tag in ns_tags: + * if ns is None: # <<<<<<<<<<<<<< + * # _tagMatches() considers NULL a wildcard + * # match but we don't + */ + __pyx_t_3 = (__pyx_v_ns == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":197 + * # _tagMatches() considers NULL a wildcard + * # match but we don't + * if c_child.ns is not NULL and c_child.ns.href is not NULL: # <<<<<<<<<<<<<< + * continue + * c_href = NULL + */ + if ((__pyx_v_c_child->ns != NULL)) { + __pyx_t_3 = (__pyx_v_c_child->ns->href != NULL); + } else { + __pyx_t_3 = (__pyx_v_c_child->ns != NULL); + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":198 + * # match but we don't + * if c_child.ns is not NULL and c_child.ns.href is not NULL: + * continue # <<<<<<<<<<<<<< + * c_href = NULL + * else: + */ + goto __pyx_L11_continue; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":199 + * if c_child.ns is not NULL and c_child.ns.href is not NULL: + * continue + * c_href = NULL # <<<<<<<<<<<<<< + * else: + * c_href = _cstr(ns) + */ + __pyx_v_c_href = NULL; + goto __pyx_L13; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":201 + * c_href = NULL + * else: + * c_href = _cstr(ns) # <<<<<<<<<<<<<< + * c_name = NULL if tag is None else _cstr(tag) + * if _tagMatches(c_child, c_href, c_name): + */ + __pyx_v_c_href = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":202 + * else: + * c_href = _cstr(ns) + * c_name = NULL if tag is None else _cstr(tag) # <<<<<<<<<<<<<< + * if _tagMatches(c_child, c_href, c_name): + * if c_child.children is not NULL: + */ + __pyx_t_3 = (__pyx_v_tag == Py_None); + if (__pyx_t_3) { + __pyx_4 = NULL; + } else { + __pyx_4 = PyString_AS_STRING(__pyx_v_tag); + } + __pyx_v_c_name = __pyx_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":203 + * c_href = _cstr(ns) + * c_name = NULL if tag is None else _cstr(tag) + * if _tagMatches(c_child, c_href, c_name): # <<<<<<<<<<<<<< + * if c_child.children is not NULL: + * c_next = _findChildForwards(c_child, 0) + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_child, __pyx_v_c_href, __pyx_v_c_name); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":204 + * c_name = NULL if tag is None else _cstr(tag) + * if _tagMatches(c_child, c_href, c_name): + * if c_child.children is not NULL: # <<<<<<<<<<<<<< + * c_next = _findChildForwards(c_child, 0) + * else: + */ + __pyx_t_3 = (__pyx_v_c_child->children != NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":205 + * if _tagMatches(c_child, c_href, c_name): + * if c_child.children is not NULL: + * c_next = _findChildForwards(c_child, 0) # <<<<<<<<<<<<<< + * else: + * c_next = _nextElement(c_child) + */ + __pyx_v_c_next = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_child, 0); + goto __pyx_L16; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":207 + * c_next = _findChildForwards(c_child, 0) + * else: + * c_next = _nextElement(c_child) # <<<<<<<<<<<<<< + * _replaceNodeByChildren(doc, c_child) + * if not attemptDeallocation(c_child): + */ + __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":208 + * else: + * c_next = _nextElement(c_child) + * _replaceNodeByChildren(doc, c_child) # <<<<<<<<<<<<<< + * if not attemptDeallocation(c_child): + * if c_child.ns is not NULL: + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__replaceNodeByChildren(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":209 + * c_next = _nextElement(c_child) + * _replaceNodeByChildren(doc, c_child) + * if not attemptDeallocation(c_child): # <<<<<<<<<<<<<< + * if c_child.ns is not NULL: + * # make namespaces absolute + */ + __pyx_t_3 = (!__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child)); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":210 + * _replaceNodeByChildren(doc, c_child) + * if not attemptDeallocation(c_child): + * if c_child.ns is not NULL: # <<<<<<<<<<<<<< + * # make namespaces absolute + * moveNodeToDocument(doc, doc._c_doc, c_child) + */ + __pyx_t_3 = (__pyx_v_c_child->ns != NULL); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":212 + * if c_child.ns is not NULL: + * # make namespaces absolute + * moveNodeToDocument(doc, doc._c_doc, c_child) # <<<<<<<<<<<<<< + * c_child = c_next + * break + */ + __pyx_t_6 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L18; + } + __pyx_L18:; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":213 + * # 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-2.2/src/lxml/cleanup.pxi":214 + * moveNodeToDocument(doc, doc._c_doc, c_child) + * c_child = c_next + * break # <<<<<<<<<<<<<< + * else: + * c_child = c_child.next + */ + goto __pyx_L12_break; + goto __pyx_L15; + } + __pyx_L15:; + __pyx_L11_continue:; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":216 + * break + * else: + * c_child = c_child.next # <<<<<<<<<<<<<< + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + */ + __pyx_v_c_child = __pyx_v_c_child->next; + } + __pyx_L12_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L10; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":217 + * else: + * c_child = c_child.next + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ # <<<<<<<<<<<<<< + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + */ + if (__pyx_v_strip_comments) { + __pyx_t_3 = (__pyx_v_c_child->type == XML_COMMENT_NODE); + } else { + __pyx_t_3 = __pyx_v_strip_comments; + } + if (!__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":218 + * c_child = c_child.next + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ + * strip_pis and c_child.type == tree.XML_PI_NODE or \ # <<<<<<<<<<<<<< + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + * c_next = _nextElement(c_child) + */ + if (__pyx_v_strip_pis) { + __pyx_t_2 = (__pyx_v_c_child->type == XML_PI_NODE); + } else { + __pyx_t_2 = __pyx_v_strip_pis; + } + if (!__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":219 + * elif strip_comments and c_child.type == tree.XML_COMMENT_NODE or \ + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: # <<<<<<<<<<<<<< + * c_next = _nextElement(c_child) + * tree.xmlUnlinkNode(c_child) + */ + if (__pyx_v_strip_entities) { + __pyx_t_7 = (__pyx_v_c_child->type == XML_ENTITY_REF_NODE); + } else { + __pyx_t_7 = __pyx_v_strip_entities; + } + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_8; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":220 + * strip_pis and c_child.type == tree.XML_PI_NODE or \ + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + * c_next = _nextElement(c_child) # <<<<<<<<<<<<<< + * tree.xmlUnlinkNode(c_child) + * attemptDeallocation(c_child) + */ + __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":221 + * strip_entities and c_child.type == tree.XML_ENTITY_REF_NODE: + * c_next = _nextElement(c_child) + * tree.xmlUnlinkNode(c_child) # <<<<<<<<<<<<<< + * attemptDeallocation(c_child) + * c_child = c_next + */ + xmlUnlinkNode(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":222 + * c_next = _nextElement(c_child) + * tree.xmlUnlinkNode(c_child) + * attemptDeallocation(c_child) # <<<<<<<<<<<<<< + * c_child = c_next + * else: + */ + __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":223 + * tree.xmlUnlinkNode(c_child) + * attemptDeallocation(c_child) + * c_child = c_next # <<<<<<<<<<<<<< + * else: + * c_child = _nextElement(c_child) + */ + __pyx_v_c_child = __pyx_v_c_next; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":225 + * c_child = c_next + * else: + * c_child = _nextElement(c_child) # <<<<<<<<<<<<<< + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + * + */ + __pyx_v_c_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child); + } + __pyx_L10:; + } + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":226 + * else: + * c_child = _nextElement(c_child) + * 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_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __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_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":231 + * # 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/cleanup.pxi":238 + * cdef tuple ns_tag + * cdef Py_ssize_t i + * decorated_list = [ (ns_tag[0] or '', 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[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":239 + * cdef Py_ssize_t i + * decorated_list = [ (ns_tag[0] or '', 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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_l)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_l)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_l)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_enumerate, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __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_2 = 0; __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __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_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[4]; __pyx_lineno = 239; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_2); + if (!(likely(PyTuple_CheckExact(__pyx_2)) || (__pyx_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_i = __pyx_t_5; + __Pyx_DECREF(((PyObject *)__pyx_v_ns_tag)); + __pyx_v_ns_tag = ((PyObject *)__pyx_2); + __pyx_2 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + if (!(likely(PyTuple_CheckExact(__pyx_2)) || (__pyx_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_i = __pyx_t_5; + __Pyx_DECREF(((PyObject *)__pyx_v_ns_tag)); + __pyx_v_ns_tag = ((PyObject *)__pyx_2); + __pyx_2 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":238 + * cdef tuple ns_tag + * cdef Py_ssize_t i + * decorated_list = [ (ns_tag[0] or '', ns_tag[1], i, ns_tag) # <<<<<<<<<<<<<< + * for i, ns_tag in enumerate(l) ] + * decorated_list.sort() + */ + __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_ns_tag), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_6) { + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_INCREF(__pyx_kp_554); + __pyx_t_4 = __pyx_kp_554; + } else { + __pyx_t_4 = __pyx_1; + __pyx_1 = 0; + } + __pyx_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_ns_tag), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 238; __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[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(((PyObject *)__pyx_v_ns_tag)); + PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_v_ns_tag)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ns_tag)); + __pyx_t_4 = 0; + __pyx_2 = 0; + __pyx_t_7 = 0; + __pyx_t_9 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_8); if (unlikely(__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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-2.2/src/lxml/cleanup.pxi":240 + * decorated_list = [ (ns_tag[0] or '', 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_1 = PyObject_GetAttr(((PyObject *)__pyx_v_decorated_list), __pyx_kp_sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 240; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":241 + * 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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (likely(((PyObject *)__pyx_v_decorated_list) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_decorated_list); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_8; + __pyx_t_8 = 0; + __pyx_1 = __Pyx_GetItemInt(__pyx_v_item, -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_9 = PyList_Append(__pyx_t_3, (PyObject*)__pyx_1); if (unlikely(__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_3)); + __pyx_r = __pyx_t_3; + __Pyx_DECREF(((PyObject *)__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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":243 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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_SetupRefcountContext("_filterSpecialTagNames"); + __Pyx_INCREF(__pyx_v_tag_names); + __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-2.2/src/lxml/cleanup.pxi":245 + * 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-2.2/src/lxml/cleanup.pxi":246 + * cdef list ns_tags + * comments[0] = 0 + * pis[0] = 0 # <<<<<<<<<<<<<< + * entities[0] = 0 + * + */ + (__pyx_v_pis[0]) = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":247 + * comments[0] = 0 + * pis[0] = 0 + * entities[0] = 0 # <<<<<<<<<<<<<< + * + * if Comment in tag_names: + */ + (__pyx_v_entities[0]) = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":249 + * entities[0] = 0 + * + * if Comment in tag_names: # <<<<<<<<<<<<<< + * comments[0] = 1 + * tag_names = [ tag for tag in tag_names + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Comment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (PySequence_Contains(__pyx_v_tag_names, __pyx_1)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":250 + * + * if Comment in tag_names: + * comments[0] = 1 # <<<<<<<<<<<<<< + * tag_names = [ tag for tag in tag_names + * if tag is not Comment ] + */ + (__pyx_v_comments[0]) = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":251 + * if Comment in tag_names: + * comments[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not Comment ] + * if ProcessingInstruction in tag_names: + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":252 + * comments[0] = 1 + * tag_names = [ tag for tag in tag_names + * if tag is not Comment ] # <<<<<<<<<<<<<< + * if ProcessingInstruction in tag_names: + * pis[0] = 1 + */ + if (PyList_CheckExact(__pyx_v_tag_names) || PyTuple_CheckExact(__pyx_v_tag_names)) { + __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_tag_names; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tag_names); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + for (;;) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":251 + * if Comment in tag_names: + * comments[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not Comment ] + * if ProcessingInstruction in tag_names: + */ + 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[4]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":252 + * comments[0] = 1 + * tag_names = [ tag for tag in tag_names + * if tag is not Comment ] # <<<<<<<<<<<<<< + * if ProcessingInstruction in tag_names: + * pis[0] = 1 + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Comment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag != __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":251 + * if Comment in tag_names: + * comments[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not Comment ] + * if ProcessingInstruction in tag_names: + */ + __pyx_t_6 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_v_tag); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_v_tag_names); + __pyx_v_tag_names = ((PyObject *)__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":253 + * tag_names = [ tag for tag in tag_names + * if tag is not Comment ] + * if ProcessingInstruction in tag_names: # <<<<<<<<<<<<<< + * pis[0] = 1 + * tag_names = [ tag for tag in tag_names + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_101); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (PySequence_Contains(__pyx_v_tag_names, __pyx_1)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":254 + * if tag is not Comment ] + * if ProcessingInstruction in tag_names: + * pis[0] = 1 # <<<<<<<<<<<<<< + * tag_names = [ tag for tag in tag_names + * if tag is not ProcessingInstruction ] + */ + (__pyx_v_pis[0]) = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":255 + * if ProcessingInstruction in tag_names: + * pis[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not ProcessingInstruction ] + * if Entity in tag_names: + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":256 + * pis[0] = 1 + * tag_names = [ tag for tag in tag_names + * if tag is not ProcessingInstruction ] # <<<<<<<<<<<<<< + * if Entity in tag_names: + * entities[0] = 1 + */ + if (PyList_CheckExact(__pyx_v_tag_names) || PyTuple_CheckExact(__pyx_v_tag_names)) { + __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_tag_names; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tag_names); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + for (;;) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":255 + * if ProcessingInstruction in tag_names: + * pis[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not ProcessingInstruction ] + * if Entity in tag_names: + */ + 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[4]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":256 + * pis[0] = 1 + * tag_names = [ tag for tag in tag_names + * if tag is not ProcessingInstruction ] # <<<<<<<<<<<<<< + * if Entity in tag_names: + * entities[0] = 1 + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_101); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag != __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":255 + * if ProcessingInstruction in tag_names: + * pis[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not ProcessingInstruction ] + * if Entity in tag_names: + */ + __pyx_t_6 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_v_tag); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_v_tag_names); + __pyx_v_tag_names = ((PyObject *)__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":257 + * tag_names = [ tag for tag in tag_names + * if tag is not ProcessingInstruction ] + * if Entity in tag_names: # <<<<<<<<<<<<<< + * entities[0] = 1 + * tag_names = [ tag for tag in tag_names + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Entity); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (PySequence_Contains(__pyx_v_tag_names, __pyx_1)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":258 + * if tag is not ProcessingInstruction ] + * if Entity in tag_names: + * entities[0] = 1 # <<<<<<<<<<<<<< + * tag_names = [ tag for tag in tag_names + * if tag is not Entity ] + */ + (__pyx_v_entities[0]) = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":259 + * if Entity in tag_names: + * entities[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not Entity ] + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":260 + * entities[0] = 1 + * tag_names = [ tag for tag in tag_names + * if tag is not Entity ] # <<<<<<<<<<<<<< + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + * return [ (ns, tag if tag != '*' else None) + */ + if (PyList_CheckExact(__pyx_v_tag_names) || PyTuple_CheckExact(__pyx_v_tag_names)) { + __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_tag_names; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tag_names); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + for (;;) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":259 + * if Entity in tag_names: + * entities[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not Entity ] + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + */ + 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[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":260 + * entities[0] = 1 + * tag_names = [ tag for tag in tag_names + * if tag is not Entity ] # <<<<<<<<<<<<<< + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + * return [ (ns, tag if tag != '*' else None) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Entity); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (__pyx_v_tag != __pyx_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":259 + * if Entity in tag_names: + * entities[0] = 1 + * tag_names = [ tag for tag in tag_names # <<<<<<<<<<<<<< + * if tag is not Entity ] + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + */ + __pyx_t_6 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_v_tag); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + __pyx_L14:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_v_tag_names); + __pyx_v_tag_names = ((PyObject *)__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":261 + * tag_names = [ tag for tag in tag_names + * if tag is not Entity ] + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) # <<<<<<<<<<<<<< + * return [ (ns, tag if tag != '*' else None) + * for ns, tag in ns_tags ] + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyList_CheckExact(__pyx_v_tag_names) || PyTuple_CheckExact(__pyx_v_tag_names)) { + __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_tag_names; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tag_names); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 261; __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[4]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_5 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__sortedTagList(__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 261; __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_v_ns_tags)); + __pyx_v_ns_tags = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":262 + * if tag is not Entity ] + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + * return [ (ns, tag if tag != '*' else None) # <<<<<<<<<<<<<< + * for ns, tag in ns_tags ] + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":263 + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + * return [ (ns, tag if tag != '*' else None) + * for ns, tag in ns_tags ] # <<<<<<<<<<<<<< + */ + if (likely(((PyObject *)__pyx_v_ns_tags) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_ns_tags); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { + PyObject* tuple = __pyx_t_5; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cleanup.pxi":262 + * if tag is not Entity ] + * ns_tags = _sortedTagList([ _getNsTag(tag) for tag in tag_names ]) + * return [ (ns, tag if tag != '*' else None) # <<<<<<<<<<<<<< + * for ns, tag in ns_tags ] + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_tag, __pyx_kp_555, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 262; __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[4]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_1) { + __Pyx_INCREF(__pyx_v_tag); + __pyx_1 = __pyx_v_tag; + } else { + __Pyx_INCREF(Py_None); + __pyx_1 = Py_None; + } + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 262; __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); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_6 = PyList_Append(__pyx_t_4, (PyObject*)__pyx_t_5); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_4)); + __pyx_r = __pyx_t_4; + __Pyx_DECREF(((PyObject *)__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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __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_DECREF(__pyx_v_tag_names); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":45 + * cdef _ExceptionContext _exc + * + * def __init__(self, namespaces, extensions, enable_regexp, # <<<<<<<<<<<<<< + * build_smart_strings): + * cdef _ExsltRegExp _regexp + */ + +static int __pyx_pf_4lxml_5etree_12_BaseContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_12_BaseContext___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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_5 = 0; + PyObject *__pyx_6 = 0; + 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; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_enable_regexp,&__pyx_kp_build_smart_strings,0}; + __Pyx_SetupRefcountContext("__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_kp_namespaces); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_enable_regexp); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_build_smart_strings); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __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[5]; __pyx_lineno = 45; __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[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._BaseContext.__init__"); + 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-2.2/src/lxml/extensions.pxi":50 + * cdef dict new_extensions + * cdef list ns + * self._utf_refs = {} # <<<<<<<<<<<<<< + * self._global_namespaces = [] + * self._function_cache = {} + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_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_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":51 + * 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[5]; __pyx_lineno = 51; __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-2.2/src/lxml/extensions.pxi":52 + * self._utf_refs = {} + * self._global_namespaces = [] + * self._function_cache = {} # <<<<<<<<<<<<<< + * self._eval_context_dict = None + * + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_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_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":53 + * 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-2.2/src/lxml/extensions.pxi":55 + * 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-2.2/src/lxml/extensions.pxi":57 + * 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-2.2/src/lxml/extensions.pxi":58 + * # 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[5]; __pyx_lineno = 58; __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-2.2/src/lxml/extensions.pxi":60 + * 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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_new_extensions)); + __pyx_v_new_extensions = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":61 + * # 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[5]; __pyx_lineno = 61; __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[5]; __pyx_lineno = 61; __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-2.2/src/lxml/extensions.pxi":62 + * 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_kp_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __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[5]; __pyx_lineno = 62; __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[5]; __pyx_lineno = 62; __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[5]; __pyx_lineno = 62; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyTuple_CheckExact(__pyx_2) && likely(PyTuple_GET_SIZE(__pyx_2) == 2)) { + PyObject* tuple = __pyx_2; + __pyx_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_5); + __pyx_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_6); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns_uri); + __pyx_v_ns_uri = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_6; + __pyx_6 = 0; + } else { + __pyx_4 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_5); + __pyx_6 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_6); + if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(__pyx_v_ns_uri); + __pyx_v_ns_uri = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_6; + __pyx_6 = 0; + } + __Pyx_DECREF(__pyx_v_function); + __pyx_v_function = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (PyTuple_CheckExact(__pyx_2) && likely(PyTuple_GET_SIZE(__pyx_2) == 2)) { + PyObject* tuple = __pyx_2; + __pyx_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_5); + __pyx_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_6); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns_uri); + __pyx_v_ns_uri = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_6; + __pyx_6 = 0; + } else { + __pyx_4 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_5); + __pyx_6 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_6); + if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(__pyx_v_ns_uri); + __pyx_v_ns_uri = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_6; + __pyx_6 = 0; + } + __Pyx_DECREF(__pyx_v_function); + __pyx_v_function = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":63 + * 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-2.2/src/lxml/extensions.pxi":64 + * 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_556), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":65 + * 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[5]; __pyx_lineno = 65; __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-2.2/src/lxml/extensions.pxi":66 + * 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[5]; __pyx_lineno = 66; __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-2.2/src/lxml/extensions.pxi":67 + * 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[5]; __pyx_lineno = 67; __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[5]; __pyx_lineno = 67; __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-2.2/src/lxml/extensions.pxi":68 + * 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[5]; __pyx_lineno = 68; __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-2.2/src/lxml/extensions.pxi":70 + * 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-2.2/src/lxml/extensions.pxi":71 + * + * 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-2.2/src/lxml/extensions.pxi":72 + * 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_kp_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 72; __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[5]; __pyx_lineno = 72; __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-2.2/src/lxml/extensions.pxi":73 + * 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[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":74 + * 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[5]; __pyx_lineno = 74; __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-2.2/src/lxml/extensions.pxi":75 + * 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[5]; __pyx_lineno = 75; __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[5]; __pyx_lineno = 75; __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_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_5); + __pyx_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_ns_uri); + __pyx_v_ns_uri = __pyx_6; + __pyx_6 = 0; + } else { + __pyx_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_5); + __pyx_6 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_6); + if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_ns_uri); + __pyx_v_ns_uri = __pyx_6; + __pyx_6 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":76 + * 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_7 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = (!__pyx_t_7); + } else { + __pyx_t_8 = __pyx_t_2; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":78 + * 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: + * raise TypeError, \ + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_557), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":79 + * 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_8 = (__pyx_v_ns_uri == Py_None); + if (!__pyx_t_8) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (!__pyx_t_2); + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":81 + * 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) + * ns_uri_utf = self._to_utf(ns_uri) + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_558), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L19; + } + __pyx_L19:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":82 + * 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[5]; __pyx_lineno = 82; __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-2.2/src/lxml/extensions.pxi":83 + * 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[5]; __pyx_lineno = 83; __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-2.2/src/lxml/extensions.pxi":84 + * prefix_utf = self._to_utf(prefix) + * ns_uri_utf = self._to_utf(ns_uri) + * ns.append( (prefix_utf, ns_uri_utf) ) # <<<<<<<<<<<<<< + * namespaces = ns + * else: + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __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_9 = PyList_Append(((PyObject *)__pyx_v_ns), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __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-2.2/src/lxml/extensions.pxi":85 + * 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-2.2/src/lxml/extensions.pxi":87 + * 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-2.2/src/lxml/extensions.pxi":89 + * 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-2.2/src/lxml/extensions.pxi":90 + * + * 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[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ExceptionContext))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/extensions.pxi":91 + * 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 %s", Py_TYPE(__pyx_v_extensions)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 91; __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-2.2/src/lxml/extensions.pxi":92 + * self._exc = _ExceptionContext() + * self._extensions = extensions + * self._namespaces = namespaces # <<<<<<<<<<<<<< + * self._temp_refs = _TempStore() + * self._build_smart_strings = build_smart_strings + */ + if (!(likely(PyList_CheckExact(__pyx_v_namespaces)) || (__pyx_v_namespaces) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_v_namespaces)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 92; __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-2.2/src/lxml/extensions.pxi":93 + * self._extensions = extensions + * self._namespaces = namespaces + * self._temp_refs = _TempStore() # <<<<<<<<<<<<<< + * 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[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__TempStore))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/extensions.pxi":94 + * self._namespaces = namespaces + * self._temp_refs = _TempStore() + * self._build_smart_strings = build_smart_strings # <<<<<<<<<<<<<< + * + * if enable_regexp: + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_build_smart_strings); if (unlikely((__pyx_t_7 == (int)-1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_build_smart_strings = __pyx_t_7; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":96 + * self._build_smart_strings = build_smart_strings + * + * if enable_regexp: # <<<<<<<<<<<<<< + * _regexp = _ExsltRegExp() + * _regexp._register_in_context(self) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_enable_regexp); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":97 + * + * 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[5]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ExsltRegExp))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/extensions.pxi":98 + * 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[5]; __pyx_lineno = 98; __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_5); + __Pyx_XDECREF(__pyx_6); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":100 + * _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; + PyObject *__pyx_1 = 0; + 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_SetupRefcountContext("_copy"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_namespaces = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":102 + * 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-2.2/src/lxml/extensions.pxi":103 + * cdef _BaseContext context + * if self._namespaces is not None: + * namespaces = self._namespaces[:] # <<<<<<<<<<<<<< + * context = self.__class__(namespaces, None, False, + * self._build_smart_strings) + */ + __pyx_1 = PySequence_GetSlice(((PyObject *)__pyx_v_self->_namespaces), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(__pyx_v_namespaces); + __pyx_v_namespaces = ((PyObject *)__pyx_1); + __pyx_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":104 + * 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_kp___class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 104; __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[5]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":105 + * 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[5]; __pyx_lineno = 105; __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[5]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_namespaces); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_namespaces); + __Pyx_GIVEREF(__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[5]; __pyx_lineno = 104; __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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__BaseContext))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 104; __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-2.2/src/lxml/extensions.pxi":106 + * 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-2.2/src/lxml/extensions.pxi":107 + * self._build_smart_strings) + * if self._extensions is not None: + * context._extensions = self._extensions.copy() # <<<<<<<<<<<<<< + * return context + * + */ + __pyx_t_4 = PyDict_Copy(((PyObject *)__pyx_v_self->_extensions)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyDict_CheckExact(__pyx_t_4)) || (__pyx_t_4) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/extensions.pxi":108 + * 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_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._BaseContext._copy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_DECREF(__pyx_v_namespaces); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":110 + * 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_SetupRefcountContext("_to_utf"); + __pyx_v_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":113 + * 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-2.2/src/lxml/extensions.pxi":114 + * 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-2.2/src/lxml/extensions.pxi":115 + * if s is None: + * return None + * dict_result = python.PyDict_GetItem(self._utf_refs, s) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * return dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_self->_utf_refs), __pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":116 + * return None + * dict_result = python.PyDict_GetItem(self._utf_refs, s) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * return dict_result + * utf = _utf8(s) + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":117 + * dict_result = python.PyDict_GetItem(self._utf_refs, s) + * if dict_result is not NULL: + * return 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-2.2/src/lxml/extensions.pxi":118 + * if dict_result is not NULL: + * return dict_result + * utf = _utf8(s) # <<<<<<<<<<<<<< + * self._utf_refs[s] = utf + * return utf + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_utf); + __pyx_v_utf = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":119 + * return dict_result + * utf = _utf8(s) + * self._utf_refs[s] = utf # <<<<<<<<<<<<<< + * return utf + * + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_self->_utf_refs), __pyx_v_s, __pyx_v_utf) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":120 + * 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(__pyx_v_utf); + __pyx_r = __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":122 + * return utf + * + * cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt): # <<<<<<<<<<<<<< + * self._xpathCtxt = xpathCtxt + * xpathCtxt.userData = 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_SetupRefcountContext("_set_xpath_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":123 + * + * cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt): + * self._xpathCtxt = xpathCtxt # <<<<<<<<<<<<<< + * xpathCtxt.userData = self + * + */ + __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":124 + * cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt): + * self._xpathCtxt = xpathCtxt + * xpathCtxt.userData = self # <<<<<<<<<<<<<< + * + * cdef _register_context(self, _Document doc): + */ + __pyx_v_xpathCtxt->userData = ((void *)__pyx_v_self); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":126 + * xpathCtxt.userData = 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_SetupRefcountContext("_register_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":127 + * + * 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-2.2/src/lxml/extensions.pxi":128 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":130 + * 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; + __Pyx_SetupRefcountContext("_cleanup_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":133 + * #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt) + * #self.unregisterGlobalNamespaces() + * python.PyDict_Clear(self._utf_refs) # <<<<<<<<<<<<<< + * self._eval_context_dict = None + * self._doc = None + */ + PyDict_Clear(((PyObject *)__pyx_v_self->_utf_refs)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":134 + * #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-2.2/src/lxml/extensions.pxi":135 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":137 + * 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_SetupRefcountContext("_release_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":138 + * + * 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-2.2/src/lxml/extensions.pxi":139 + * 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-2.2/src/lxml/extensions.pxi":140 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":144 + * # 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":146 + * 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-2.2/src/lxml/extensions.pxi":147 + * 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_559), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":148 + * 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[5]; __pyx_lineno = 148; __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-2.2/src/lxml/extensions.pxi":149 + * 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[5]; __pyx_lineno = 149; __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-2.2/src/lxml/extensions.pxi":150 + * 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[5]; __pyx_lineno = 150; __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-2.2/src/lxml/extensions.pxi":151 + * 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-2.2/src/lxml/extensions.pxi":152 + * 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[5]; __pyx_lineno = 152; __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-2.2/src/lxml/extensions.pxi":154 + * 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[5]; __pyx_lineno = 154; __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-2.2/src/lxml/extensions.pxi":155 + * else: + * namespaces = [] + * for item in self._namespaces: # <<<<<<<<<<<<<< + * if item[0] == prefix_utf: + * item = new_item + */ + if (likely(((PyObject *)__pyx_v_self->_namespaces) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_self->_namespaces); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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-2.2/src/lxml/extensions.pxi":156 + * namespaces = [] + * for item in self._namespaces: + * if item[0] == prefix_utf: # <<<<<<<<<<<<<< + * item = new_item + * new_item = None + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_item, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_1, __pyx_v_prefix_utf, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":157 + * 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-2.2/src/lxml/extensions.pxi":158 + * 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-2.2/src/lxml/extensions.pxi":159 + * item = new_item + * new_item = None + * namespaces.append(item) # <<<<<<<<<<<<<< + * if new_item is not None: + * namespaces.append(new_item) + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_namespaces), __pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":160 + * 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-2.2/src/lxml/extensions.pxi":161 + * namespaces.append(item) + * if new_item is not None: + * namespaces.append(new_item) # <<<<<<<<<<<<<< + * self._namespaces = namespaces + * if self._xpathCtxt is not NULL: + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_namespaces), __pyx_v_new_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":162 + * 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-2.2/src/lxml/extensions.pxi":163 + * 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-2.2/src/lxml/extensions.pxi":165 + * 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, PyString_AS_STRING(__pyx_v_prefix_utf), PyString_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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":167 + * 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_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":168 + * + * 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-2.2/src/lxml/extensions.pxi":169 + * 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_560), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":170 + * 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[5]; __pyx_lineno = 170; __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-2.2/src/lxml/extensions.pxi":171 + * 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[5]; __pyx_lineno = 171; __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-2.2/src/lxml/extensions.pxi":172 + * 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)) + */ + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_self->_global_namespaces), __pyx_v_prefix_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":174 + * 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, PyString_AS_STRING(__pyx_v_prefix_utf), PyString_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":176 + * _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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":177 + * + * 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-2.2/src/lxml/extensions.pxi":178 + * 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-2.2/src/lxml/extensions.pxi":179 + * 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 (likely(((PyObject *)__pyx_v_self->_namespaces) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_self->_namespaces); __Pyx_INCREF(__pyx_t_3); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_prefix_utf); + __pyx_v_prefix_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns_uri_utf); + __pyx_v_ns_uri_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_prefix_utf); + __pyx_v_prefix_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns_uri_utf); + __pyx_v_ns_uri_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":181 + * 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, PyString_AS_STRING(__pyx_v_prefix_utf), PyString_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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":183 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":184 + * + * 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[5]; __pyx_lineno = 184; __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-2.2/src/lxml/extensions.pxi":185 + * 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-2.2/src/lxml/extensions.pxi":186 + * 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 (likely(((PyObject *)__pyx_v_ns_prefixes) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_ns_prefixes); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_prefix_utf); + __pyx_v_prefix_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns_uri_utf); + __pyx_v_ns_uri_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_prefix_utf); + __pyx_v_prefix_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_ns_uri_utf); + __pyx_v_ns_uri_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":187 + * 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)) + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_self->_global_namespaces), __pyx_v_prefix_utf); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":189 + * 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, PyString_AS_STRING(__pyx_v_prefix_utf), PyString_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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":191 + * 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; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("unregisterGlobalNamespaces"); + __pyx_v_prefix_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":192 + * + * 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 = (PyList_GET_SIZE(((PyObject *)__pyx_v_self->_global_namespaces)) > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":193 + * 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 (likely(((PyObject *)__pyx_v_self->_global_namespaces) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_self->_global_namespaces); __Pyx_INCREF(__pyx_t_3); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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++; + __Pyx_DECREF(__pyx_v_prefix_utf); + __pyx_v_prefix_utf = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":195 + * for prefix_utf in self._global_namespaces: + * xpath.xmlXPathRegisterNs(self._xpathCtxt, + * _cstr(prefix_utf), NULL) # <<<<<<<<<<<<<< + * del self._global_namespaces[:] + * + */ + xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyString_AS_STRING(__pyx_v_prefix_utf), NULL); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":196 + * xpath.xmlXPathRegisterNs(self._xpathCtxt, + * _cstr(prefix_utf), NULL) + * del self._global_namespaces[:] # <<<<<<<<<<<<<< + * + * cdef void _unregisterNamespace(self, prefix_utf): + */ + if (PySequence_DelSlice(((PyObject *)__pyx_v_self->_global_namespaces), 0, PY_SSIZE_T_MAX) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __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_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":198 + * 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_SetupRefcountContext("_unregisterNamespace"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":200 + * cdef void _unregisterNamespace(self, prefix_utf): + * xpath.xmlXPathRegisterNs(self._xpathCtxt, + * _cstr(prefix_utf), NULL) # <<<<<<<<<<<<<< + * + * # extension functions + */ + xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, PyString_AS_STRING(__pyx_v_prefix_utf), NULL); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":204 + * # 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) { + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_addLocalExtensionFunction"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":205 + * + * 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-2.2/src/lxml/extensions.pxi":206 + * cdef void _addLocalExtensionFunction(self, ns_utf, name_utf, function): + * if self._extensions is None: + * self._extensions = {} # <<<<<<<<<<<<<< + * self._extensions[(ns_utf, name_utf)] = function + * + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __Pyx_GOTREF(__pyx_v_self->_extensions); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_extensions)); + __pyx_v_self->_extensions = __pyx_1; + __pyx_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":207 + * 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[5]; __pyx_lineno = 207; __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[5]; __pyx_lineno = 207; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("lxml.etree._BaseContext._addLocalExtensionFunction"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":209 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + void *__pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":213 + * 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-2.2/src/lxml/extensions.pxi":215 + * 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_result + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_self->_function_cache), __pyx_v_ns_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":216 + * dict_result = python.PyDict_GetItem( + * self._function_cache, ns_utf) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * d = dict_result + * else: + */ + __pyx_t_5 = (__pyx_v_dict_result != NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":217 + * self._function_cache, ns_utf) + * if dict_result is not NULL: + * d = 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-2.2/src/lxml/extensions.pxi":219 + * d = dict_result + * else: + * d = {} # <<<<<<<<<<<<<< + * self._function_cache[ns_utf] = d + * for name_utf, function in ns_functions.iteritems(): + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_d)); + __pyx_v_d = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":220 + * 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[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":221 + * 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_7 = PyObject_GetAttr(__pyx_v_ns_functions, __pyx_kp_iteritems); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_6 = 0; __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break; + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_7))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; + } else { + __pyx_t_8 = PyIter_Next(__pyx_t_7); + if (!__pyx_t_8) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __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_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_function); + __pyx_v_function = __pyx_1; + __pyx_1 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_function); + __pyx_v_function = __pyx_1; + __pyx_1 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":222 + * 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[5]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":223 + * 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_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":225 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_5 = 0; + PyObject *__pyx_6 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + void *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":229 + * 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-2.2/src/lxml/extensions.pxi":230 + * 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-2.2/src/lxml/extensions.pxi":231 + * 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-2.2/src/lxml/extensions.pxi":232 + * 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-2.2/src/lxml/extensions.pxi":233 + * 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_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_5); + __pyx_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_6); + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_6; + __pyx_6 = 0; + } else { + __pyx_4 = PyObject_GetIter(((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_5); + __pyx_6 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_6); + if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_5; + __pyx_5 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_6; + __pyx_6 = 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-2.2/src/lxml/extensions.pxi":234 + * 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_6 = (__pyx_v_d == ((PyObject *)Py_None)); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_1; + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":235 + * 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-2.2/src/lxml/extensions.pxi":237 + * last_ns = ns_utf + * dict_result = python.PyDict_GetItem( + * self._function_cache, ns_utf) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * d = dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_self->_function_cache), __pyx_v_ns_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":238 + * dict_result = python.PyDict_GetItem( + * self._function_cache, ns_utf) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * d = dict_result + * else: + */ + __pyx_t_7 = (__pyx_v_dict_result != NULL); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":239 + * self._function_cache, ns_utf) + * if dict_result is not NULL: + * d = 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-2.2/src/lxml/extensions.pxi":241 + * d = dict_result + * else: + * d = {} # <<<<<<<<<<<<<< + * self._function_cache[ns_utf] = d + * d[name_utf] = function + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __Pyx_DECREF(((PyObject *)__pyx_v_d)); + __pyx_v_d = __pyx_4; + __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":242 + * 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[5]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":243 + * 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[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":244 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_5); + __Pyx_XDECREF(__pyx_6); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":246 + * 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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":248 + * 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-2.2/src/lxml/extensions.pxi":249 + * _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[5]; __pyx_lineno = 249; __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[5]; __pyx_lineno = 249; __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-2.2/src/lxml/extensions.pxi":250 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":252 + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/extensions.pxi":254 + * 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 \ + */ + __pyx_t_2 = PyDict_Items(((PyObject *)__pyx_v_self->_function_cache)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __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[5]; __pyx_lineno = 254; __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[5]; __pyx_lineno = 254; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_functions); + __pyx_v_functions = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_functions); + __pyx_v_functions = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":255 + * _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_4 = 0; __pyx_t_2 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __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-2.2/src/lxml/extensions.pxi":256 + * 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_6 = (__pyx_v_self->_extensions == ((PyObject *)Py_None)); + if (!__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":257 + * 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[5]; __pyx_lineno = 257; __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); + __pyx_t_7 = (!PySequence_Contains(((PyObject *)__pyx_v_self->_extensions), ((PyObject *)__pyx_t_5))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_6; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":258 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":260 + * 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; + __Pyx_SetupRefcountContext("_find_cached_function"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":267 + * 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-2.2/src/lxml/extensions.pxi":269 + * if c_ns_uri is NULL: + * c_dict = python.PyDict_GetItem( + * self._function_cache, None) # <<<<<<<<<<<<<< + * else: + * c_dict = python.PyDict_GetItem( + */ + __pyx_v_c_dict = PyDict_GetItem(((PyObject *)__pyx_v_self->_function_cache), Py_None); + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":272 + * else: + * c_dict = python.PyDict_GetItem( + * self._function_cache, c_ns_uri) # <<<<<<<<<<<<<< + * + * if c_dict is not NULL: + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_c_ns_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_c_dict = PyDict_GetItem(((PyObject *)__pyx_v_self->_function_cache), __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":274 + * self._function_cache, c_ns_uri) + * + * if c_dict is not NULL: # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem( + * c_dict, c_name) + */ + __pyx_t_1 = (__pyx_v_c_dict != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":276 + * if c_dict is not NULL: + * dict_result = python.PyDict_GetItem( + * c_dict, c_name) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * return dict_result + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_c_dict), __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":277 + * dict_result = python.PyDict_GetItem( + * c_dict, c_name) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * return dict_result + * return None + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":278 + * c_dict, c_name) + * if dict_result is not NULL: + * return 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-2.2/src/lxml/extensions.pxi":279 + * if dict_result is not NULL: + * return 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_AddTraceback("lxml.etree._BaseContext._find_cached_function"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":284 + * + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":286 + * 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-2.2/src/lxml/extensions.pxi":287 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":288 + * if self._xpathCtxt is NULL: + * raise XPathError, \ + * u"XPath context is only usable during the evaluation" # <<<<<<<<<<<<<< + * c_node = self._xpathCtxt.node + * if c_node is NULL: + */ + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_561), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":289 + * 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-2.2/src/lxml/extensions.pxi":290 + * 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-2.2/src/lxml/extensions.pxi":291 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_562), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":292 + * 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-2.2/src/lxml/extensions.pxi":293 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":294 + * if c_node.doc != self._xpathCtxt.doc: + * raise XPathError, \ + * u"document-external context nodes are not supported" # <<<<<<<<<<<<<< + * if self._doc is None: + * raise XPathError, u"document context is missing" + */ + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_563), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":295 + * 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-2.2/src/lxml/extensions.pxi":296 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_564), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":297 + * 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 *)__pyx_f_4lxml_5etree__elementFactory(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._BaseContext.context_node.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":300 + * + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":301 + * 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-2.2/src/lxml/extensions.pxi":302 + * def __get__(self): + * if self._eval_context_dict is None: + * self._eval_context_dict = {} # <<<<<<<<<<<<<< + * return self._eval_context_dict + * + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __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_1; + __pyx_1 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":303 + * 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_1); + __Pyx_AddTraceback("lxml.etree._BaseContext.eval_context.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":307 + * # 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_SetupRefcountContext("_release_temp_refs"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":309 + * cdef _release_temp_refs(self): + * u"Free temporarily referenced objects from this context." + * self._temp_refs.clear() # <<<<<<<<<<<<<< + * + * cdef _hold(self, obj): + */ + __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[5]; __pyx_lineno = 309; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":311 + * self._temp_refs.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; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("_hold"); + __pyx_v_o = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":319 + * """ + * cdef _Element element + * if isinstance(obj, _Element): # <<<<<<<<<<<<<< + * self._temp_refs.add(obj) + * self._temp_refs.add((<_Element>obj)._doc) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_obj, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":320 + * cdef _Element element + * if isinstance(obj, _Element): + * self._temp_refs.add(obj) # <<<<<<<<<<<<<< + * self._temp_refs.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[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":321 + * if isinstance(obj, _Element): + * self._temp_refs.add(obj) + * self._temp_refs.add((<_Element>obj)._doc) # <<<<<<<<<<<<<< + * return + * elif _isString(obj) or not python.PySequence_Check(obj): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_self->_temp_refs->__pyx_vtab)->add(__pyx_v_self->_temp_refs, ((PyObject *)((struct LxmlElement *)__pyx_v_obj)->_doc)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":322 + * self._temp_refs.add(obj) + * self._temp_refs.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-2.2/src/lxml/extensions.pxi":323 + * self._temp_refs.add((<_Element>obj)._doc) + * return + * elif _isString(obj) or not python.PySequence_Check(obj): # <<<<<<<<<<<<<< + * return + * for o in obj: + */ + if (!_isString(__pyx_v_obj)) { + __pyx_t_1 = (!PySequence_Check(__pyx_v_obj)); + } else { + __pyx_t_1 = _isString(__pyx_v_obj); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":324 + * 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-2.2/src/lxml/extensions.pxi":325 + * elif _isString(obj) or not python.PySequence_Check(obj): + * return + * for o in obj: # <<<<<<<<<<<<<< + * if isinstance(o, _Element): + * #print "Holding element:", element._c_node + */ + if (PyList_CheckExact(__pyx_v_obj) || PyTuple_CheckExact(__pyx_v_obj)) { + __pyx_t_3 = 0; __pyx_t_4 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 325; __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[5]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_o); + __pyx_v_o = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":326 + * return + * for o in obj: + * if isinstance(o, _Element): # <<<<<<<<<<<<<< + * #print "Holding element:", element._c_node + * self._temp_refs.add(o) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":328 + * if isinstance(o, _Element): + * #print "Holding element:", element._c_node + * self._temp_refs.add(o) # <<<<<<<<<<<<<< + * #print "Holding document:", element._doc._c_doc + * self._temp_refs.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[5]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":330 + * self._temp_refs.add(o) + * #print "Holding document:", element._doc._c_doc + * self._temp_refs.add((<_Element>o)._doc) # <<<<<<<<<<<<<< + * + * def Extension(module, function_mapping=None, *, ns=None): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__TempStore *)__pyx_v_self->_temp_refs->__pyx_vtab)->add(__pyx_v_self->_temp_refs, ((PyObject *)((struct LxmlElement *)__pyx_v_o)->_doc)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + } + __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_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.etree._BaseContext._hold"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":332 + * self._temp_refs.add((<_Element>o)._doc) + * + * def Extension(module, function_mapping=None, *, ns=None): # <<<<<<<<<<<<<< + * u"""Extension(module, function_mapping=None, ns=None) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_Extension(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_Extension[] = "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 PyObject *__pyx_pf_4lxml_5etree_Extension(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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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; + int __pyx_t_8; + int __pyx_t_9; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_module,&__pyx_kp_function_mapping,&__pyx_kp_ns,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = 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_kp_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_kp_function_mapping); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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[5]; __pyx_lineno = 332; __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 = Py_None; + __pyx_v_ns = 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[5]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Extension"); + 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-2.2/src/lxml/extensions.pxi":345 + * functions. + * """ + * cdef dict functions = {} # <<<<<<<<<<<<<< + * if python.PyDict_Check(function_mapping): + * for function_name, xpath_name in function_mapping.items(): + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_v_functions = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":346 + * """ + * 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_1 = PyDict_Check(__pyx_v_function_mapping); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":347 + * 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_3 = PyObject_GetAttr(__pyx_v_function_mapping, __pyx_kp_items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __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[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __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_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[5]; __pyx_lineno = 347; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_function_name); + __pyx_v_function_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_xpath_name); + __pyx_v_xpath_name = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_function_name); + __pyx_v_function_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_xpath_name); + __pyx_v_xpath_name = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":348 + * 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[5]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 348; __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_xpath_name); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_xpath_name); + __Pyx_GIVEREF(__pyx_v_xpath_name); + if (PyDict_SetItem(((PyObject *)__pyx_v_functions), ((PyObject *)__pyx_t_5), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 348; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":350 + * 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_1 = (__pyx_v_function_mapping == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":351 + * 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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyObject_Dir(__pyx_v_module); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 351; __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_2 = 0; __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 351; __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_2 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 351; __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-2.2/src/lxml/extensions.pxi":352 + * 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_kp_startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_565)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_565)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_565)); + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = (!__pyx_t_1); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":351 + * 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_9 = PyList_Append(__pyx_t_3, (PyObject*)__pyx_v_name); if (unlikely(__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_v_function_mapping); + __pyx_v_function_mapping = ((PyObject *)__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":353 + * 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_2 = 0; __pyx_t_3 = __pyx_v_function_mapping; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_function_mapping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 353; __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_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_function_name); + __pyx_v_function_name = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":354 + * if not name.startswith(u'_') ] + * for function_name in function_mapping: + * functions[(ns, function_name)] = getattr(module, function_name) # <<<<<<<<<<<<<< + * return functions + * + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_ns); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns); + __Pyx_GIVEREF(__pyx_v_ns); + __Pyx_INCREF(__pyx_v_function_name); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_function_name); + __Pyx_GIVEREF(__pyx_v_function_name); + if (PyDict_SetItem(((PyObject *)__pyx_v_functions), ((PyObject *)__pyx_t_7), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":355 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __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.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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":362 + * cdef class _ExsltRegExp: + * cdef dict _compile_map + * def __init__(self): # <<<<<<<<<<<<<< + * self._compile_map = {} + * + */ + +static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + PyObject *__pyx_1 = 0; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/extensions.pxi":363 + * cdef dict _compile_map + * def __init__(self): + * self._compile_map = {} # <<<<<<<<<<<<<< + * + * cdef _make_string(self, value): + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_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_1; + __pyx_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("lxml.etree._ExsltRegExp.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":365 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/extensions.pxi":367 + * 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-2.2/src/lxml/extensions.pxi":368 + * 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-2.2/src/lxml/extensions.pxi":369 + * 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-2.2/src/lxml/extensions.pxi":371 + * 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-2.2/src/lxml/extensions.pxi":372 + * # 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_566)); + __pyx_r = ((PyObject *)__pyx_kp_566); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":373 + * if python.PyList_GET_SIZE(value) == 0: + * return u'' + * firstnode = value[0] # <<<<<<<<<<<<<< + * if _isString(firstnode): + * return firstnode + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_value, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_firstnode); + __pyx_v_firstnode = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":374 + * 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-2.2/src/lxml/extensions.pxi":375 + * 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-2.2/src/lxml/extensions.pxi":376 + * 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 = PyObject_TypeCheck(__pyx_v_firstnode, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":377 + * 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-2.2/src/lxml/extensions.pxi":378 + * 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-2.2/src/lxml/extensions.pxi":379 + * 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[5]; __pyx_lineno = 379; __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-2.2/src/lxml/extensions.pxi":380 + * if c_text is NULL: + * python.PyErr_NoMemory() + * try: # <<<<<<<<<<<<<< + * s = funicode(c_text) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":381 + * 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[5]; __pyx_lineno = 381; __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; + } + /*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_1); __pyx_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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":383 + * s = funicode(c_text) + * finally: + * tree.xmlFree(c_text) # <<<<<<<<<<<<<< + * return s + * else: + */ + 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-2.2/src/lxml/extensions.pxi":384 + * 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-2.2/src/lxml/extensions.pxi":386 + * 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[5]; __pyx_lineno = 386; __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[5]; __pyx_lineno = 386; __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-2.2/src/lxml/extensions.pxi":388 + * 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[5]; __pyx_lineno = 388; __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[5]; __pyx_lineno = 388; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":390 + * 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_SetupRefcountContext("_compile"); + __Pyx_INCREF(__pyx_v_rexp); + __pyx_v_key = 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-2.2/src/lxml/extensions.pxi":392 + * 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[5]; __pyx_lineno = 392; __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-2.2/src/lxml/extensions.pxi":393 + * 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[5]; __pyx_lineno = 393; __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(__pyx_v_key); + __pyx_v_key = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":394 + * 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 c_result + */ + __pyx_v_c_result = PyDict_GetItem(((PyObject *)__pyx_v_self->_compile_map), __pyx_v_key); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":395 + * key = (rexp, ignore_case) + * c_result = python.PyDict_GetItem(self._compile_map, key) + * if c_result is not NULL: # <<<<<<<<<<<<<< + * return c_result + * py_flags = re.UNICODE + */ + __pyx_t_2 = (__pyx_v_c_result != NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":396 + * c_result = python.PyDict_GetItem(self._compile_map, key) + * if c_result is not NULL: + * return 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-2.2/src/lxml/extensions.pxi":397 + * if c_result is not NULL: + * return 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_kp_UNICODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 397; __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-2.2/src/lxml/extensions.pxi":398 + * return 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[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":399 + * 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_kp_IGNORECASE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __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[5]; __pyx_lineno = 399; __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-2.2/src/lxml/extensions.pxi":400 + * 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_kp_compile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __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[5]; __pyx_lineno = 400; __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[5]; __pyx_lineno = 400; __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-2.2/src/lxml/extensions.pxi":401 + * 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), __pyx_v_key, __pyx_v_rexp_compiled) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":402 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":404 + * 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_test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_test(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_kp_ctxt,&__pyx_kp_s,&__pyx_kp_rexp,&__pyx_kp_flags,0}; + __Pyx_SetupRefcountContext("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_172); + 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_kp_ctxt); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_rexp); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags); + if (unlikely(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[5]; __pyx_lineno = 404; __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_172); + 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[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test"); + 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-2.2/src/lxml/extensions.pxi":405 + * + * 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[5]; __pyx_lineno = 405; __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-2.2/src/lxml/extensions.pxi":406 + * 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[5]; __pyx_lineno = 406; __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-2.2/src/lxml/extensions.pxi":407 + * 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_kp_567))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __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[5]; __pyx_lineno = 407; __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[5]; __pyx_lineno = 407; __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-2.2/src/lxml/extensions.pxi":408 + * 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_kp_search); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __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[5]; __pyx_lineno = 408; __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[5]; __pyx_lineno = 408; __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-2.2/src/lxml/extensions.pxi":409 + * 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[5]; __pyx_lineno = 409; __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-2.2/src/lxml/extensions.pxi":411 + * 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[5]; __pyx_lineno = 411; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":413 + * 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_match(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_match(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_ctxt,&__pyx_kp_s,&__pyx_kp_rexp,&__pyx_kp_flags,0}; + __Pyx_SetupRefcountContext("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_173); + 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_kp_ctxt); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_rexp); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags); + if (unlikely(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[5]; __pyx_lineno = 413; __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_173); + 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[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match"); + 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-2.2/src/lxml/extensions.pxi":415 + * 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[5]; __pyx_lineno = 415; __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-2.2/src/lxml/extensions.pxi":416 + * 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[5]; __pyx_lineno = 416; __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-2.2/src/lxml/extensions.pxi":417 + * 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_kp_568))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 417; __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[5]; __pyx_lineno = 417; __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[5]; __pyx_lineno = 417; __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-2.2/src/lxml/extensions.pxi":418 + * 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_kp_569))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":419 + * 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_kp_findall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __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[5]; __pyx_lineno = 419; __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[5]; __pyx_lineno = 419; __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-2.2/src/lxml/extensions.pxi":420 + * 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[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_2); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":421 + * 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-2.2/src/lxml/extensions.pxi":423 + * return () + * else: + * result = rexpc.search(s) # <<<<<<<<<<<<<< + * if not result: + * return () + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_rexpc, __pyx_kp_search); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 423; __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[5]; __pyx_lineno = 423; __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[5]; __pyx_lineno = 423; __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-2.2/src/lxml/extensions.pxi":424 + * 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[5]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_5); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":425 + * 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-2.2/src/lxml/extensions.pxi":426 + * if not result: + * return () + * results = [ result.group() ] # <<<<<<<<<<<<<< + * results.extend( result.groups(u'') ) + * result_list = [] + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_result, __pyx_kp_group); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 426; __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[5]; __pyx_lineno = 426; __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[5]; __pyx_lineno = 426; __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-2.2/src/lxml/extensions.pxi":427 + * return () + * results = [ result.group() ] + * results.extend( result.groups(u'') ) # <<<<<<<<<<<<<< + * result_list = [] + * root = Element(u'matches') + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_results, __pyx_kp_extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_result, __pyx_kp_groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __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[5]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_570)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_570)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_570)); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __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_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":428 + * results = [ result.group() ] + * results.extend( result.groups(u'') ) + * result_list = [] # <<<<<<<<<<<<<< + * root = Element(u'matches') + * join_groups = u''.join + */ + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_v_result_list)); + __pyx_v_result_list = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":429 + * results.extend( result.groups(u'') ) + * result_list = [] + * root = Element(u'matches') # <<<<<<<<<<<<<< + * join_groups = u''.join + * for s_match in results: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Element); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_571)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_571)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_571)); + __pyx_t_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_root); + __pyx_v_root = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":430 + * result_list = [] + * root = Element(u'matches') + * join_groups = u''.join # <<<<<<<<<<<<<< + * for s_match in results: + * if python.PyTuple_CheckExact(s_match): + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_572), __pyx_kp_join); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_join_groups); + __pyx_v_join_groups = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":431 + * 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_7 = 0; __pyx_t_4 = __pyx_v_results; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; + } else { + __pyx_t_6 = PyIter_Next(__pyx_t_4); + if (!__pyx_t_6) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_v_s_match); + __pyx_v_s_match = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":432 + * 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-2.2/src/lxml/extensions.pxi":433 + * 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_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_s_match); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s_match); + __Pyx_GIVEREF(__pyx_v_s_match); + __pyx_t_3 = PyObject_Call(__pyx_v_join_groups, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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-2.2/src/lxml/extensions.pxi":434 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_SubElement); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 434; __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_INCREF(((PyObject *)__pyx_kp_573)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_573)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_573)); + __pyx_t_6 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_elem); + __pyx_v_elem = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":435 + * 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_kp_text, __pyx_v_s_match) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":436 + * elem = SubElement(root, u'match') + * elem.text = s_match + * result_list.append(elem) # <<<<<<<<<<<<<< + * return result_list + * + */ + __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_result_list), __pyx_v_elem); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":437 + * 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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":439 + * 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_replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_replace(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; + PyObject *__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_kp_ctxt,&__pyx_kp_s,&__pyx_kp_rexp,&__pyx_kp_flags,&__pyx_kp_replacement,0}; + __Pyx_SetupRefcountContext("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_kp_ctxt); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_rexp); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 3); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_replacement); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 4); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 439; __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[5]; __pyx_lineno = 439; __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[5]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace"); + 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); + __pyx_v_count = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":440 + * + * 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[5]; __pyx_lineno = 440; __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-2.2/src/lxml/extensions.pxi":441 + * 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[5]; __pyx_lineno = 441; __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-2.2/src/lxml/extensions.pxi":442 + * 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[5]; __pyx_lineno = 442; __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-2.2/src/lxml/extensions.pxi":443 + * 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_kp_574))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 443; __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[5]; __pyx_lineno = 443; __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[5]; __pyx_lineno = 443; __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-2.2/src/lxml/extensions.pxi":444 + * 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_kp_575))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":445 + * rexpc = self._compile(rexp, u'i' in flags) + * if u'g' in flags: + * count = 0 # <<<<<<<<<<<<<< + * else: + * count = 1 + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_int_0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":447 + * count = 0 + * else: + * count = 1 # <<<<<<<<<<<<<< + * return rexpc.sub(replacement, s, count) + * + */ + __Pyx_INCREF(__pyx_int_1); + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_int_1; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":448 + * 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_kp_sub); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_replacement); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_replacement); + __Pyx_GIVEREF(__pyx_v_replacement); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __Pyx_INCREF(__pyx_v_count); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_count); + __Pyx_GIVEREF(__pyx_v_count); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __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_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._ExsltRegExp.replace"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_rexpc); + __Pyx_DECREF(__pyx_v_count); + __Pyx_DECREF(__pyx_v_s); + __Pyx_DECREF(__pyx_v_flags); + __Pyx_DECREF(__pyx_v_replacement); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":450 + * return rexpc.sub(replacement, s, count) + * + * cdef _register_in_context(self, _BaseContext context): # <<<<<<<<<<<<<< + * ns = "http://exslt.org/regular-expressions" + * context._addLocalExtensionFunction(ns, "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_SetupRefcountContext("_register_in_context"); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":451 + * + * cdef _register_in_context(self, _BaseContext context): + * ns = "http://exslt.org/regular-expressions" # <<<<<<<<<<<<<< + * context._addLocalExtensionFunction(ns, "test", self.test) + * context._addLocalExtensionFunction(ns, "match", self.match) + */ + __Pyx_INCREF(__pyx_kp_576); + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_kp_576; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":452 + * cdef _register_in_context(self, _BaseContext context): + * ns = "http://exslt.org/regular-expressions" + * context._addLocalExtensionFunction(ns, "test", self.test) # <<<<<<<<<<<<<< + * context._addLocalExtensionFunction(ns, "match", self.match) + * context._addLocalExtensionFunction(ns, "replace", self.replace) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_test); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 452; __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, __pyx_v_ns, __pyx_kp_577, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":453 + * ns = "http://exslt.org/regular-expressions" + * context._addLocalExtensionFunction(ns, "test", self.test) + * context._addLocalExtensionFunction(ns, "match", self.match) # <<<<<<<<<<<<<< + * context._addLocalExtensionFunction(ns, "replace", self.replace) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 453; __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, __pyx_v_ns, __pyx_kp_578, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":454 + * context._addLocalExtensionFunction(ns, "test", self.test) + * context._addLocalExtensionFunction(ns, "match", self.match) + * context._addLocalExtensionFunction(ns, "replace", self.replace) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __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, __pyx_v_ns, __pyx_kp_579, __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":460 + * # helper functions + * + * cdef xpath.xmlXPathObject* _wrapXPathObject(object obj) except NULL: # <<<<<<<<<<<<<< + * cdef xpath.xmlNodeSet* resultSet + * cdef _Element node + */ + +static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *__pyx_v_obj) { + xmlNodeSet *__pyx_v_resultSet; + struct LxmlElement *__pyx_v_node; + PyObject *__pyx_v_element; + xmlXPathObject *__pyx_r; + PyObject *__pyx_1 = 0; + 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; + __Pyx_SetupRefcountContext("_wrapXPathObject"); + __Pyx_INCREF(__pyx_v_obj); + __pyx_v_node = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":463 + * cdef xpath.xmlNodeSet* resultSet + * cdef _Element node + * if python.PyUnicode_Check(obj): # <<<<<<<<<<<<<< + * obj = _utf8(obj) + * if python.PyString_Check(obj): + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_obj); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":464 + * cdef _Element node + * if python.PyUnicode_Check(obj): + * obj = _utf8(obj) # <<<<<<<<<<<<<< + * if python.PyString_Check(obj): + * return xpath.xmlXPathNewCString(_cstr(obj)) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 464; __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-2.2/src/lxml/extensions.pxi":465 + * if python.PyUnicode_Check(obj): + * obj = _utf8(obj) + * if python.PyString_Check(obj): # <<<<<<<<<<<<<< + * return xpath.xmlXPathNewCString(_cstr(obj)) + * if python.PyBool_Check(obj): + */ + __pyx_t_1 = PyString_Check(__pyx_v_obj); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":466 + * obj = _utf8(obj) + * if python.PyString_Check(obj): + * return xpath.xmlXPathNewCString(_cstr(obj)) # <<<<<<<<<<<<<< + * if python.PyBool_Check(obj): + * return xpath.xmlXPathNewBoolean(obj) + */ + __pyx_r = xmlXPathNewCString(PyString_AS_STRING(__pyx_v_obj)); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":467 + * if python.PyString_Check(obj): + * 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-2.2/src/lxml/extensions.pxi":468 + * 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[5]; __pyx_lineno = 468; __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-2.2/src/lxml/extensions.pxi":469 + * 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-2.2/src/lxml/extensions.pxi":470 + * 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(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 470; __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-2.2/src/lxml/extensions.pxi":471 + * 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-2.2/src/lxml/extensions.pxi":472 + * 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-2.2/src/lxml/extensions.pxi":473 + * 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 = PyObject_TypeCheck(__pyx_v_obj, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":474 + * 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-2.2/src/lxml/extensions.pxi":475 + * elif isinstance(obj, _Element): + * resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node) + * elif python.PySequence_Check(obj): # <<<<<<<<<<<<<< + * resultSet = xpath.xmlXPathNodeSetCreate(NULL) + * for element in obj: + */ + __pyx_t_1 = PySequence_Check(__pyx_v_obj); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":476 + * resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node) + * elif python.PySequence_Check(obj): + * resultSet = xpath.xmlXPathNodeSetCreate(NULL) # <<<<<<<<<<<<<< + * for element in obj: + * if isinstance(element, _Element): + */ + __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":477 + * elif python.PySequence_Check(obj): + * resultSet = xpath.xmlXPathNodeSetCreate(NULL) + * for element in obj: # <<<<<<<<<<<<<< + * if isinstance(element, _Element): + * node = <_Element>element + */ + 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[5]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_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[5]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_v_element); + __pyx_v_element = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":478 + * resultSet = xpath.xmlXPathNodeSetCreate(NULL) + * for element in obj: + * if isinstance(element, _Element): # <<<<<<<<<<<<<< + * node = <_Element>element + * xpath.xmlXPathNodeSetAdd(resultSet, node._c_node) + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":479 + * for element in obj: + * if isinstance(element, _Element): + * node = <_Element>element # <<<<<<<<<<<<<< + * xpath.xmlXPathNodeSetAdd(resultSet, node._c_node) + * else: + */ + __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_element))); + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((struct LxmlElement *)__pyx_v_element); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":480 + * if isinstance(element, _Element): + * node = <_Element>element + * xpath.xmlXPathNodeSetAdd(resultSet, node._c_node) # <<<<<<<<<<<<<< + * else: + * xpath.xmlXPathFreeNodeSet(resultSet) + */ + xmlXPathNodeSetAdd(__pyx_v_resultSet, __pyx_v_node->_c_node); + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":482 + * xpath.xmlXPathNodeSetAdd(resultSet, node._c_node) + * else: + * xpath.xmlXPathFreeNodeSet(resultSet) # <<<<<<<<<<<<<< + * raise XPathResultError, u"This is not a node: %r" % element + * else: + */ + xmlXPathFreeNodeSet(__pyx_v_resultSet); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":483 + * else: + * xpath.xmlXPathFreeNodeSet(resultSet) + * raise XPathResultError, u"This is not a node: %r" % element # <<<<<<<<<<<<<< + * else: + * raise XPathResultError, u"Unknown return type: %s" % \ + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathResultError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_580), __pyx_v_element); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_1, __pyx_t_6, 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":485 + * raise XPathResultError, u"This is not a node: %r" % element + * else: + * raise XPathResultError, u"Unknown return type: %s" % \ # <<<<<<<<<<<<<< + * python._fqtypename(obj) + * return xpath.xmlXPathWrapNodeSet(resultSet) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathResultError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":486 + * else: + * raise XPathResultError, u"Unknown return type: %s" % \ + * python._fqtypename(obj) # <<<<<<<<<<<<<< + * return xpath.xmlXPathWrapNodeSet(resultSet) + * + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(_fqtypename(__pyx_v_obj)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_581), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_1, __pyx_t_6, 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":487 + * 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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("lxml.etree._wrapXPathObject"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_node); + __Pyx_DECREF(__pyx_v_element); + __Pyx_DECREF(__pyx_v_obj); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":489 + * return xpath.xmlXPathWrapNodeSet(resultSet) + * + * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj, # <<<<<<<<<<<<<< + * _Document doc, bint smart_string): + * if xpathObj.type == xpath.XPATH_UNDEFINED: + */ + +static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, int __pyx_v_smart_string) { + PyObject *__pyx_v_stringval; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_unwrapXPathObject"); + __pyx_v_stringval = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":491 + * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj, + * _Document doc, bint smart_string): + * 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-2.2/src/lxml/extensions.pxi":492 + * _Document doc, bint smart_string): + * if xpathObj.type == xpath.XPATH_UNDEFINED: + * raise XPathResultError, u"Undefined xpath result" # <<<<<<<<<<<<<< + * elif xpathObj.type == xpath.XPATH_NODESET: + * return _createNodeSetResult(xpathObj, doc, smart_string, 0) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathResultError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_582), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":493 + * if xpathObj.type == xpath.XPATH_UNDEFINED: + * raise XPathResultError, u"Undefined xpath result" + * elif xpathObj.type == xpath.XPATH_NODESET: # <<<<<<<<<<<<<< + * return _createNodeSetResult(xpathObj, doc, smart_string, 0) + * 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-2.2/src/lxml/extensions.pxi":494 + * raise XPathResultError, u"Undefined xpath result" + * elif xpathObj.type == xpath.XPATH_NODESET: + * return _createNodeSetResult(xpathObj, doc, smart_string, 0) # <<<<<<<<<<<<<< + * 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_smart_string, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __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; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":495 + * elif xpathObj.type == xpath.XPATH_NODESET: + * return _createNodeSetResult(xpathObj, doc, smart_string, 0) + * 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-2.2/src/lxml/extensions.pxi":496 + * return _createNodeSetResult(xpathObj, doc, smart_string, 0) + * 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[5]; __pyx_lineno = 496; __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-2.2/src/lxml/extensions.pxi":497 + * 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-2.2/src/lxml/extensions.pxi":498 + * 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[5]; __pyx_lineno = 498; __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-2.2/src/lxml/extensions.pxi":499 + * elif xpathObj.type == xpath.XPATH_NUMBER: + * return xpathObj.floatval + * elif xpathObj.type == xpath.XPATH_STRING: # <<<<<<<<<<<<<< + * stringval = funicode(xpathObj.stringval) + * if smart_string: + */ + __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_STRING); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":500 + * return xpathObj.floatval + * elif xpathObj.type == xpath.XPATH_STRING: + * stringval = funicode(xpathObj.stringval) # <<<<<<<<<<<<<< + * if smart_string: + * stringval = _elementStringResultFactory( + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_xpathObj->stringval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 500; __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-2.2/src/lxml/extensions.pxi":501 + * elif xpathObj.type == xpath.XPATH_STRING: + * stringval = funicode(xpathObj.stringval) + * if smart_string: # <<<<<<<<<<<<<< + * stringval = _elementStringResultFactory( + * stringval, None, 0, 0) + */ + __pyx_t_1 = __pyx_v_smart_string; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":503 + * if smart_string: + * stringval = _elementStringResultFactory( + * stringval, None, 0, 0) # <<<<<<<<<<<<<< + * return stringval + * elif xpathObj.type == xpath.XPATH_POINT: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_stringval, ((struct LxmlElement *)Py_None), 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 502; __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-2.2/src/lxml/extensions.pxi":504 + * stringval = _elementStringResultFactory( + * stringval, None, 0, 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-2.2/src/lxml/extensions.pxi":505 + * stringval, None, 0, 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-2.2/src/lxml/extensions.pxi":506 + * 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_kp_583), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":507 + * 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-2.2/src/lxml/extensions.pxi":508 + * 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_kp_584), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":509 + * 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-2.2/src/lxml/extensions.pxi":510 + * 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_kp_585), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":511 + * 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-2.2/src/lxml/extensions.pxi":512 + * 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, smart_string, 1) + */ + __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_kp_586), 0); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":513 + * elif xpathObj.type == xpath.XPATH_USERS: + * raise NotImplementedError, u"XPATH_USERS" + * elif xpathObj.type == xpath.XPATH_XSLT_TREE: # <<<<<<<<<<<<<< + * return _createNodeSetResult(xpathObj, doc, smart_string, 1) + * else: + */ + __pyx_t_1 = (__pyx_v_xpathObj->type == XPATH_XSLT_TREE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":514 + * raise NotImplementedError, u"XPATH_USERS" + * elif xpathObj.type == xpath.XPATH_XSLT_TREE: + * return _createNodeSetResult(xpathObj, doc, smart_string, 1) # <<<<<<<<<<<<<< + * 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_smart_string, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 514; __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-2.2/src/lxml/extensions.pxi":516 + * return _createNodeSetResult(xpathObj, doc, smart_string, 1) + * else: + * raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type) # <<<<<<<<<<<<<< + * + * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc, + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathResultError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_xpathObj->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 516; __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[5]; __pyx_lineno = 516; __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*)&PyUnicode_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_587), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_1, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 516; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._unwrapXPathObject"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_stringval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":518 + * raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type) + * + * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc, # <<<<<<<<<<<<<< + * bint smart_string, bint is_fragment): + * cdef xmlNode* c_node + */ + +static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, int __pyx_v_smart_string, int __pyx_v_is_fragment) { + 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; + __Pyx_SetupRefcountContext("_createNodeSetResult"); + __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":523 + * 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[5]; __pyx_lineno = 523; __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-2.2/src/lxml/extensions.pxi":524 + * cdef list result + * result = [] + * if xpathObj.nodesetval is NULL: # <<<<<<<<<<<<<< + * return result + * for i from 0 <= i < xpathObj.nodesetval.nodeNr: + */ + __pyx_t_2 = (__pyx_v_xpathObj->nodesetval == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":525 + * result = [] + * if xpathObj.nodesetval is NULL: + * return result # <<<<<<<<<<<<<< + * for i from 0 <= i < 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-2.2/src/lxml/extensions.pxi":526 + * if xpathObj.nodesetval is NULL: + * return result + * for i from 0 <= i < xpathObj.nodesetval.nodeNr: # <<<<<<<<<<<<<< + * c_node = xpathObj.nodesetval.nodeTab[i] + * _unpackNodeSetEntry(result, c_node, doc, + */ + __pyx_t_3 = __pyx_v_xpathObj->nodesetval->nodeNr; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":527 + * return result + * for i from 0 <= i < xpathObj.nodesetval.nodeNr: + * c_node = xpathObj.nodesetval.nodeTab[i] # <<<<<<<<<<<<<< + * _unpackNodeSetEntry(result, c_node, doc, + * smart_string, is_fragment) + */ + __pyx_v_c_node = (__pyx_v_xpathObj->nodesetval->nodeTab[__pyx_v_i]); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":529 + * c_node = xpathObj.nodesetval.nodeTab[i] + * _unpackNodeSetEntry(result, c_node, doc, + * smart_string, is_fragment) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_result, __pyx_v_c_node, __pyx_v_doc, __pyx_v_smart_string, __pyx_v_is_fragment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 528; __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-2.2/src/lxml/extensions.pxi":530 + * _unpackNodeSetEntry(result, c_node, doc, + * smart_string, is_fragment) + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":532 + * return result + * + * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc, # <<<<<<<<<<<<<< + * bint smart_string, 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, int __pyx_v_smart_string, 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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/extensions.pxi":536 + * 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-2.2/src/lxml/extensions.pxi":537 + * 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 + */ + if ((__pyx_v_c_node->doc != __pyx_v_doc->_c_doc)) { + __pyx_t_1 = (__pyx_v_c_node->doc->_private == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_node->doc != __pyx_v_doc->_c_doc); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":542 + * # -> 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) # <<<<<<<<<<<<<< + * results.append( + * _fakeDocElementFactory(doc, c_node)) + */ + __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-2.2/src/lxml/extensions.pxi":544 + * c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1) + * 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_2 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_results), __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":545 + * 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: + */ + if (!(__pyx_v_c_node->type == XML_TEXT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":546 + * _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( + */ + if (!(__pyx_v_c_node->type == XML_CDATA_SECTION_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":547 + * 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, smart_string)) + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE); + } else { + __pyx_t_1 = (__pyx_v_c_node->type == XML_CDATA_SECTION_NODE); + } + __pyx_t_4 = __pyx_t_1; + } else { + __pyx_t_4 = (__pyx_v_c_node->type == XML_TEXT_NODE); + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":549 + * c_node.type == tree.XML_ATTRIBUTE_NODE: + * results.append( + * _buildElementStringResult(doc, c_node, smart_string)) # <<<<<<<<<<<<<< + * elif c_node.type == tree.XML_NAMESPACE_DECL: + * s = (c_node).href + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__buildElementStringResult(__pyx_v_doc, __pyx_v_c_node, __pyx_v_smart_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_results), __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":550 + * results.append( + * _buildElementStringResult(doc, c_node, smart_string)) + * elif c_node.type == tree.XML_NAMESPACE_DECL: # <<<<<<<<<<<<<< + * s = (c_node).href + * if s is NULL: + */ + __pyx_t_4 = (__pyx_v_c_node->type == XML_NAMESPACE_DECL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":551 + * _buildElementStringResult(doc, c_node, smart_string)) + * elif c_node.type == tree.XML_NAMESPACE_DECL: + * s = (c_node).href # <<<<<<<<<<<<<< + * if s is NULL: + * href = None + */ + __pyx_v_s = ((xmlNs *)__pyx_v_c_node)->href; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":552 + * elif c_node.type == tree.XML_NAMESPACE_DECL: + * s = (c_node).href + * if s is NULL: # <<<<<<<<<<<<<< + * href = None + * else: + */ + __pyx_t_4 = (__pyx_v_s == NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":553 + * s = (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-2.2/src/lxml/extensions.pxi":555 + * href = None + * else: + * href = funicode(s) # <<<<<<<<<<<<<< + * s = (c_node).prefix + * if s is NULL: + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_href); + __pyx_v_href = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":556 + * else: + * href = funicode(s) + * s = (c_node).prefix # <<<<<<<<<<<<<< + * if s is NULL: + * prefix = None + */ + __pyx_v_s = ((xmlNs *)__pyx_v_c_node)->prefix; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":557 + * href = funicode(s) + * s = (c_node).prefix + * if s is NULL: # <<<<<<<<<<<<<< + * prefix = None + * else: + */ + __pyx_t_4 = (__pyx_v_s == NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":558 + * s = (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-2.2/src/lxml/extensions.pxi":560 + * prefix = None + * else: + * prefix = funicode(s) # <<<<<<<<<<<<<< + * results.append( (prefix, href) ) + * elif c_node.type == tree.XML_DOCUMENT_NODE or \ + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 560; __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_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":561 + * 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: + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_prefix); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_prefix); + __Pyx_GIVEREF(__pyx_v_prefix); + __Pyx_INCREF(__pyx_v_href); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_href); + __Pyx_GIVEREF(__pyx_v_href); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_results), ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":562 + * 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 + */ + if (!(__pyx_v_c_node->type == XML_DOCUMENT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":563 + * 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_4 = (__pyx_v_c_node->type == XML_HTML_DOCUMENT_NODE); + } else { + __pyx_t_4 = (__pyx_v_c_node->type == XML_DOCUMENT_NODE); + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":565 + * 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: + */ + __pyx_t_4 = __pyx_v_is_fragment; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":566 + * # 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, + */ + __pyx_v_c_child = __pyx_v_c_node->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":567 + * if is_fragment: + * c_child = c_node.children + * while c_child is not NULL: # <<<<<<<<<<<<<< + * _unpackNodeSetEntry(results, c_child, doc, + * smart_string, is_fragment) + */ + while (1) { + __pyx_t_4 = (__pyx_v_c_child != NULL); + if (!__pyx_t_4) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":569 + * while c_child is not NULL: + * _unpackNodeSetEntry(results, c_child, doc, + * smart_string, is_fragment) # <<<<<<<<<<<<<< + * c_child = c_child.next + * elif c_node.type == tree.XML_XINCLUDE_START or \ + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_results, __pyx_v_c_child, __pyx_v_doc, __pyx_v_smart_string, __pyx_v_is_fragment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 568; __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-2.2/src/lxml/extensions.pxi":570 + * _unpackNodeSetEntry(results, c_child, doc, + * smart_string, is_fragment) + * 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-2.2/src/lxml/extensions.pxi":571 + * smart_string, is_fragment) + * c_child = c_child.next + * elif c_node.type == tree.XML_XINCLUDE_START or \ # <<<<<<<<<<<<<< + * c_node.type == tree.XML_XINCLUDE_END: + * pass + */ + if (!(__pyx_v_c_node->type == XML_XINCLUDE_START)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":572 + * 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_4 = (__pyx_v_c_node->type == XML_XINCLUDE_END); + } else { + __pyx_t_4 = (__pyx_v_c_node->type == XML_XINCLUDE_START); + } + if (__pyx_t_4) { + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":576 + * else: + * raise NotImplementedError, \ + * u"Not yet implemented result node type: %d" % c_node.type # <<<<<<<<<<<<<< + * + * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj): + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_588), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_t_5, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 575; __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_5); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":578 + * 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_SetupRefcountContext("_freeXPathObject"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":582 + * 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-2.2/src/lxml/extensions.pxi":583 + * """ + * 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-2.2/src/lxml/extensions.pxi":584 + * 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-2.2/src/lxml/extensions.pxi":585 + * xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval) + * xpathObj.nodesetval = NULL + * xpath.xmlXPathFreeObject(xpathObj) # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + xmlXPathFreeObject(__pyx_v_xpathObj); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":596 + * cdef readonly object is_attribute + * + * def getparent(self): # <<<<<<<<<<<<<< + * return self._parent + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("getparent"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":597 + * + * def getparent(self): + * return self._parent # <<<<<<<<<<<<<< + * + * class _ElementStringResult(str): + */ + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":602 + * # we need to use a Python class here, str 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_SetupRefcountContext("getparent"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":603 + * # 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_kp__parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 603; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":605 + * return self._parent + * + * cdef object _elementStringResultFactory(string_value, _Element parent, # <<<<<<<<<<<<<< + * bint is_attribute, bint is_tail): + * cdef _ElementUnicodeResult uresult + */ + +static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *__pyx_v_string_value, struct LxmlElement *__pyx_v_parent, int __pyx_v_is_attribute, int __pyx_v_is_tail) { + struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_uresult; + int __pyx_v_is_text; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/extensions.pxi":609 + * cdef _ElementUnicodeResult uresult + * cdef bint is_text + * 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-2.2/src/lxml/extensions.pxi":610 + * cdef bint is_text + * 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-2.2/src/lxml/extensions.pxi":612 + * is_text = 0 + * else: + * is_text = not (is_tail or is_attribute) # <<<<<<<<<<<<<< + * + * if python.PyString_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-2.2/src/lxml/extensions.pxi":614 + * is_text = not (is_tail or is_attribute) + * + * if python.PyString_CheckExact(string_value): # <<<<<<<<<<<<<< + * result = _ElementStringResult(string_value) + * result._parent = parent + */ + __pyx_t_1 = PyString_CheckExact(__pyx_v_string_value); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":615 + * + * if python.PyString_CheckExact(string_value): + * result = _ElementStringResult(string_value) # <<<<<<<<<<<<<< + * result._parent = parent + * result.is_attribute = is_attribute + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_174); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_string_value); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_string_value); + __Pyx_GIVEREF(__pyx_v_string_value); + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":616 + * if python.PyString_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_kp__parent, ((PyObject *)__pyx_v_parent)) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":617 + * result = _ElementStringResult(string_value) + * result._parent = parent + * result.is_attribute = is_attribute # <<<<<<<<<<<<<< + * result.is_tail = is_tail + * result.is_text = is_text + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_attribute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_v_result, __pyx_kp_is_attribute, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":618 + * result._parent = parent + * result.is_attribute = is_attribute + * result.is_tail = is_tail # <<<<<<<<<<<<<< + * result.is_text = is_text + * return result + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_v_result, __pyx_kp_is_tail, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":619 + * result.is_attribute = is_attribute + * result.is_tail = is_tail + * result.is_text = is_text # <<<<<<<<<<<<<< + * return result + * else: + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_is_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_v_result, __pyx_kp_is_text, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":620 + * result.is_tail = is_tail + * result.is_text = is_text + * 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-2.2/src/lxml/extensions.pxi":622 + * return result + * else: + * uresult = _ElementUnicodeResult(string_value) # <<<<<<<<<<<<<< + * uresult._parent = parent + * uresult.is_attribute = is_attribute + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 622; __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_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementUnicodeResult)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ElementUnicodeResult))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_uresult)); + __pyx_v_uresult = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":623 + * 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-2.2/src/lxml/extensions.pxi":624 + * uresult = _ElementUnicodeResult(string_value) + * uresult._parent = parent + * uresult.is_attribute = is_attribute # <<<<<<<<<<<<<< + * uresult.is_tail = is_tail + * uresult.is_text = is_text + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_is_attribute); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_uresult->is_attribute); + __Pyx_DECREF(__pyx_v_uresult->is_attribute); + __pyx_v_uresult->is_attribute = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":625 + * uresult._parent = parent + * uresult.is_attribute = is_attribute + * uresult.is_tail = is_tail # <<<<<<<<<<<<<< + * uresult.is_text = is_text + * return uresult + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_is_tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_uresult->is_tail); + __Pyx_DECREF(__pyx_v_uresult->is_tail); + __pyx_v_uresult->is_tail = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":626 + * uresult.is_attribute = is_attribute + * uresult.is_tail = is_tail + * uresult.is_text = is_text # <<<<<<<<<<<<<< + * return uresult + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_is_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_uresult->is_text); + __Pyx_DECREF(__pyx_v_uresult->is_text); + __pyx_v_uresult->is_text = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":627 + * uresult.is_tail = is_tail + * uresult.is_text = is_text + * 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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":629 + * return uresult + * + * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node, # <<<<<<<<<<<<<< + * bint smart_string): + * cdef _Element parent + */ + +static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, int __pyx_v_smart_string) { + struct LxmlElement *__pyx_v_parent; + xmlNode *__pyx_v_c_element; + char *__pyx_v_s; + int __pyx_v_is_attribute; + int __pyx_v_is_tail; + PyObject *__pyx_v_value; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_buildElementStringResult"); + __pyx_v_parent = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":636 + * cdef bint is_attribute, is_text, is_tail + * + * if c_node.type == tree.XML_ATTRIBUTE_NODE: # <<<<<<<<<<<<<< + * is_attribute = 1 + * is_tail = 0 + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":637 + * + * if c_node.type == tree.XML_ATTRIBUTE_NODE: + * is_attribute = 1 # <<<<<<<<<<<<<< + * is_tail = 0 + * s = tree.xmlNodeGetContent(c_node) + */ + __pyx_v_is_attribute = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":638 + * if c_node.type == tree.XML_ATTRIBUTE_NODE: + * is_attribute = 1 + * is_tail = 0 # <<<<<<<<<<<<<< + * s = tree.xmlNodeGetContent(c_node) + * try: + */ + __pyx_v_is_tail = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":639 + * is_attribute = 1 + * 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-2.2/src/lxml/extensions.pxi":640 + * is_tail = 0 + * s = tree.xmlNodeGetContent(c_node) + * try: # <<<<<<<<<<<<<< + * value = funicode(s) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":641 + * 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[5]; __pyx_lineno = 641; __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; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":643 + * value = funicode(s) + * finally: + * tree.xmlFree(s) # <<<<<<<<<<<<<< + * c_element = NULL + * else: + */ + 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-2.2/src/lxml/extensions.pxi":644 + * 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-2.2/src/lxml/extensions.pxi":647 + * else: + * #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type" + * is_attribute = 0 # <<<<<<<<<<<<<< + * # may be tail text or normal text + * value = funicode(c_node.content) + */ + __pyx_v_is_attribute = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":649 + * is_attribute = 0 + * # 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[5]; __pyx_lineno = 649; __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-2.2/src/lxml/extensions.pxi":650 + * # 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-2.2/src/lxml/extensions.pxi":651 + * value = funicode(c_node.content) + * c_element = _previousElement(c_node) + * is_tail = c_element is not NULL # <<<<<<<<<<<<<< + * + * if not smart_string: + */ + __pyx_v_is_tail = (__pyx_v_c_element != NULL); + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":653 + * is_tail = c_element is not NULL + * + * if not smart_string: # <<<<<<<<<<<<<< + * return value + * + */ + __pyx_t_1 = (!__pyx_v_smart_string); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":654 + * + * if not smart_string: + * 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-2.2/src/lxml/extensions.pxi":656 + * 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-2.2/src/lxml/extensions.pxi":658 + * 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-2.2/src/lxml/extensions.pxi":659 + * # 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) { + if ((__pyx_v_c_element != NULL)) { + __pyx_t_1 = (!_isElement(__pyx_v_c_element)); + } else { + __pyx_t_1 = (__pyx_v_c_element != NULL); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":660 + * 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-2.2/src/lxml/extensions.pxi":662 + * c_element = c_element.parent + * + * if c_element is not NULL: # <<<<<<<<<<<<<< + * parent = _fakeDocElementFactory(doc, c_element) + * + */ + __pyx_t_1 = (__pyx_v_c_element != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":663 + * + * if c_element is not NULL: + * parent = _fakeDocElementFactory(doc, c_element) # <<<<<<<<<<<<<< + * + * return _elementStringResultFactory( + */ + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_element)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 663; __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-2.2/src/lxml/extensions.pxi":665 + * parent = _fakeDocElementFactory(doc, c_element) + * + * return _elementStringResultFactory( # <<<<<<<<<<<<<< + * value, parent, is_attribute, is_tail) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":666 + * + * return _elementStringResultFactory( + * value, parent, is_attribute, is_tail) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_value, __pyx_v_parent, __pyx_v_is_attribute, __pyx_v_is_tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 665; __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_DECREF((PyObject *)__pyx_v_parent); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":672 + * # 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; + int __pyx_v_i; + PyObject *__pyx_v_args; + PyObject *__pyx_v_o; + PyObject *__pyx_v_res; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + xmlXPathObject *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/extensions.pxi":678 + * cdef int i + * cdef list args + * 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-2.2/src/lxml/extensions.pxi":679 + * cdef list args + * doc = context._doc + * try: # <<<<<<<<<<<<<< + * args = [] + * for i from 0 <= i < 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-2.2/src/lxml/extensions.pxi":680 + * doc = context._doc + * try: + * args = [] # <<<<<<<<<<<<<< + * for i from 0 <= i < nargs: + * obj = xpath.valuePop(ctxt) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 680; __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-2.2/src/lxml/extensions.pxi":681 + * try: + * args = [] + * for i from 0 <= i < nargs: # <<<<<<<<<<<<<< + * obj = xpath.valuePop(ctxt) + * o = _unwrapXPathObject(obj, doc, context._build_smart_strings) + */ + __pyx_t_2 = __pyx_v_nargs; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":682 + * args = [] + * for i from 0 <= i < nargs: + * obj = xpath.valuePop(ctxt) # <<<<<<<<<<<<<< + * o = _unwrapXPathObject(obj, doc, context._build_smart_strings) + * _freeXPathObject(obj) + */ + __pyx_v_obj = valuePop(__pyx_v_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":683 + * for i from 0 <= i < nargs: + * obj = xpath.valuePop(ctxt) + * o = _unwrapXPathObject(obj, doc, context._build_smart_strings) # <<<<<<<<<<<<<< + * _freeXPathObject(obj) + * args.append(o) + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_obj, __pyx_v_doc, __pyx_v_context->_build_smart_strings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 683; __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-2.2/src/lxml/extensions.pxi":684 + * obj = xpath.valuePop(ctxt) + * o = _unwrapXPathObject(obj, doc, context._build_smart_strings) + * _freeXPathObject(obj) # <<<<<<<<<<<<<< + * args.append(o) + * args.reverse() + */ + __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_obj); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":685 + * o = _unwrapXPathObject(obj, doc, context._build_smart_strings) + * _freeXPathObject(obj) + * args.append(o) # <<<<<<<<<<<<<< + * args.reverse() + * + */ + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_args), __pyx_v_o); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":686 + * _freeXPathObject(obj) + * args.append(o) + * args.reverse() # <<<<<<<<<<<<<< + * + * res = function(context, *args) + */ + __pyx_t_2 = PyList_Reverse(((PyObject *)__pyx_v_args)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":688 + * args.reverse() + * + * res = function(context, *args) # <<<<<<<<<<<<<< + * # wrap result for XPath consumption + * obj = _wrapXPathObject(res) + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 688; __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_1 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_v_function, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_res); + __pyx_v_res = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":690 + * res = function(context, *args) + * # wrap result for XPath consumption + * obj = _wrapXPathObject(res) # <<<<<<<<<<<<<< + * # prevent Python from deallocating elements handed to libxml2 + * context._hold(res) + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_res); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_obj = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":692 + * obj = _wrapXPathObject(res) + * # prevent Python from deallocating elements handed to libxml2 + * context._hold(res) # <<<<<<<<<<<<<< + * xpath.valuePush(ctxt, obj) + * except: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_hold(__pyx_v_context, __pyx_v_res); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":693 + * # 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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":694 + * 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_1, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_6); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":695 + * 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-2.2/src/lxml/extensions.pxi":696 + * 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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L4_exception_handled; + } + __pyx_L5_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":700 + * # 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_v_exception; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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); + __pyx_v_exception = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":704 + * 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-2.2/src/lxml/extensions.pxi":705 + * 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-2.2/src/lxml/extensions.pxi":706 + * 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[5]; __pyx_lineno = 706; __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-2.2/src/lxml/extensions.pxi":707 + * 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-2.2/src/lxml/extensions.pxi":708 + * 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-2.2/src/lxml/extensions.pxi":710 + * _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-2.2/src/lxml/extensions.pxi":711 + * else: + * if rctxt.functionURI is not NULL: + * fref = u"{%s}%s" % (rctxt.functionURI, rctxt.function) # <<<<<<<<<<<<<< + * else: + * fref = rctxt.function + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_rctxt->functionURI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_rctxt->function); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 711; __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[5]; __pyx_lineno = 711; __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_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_589), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 711; __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_fref); + __pyx_v_fref = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":713 + * fref = u"{%s}%s" % (rctxt.functionURI, rctxt.function) + * else: + * fref = rctxt.function # <<<<<<<<<<<<<< + * xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR) + * exception = XPathFunctionError(u"XPath function '%s' not found" % fref) + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_rctxt->function); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_fref); + __pyx_v_fref = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":714 + * else: + * fref = rctxt.function + * xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR) # <<<<<<<<<<<<<< + * exception = XPathFunctionError(u"XPath function '%s' not found" % fref) + * context._exc._store_exception(exception) + */ + xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":715 + * fref = rctxt.function + * xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR) + * exception = XPathFunctionError(u"XPath function '%s' not found" % fref) # <<<<<<<<<<<<<< + * context._exc._store_exception(exception) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathFunctionError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_590), __pyx_v_fref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 715; __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[5]; __pyx_lineno = 715; __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(__pyx_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_exception); + __pyx_v_exception = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":716 + * xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR) + * exception = XPathFunctionError(u"XPath function '%s' not found" % fref) + * context._exc._store_exception(exception) # <<<<<<<<<<<<<< + */ + ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_exception(__pyx_v_context->_exc, __pyx_v_exception); + } + __pyx_L3:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_DECREF(__pyx_v_exception); + __Pyx_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_register_xpath_function"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":32 + * + * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf): + * if ns_utf is None: # <<<<<<<<<<<<<< + * return xpath.xmlXPathRegisterFunc( + * ctxt, _cstr(name_utf), + */ + __pyx_t_1 = (__pyx_v_ns_utf == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":35 + * return xpath.xmlXPathRegisterFunc( + * ctxt, _cstr(name_utf), + * _xpath_function_call) # <<<<<<<<<<<<<< + * else: + * return xpath.xmlXPathRegisterFuncNS( + */ + __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), PyString_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-2.2/src/lxml/xpath.pxi":39 + * return xpath.xmlXPathRegisterFuncNS( + * 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), PyString_AS_STRING(__pyx_v_name_utf), PyString_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__xpath_function_call); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_unregister_xpath_function"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":42 + * + * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf): + * if ns_utf is None: # <<<<<<<<<<<<<< + * return xpath.xmlXPathRegisterFunc( + * ctxt, _cstr(name_utf), NULL) + */ + __pyx_t_1 = (__pyx_v_ns_utf == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":44 + * if ns_utf is None: + * return xpath.xmlXPathRegisterFunc( + * ctxt, _cstr(name_utf), NULL) # <<<<<<<<<<<<<< + * else: + * return xpath.xmlXPathRegisterFuncNS( + */ + __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), PyString_AS_STRING(__pyx_v_name_utf), NULL); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":47 + * else: + * return xpath.xmlXPathRegisterFuncNS( + * ctxt, _cstr(name_utf), _cstr(ns_utf), NULL) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), PyString_AS_STRING(__pyx_v_name_utf), PyString_AS_STRING(__pyx_v_ns_utf), NULL); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_enable_regexp,&__pyx_kp_variables,&__pyx_kp_build_smart_strings,0}; + __Pyx_SetupRefcountContext("__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_kp_namespaces); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_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_kp_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_kp_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_kp_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__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_kp___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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("set_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + __Pyx_SetupRefcountContext("register_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/src/lxml/xpath.pxi":66 + * cdef register_context(self, _Document doc): + * self._register_context(doc) + * self.registerGlobalNamespaces() # <<<<<<<<<<<<<< + * self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function) + * if self._variables is not None: + */ + __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-2.2/src/lxml/xpath.pxi":67 + * self._register_context(doc) + * self.registerGlobalNamespaces() + * self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function) # <<<<<<<<<<<<<< + * if self._variables is not None: + * self.registerVariables(self._variables) + */ + ((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-2.2/src/lxml/xpath.pxi":68 + * self.registerGlobalNamespaces() + * self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function) + * 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-2.2/src/lxml/xpath.pxi":69 + * self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function) + * if self._variables is not None: + * self.registerVariables(self._variables) # <<<<<<<<<<<<<< + * + * cdef unregister_context(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->registerVariables(__pyx_v_self, __pyx_v_self->_variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 69; __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:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree._XPathContext.register_context"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":71 + * 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_SetupRefcountContext("unregister_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":73 + * 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 = 72; __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-2.2/src/lxml/xpath.pxi":74 + * 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 = 74; __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-2.2/src/lxml/xpath.pxi":75 + * 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-2.2/src/lxml/xpath.pxi":76 + * self.unregisterGlobalNamespaces() + * xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt) + * self._cleanup_context() # <<<<<<<<<<<<<< + * + * cdef registerVariables(self, variable_dict): + */ + __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 = 76; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":78 + * self._cleanup_context() + * + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + xmlXPathObject *__pyx_t_4; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/xpath.pxi":79 + * + * 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_kp_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 79; __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 = 79; __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 = 79; __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 = 79; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":80 + * 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)) + */ + __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 = 80; __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-2.2/src/lxml/xpath.pxi":82 + * name_utf = self._to_utf(name) + * xpath.xmlXPathRegisterVariable( + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) # <<<<<<<<<<<<<< + * + * cdef registerVariable(self, name, value): + */ + __pyx_t_4 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, PyString_AS_STRING(__pyx_v_name_utf), __pyx_t_4); + } + __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":84 + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) + * + * 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_SetupRefcountContext("registerVariable"); + __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":85 + * + * cdef registerVariable(self, name, value): + * name_utf = self._to_utf(name) # <<<<<<<<<<<<<< + * xpath.xmlXPathRegisterVariable( + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) + */ + __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 = 85; __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-2.2/src/lxml/xpath.pxi":87 + * name_utf = self._to_utf(name) + * xpath.xmlXPathRegisterVariable( + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) # <<<<<<<<<<<<<< + * + * cdef void _registerVariable(self, name_utf, value): + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, PyString_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":89 + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) + * + * cdef void _registerVariable(self, name_utf, value): # <<<<<<<<<<<<<< + * xpath.xmlXPathRegisterVariable( + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) + */ + +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_SetupRefcountContext("_registerVariable"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":91 + * cdef void _registerVariable(self, name_utf, value): + * xpath.xmlXPathRegisterVariable( + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) # <<<<<<<<<<<<<< + * + * cdef void _setupDict(self, xpath.xmlXPathContext* xpathCtxt): + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, PyString_AS_STRING(__pyx_v_name_utf), __pyx_t_1); + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("lxml.etree._XPathContext._registerVariable"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":93 + * self._xpathCtxt, _cstr(name_utf), _wrapXPathObject(value)) + * + * 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_SetupRefcountContext("_setupDict"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":94 + * + * cdef void _setupDict(self, xpath.xmlXPathContext* xpathCtxt): + * __GLOBAL_PARSER_CONTEXT.initXPathParserDict(xpathCtxt) # <<<<<<<<<<<<<< + * + * cdef bint _XPATH_VERSION_WARNING_REQUIRED + */ + ((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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":108 + * cdef _ErrorLog _error_log + * + * def __init__(self, namespaces, extensions, enable_regexp, # <<<<<<<<<<<<<< + * smart_strings): + * global _XPATH_VERSION_WARNING_REQUIRED + */ + +static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___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_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_enable_regexp,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("__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_kp_namespaces); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_enable_regexp); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_smart_strings); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 108; __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 = 108; __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_warnings = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":111 + * smart_strings): + * global _XPATH_VERSION_WARNING_REQUIRED + * if _XPATH_VERSION_WARNING_REQUIRED: # <<<<<<<<<<<<<< + * _XPATH_VERSION_WARNING_REQUIRED = 0 + * import warnings + */ + __pyx_t_1 = __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":112 + * 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-2.2/src/lxml/xpath.pxi":113 + * 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_1 = __Pyx_Import(__pyx_kp_warnings, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_warnings); + __pyx_v_warnings = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":114 + * _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._error_log = _ErrorLog() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_warnings, __pyx_kp_warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":115 + * import warnings + * warnings.warn(u"This version of libxml2 has a known XPath bug. " + \ + * u"Use it at your own risk.") # <<<<<<<<<<<<<< + * self._error_log = _ErrorLog() + * self._context = _XPathContext(namespaces, extensions, + */ + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_kp_591), ((PyObject *)__pyx_kp_592)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 114; __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[17]; __pyx_lineno = 114; __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(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 114; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":116 + * warnings.warn(u"This version of libxml2 has a known XPath bug. " + \ + * u"Use it at your own risk.") + * self._error_log = _ErrorLog() # <<<<<<<<<<<<<< + * self._context = _XPathContext(namespaces, extensions, + * enable_regexp, None, smart_strings) + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); + __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_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":118 + * self._error_log = _ErrorLog() + * self._context = _XPathContext(namespaces, extensions, + * enable_regexp, None, smart_strings) # <<<<<<<<<<<<<< + * if config.ENABLE_THREADING: + * self._eval_lock = python.PyThread_allocate_lock() + */ + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_namespaces); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_namespaces); + __Pyx_GIVEREF(__pyx_v_namespaces); + __Pyx_INCREF(__pyx_v_extensions); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_extensions); + __Pyx_GIVEREF(__pyx_v_extensions); + __Pyx_INCREF(__pyx_v_enable_regexp); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_enable_regexp); + __Pyx_GIVEREF(__pyx_v_enable_regexp); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 3, Py_None); + __Pyx_GIVEREF(Py_None); + __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(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathContext)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__XPathContext))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":117 + * u"Use it at your own risk.") + * self._error_log = _ErrorLog() + * self._context = _XPathContext(namespaces, extensions, # <<<<<<<<<<<<<< + * enable_regexp, None, smart_strings) + * if config.ENABLE_THREADING: + */ + __Pyx_GIVEREF(__pyx_t_4); + __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_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":119 + * self._context = _XPathContext(namespaces, extensions, + * enable_regexp, None, smart_strings) + * if config.ENABLE_THREADING: # <<<<<<<<<<<<<< + * self._eval_lock = python.PyThread_allocate_lock() + * if self._eval_lock is NULL: + */ + __pyx_t_1 = ENABLE_THREADING; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":120 + * enable_regexp, None, smart_strings) + * 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-2.2/src/lxml/xpath.pxi":121 + * if config.ENABLE_THREADING: + * self._eval_lock = python.PyThread_allocate_lock() + * if self._eval_lock is NULL: # <<<<<<<<<<<<<< + * python.PyErr_NoMemory() + * + */ + __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-2.2/src/lxml/xpath.pxi":122 + * self._eval_lock = python.PyThread_allocate_lock() + * if self._eval_lock is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * + * property error_log: + */ + __pyx_t_4 = PyErr_NoMemory(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_warnings); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":125 + * + * property error_log: + * def __get__(self): # <<<<<<<<<<<<<< + * 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; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":126 + * property error_log: + * def __get__(self): + * return self._error_log.copy() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)->_error_log), __pyx_kp_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 126; __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[17]; __pyx_lineno = 126; __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._XPathEvaluatorBase.error_log.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":128 + * 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___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":129 + * + * 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-2.2/src/lxml/xpath.pxi":130 + * 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-2.2/src/lxml/xpath.pxi":131 + * 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) + */ + __pyx_t_1 = ENABLE_THREADING; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":132 + * 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-2.2/src/lxml/xpath.pxi":133 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":135 + * 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_SetupRefcountContext("set_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":136 + * + * 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-2.2/src/lxml/xpath.pxi":137 + * 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 = 137; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":139 + * 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_evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_19_XPathEvaluatorBase_evaluate[] = "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_evaluate(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_kp__eval_arg,0}; + __Pyx_SetupRefcountContext("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_kp__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 = 139; __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__variables); + __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.evaluate"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":152 + * :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 = 152; __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), __pyx_v__variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 152; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":154 + * 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_SetupRefcountContext("_checkAbsolutePath"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":156 + * 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-2.2/src/lxml/xpath.pxi":157 + * 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-2.2/src/lxml/xpath.pxi":158 + * 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-2.2/src/lxml/xpath.pxi":159 + * return 0 + * c = path[0] + * while c == c' ' or c == c'\t': # <<<<<<<<<<<<<< + * path = path + 1 + * c = path[0] + */ + while (1) { + if (!(__pyx_v_c == ' ')) { + __pyx_t_1 = (__pyx_v_c == '\t'); + } else { + __pyx_t_1 = (__pyx_v_c == ' '); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":160 + * 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-2.2/src/lxml/xpath.pxi":161 + * 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-2.2/src/lxml/xpath.pxi":162 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":164 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_lock"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":166 + * 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); + } else { + __pyx_t_1 = ENABLE_THREADING; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":167 + * 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) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":169 + * with nogil: + * result = python.PyThread_acquire_lock( + * self._eval_lock, python.WAIT_LOCK) # <<<<<<<<<<<<<< + * if result == 0: + * raise ParserError, u"parser locking failed" + */ + __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_eval_lock, WAIT_LOCK); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":170 + * result = python.PyThread_acquire_lock( + * self._eval_lock, python.WAIT_LOCK) + * if result == 0: # <<<<<<<<<<<<<< + * raise ParserError, u"parser locking failed" + * return 0 + */ + __pyx_t_1 = (__pyx_v_result == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":171 + * self._eval_lock, python.WAIT_LOCK) + * if result == 0: + * raise ParserError, u"parser locking failed" # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ParserError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_593), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[17]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":172 + * if result == 0: + * raise ParserError, u"parser 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_1); + __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._lock"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":174 + * 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; + __Pyx_SetupRefcountContext("_unlock"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":175 + * + * 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); + } else { + __pyx_t_1 = ENABLE_THREADING; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":176 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":178 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/xpath.pxi":180 + * 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_kp_filter_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 180; __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 = 180; __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 = 180; __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 (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__BaseErrorLog))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 180; __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-2.2/src/lxml/xpath.pxi":181 + * 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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":182 + * 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 = 182; __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-2.2/src/lxml/xpath.pxi":183 + * 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-2.2/src/lxml/xpath.pxi":184 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 184; __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_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 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":185 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":186 + * raise XPathSyntaxError(message, self._error_log) + * raise XPathSyntaxError(self._error_log._buildExceptionMessage( + * u"Error in xpath expression"), # <<<<<<<<<<<<<< + * self._error_log) + * + */ + __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_594)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":187 + * 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 = 185; __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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":189 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/xpath.pxi":191 + * 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_kp_filter_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 191; __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 = 191; __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 = 191; __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 (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__BaseErrorLog))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 191; __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-2.2/src/lxml/xpath.pxi":192 + * 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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_4); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":193 + * 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_kp_filter_types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 193; __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 = 193; __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 = 193; __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 (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__BaseErrorLog))) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 193; __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-2.2/src/lxml/xpath.pxi":194 + * 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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":195 + * 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 = 195; __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-2.2/src/lxml/xpath.pxi":196 + * 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-2.2/src/lxml/xpath.pxi":197 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathEvalError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_message); + __Pyx_GIVEREF(__pyx_v_message); + __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 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":198 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathEvalError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":199 + * raise XPathEvalError(message, self._error_log) + * raise XPathEvalError(self._error_log._buildExceptionMessage( + * u"Error in xpath expression"), # <<<<<<<<<<<<<< + * self._error_log) + * + */ + __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_595)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":200 + * 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 = 198; __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_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":202 + * 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; + __Pyx_SetupRefcountContext("_handle_result"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":203 + * + * 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-2.2/src/lxml/xpath.pxi":204 + * 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-2.2/src/lxml/xpath.pxi":205 + * 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-2.2/src/lxml/xpath.pxi":206 + * 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-2.2/src/lxml/xpath.pxi":207 + * _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 = 207; __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-2.2/src/lxml/xpath.pxi":208 + * 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 = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":210 + * 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-2.2/src/lxml/xpath.pxi":211 + * + * 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 = 211; __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-2.2/src/lxml/xpath.pxi":212 + * 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 = 212; __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-2.2/src/lxml/xpath.pxi":214 + * self._raise_eval_error() + * + * try: # <<<<<<<<<<<<<< + * result = _unwrapXPathObject(xpathObj, doc, + * self._context._build_smart_strings) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":216 + * try: + * result = _unwrapXPathObject(xpathObj, doc, + * self._context._build_smart_strings) # <<<<<<<<<<<<<< + * finally: + * _freeXPathObject(xpathObj) + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_self->_context->__pyx_base._build_smart_strings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + } + /*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_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":218 + * self._context._build_smart_strings) + * finally: + * _freeXPathObject(xpathObj) # <<<<<<<<<<<<<< + * self._context._release_temp_refs() + * + */ + __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":219 + * finally: + * _freeXPathObject(xpathObj) + * self._context._release_temp_refs() # <<<<<<<<<<<<<< + * + * return result + */ + __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 = 219; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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-2.2/src/lxml/xpath.pxi":221 + * 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_AddTraceback("lxml.etree._XPathEvaluatorBase._handle_result"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":238 + * """ + * 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; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_element,&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_regexp,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + values[1] = Py_None; + values[2] = Py_None; + values[3] = __pyx_k_175; + values[4] = __pyx_k_176; + 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_kp_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_kp_namespaces); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_regexp); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 238; __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)); + __pyx_v_namespaces = Py_None; + __pyx_v_extensions = Py_None; + __pyx_v_regexp = __pyx_k_175; + __pyx_v_smart_strings = __pyx_k_176; + } + 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 = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__init__"); + 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 = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":243 + * cdef int ns_register_status + * cdef _Document 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-2.2/src/lxml/xpath.pxi":244 + * cdef _Document 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-2.2/src/lxml/xpath.pxi":245 + * self._element = element + * doc = element._doc + * _XPathEvaluatorBase.__init__(self, namespaces, extensions, # <<<<<<<<<<<<<< + * regexp, smart_strings) + * xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":246 + * doc = element._doc + * _XPathEvaluatorBase.__init__(self, namespaces, extensions, + * regexp, smart_strings) # <<<<<<<<<<<<<< + * xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc) + * if xpathCtxt is NULL: + */ + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 245; __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 = 245; __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-2.2/src/lxml/xpath.pxi":247 + * _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-2.2/src/lxml/xpath.pxi":248 + * regexp, smart_strings) + * xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc) + * 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-2.2/src/lxml/xpath.pxi":249 + * xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc) + * if xpathCtxt is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * self.set_context(xpathCtxt) + * + */ + __pyx_t_3 = PyErr_NoMemory(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 249; __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-2.2/src/lxml/xpath.pxi":250 + * if xpathCtxt is NULL: + * python.PyErr_NoMemory() + * self.set_context(xpathCtxt) # <<<<<<<<<<<<<< + * + * def register_namespace(self, prefix, uri): + */ + __pyx_t_3 = ((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_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __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.XPathElementEvaluator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_doc); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":252 + * 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_register_namespace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_register_namespace[] = "Register a namespace with the XPath context.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_register_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_kp_prefix,&__pyx_kp_uri,0}; + __Pyx_SetupRefcountContext("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_kp_prefix); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_uri); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 252; __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 = 252; __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 = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":255 + * u"""Register a namespace with the XPath context. + * """ + * 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 = 255; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":257 + * self._context.addNamespace(prefix, uri) + * + * def register_namespaces(self, namespaces): # <<<<<<<<<<<<<< + * u"""Register a prefix -> uri dict. + * """ + */ + +static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_register_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_v_namespaces); /*proto*/ +static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_register_namespaces[] = "Register a prefix -> uri dict.\n "; +static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_register_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_v_namespaces) { + PyObject *__pyx_v_prefix; + PyObject *__pyx_v_uri; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("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-2.2/src/lxml/xpath.pxi":260 + * u"""Register a prefix -> uri dict. + * """ + * for prefix, uri in namespaces.items(): # <<<<<<<<<<<<<< + * self._context.addNamespace(prefix, uri) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_namespaces, __pyx_kp_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 260; __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 = 260; __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 = 260; __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 = 260; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_uri); + __pyx_v_uri = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_uri); + __pyx_v_uri = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":261 + * """ + * 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 = 261; __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":263 + * self._context.addNamespace(prefix, uri) + * + * def __call__(self, _path, **_variables): # <<<<<<<<<<<<<< + * u"""__call__(self, _path, **_variables) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator___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 "; +static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator___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_kp__path,0}; + __Pyx_SetupRefcountContext("__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_kp__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 = 263; __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 = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__variables); + __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_path = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":277 + * cdef _Document doc + * cdef char* c_path + * path = _utf8(_path) # <<<<<<<<<<<<<< + * doc = self._element._doc + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_path); + __pyx_v_path = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":278 + * cdef char* c_path + * 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-2.2/src/lxml/xpath.pxi":280 + * 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 = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":281 + * + * 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-2.2/src/lxml/xpath.pxi":282 + * 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-2.2/src/lxml/xpath.pxi":283 + * 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-2.2/src/lxml/xpath.pxi":284 + * 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 = 284; __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-2.2/src/lxml/xpath.pxi":285 + * 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, __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 285; __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-2.2/src/lxml/xpath.pxi":286 + * self._context.register_context(doc) + * self._context.registerVariables(_variables) + * c_path = _cstr(path) # <<<<<<<<<<<<<< + * with nogil: + * xpathObj = xpath.xmlXPathEvalExpression( + */ + __pyx_v_c_path = PyString_AS_STRING(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":287 + * self._context.registerVariables(_variables) + * c_path = _cstr(path) + * with nogil: # <<<<<<<<<<<<<< + * xpathObj = xpath.xmlXPathEvalExpression( + * c_path, self._xpathCtxt) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":289 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":290 + * 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 = 290; __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; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":292 + * result = self._handle_result(xpathObj, doc) + * finally: + * self._error_log.disconnect() # <<<<<<<<<<<<<< + * self._context.unregister_context() + * self._unlock() + */ + ((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-2.2/src/lxml/xpath.pxi":293 + * 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 = 293; __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-2.2/src/lxml/xpath.pxi":294 + * 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-2.2/src/lxml/xpath.pxi":296 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":309 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree,&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_regexp,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + values[1] = Py_None; + values[2] = Py_None; + values[3] = __pyx_k_177; + values[4] = __pyx_k_178; + 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_kp_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_kp_namespaces); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_regexp); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 309; __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)); + __pyx_v_namespaces = Py_None; + __pyx_v_extensions = Py_None; + __pyx_v_regexp = __pyx_k_177; + __pyx_v_smart_strings = __pyx_k_178; + } + 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 = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__"); + 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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":311 + * 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, smart_strings=smart_strings) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), __pyx_kp___init__); 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":312 + * 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 = 311; __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)); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":313 + * XPathElementEvaluator.__init__( + * self, etree._context_node, namespaces=namespaces, + * extensions=extensions, regexp=regexp, smart_strings=smart_strings) # <<<<<<<<<<<<<< + * + * def __call__(self, _path, **_variables): + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 311; __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(((PyObject *)__pyx_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":315 + * extensions=extensions, regexp=regexp, smart_strings=smart_strings) + * + * def __call__(self, _path, **_variables): # <<<<<<<<<<<<<< + * u"""__call__(self, _path, **_variables) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_22XPathDocumentEvaluator___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 "; +static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___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_kp__path,0}; + __Pyx_SetupRefcountContext("__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_kp__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 = 315; __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 = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__variables); + __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_path = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":327 + * cdef _Document doc + * cdef char* c_path + * path = _utf8(_path) # <<<<<<<<<<<<<< + * doc = self._element._doc + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_path); + __pyx_v_path = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":328 + * cdef char* c_path + * 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-2.2/src/lxml/xpath.pxi":330 + * 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 = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":331 + * + * 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-2.2/src/lxml/xpath.pxi":332 + * 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-2.2/src/lxml/xpath.pxi":333 + * 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 = 333; __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-2.2/src/lxml/xpath.pxi":334 + * 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 = 334; __pyx_clineno = __LINE__; goto __pyx_L7;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":335 + * 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-2.2/src/lxml/xpath.pxi":336 + * 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, __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 336; __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-2.2/src/lxml/xpath.pxi":337 + * try: + * self._context.registerVariables(_variables) + * c_path = _cstr(path) # <<<<<<<<<<<<<< + * with nogil: + * self._xpathCtxt.doc = c_doc + */ + __pyx_v_c_path = PyString_AS_STRING(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":338 + * self._context.registerVariables(_variables) + * c_path = _cstr(path) + * with nogil: # <<<<<<<<<<<<<< + * self._xpathCtxt.doc = c_doc + * self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":339 + * 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-2.2/src/lxml/xpath.pxi":340 + * 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-2.2/src/lxml/xpath.pxi":342 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":343 + * 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 = 343; __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; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":345 + * result = self._handle_result(xpathObj, doc) + * finally: + * _destroyFakeDoc(doc._c_doc, c_doc) # <<<<<<<<<<<<<< + * self._context.unregister_context() + * finally: + */ + __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":346 + * 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 = 346; __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; + } + } + } + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":348 + * self._context.unregister_context() + * finally: + * self._error_log.disconnect() # <<<<<<<<<<<<<< + * self._unlock() + * + */ + ((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-2.2/src/lxml/xpath.pxi":349 + * 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-2.2/src/lxml/xpath.pxi":351 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":354 + * + * + * 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_XPathEvaluator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_XPathEvaluator[] = "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 PyObject *__pyx_pf_4lxml_5etree_XPathEvaluator(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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree_or_element,&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_regexp,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("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] = Py_None; + values[2] = Py_None; + values[3] = __pyx_k_179; + values[4] = __pyx_k_180; + 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_kp_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_kp_namespaces); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_regexp); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 354; __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 = Py_None; + __pyx_v_extensions = Py_None; + __pyx_v_regexp = __pyx_k_179; + __pyx_v_smart_strings = __pyx_k_180; + } + 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 = 354; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XPathEvaluator"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":369 + * you pass ``smart_strings=False``. + * """ + * if isinstance(etree_or_element, _ElementTree): # <<<<<<<<<<<<<< + * return XPathDocumentEvaluator( + * etree_or_element, namespaces=namespaces, + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_etree_or_element, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":370 + * """ + * 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-2.2/src/lxml/xpath.pxi":371 + * 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 = 370; __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); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":372 + * return XPathDocumentEvaluator( + * etree_or_element, namespaces=namespaces, + * extensions=extensions, regexp=regexp, smart_strings=smart_strings) # <<<<<<<<<<<<<< + * else: + * return XPathElementEvaluator( + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 370; __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_1)); __pyx_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":374 + * 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-2.2/src/lxml/xpath.pxi":375 + * else: + * return XPathElementEvaluator( + * etree_or_element, namespaces=namespaces, # <<<<<<<<<<<<<< + * extensions=extensions, regexp=regexp, smart_strings=smart_strings) + * + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_etree_or_element); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_etree_or_element); + __Pyx_GIVEREF(__pyx_v_etree_or_element); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":376 + * return XPathElementEvaluator( + * etree_or_element, namespaces=namespaces, + * extensions=extensions, regexp=regexp, smart_strings=smart_strings) # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.XPathEvaluator"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":394 + * cdef readonly object path + * + * def __init__(self, path, *, namespaces=None, extensions=None, # <<<<<<<<<<<<<< + * regexp=True, smart_strings=True): + * cdef xpath.xmlXPathContext* xpathCtxt + */ + +static int __pyx_pf_4lxml_5etree_5XPath___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_5XPath___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_kp_path,&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_regexp,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + values[1] = Py_None; + values[2] = Py_None; + values[3] = __pyx_k_181; + values[4] = __pyx_k_182; + 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_kp_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_kp_namespaces); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_regexp); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 394; __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 = Py_None; + __pyx_v_extensions = Py_None; + __pyx_v_regexp = __pyx_k_181; + __pyx_v_smart_strings = __pyx_k_182; + } + 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 = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XPath.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":397 + * regexp=True, smart_strings=True): + * cdef xpath.xmlXPathContext* xpathCtxt + * _XPathEvaluatorBase.__init__(self, namespaces, extensions, # <<<<<<<<<<<<<< + * regexp, smart_strings) + * self.path = path + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":398 + * cdef xpath.xmlXPathContext* xpathCtxt + * _XPathEvaluatorBase.__init__(self, namespaces, extensions, + * regexp, smart_strings) # <<<<<<<<<<<<<< + * self.path = path + * path = _utf8(path) + */ + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 397; __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 = 397; __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-2.2/src/lxml/xpath.pxi":399 + * _XPathEvaluatorBase.__init__(self, namespaces, extensions, + * regexp, smart_strings) + * self.path = path # <<<<<<<<<<<<<< + * path = _utf8(path) + * xpathCtxt = xpath.xmlXPathNewContext(NULL) + */ + __Pyx_INCREF(__pyx_v_path); + __Pyx_GIVEREF(__pyx_v_path); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->path); + __Pyx_DECREF(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->path); + ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->path = __pyx_v_path; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":400 + * regexp, smart_strings) + * self.path = path + * path = _utf8(path) # <<<<<<<<<<<<<< + * xpathCtxt = xpath.xmlXPathNewContext(NULL) + * if xpathCtxt is NULL: + */ + __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 400; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":401 + * self.path = path + * 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-2.2/src/lxml/xpath.pxi":402 + * 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-2.2/src/lxml/xpath.pxi":403 + * 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 = 403; __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-2.2/src/lxml/xpath.pxi":404 + * if xpathCtxt is NULL: + * python.PyErr_NoMemory() + * self.set_context(xpathCtxt) # <<<<<<<<<<<<<< + * self._error_log.connect() + * self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(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 = 404; __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-2.2/src/lxml/xpath.pxi":405 + * python.PyErr_NoMemory() + * self.set_context(xpathCtxt) + * self._error_log.connect() # <<<<<<<<<<<<<< + * self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(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-2.2/src/lxml/xpath.pxi":406 + * self.set_context(xpathCtxt) + * self._error_log.connect() + * self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(path)) # <<<<<<<<<<<<<< + * self._error_log.disconnect() + * if self._xpath is NULL: + */ + ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->_xpath = xmlXPathCtxtCompile(__pyx_v_xpathCtxt, PyString_AS_STRING(__pyx_v_path)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":407 + * self._error_log.connect() + * self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(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-2.2/src/lxml/xpath.pxi":408 + * self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _cstr(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-2.2/src/lxml/xpath.pxi":409 + * 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 = 409; __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_DECREF(__pyx_v_path); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":411 + * 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___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_5XPath___call__[] = "__call__(self, _etree_or_element, **_variables)"; +static PyObject *__pyx_pf_4lxml_5etree_5XPath___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_kp__etree_or_element,0}; + __Pyx_SetupRefcountContext("__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_kp__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 = 411; __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 = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__variables); + __Pyx_AddTraceback("lxml.etree.XPath.__call__"); + 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-2.2/src/lxml/xpath.pxi":417 + * cdef _Element element + * + * 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 = 417; __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-2.2/src/lxml/xpath.pxi":418 + * + * 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 = 418; __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-2.2/src/lxml/xpath.pxi":420 + * 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 = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":421 + * + * 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-2.2/src/lxml/xpath.pxi":422 + * 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-2.2/src/lxml/xpath.pxi":423 + * 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-2.2/src/lxml/xpath.pxi":425 + * self._xpathCtxt.node = element._c_node + * + * try: # <<<<<<<<<<<<<< + * self._context.register_context(document) + * self._context.registerVariables(_variables) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":426 + * + * 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 = 426; __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-2.2/src/lxml/xpath.pxi":427 + * 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, __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 427; __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-2.2/src/lxml/xpath.pxi":428 + * self._context.register_context(document) + * self._context.registerVariables(_variables) + * with nogil: # <<<<<<<<<<<<<< + * xpathObj = xpath.xmlXPathCompiledEval( + * self._xpath, self._xpathCtxt) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":430 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":431 + * 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 = 431; __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; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":433 + * result = self._handle_result(xpathObj, document) + * finally: + * self._error_log.disconnect() # <<<<<<<<<<<<<< + * self._context.unregister_context() + * self._unlock() + */ + ((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-2.2/src/lxml/xpath.pxi":434 + * 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 = 434; __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-2.2/src/lxml/xpath.pxi":435 + * 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-2.2/src/lxml/xpath.pxi":436 + * self._context.unregister_context() + * self._unlock() + * return result # <<<<<<<<<<<<<< + * + * def __dealloc__(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_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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":438 + * return result + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self._xpath is not NULL: + * xpath.xmlXPathFreeCompExpr(self._xpath) + */ + +static void __pyx_pf_4lxml_5etree_5XPath___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_5XPath___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":439 + * + * 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-2.2/src/lxml/xpath.pxi":440 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":442 + * xpath.xmlXPathFreeCompExpr(self._xpath) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.path + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_5XPath___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_5XPath___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":443 + * + * def __repr__(self): + * return self.path # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->path); + __pyx_r = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self)->path; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":460 + * you pass ``smart_strings=False``. + * """ + * def __init__(self, path, *, extensions=None, regexp=True, smart_strings=True): # <<<<<<<<<<<<<< + * path, namespaces = self._nsextract_path(path) + * XPath.__init__(self, path, namespaces=namespaces, + */ + +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_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_path,&__pyx_kp_extensions,&__pyx_kp_regexp,&__pyx_kp_smart_strings,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = Py_None; + values[2] = __pyx_k_185; + values[3] = __pyx_k_186; + 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_kp_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_kp_extensions); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_regexp); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 460; __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 = Py_None; + __pyx_v_regexp = __pyx_k_185; + __pyx_v_smart_strings = __pyx_k_186; + } + 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 = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.ETXPath.__init__"); + 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-2.2/src/lxml/xpath.pxi":461 + * """ + * 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 = 461; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_path); + __pyx_v_path = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_namespaces); + __pyx_v_namespaces = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_path); + __pyx_v_path = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_namespaces); + __pyx_v_namespaces = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":462 + * 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, + * smart_strings=smart_strings) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __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 = 462; __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_path); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_path); + __Pyx_GIVEREF(__pyx_v_path); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":463 + * path, namespaces = self._nsextract_path(path) + * XPath.__init__(self, path, namespaces=namespaces, + * extensions=extensions, regexp=regexp, # <<<<<<<<<<<<<< + * smart_strings=smart_strings) + * + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":464 + * XPath.__init__(self, path, namespaces=namespaces, + * extensions=extensions, regexp=regexp, + * smart_strings=smart_strings) # <<<<<<<<<<<<<< + * + * cdef _nsextract_path(self, path): + */ + if (PyDict_SetItem(__pyx_1, __pyx_kp_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 462; __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(((PyObject *)__pyx_1)); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.ETXPath.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_namespaces); + __Pyx_DECREF(__pyx_v_path); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":466 + * 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_1 = 0; + 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_SetupRefcountContext("_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 = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_namespace = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_prefix_str = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":468 + * cdef _nsextract_path(self, path): + * # replace {namespaces} by new prefixes + * cdef dict namespaces = {} # <<<<<<<<<<<<<< + * cdef list namespace_defs = [] + * cdef int i + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_v_namespaces = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":469 + * # 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 = 469; __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-2.2/src/lxml/xpath.pxi":471 + * cdef list namespace_defs = [] + * cdef int i + * path_utf = _utf8(path) # <<<<<<<<<<<<<< + * stripped_path = _replace_strings('', path_utf) # remove string literals + * i = 1 + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 471; __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-2.2/src/lxml/xpath.pxi":472 + * cdef int i + * path_utf = _utf8(path) + * stripped_path = _replace_strings('', 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 = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_596); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_596); + __Pyx_GIVEREF(__pyx_kp_596); + __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 = 472; __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-2.2/src/lxml/xpath.pxi":473 + * path_utf = _utf8(path) + * stripped_path = _replace_strings('', 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-2.2/src/lxml/xpath.pxi":474 + * stripped_path = _replace_strings('', path_utf) # remove string literals + * i = 1 + * for namespace_def in _find_namespaces(stripped_path): # <<<<<<<<<<<<<< + * if namespace_def not in namespace_defs: + * prefix = python.PyString_FromFormat("__xpp%02d", i) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 474; __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 = 474; __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 = 474; __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 = 474; __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-2.2/src/lxml/xpath.pxi":475 + * i = 1 + * for namespace_def in _find_namespaces(stripped_path): + * if namespace_def not in namespace_defs: # <<<<<<<<<<<<<< + * prefix = python.PyString_FromFormat("__xpp%02d", i) + * i += 1 + */ + __pyx_t_4 = (!PySequence_Contains(((PyObject *)__pyx_v_namespace_defs), __pyx_v_namespace_def)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":476 + * for namespace_def in _find_namespaces(stripped_path): + * if namespace_def not in namespace_defs: + * prefix = python.PyString_FromFormat("__xpp%02d", i) # <<<<<<<<<<<<<< + * i += 1 + * namespace_defs.append(namespace_def) + */ + __pyx_t_1 = PyString_FromFormat(__pyx_k_597, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 476; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":477 + * if namespace_def not in namespace_defs: + * prefix = python.PyString_FromFormat("__xpp%02d", i) + * i += 1 # <<<<<<<<<<<<<< + * namespace_defs.append(namespace_def) + * namespace = namespace_def[1:-1] # remove '{}' + */ + __pyx_v_i += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":478 + * prefix = python.PyString_FromFormat("__xpp%02d", i) + * i += 1 + * namespace_defs.append(namespace_def) # <<<<<<<<<<<<<< + * namespace = namespace_def[1:-1] # remove '{}' + * namespace = python.PyUnicode_FromEncodedObject( + */ + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_namespace_defs), __pyx_v_namespace_def); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":479 + * i += 1 + * namespace_defs.append(namespace_def) + * namespace = namespace_def[1:-1] # remove '{}' # <<<<<<<<<<<<<< + * namespace = python.PyUnicode_FromEncodedObject( + * namespace, 'UTF-8', 'strict') + */ + __pyx_1 = PySequence_GetSlice(__pyx_v_namespace_def, 1, -1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_namespace); + __pyx_v_namespace = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":481 + * 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 = PyUnicode_FromEncodedObject(__pyx_v_namespace, __pyx_k_598, __pyx_k_599); 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_DECREF(__pyx_v_namespace); + __pyx_v_namespace = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":483 + * namespace, 'UTF-8', 'strict') + * namespaces[ + * python.PyUnicode_FromEncodedObject(prefix, 'UTF-8', 'strict') # <<<<<<<<<<<<<< + * ] = namespace + * prefix_str = prefix + ':' + */ + __pyx_t_1 = PyUnicode_FromEncodedObject(__pyx_v_prefix, __pyx_k_600, __pyx_k_601); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 483; __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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":485 + * python.PyUnicode_FromEncodedObject(prefix, 'UTF-8', 'strict') + * ] = namespace + * prefix_str = prefix + ':' # <<<<<<<<<<<<<< + * # FIXME: this also replaces {namespaces} within strings! + * path_utf = path_utf.replace(namespace_def, prefix_str) + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_prefix, __pyx_kp_602); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_prefix_str); + __pyx_v_prefix_str = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":487 + * prefix_str = prefix + ':' + * # 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_kp_replace); 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_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 487; __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(__pyx_v_prefix_str); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_prefix_str); + __Pyx_GIVEREF(__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 = 487; __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-2.2/src/lxml/xpath.pxi":488 + * # 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 = PyUnicode_FromEncodedObject(__pyx_v_path_utf, __pyx_k_603, __pyx_k_604); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 488; __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-2.2/src/lxml/xpath.pxi":489 + * 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 = 489; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + __Pyx_SetupRefcountContext("_copy"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTResolverContext))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/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 = __pyx_f_4lxml_5etree__initXSLTResolverContext(__pyx_v_context, __pyx_v_self->_parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 57; __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-2.2/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-2.2/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_AddTraceback("lxml.etree._XSLTResolverContext._copy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("_initXSLTResolverContext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_kp_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 (!(__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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + xmlDoc *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + xmlDoc *__pyx_t_6; + xmlDoc *__pyx_t_7; + xmlDoc *__pyx_t_8; + xmlDoc *__pyx_t_9; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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-2.2/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-2.2/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-2.2/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-2.2/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) + */ + if ((__pyx_v_c_doc != NULL)) { + __pyx_t_1 = (__pyx_v_c_doc->URL != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_doc != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (strcmp(__pyx_v_c_uri, __pyx_v_c_doc->URL) == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_2; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_1 = (strncmp(__pyx_k_605, __pyx_v_c_uri, 26) == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 += 26; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_uri); + __pyx_v_uri = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":90 + * c_uri += 26 + * uri = _decodeFilename(c_uri) + * doc_ref = resolvers.resolve(uri, None, context) # <<<<<<<<<<<<<< + * + * c_doc = NULL + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_resolvers), __pyx_kp_resolve); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_uri); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_uri); + __Pyx_GIVEREF(__pyx_v_uri); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(((PyObject *)__pyx_v_context)); + PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_context)); + __Pyx_GIVEREF(((PyObject *)__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[18]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L5_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; + if (!(__Pyx_TypeTest(__pyx_t_5, __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_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1 = (((PyObject *)__pyx_v_doc_ref) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_STRING); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_6 = __pyx_f_4lxml_5etree__parseDoc(__pyx_v_doc_ref->_data_bytes, __pyx_v_doc_ref->_filename, __pyx_v_context->_parser); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_v_c_doc = __pyx_t_6; + goto __pyx_L15; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_7 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_v_doc_ref->_filename, __pyx_v_context->_parser); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_v_c_doc = __pyx_t_7; + goto __pyx_L15; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_FILE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_8 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_v_doc_ref->_file, __pyx_v_doc_ref->_filename, __pyx_v_context->_parser); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_v_c_doc = __pyx_t_8; + goto __pyx_L15; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = (__pyx_v_doc_ref->_type == __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_9 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_v_c_doc = __pyx_t_9; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + */ + if ((__pyx_v_c_doc != NULL)) { + __pyx_t_1 = (__pyx_v_c_doc->URL == NULL); + } else { + __pyx_t_1 = (__pyx_v_c_doc != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_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_L0; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_5, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L8_except_return; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __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_FinishRefcountContext(); + PyGILState_Release(_save); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_xslt_store_resolver_exception"); + __pyx_v_message = 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-2.2/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-2.2/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_606), __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(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTApplyError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_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_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_exception); + __pyx_v_exception = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":119 + * exception = XSLTApplyError(message) + * else: + * exception = XSLTParseError(message) # <<<<<<<<<<<<<< + * (<_XSLTResolverContext>context)._store_exception(exception) + * except Exception, e: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_1); + __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(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_message); + __Pyx_GIVEREF(__pyx_v_message); + __pyx_t_2 = PyObject_Call(__pyx_1, ((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_1); __pyx_1 = 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-2.2/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_1); __pyx_1 = 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-2.2/src/lxml/xslt.pxi":121 + * exception = XSLTParseError(message) + * (<_XSLTResolverContext>context)._store_exception(exception) + * except Exception, e: # <<<<<<<<<<<<<< + * (<_XSLTResolverContext>context)._store_exception(e) + * + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree._xslt_store_resolver_exception"); + if (__Pyx_GetException(&__pyx_1, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_e); + __pyx_v_e = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L4_exception_handled; + } + __pyx_L5_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":134 + * cdef int error + * # find resolver contexts of stylesheet and transformed doc + * if c_type == xslt.XSLT_LOAD_DOCUMENT: # <<<<<<<<<<<<<< + * # transformation time + * c_pcontext = (c_ctxt)._private + */ + __pyx_t_1 = (__pyx_v_c_type == XSLT_LOAD_DOCUMENT); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":136 + * if c_type == xslt.XSLT_LOAD_DOCUMENT: + * # transformation time + * c_pcontext = (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-2.2/src/lxml/xslt.pxi":137 + * # transformation time + * c_pcontext = (c_ctxt)._private + * elif c_type == xslt.XSLT_LOAD_STYLESHEET: # <<<<<<<<<<<<<< + * # include/import resolution while parsing + * c_pcontext = (c_ctxt).doc._private + */ + __pyx_t_1 = (__pyx_v_c_type == XSLT_LOAD_STYLESHEET); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":139 + * elif c_type == xslt.XSLT_LOAD_STYLESHEET: + * # include/import resolution while parsing + * c_pcontext = (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-2.2/src/lxml/xslt.pxi":141 + * c_pcontext = (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-2.2/src/lxml/xslt.pxi":143 + * 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-2.2/src/lxml/xslt.pxi":146 + * # 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-2.2/src/lxml/xslt.pxi":148 + * 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-2.2/src/lxml/xslt.pxi":149 + * + * 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) + */ + if ((__pyx_v_c_doc == NULL)) { + __pyx_t_1 = (!__pyx_v_error); + } else { + __pyx_t_1 = (__pyx_v_c_doc == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":151 + * 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-2.2/src/lxml/xslt.pxi":152 + * 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_1 = (__pyx_v_c_doc == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":153 + * 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-2.2/src/lxml/xslt.pxi":155 + * _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 + */ + if ((__pyx_v_c_doc != NULL)) { + __pyx_t_1 = (__pyx_v_c_type == XSLT_LOAD_STYLESHEET); + } else { + __pyx_t_1 = (__pyx_v_c_doc != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 + * + */ + __pyx_v_c_doc->_private = __pyx_v_c_pcontext; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":157 + * 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-2.2/src/lxml/xslt.pxi":189 + * """ + * cdef xslt.xsltSecurityPrefs* _prefs + * def __init__(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___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_17XSLTAccessControl___init__(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_kp_read_file,&__pyx_kp_write_file,&__pyx_kp_create_dir,&__pyx_kp_read_network,&__pyx_kp_write_network,0}; + __Pyx_SetupRefcountContext("__init__"); + 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_193; + values[1] = __pyx_k_194; + values[2] = __pyx_k_195; + values[3] = __pyx_k_196; + values[4] = __pyx_k_197; + 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_kp_read_file); + if (value) { values[0] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_write_file); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_create_dir); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_read_network); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 189; __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_193; + __pyx_v_write_file = __pyx_k_194; + __pyx_v_create_dir = __pyx_k_195; + __pyx_v_read_network = __pyx_k_196; + __pyx_v_write_network = __pyx_k_197; + } + 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[18]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":191 + * def __init__(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-2.2/src/lxml/xslt.pxi":192 + * 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-2.2/src/lxml/xslt.pxi":193 + * 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 = 193; __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-2.2/src/lxml/xslt.pxi":194 + * 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 = 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-2.2/src/lxml/xslt.pxi":195 + * 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 = 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-2.2/src/lxml/xslt.pxi":196 + * 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 = 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-2.2/src/lxml/xslt.pxi":197 + * 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 = 197; __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-2.2/src/lxml/xslt.pxi":198 + * 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 = 198; __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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":208 + * 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___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_17XSLTAccessControl___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":209 + * + * 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-2.2/src/lxml/xslt.pxi":210 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":212 + * 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_SetupRefcountContext("_setAccess"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":214 + * 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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":215 + * 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-2.2/src/lxml/xslt.pxi":217 + * 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-2.2/src/lxml/xslt.pxi":218 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":220 + * 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_SetupRefcountContext("_register_in_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":221 + * + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":225 + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":226 + * 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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":227 + * 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_1 = ((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_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, ((PyObject *)__pyx_kp_607), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":228 + * 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_1 = ((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_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, ((PyObject *)__pyx_kp_608), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":229 + * 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_1 = ((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_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, ((PyObject *)__pyx_kp_609), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":230 + * 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_1 = ((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_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, ((PyObject *)__pyx_kp_610), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":231 + * 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_1 = ((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_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, ((PyObject *)__pyx_kp_611), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_1); + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.options.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":234 + * } + * + * 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_SetupRefcountContext("_optval"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":236 + * cdef _optval(self, xslt.xsltSecurityOption option): + * cdef xslt.xsltSecurityCheck function + * function = xslt.xsltGetSecurityPrefs(self._prefs, option) # <<<<<<<<<<<<<< + * if function is xslt.xsltSecurityAllow: + * return True + */ + __pyx_v_function = xsltGetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":237 + * cdef xslt.xsltSecurityCheck function + * function = xslt.xsltGetSecurityPrefs(self._prefs, option) + * if function is xslt.xsltSecurityAllow: # <<<<<<<<<<<<<< + * return True + * elif function is xslt.xsltSecurityForbid: + */ + __pyx_t_1 = (__pyx_v_function == ((int (*)(xsltSecurityPrefs *, xsltTransformContext *, char *))xsltSecurityAllow)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":238 + * function = xslt.xsltGetSecurityPrefs(self._prefs, option) + * if function is xslt.xsltSecurityAllow: + * return True # <<<<<<<<<<<<<< + * elif function is 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 = 238; __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-2.2/src/lxml/xslt.pxi":239 + * if function is xslt.xsltSecurityAllow: + * return True + * elif function is xslt.xsltSecurityForbid: # <<<<<<<<<<<<<< + * return False + * else: + */ + __pyx_t_1 = (__pyx_v_function == ((int (*)(xsltSecurityPrefs *, xsltTransformContext *, char *))xsltSecurityForbid)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":240 + * return True + * elif function is 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 = 240; __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-2.2/src/lxml/xslt.pxi":242 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":244 + * return None + * + * def __repr__(self): # <<<<<<<<<<<<<< + * items = self.options.items() + * items.sort() + */ + +static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_items; + PyObject *__pyx_v_item; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/xslt.pxi":245 + * + * def __repr__(self): + * items = self.options.items() # <<<<<<<<<<<<<< + * items.sort() + * return u"%s(%s)" % ( + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_options); 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_GetAttr(__pyx_t_1, __pyx_kp_items); 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_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); 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_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-2.2/src/lxml/xslt.pxi":246 + * 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_kp_sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 246; __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 = 246; __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-2.2/src/lxml/xslt.pxi":247 + * 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-2.2/src/lxml/xslt.pxi":248 + * 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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_613)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_613)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_613)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __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_1 = __Pyx_GetItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":249 + * return u"%s(%s)" % ( + * funicode(python._fqtypename(self)).split(u'.')[-1], + * u', '.join([u"%s=%r" % item for item in items])) # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_614), __pyx_kp_join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __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_4 = 0; __pyx_t_1 = __pyx_v_items; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __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_615), __pyx_v_item); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __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[18]; __pyx_lineno = 249; __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_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_612), ((PyObject *)__pyx_t_1)); 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(((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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":254 + * # 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_SetupRefcountContext("_register_xslt_function"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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( + */ + __pyx_t_1 = (__pyx_v_ns_utf == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":256 + * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf): + * if ns_utf is None: + * return 0 # <<<<<<<<<<<<<< + * return xslt.xsltRegisterExtFunction( + * ctxt, _cstr(name_utf), _cstr(ns_utf), + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":259 + * return xslt.xsltRegisterExtFunction( + * 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), PyString_AS_STRING(__pyx_v_name_utf), PyString_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__xpath_function_call); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":261 + * _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_SetupRefcountContext("_unregister_xslt_function"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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( + */ + __pyx_t_1 = (__pyx_v_ns_utf == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":263 + * cdef int _unregister_xslt_function(void* ctxt, name_utf, ns_utf): + * if ns_utf is None: + * return 0 # <<<<<<<<<<<<<< + * return xslt.xsltRegisterExtFunction( + * ctxt, _cstr(name_utf), _cstr(ns_utf), + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":266 + * return xslt.xsltRegisterExtFunction( + * ctxt, _cstr(name_utf), _cstr(ns_utf), + * NULL) # <<<<<<<<<<<<<< + * + * cdef dict EMPTY_DICT = {} + */ + __pyx_r = xsltRegisterExtFunction(((xsltTransformContext *)__pyx_v_ctxt), PyString_AS_STRING(__pyx_v_name_utf), PyString_AS_STRING(__pyx_v_ns_utf), NULL); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":274 + * cdef _ReadOnlyElementProxy _extension_element_proxy + * cdef dict _extension_elements + * def __init__(self, namespaces, extensions, enable_regexp, # <<<<<<<<<<<<<< + * build_smart_strings): + * self._xsltCtxt = NULL + */ + +static int __pyx_pf_4lxml_5etree_12_XSLTContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_12_XSLTContext___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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_namespaces,&__pyx_kp_extensions,&__pyx_kp_enable_regexp,&__pyx_kp_build_smart_strings,0}; + __Pyx_SetupRefcountContext("__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_kp_namespaces); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_extensions); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_enable_regexp); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_build_smart_strings); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 274; __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 = 274; __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 = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__"); + 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 = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name_utf = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":276 + * def __init__(self, namespaces, extensions, enable_regexp, + * build_smart_strings): + * self._xsltCtxt = NULL # <<<<<<<<<<<<<< + * self._extension_elements = EMPTY_DICT + * if extensions is not None and extensions: + */ + ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_xsltCtxt = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":277 + * build_smart_strings): + * self._xsltCtxt = NULL + * self._extension_elements = EMPTY_DICT # <<<<<<<<<<<<<< + * if extensions is not None and extensions: + * for ns_name_tuple, extension in extensions.items(): + */ + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":278 + * self._xsltCtxt = NULL + * self._extension_elements = EMPTY_DICT + * 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 = 278; __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-2.2/src/lxml/xslt.pxi":279 + * self._extension_elements = EMPTY_DICT + * 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_kp_items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __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 = 279; __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 = 279; __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 = 279; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_ns_name_tuple); + __pyx_v_ns_name_tuple = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_extension); + __pyx_v_extension = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_name_tuple); + __pyx_v_ns_name_tuple = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_extension); + __pyx_v_extension = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":280 + * 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_1 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = (__pyx_1 == Py_None); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":281 + * 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_2 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTExtensionError); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":282 + * if ns_name_tuple[0] is None: + * raise XSLTExtensionError, \ + * u"extensions must not have empty namespaces" # <<<<<<<<<<<<<< + * if isinstance(extension, XSLTExtension): + * if self._extension_elements is EMPTY_DICT: + */ + __Pyx_Raise(__pyx_2, ((PyObject *)__pyx_kp_616), 0); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":283 + * 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 = PyObject_TypeCheck(__pyx_v_extension, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLTExtension))); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":284 + * 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-2.2/src/lxml/xslt.pxi":285 + * 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_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_3)); + __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_3; + __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":286 + * 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_kp_copy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 286; __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[18]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_extensions); + __pyx_v_extensions = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":287 + * 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_1 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_7 = __pyx_f_4lxml_5etree__utf8(__pyx_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":288 + * 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_2 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_7 = __pyx_f_4lxml_5etree__utf8(__pyx_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":289 + * 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_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_ns_utf); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns_utf); + __Pyx_GIVEREF(__pyx_v_ns_utf); + __Pyx_INCREF(__pyx_v_name_utf); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_name_utf); + __Pyx_GIVEREF(__pyx_v_name_utf); + if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self)->_extension_elements), ((PyObject *)__pyx_t_7), __pyx_v_extension) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":290 + * 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 = 290; __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-2.2/src/lxml/xslt.pxi":291 + * 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_kp___init__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":292 + * del extensions[ns_name_tuple] + * _BaseContext.__init__(self, namespaces, extensions, enable_regexp, + * build_smart_strings) # <<<<<<<<<<<<<< + * + * cdef _BaseContext _copy(self): + */ + __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_namespaces); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_namespaces); + __Pyx_GIVEREF(__pyx_v_namespaces); + __Pyx_INCREF(__pyx_v_extensions); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_extensions); + __Pyx_GIVEREF(__pyx_v_extensions); + __Pyx_INCREF(__pyx_v_enable_regexp); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_enable_regexp); + __Pyx_GIVEREF(__pyx_v_enable_regexp); + __Pyx_INCREF(__pyx_v_build_smart_strings); + PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_build_smart_strings); + __Pyx_GIVEREF(__pyx_v_build_smart_strings); + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 291; __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_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":294 + * 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_SetupRefcountContext("_copy"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":296 + * 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 = 296; __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-2.2/src/lxml/xslt.pxi":297 + * 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-2.2/src/lxml/xslt.pxi":298 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":300 + * 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; + __Pyx_SetupRefcountContext("register_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":302 + * 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-2.2/src/lxml/xslt.pxi":303 + * _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-2.2/src/lxml/xslt.pxi":304 + * 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 = 304; __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-2.2/src/lxml/xslt.pxi":305 + * 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-2.2/src/lxml/xslt.pxi":306 + * 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-2.2/src/lxml/xslt.pxi":307 + * self.registerLocalFunctions(xsltCtxt, _register_xslt_function) + * self.registerGlobalFunctions(xsltCtxt, _register_xslt_function) + * _registerXSLTExtensions(xsltCtxt, self._extension_elements) # <<<<<<<<<<<<<< + * + * cdef free_context(self): + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__registerXSLTExtensions(__pyx_v_xsltCtxt, ((PyObject *)__pyx_v_self->_extension_elements)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 307; __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.register_context"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":309 + * _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_SetupRefcountContext("free_context"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":310 + * + * 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 = 310; __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-2.2/src/lxml/xslt.pxi":311 + * 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 = 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-2.2/src/lxml/xslt.pxi":312 + * 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-2.2/src/lxml/xslt.pxi":313 + * 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-2.2/src/lxml/xslt.pxi":314 + * 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-2.2/src/lxml/xslt.pxi":315 + * 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 = 315; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":323 + * """ + * cdef str strval + * def __init__(self, strval): # <<<<<<<<<<<<<< + * self.strval = _utf8(strval) + * + */ + +static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___init__(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_kp_strval,0}; + __Pyx_SetupRefcountContext("__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_kp_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), "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 323; __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("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":324 + * cdef str strval + * def __init__(self, strval): + * self.strval = _utf8(strval) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_strval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyString_CheckExact(__pyx_t_1)) || (__pyx_t_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected str, got %s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":359 + * cdef _ErrorLog _error_log + * + * def __init__(self, xslt_input, *, extensions=None, regexp=True, # <<<<<<<<<<<<<< + * access_control=None): + * cdef xslt.xsltStylesheet* c_style + */ + +static int __pyx_pf_4lxml_5etree_4XSLT___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_4XSLT___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_1 = 0; + PyObject *__pyx_t_1 = NULL; + xmlDoc *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + xmlDoc *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_xslt_input,&__pyx_kp_extensions,&__pyx_kp_regexp,&__pyx_kp_access_control,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = Py_None; + values[2] = __pyx_k_198; + values[3] = 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_kp_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_kp_extensions); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_regexp); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 359; __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); + __pyx_v_extensions = Py_None; + __pyx_v_regexp = __pyx_k_198; + __pyx_v_access_control = 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 = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XSLT.__init__"); + 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 = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":366 + * 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 = 366; __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-2.2/src/lxml/xslt.pxi":367 + * + * 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 = 367; __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-2.2/src/lxml/xslt.pxi":370 + * + * # set access control or raise TypeError + * self._access_control = access_control # <<<<<<<<<<<<<< + * + * # make a copy of the document as stylesheet parsing modifies it + */ + if (!(__Pyx_TypeTest(__pyx_v_access_control, __pyx_ptype_4lxml_5etree_XSLTAccessControl))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 370; __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-2.2/src/lxml/xslt.pxi":373 + * + * # 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 = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":376 + * + * # 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-2.2/src/lxml/xslt.pxi":378 + * 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 = 378; __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 = 378; __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_617), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyUnicode_AsASCIIString(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 377; __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_doc_url_utf); + __pyx_v_doc_url_utf = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":379 + * 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(PyString_AS_STRING(__pyx_v_doc_url_utf)); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":381 + * 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 = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/xslt.pxi":382 + * + * 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 = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__XSLTResolverContext))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/xslt.pxi":383 + * 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 = __pyx_f_4lxml_5etree__initXSLTResolverContext(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context, __pyx_v_doc->_parser); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 383; __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-2.2/src/lxml/xslt.pxi":385 + * _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 = self._xslt_resolver_context + * + */ + __pyx_t_5 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_xslt_resolver_context->_c_style_doc = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":386 + * # 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 = 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-2.2/src/lxml/xslt.pxi":388 + * c_doc._private = 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-2.2/src/lxml/xslt.pxi":389 + * + * self._error_log.connect() + * with nogil: # <<<<<<<<<<<<<< + * c_style = xslt.xsltParseStylesheetDoc(c_doc) + * self._error_log.disconnect() + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":390 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":391 + * 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-2.2/src/lxml/xslt.pxi":393 + * 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-2.2/src/lxml/xslt.pxi":394 + * + * 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-2.2/src/lxml/xslt.pxi":395 + * 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_6 = ((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_6 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":397 + * 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-2.2/src/lxml/xslt.pxi":398 + * # 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_4 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error, __pyx_kp_message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_3; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":399 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log->__pyx_base.__pyx_base.last_error, __pyx_kp_message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":400 + * self._error_log.last_error.message: + * raise XSLTParseError(self._error_log.last_error.message, + * self._error_log) # <<<<<<<<<<<<<< + * else: + * raise XSLTParseError( + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 399; __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(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log)); + PyTuple_SET_ITEM(__pyx_t_1, 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_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":402 + * self._error_log) + * else: + * raise XSLTParseError( # <<<<<<<<<<<<<< + * self._error_log._buildExceptionMessage( + * u"Cannot parse stylesheet"), + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":404 + * 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_618)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":405 + * self._error_log._buildExceptionMessage( + * u"Cannot parse stylesheet"), + * self._error_log) # <<<<<<<<<<<<<< + * + * c_doc._private = NULL # no longer used! + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 402; __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(((PyObject *)((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_error_log)); + PyTuple_SET_ITEM(__pyx_t_1, 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_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":407 + * 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-2.2/src/lxml/xslt.pxi":408 + * + * 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-2.2/src/lxml/xslt.pxi":409 + * 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 = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 0, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_v_extensions); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_extensions); + __Pyx_GIVEREF(__pyx_v_extensions); + __Pyx_INCREF(__pyx_v_regexp); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_regexp); + __Pyx_GIVEREF(__pyx_v_regexp); + PyTuple_SET_ITEM(__pyx_t_1, 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_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__XSLTContext))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":411 + * 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___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_4XSLT___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":412 + * + * 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-2.2/src/lxml/xslt.pxi":413 + * 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); + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":414 + * 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 + * xslt.xsltFreeStylesheet(self._c_style) + */ + 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-2.2/src/lxml/xslt.pxi":416 + * tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc) + * # this cleans up the doc copy as well + * xslt.xsltFreeStylesheet(self._c_style) # <<<<<<<<<<<<<< + * + * property error_log: + */ + xsltFreeStylesheet(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style); + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":420 + * 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_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":421 + * 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_kp_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 421; __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 = 421; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":424 + * + * @classmethod + * def strparam(_, strval): # <<<<<<<<<<<<<< + * u"""strparam(strval) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_4XSLT_strparam(PyObject *__pyx_v__, PyObject *__pyx_v_strval); /*proto*/ +static char __pyx_doc_4lxml_5etree_4XSLT_strparam[] = "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_strparam(PyObject *__pyx_v__, PyObject *__pyx_v_strval) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("strparam"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":435 + * 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 = 435; __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 = 435; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":437 + * 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_apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_4XSLT_apply[] = "apply(self, _input, profile_run=False, **kw)\n \n :deprecated: call the object, not this method."; +static PyObject *__pyx_pf_4lxml_5etree_4XSLT_apply(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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp__input,&__pyx_kp_profile_run,0}; + __Pyx_SetupRefcountContext("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_199; + 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_kp__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 = 437; __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_199; + } + 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 = 437; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kw); + __Pyx_AddTraceback("lxml.etree.XSLT.apply"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":441 + * + * :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 = 441; __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_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItem(__pyx_1, __pyx_kp_profile_run, __pyx_v_profile_run) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_Update(((PyObject *)__pyx_1), __pyx_v_kw) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_v_self, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 441; __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_1)); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree.XSLT.apply"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_kw); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":443 + * 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_tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_result_tree); /*proto*/ +static char __pyx_doc_4lxml_5etree_4XSLT_tostring[] = "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_tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_result_tree) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("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 = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":450 + * :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 = 450; __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 = 450; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":452 + * return str(result_tree) + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * return self.__copy__() + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_4XSLT___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_4XSLT___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__deepcopy__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":453 + * + * def __deepcopy__(self, memo): + * return self.__copy__() # <<<<<<<<<<<<<< + * + * def __copy__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___copy__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 453; __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 = 453; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":455 + * return self.__copy__() + * + * def __copy__(self): # <<<<<<<<<<<<<< + * return _copyXSLT(self) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_4XSLT___copy__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_4XSLT___copy__(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__copy__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":456 + * + * 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 = 456; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":458 + * 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___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_4XSLT___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 "; +static PyObject *__pyx_pf_4lxml_5etree_4XSLT___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; + PyObject *__pyx_v_error; + PyObject *__pyx_v_message; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + xmlDoc *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp__input,&__pyx_kp_profile_run,0}; + __Pyx_SetupRefcountContext("__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_200; + 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_kp__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 = 458; __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_200; + } + 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 = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kw); + __Pyx_AddTraceback("lxml.etree.XSLT.__call__"); + 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_error = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_message = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":475 + * 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-2.2/src/lxml/xslt.pxi":479 + * cdef tree.xmlDict* c_dict + * + * 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 = 479; __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-2.2/src/lxml/xslt.pxi":480 + * + * 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 = 480; __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-2.2/src/lxml/xslt.pxi":482 + * 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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":484 + * 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-2.2/src/lxml/xslt.pxi":485 + * + * 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-2.2/src/lxml/xslt.pxi":486 + * 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-2.2/src/lxml/xslt.pxi":487 + * 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 = 487; __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-2.2/src/lxml/xslt.pxi":493 + * # 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-2.2/src/lxml/xslt.pxi":494 + * # 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-2.2/src/lxml/xslt.pxi":495 + * 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-2.2/src/lxml/xslt.pxi":496 + * 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-2.2/src/lxml/xslt.pxi":499 + * + * 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-2.2/src/lxml/xslt.pxi":501 + * 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 = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":502 + * + * 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-2.2/src/lxml/xslt.pxi":504 + * transform_ctxt.profile = 1 + * + * try: # <<<<<<<<<<<<<< + * self._error_log.connect() + * context = self._context._copy() + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":505 + * + * 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-2.2/src/lxml/xslt.pxi":506 + * 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 = 506; __pyx_clineno = __LINE__; goto __pyx_L10;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTContext))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 506; __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-2.2/src/lxml/xslt.pxi":507 + * 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 = 507; __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-2.2/src/lxml/xslt.pxi":509 + * context.register_context(transform_ctxt, input_doc) + * + * resolver_context = self._xslt_resolver_context._copy() # <<<<<<<<<<<<<< + * transform_ctxt._private = 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 = 509; __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-2.2/src/lxml/xslt.pxi":510 + * + * resolver_context = self._xslt_resolver_context._copy() + * transform_ctxt._private = resolver_context # <<<<<<<<<<<<<< + * + * c_result = self._run_transform( + */ + __pyx_v_transform_ctxt->_private = ((PyObject *)__pyx_v_resolver_context); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":513 + * + * c_result = self._run_transform( + * c_doc, kw, context, transform_ctxt) # <<<<<<<<<<<<<< + * + * if transform_ctxt.state != xslt.XSLT_STATE_OK: + */ + if (!(likely(PyDict_CheckExact(__pyx_v_kw)) || (__pyx_v_kw) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected dict, got %s", Py_TYPE(__pyx_v_kw)->tp_name), 0))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L10;} + __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, ((PyObject *)__pyx_v_kw), __pyx_v_context, __pyx_v_transform_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":515 + * c_doc, kw, context, transform_ctxt) + * + * 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-2.2/src/lxml/xslt.pxi":516 + * + * 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-2.2/src/lxml/xslt.pxi":517 + * 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-2.2/src/lxml/xslt.pxi":518 + * if c_result is not NULL: + * tree.xmlFreeDoc(c_result) + * c_result = NULL # <<<<<<<<<<<<<< + * + * if transform_ctxt.profile: + */ + __pyx_v_c_result = NULL; + goto __pyx_L13; + } + __pyx_L13:; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":520 + * c_result = NULL + * + * if transform_ctxt.profile: # <<<<<<<<<<<<<< + * c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt) + * if c_profile_doc is not NULL: + */ + __pyx_t_4 = __pyx_v_transform_ctxt->profile; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":521 + * + * 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-2.2/src/lxml/xslt.pxi":522 + * 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-2.2/src/lxml/xslt.pxi":524 + * 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_f_4lxml_5etree__documentFactory(__pyx_v_c_profile_doc, __pyx_v_input_doc->_parser)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L10;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_profile_doc)); + __pyx_v_profile_doc = ((struct LxmlDocument *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + } + /*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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":526 + * c_profile_doc, input_doc._parser) + * finally: + * if context is not None: # <<<<<<<<<<<<<< + * context.free_context() + * _destroyFakeDoc(input_doc._c_doc, c_doc) + */ + __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":527 + * finally: + * if context is not None: + * context.free_context() # <<<<<<<<<<<<<< + * _destroyFakeDoc(input_doc._c_doc, c_doc) + * self._error_log.disconnect() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_context->__pyx_base.__pyx_vtab)->free_context(__pyx_v_context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":528 + * 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-2.2/src/lxml/xslt.pxi":529 + * 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_L18; + __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_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-2.2/src/lxml/xslt.pxi":531 + * 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-2.2/src/lxml/xslt.pxi":532 + * + * 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)); + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":533 + * 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_5 = (__pyx_v_c_result != NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":534 + * 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-2.2/src/lxml/xslt.pxi":535 + * 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_L23; + } + __pyx_L23:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":536 + * tree.xmlFreeDoc(c_result) + * c_result = NULL + * resolver_context._raise_if_stored() # <<<<<<<<<<<<<< + * + * if context._exc._has_raised(): + */ + __pyx_t_4 = ((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_4 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L20;} + goto __pyx_L22; + } + __pyx_L22:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":538 + * resolver_context._raise_if_stored() + * + * if context._exc._has_raised(): # <<<<<<<<<<<<<< + * if c_result is not NULL: + * tree.xmlFreeDoc(c_result) + */ + __pyx_t_5 = ((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_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":539 + * + * if context._exc._has_raised(): + * if c_result is not NULL: # <<<<<<<<<<<<<< + * tree.xmlFreeDoc(c_result) + * c_result = NULL + */ + __pyx_t_5 = (__pyx_v_c_result != NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":540 + * 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-2.2/src/lxml/xslt.pxi":541 + * 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_L25; + } + __pyx_L25:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":542 + * tree.xmlFreeDoc(c_result) + * c_result = NULL + * context._exc._raise_if_stored() # <<<<<<<<<<<<<< + * + * if c_result is NULL: + */ + __pyx_t_4 = ((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_4 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L20;} + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":544 + * 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_5 = (__pyx_v_c_result == NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":546 + * 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-2.2/src/lxml/xslt.pxi":547 + * # 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_5 = (__pyx_v_error != Py_None); + if (__pyx_t_5) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_3; + } else { + __pyx_t_6 = __pyx_t_5; + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":548 + * 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_1 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":549 + * 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_7 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_message); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_619), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L28; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":551 + * 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_1 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L28:; + goto __pyx_L27; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":552 + * 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_6 = (__pyx_v_error != Py_None); + if (__pyx_t_6) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_error, __pyx_kp_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __pyx_t_5; + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":553 + * 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_kp_line); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_620), __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L27; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":555 + * 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_621)); + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = ((PyObject *)__pyx_kp_621); + } + __pyx_L27:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":556 + * else: + * message = u"Error applying stylesheet" + * raise XSLTApplyError(message, self._error_log) # <<<<<<<<<<<<<< + * finally: + * if resolver_context is not None: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTApplyError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_1, 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_1, 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_8 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L20;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L20;} + goto __pyx_L26; + } + __pyx_L26:; + } + /*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_L21; + __pyx_L20: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L21; + } + __pyx_L21:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":558 + * raise XSLTApplyError(message, self._error_log) + * finally: + * if resolver_context is not None: # <<<<<<<<<<<<<< + * resolver_context.clear() + * + */ + __pyx_t_3 = (((PyObject *)__pyx_v_resolver_context) != Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":559 + * 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_L30; + } + __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; + } + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":561 + * resolver_context.clear() + * + * result_doc = _documentFactory(c_result, input_doc._parser) # <<<<<<<<<<<<<< + * + * c_dict = c_result.dict + */ + __pyx_t_8 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_result, __pyx_v_input_doc->_parser)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __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-2.2/src/lxml/xslt.pxi":563 + * 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-2.2/src/lxml/xslt.pxi":564 + * + * 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-2.2/src/lxml/xslt.pxi":565 + * 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: + */ + if (!(__pyx_v_c_dict != __pyx_v_c_result->dict)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":566 + * __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: + */ + if (!(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict != __pyx_v_c_result->dict)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":567 + * 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_3 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict); + } else { + __pyx_t_3 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict != __pyx_v_c_result->dict); + } + __pyx_t_6 = __pyx_t_3; + } else { + __pyx_t_6 = (__pyx_v_c_dict != __pyx_v_c_result->dict); + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":568 + * 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(c_result, + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":569 + * input_doc._c_doc.dict is not c_result.dict: + * with nogil: + * if c_dict is not c_result.dict: # <<<<<<<<<<<<<< + * fixThreadDictNames(c_result, + * c_dict, c_result.dict) + */ + __pyx_t_6 = (__pyx_v_c_dict != __pyx_v_c_result->dict); + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":571 + * if c_dict is not c_result.dict: + * fixThreadDictNames(c_result, + * c_dict, c_result.dict) # <<<<<<<<<<<<<< + * if self._c_style.doc.dict is not c_result.dict: + * fixThreadDictNames(c_result, + */ + __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_c_dict, __pyx_v_c_result->dict); + goto __pyx_L35; + } + __pyx_L35:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":572 + * fixThreadDictNames(c_result, + * c_dict, c_result.dict) + * if self._c_style.doc.dict is not c_result.dict: # <<<<<<<<<<<<<< + * fixThreadDictNames(c_result, + * self._c_style.doc.dict, c_result.dict) + */ + __pyx_t_6 = (((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self)->_c_style->doc->dict != __pyx_v_c_result->dict); + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":574 + * if self._c_style.doc.dict is not c_result.dict: + * fixThreadDictNames(c_result, + * self._c_style.doc.dict, c_result.dict) # <<<<<<<<<<<<<< + * if input_doc._c_doc.dict is not c_result.dict: + * fixThreadDictNames(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_L36; + } + __pyx_L36:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":575 + * fixThreadDictNames(c_result, + * self._c_style.doc.dict, c_result.dict) + * if input_doc._c_doc.dict is not c_result.dict: # <<<<<<<<<<<<<< + * fixThreadDictNames(c_result, + * input_doc._c_doc.dict, c_result.dict) + */ + __pyx_t_6 = (__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict); + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":577 + * if input_doc._c_doc.dict is not c_result.dict: + * fixThreadDictNames(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_L37; + } + __pyx_L37:; + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + goto __pyx_L31; + } + __pyx_L31:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":579 + * 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 = 579; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); + __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_error); + __Pyx_DECREF(__pyx_v_message); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":581 + * return _xsltResultTreeFactory(result_doc, self, profile_doc) + * + * cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc, # <<<<<<<<<<<<<< + * dict parameters, _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, PyObject *__pyx_v_parameters, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xsltTransformContext *__pyx_v_transform_ctxt) { + xmlDoc *__pyx_v_c_result; + char **__pyx_v_params; + Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_parameter_count; + PyObject *__pyx_v_keep_ref; + PyObject *__pyx_v_key; + PyObject *__pyx_v_value; + PyObject *__pyx_v_k; + PyObject *__pyx_v_v; + xmlDoc *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + Py_ssize_t __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_SetupRefcountContext("_run_transform"); + __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 = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":590 + * + * xslt.xsltSetTransformErrorFunc(transform_ctxt, self._error_log, + * _receiveXSLTError) # <<<<<<<<<<<<<< + * + * if self._access_control is not None: + */ + xsltSetTransformErrorFunc(__pyx_v_transform_ctxt, ((void *)__pyx_v_self->_error_log), __pyx_f_4lxml_5etree__receiveXSLTError); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":592 + * _receiveXSLTError) + * + * if self._access_control is not None: # <<<<<<<<<<<<<< + * self._access_control._register_in_context(transform_ctxt) + * + */ + __pyx_t_1 = (((PyObject *)__pyx_v_self->_access_control) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":593 + * + * if self._access_control is not None: + * self._access_control._register_in_context(transform_ctxt) # <<<<<<<<<<<<<< + * + * parameter_count = len(parameters) + */ + ((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-2.2/src/lxml/xslt.pxi":595 + * self._access_control._register_in_context(transform_ctxt) + * + * parameter_count = len(parameters) # <<<<<<<<<<<<<< + * if parameter_count > 0: + * # allocate space for parameters + */ + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_parameters)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_parameter_count = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":596 + * + * parameter_count = len(parameters) + * if parameter_count > 0: # <<<<<<<<<<<<<< + * # allocate space for parameters + * # * 2 as we want an entry for both key and value, + */ + __pyx_t_1 = (__pyx_v_parameter_count > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":601 + * # and + 1 as array is NULL terminated + * params = 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-2.2/src/lxml/xslt.pxi":602 + * params = 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-2.2/src/lxml/xslt.pxi":603 + * 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-2.2/src/lxml/xslt.pxi":604 + * 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 = 604; __pyx_clineno = __LINE__; goto __pyx_L5_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-2.2/src/lxml/xslt.pxi":605 + * i = 0 + * keep_ref = [] + * for key, value in parameters.iteritems(): # <<<<<<<<<<<<<< + * k = _utf8(key) + * if isinstance(value, _XSLTQuotedStringParam): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_parameters)); + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = ((PyObject *)__pyx_v_parameters); + __pyx_t_2 = 0; + while (1) { + if (!PyDict_Next(__pyx_t_3, (&__pyx_t_2), ((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-2.2/src/lxml/xslt.pxi":606 + * keep_ref = [] + * for key, value in parameters.iteritems(): + * k = _utf8(key) # <<<<<<<<<<<<<< + * if isinstance(value, _XSLTQuotedStringParam): + * v = (<_XSLTQuotedStringParam>value).strval + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__utf8(__pyx_v_key); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":607 + * for key, value in parameters.iteritems(): + * k = _utf8(key) + * if isinstance(value, _XSLTQuotedStringParam): # <<<<<<<<<<<<<< + * v = (<_XSLTQuotedStringParam>value).strval + * xslt.xsltQuoteOneUserParam( + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":608 + * k = _utf8(key) + * 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(__pyx_v_v); + __pyx_v_v = ((PyObject *)((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_value)->strval); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":610 + * v = (<_XSLTQuotedStringParam>value).strval + * xslt.xsltQuoteOneUserParam( + * transform_ctxt, _cstr(k), _cstr(v)) # <<<<<<<<<<<<<< + * else: + * v = _utf8(value) + */ + xsltQuoteOneUserParam(__pyx_v_transform_ctxt, PyString_AS_STRING(__pyx_v_k), PyString_AS_STRING(__pyx_v_v)); + goto __pyx_L15; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":612 + * transform_ctxt, _cstr(k), _cstr(v)) + * else: + * v = _utf8(value) # <<<<<<<<<<<<<< + * params[i] = _cstr(k) + * i += 1 + */ + __pyx_t_6 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":613 + * else: + * v = _utf8(value) + * params[i] = _cstr(k) # <<<<<<<<<<<<<< + * i += 1 + * params[i] = _cstr(v) + */ + (__pyx_v_params[__pyx_v_i]) = PyString_AS_STRING(__pyx_v_k); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":614 + * v = _utf8(value) + * params[i] = _cstr(k) + * i += 1 # <<<<<<<<<<<<<< + * params[i] = _cstr(v) + * i += 1 + */ + __pyx_v_i += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":615 + * params[i] = _cstr(k) + * i += 1 + * params[i] = _cstr(v) # <<<<<<<<<<<<<< + * i += 1 + * keep_ref.append(k) + */ + (__pyx_v_params[__pyx_v_i]) = PyString_AS_STRING(__pyx_v_v); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":616 + * i += 1 + * params[i] = _cstr(v) + * i += 1 # <<<<<<<<<<<<<< + * keep_ref.append(k) + * keep_ref.append(v) + */ + __pyx_v_i += 1; + } + __pyx_L15:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":617 + * params[i] = _cstr(v) + * i += 1 + * keep_ref.append(k) # <<<<<<<<<<<<<< + * keep_ref.append(v) + * except: + */ + __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_keep_ref), __pyx_v_k); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":618 + * i += 1 + * keep_ref.append(k) + * keep_ref.append(v) # <<<<<<<<<<<<<< + * except: + * python.PyMem_Free(params) + */ + __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_keep_ref), __pyx_v_v); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 618; __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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":619 + * keep_ref.append(k) + * keep_ref.append(v) + * except: # <<<<<<<<<<<<<< + * python.PyMem_Free(params) + * raise + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree._run_transform"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_6, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":620 + * keep_ref.append(v) + * except: + * python.PyMem_Free(params) # <<<<<<<<<<<<<< + * raise + * params[i] = NULL + */ + PyMem_Free(__pyx_v_params); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":621 + * except: + * python.PyMem_Free(params) + * raise # <<<<<<<<<<<<<< + * params[i] = NULL + * else: + */ + __Pyx_Raise(__pyx_t_3, __pyx_t_6, __pyx_t_8); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L7_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_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":622 + * python.PyMem_Free(params) + * raise + * params[i] = NULL # <<<<<<<<<<<<<< + * else: + * params = NULL + */ + (__pyx_v_params[__pyx_v_i]) = NULL; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":624 + * params[i] = NULL + * else: + * params = NULL # <<<<<<<<<<<<<< + * + * with nogil: + */ + __pyx_v_params = NULL; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":626 + * params = NULL + * + * with nogil: # <<<<<<<<<<<<<< + * c_result = xslt.xsltApplyStylesheetUser( + * self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":628 + * with nogil: + * c_result = xslt.xsltApplyStylesheetUser( + * self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt) # <<<<<<<<<<<<<< + * + * if params is not NULL: + */ + __pyx_v_c_result = xsltApplyStylesheetUser(__pyx_v_self->_c_style, __pyx_v_c_input_doc, __pyx_v_params, NULL, NULL, __pyx_v_transform_ctxt); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":630 + * self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt) + * + * if params is not NULL: # <<<<<<<<<<<<<< + * # deallocate space for parameters + * python.PyMem_Free(params) + */ + __pyx_t_1 = (__pyx_v_params != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":632 + * if params is not NULL: + * # deallocate space for parameters + * python.PyMem_Free(params) # <<<<<<<<<<<<<< + * + * return c_result + */ + PyMem_Free(__pyx_v_params); + goto __pyx_L21; + } + __pyx_L21:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":634 + * python.PyMem_Free(params) + * + * return c_result # <<<<<<<<<<<<<< + * + * cdef extern from "etree_defs.h": + */ + __pyx_r = __pyx_v_c_result; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("lxml.etree.XSLT._run_transform"); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":640 + * 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_SetupRefcountContext("_copyXSLT"); + __pyx_v_new_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":643 + * cdef XSLT new_xslt + * cdef xmlDoc* c_doc + * 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 = 643; __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-2.2/src/lxml/xslt.pxi":644 + * cdef xmlDoc* c_doc + * 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-2.2/src/lxml/xslt.pxi":645 + * 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 = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/xslt.pxi":646 + * 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 = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTContext))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 646; __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-2.2/src/lxml/xslt.pxi":648 + * 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 = 648; __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-2.2/src/lxml/xslt.pxi":650 + * 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 = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":649 + * + * 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-2.2/src/lxml/xslt.pxi":652 + * 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 = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_2; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":653 + * + * 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-2.2/src/lxml/xslt.pxi":654 + * 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-2.2/src/lxml/xslt.pxi":655 + * 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-2.2/src/lxml/xslt.pxi":656 + * 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 = 656; __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-2.2/src/lxml/xslt.pxi":658 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":666 + * cdef Py_ssize_t _buffer_len + * cdef Py_ssize_t _buffer_refcnt + * 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_SetupRefcountContext("_saveToStringAndSize"); + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":669 + * 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-2.2/src/lxml/xslt.pxi":670 + * 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-2.2/src/lxml/xslt.pxi":671 + * 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-2.2/src/lxml/xslt.pxi":672 + * 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-2.2/src/lxml/xslt.pxi":673 + * 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-2.2/src/lxml/xslt.pxi":674 + * doc = self._doc + * if doc is None: + * s[0] = NULL # <<<<<<<<<<<<<< + * return + * with nogil: + */ + (__pyx_v_s[0]) = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":675 + * 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-2.2/src/lxml/xslt.pxi":676 + * s[0] = NULL + * return + * with nogil: # <<<<<<<<<<<<<< + * r = xslt.xsltSaveResultToString(s, l, doc._c_doc, + * self._xslt._c_style) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":678 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":679 + * 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-2.2/src/lxml/xslt.pxi":680 + * 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 = 680; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":682 + * python.PyErr_NoMemory() + * + * def __str__(self): # <<<<<<<<<<<<<< + * cdef char* s + * cdef int l + */ + +static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree___str__(PyObject *__pyx_v_self) { + char *__pyx_v_s; + int __pyx_v_l; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__str__"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":685 + * cdef char* s + * cdef int l + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * return self.__unicode__() + * self._saveToStringAndSize(&s, &l) + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":686 + * cdef int l + * if python.IS_PYTHON3: + * return self.__unicode__() # <<<<<<<<<<<<<< + * self._saveToStringAndSize(&s, &l) + * if s is NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___unicode__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 686; __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[18]; __pyx_lineno = 686; __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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":687 + * if python.IS_PYTHON3: + * return self.__unicode__() + * self._saveToStringAndSize(&s, &l) # <<<<<<<<<<<<<< + * if s is NULL: + * return '' + */ + __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), (&__pyx_v_s), (&__pyx_v_l)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 687; __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-2.2/src/lxml/xslt.pxi":688 + * 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_1 = (__pyx_v_s == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":689 + * 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(__pyx_kp_622); + __pyx_r = __pyx_kp_622; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":691 + * return '' + * # we must not use 'funicode' here as this is not always UTF-8 + * try: # <<<<<<<<<<<<<< + * result = python.PyString_FromStringAndSize(s, l) + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":692 + * # we must not use 'funicode' here as this is not always UTF-8 + * try: + * result = python.PyString_FromStringAndSize(s, l) # <<<<<<<<<<<<<< + * finally: + * tree.xmlFree(s) + */ + __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_s, __pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 692; __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; + } + /*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_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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":694 + * result = python.PyString_FromStringAndSize(s, l) + * finally: + * tree.xmlFree(s) # <<<<<<<<<<<<<< + * return result + * + */ + 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-2.2/src/lxml/xslt.pxi":695 + * finally: + * tree.xmlFree(s) + * return result # <<<<<<<<<<<<<< + * + * def __unicode__(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._XSLTResultTree.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":697 + * return result + * + * def __unicode__(self): # <<<<<<<<<<<<<< + * cdef char* encoding + * cdef char* s + */ + +static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree___unicode__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree___unicode__(PyObject *__pyx_v_self, 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_SetupRefcountContext("__unicode__"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":701 + * 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 = 701; __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-2.2/src/lxml/xslt.pxi":702 + * 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-2.2/src/lxml/xslt.pxi":703 + * self._saveToStringAndSize(&s, &l) + * if s is NULL: + * return u'' # <<<<<<<<<<<<<< + * encoding = self._xslt._c_style.encoding + * if encoding is NULL: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_623)); + __pyx_r = ((PyObject *)__pyx_kp_623); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":704 + * if s is NULL: + * return u'' + * encoding = self._xslt._c_style.encoding # <<<<<<<<<<<<<< + * if encoding is NULL: + * encoding = 'ascii' + */ + __pyx_v_encoding = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_xslt->_c_style->encoding; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":705 + * return u'' + * encoding = self._xslt._c_style.encoding + * if encoding is NULL: # <<<<<<<<<<<<<< + * encoding = 'ascii' + * try: + */ + __pyx_t_2 = (__pyx_v_encoding == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":706 + * encoding = self._xslt._c_style.encoding + * if encoding is NULL: + * encoding = 'ascii' # <<<<<<<<<<<<<< + * try: + * result = python.PyUnicode_Decode(s, l, encoding, 'strict') + */ + __pyx_v_encoding = __pyx_k_624; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":707 + * if encoding is NULL: + * encoding = 'ascii' + * try: # <<<<<<<<<<<<<< + * result = python.PyUnicode_Decode(s, l, encoding, 'strict') + * finally: + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":708 + * encoding = 'ascii' + * try: + * result = python.PyUnicode_Decode(s, l, encoding, 'strict') # <<<<<<<<<<<<<< + * finally: + * tree.xmlFree(s) + */ + __pyx_t_1 = PyUnicode_Decode(__pyx_v_s, __pyx_v_l, __pyx_v_encoding, __pyx_k_625); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L8;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + } + /*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_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":710 + * result = python.PyUnicode_Decode(s, l, encoding, 'strict') + * finally: + * tree.xmlFree(s) # <<<<<<<<<<<<<< + * return _stripEncodingDeclaration(result) + * + */ + 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-2.2/src/lxml/xslt.pxi":711 + * 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 = 711; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":713 + * return _stripEncodingDeclaration(result) + * + * def __getbuffer__(self, Py_buffer* buffer, int flags): # <<<<<<<<<<<<<< + * cdef int l + * if buffer is NULL: + */ + +static int __pyx_pf_4lxml_5etree_15_XSLTResultTree___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/ +static int __pyx_pf_4lxml_5etree_15_XSLTResultTree___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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/xslt.pxi":715 + * def __getbuffer__(self, Py_buffer* buffer, int flags): + * cdef int l + * if buffer is NULL: # <<<<<<<<<<<<<< + * return # LOCK + * 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-2.2/src/lxml/xslt.pxi":716 + * cdef int l + * if buffer is NULL: + * return # LOCK # <<<<<<<<<<<<<< + * if self._buffer is NULL or flags & python.PyBUF_WRITABLE: + * self._saveToStringAndSize(&buffer.buf, &l) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":717 + * if buffer is NULL: + * return # LOCK + * if self._buffer is NULL or flags & python.PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * self._saveToStringAndSize(&buffer.buf, &l) + * buffer.len = l + */ + if (!(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer == NULL)) { + __pyx_t_1 = (__pyx_v_flags & PyBUF_WRITABLE); + } else { + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":718 + * return # LOCK + * if self._buffer is NULL or flags & python.PyBUF_WRITABLE: + * self._saveToStringAndSize(&buffer.buf, &l) # <<<<<<<<<<<<<< + * buffer.len = l + * if self._buffer is NULL and not flags & python.PyBUF_WRITABLE: + */ + __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), ((char **)(&__pyx_v_buffer->buf)), (&__pyx_v_l)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 718; __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-2.2/src/lxml/xslt.pxi":719 + * if self._buffer is NULL or flags & python.PyBUF_WRITABLE: + * self._saveToStringAndSize(&buffer.buf, &l) + * buffer.len = l # <<<<<<<<<<<<<< + * if self._buffer is NULL and not flags & python.PyBUF_WRITABLE: + * self._buffer = buffer.buf + */ + __pyx_v_buffer->len = __pyx_v_l; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":720 + * self._saveToStringAndSize(&buffer.buf, &l) + * buffer.len = l + * if self._buffer is NULL and not flags & python.PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * self._buffer = buffer.buf + * self._buffer_len = l + */ + if ((((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer == NULL)) { + __pyx_t_1 = (!(__pyx_v_flags & PyBUF_WRITABLE)); + } else { + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":721 + * buffer.len = l + * if self._buffer is NULL and not flags & python.PyBUF_WRITABLE: + * self._buffer = 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-2.2/src/lxml/xslt.pxi":722 + * if self._buffer is NULL and not flags & python.PyBUF_WRITABLE: + * self._buffer = 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-2.2/src/lxml/xslt.pxi":723 + * self._buffer = buffer.buf + * self._buffer_len = l + * self._buffer_refcnt = 1 # <<<<<<<<<<<<<< + * else: + * buffer.buf = 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-2.2/src/lxml/xslt.pxi":725 + * self._buffer_refcnt = 1 + * else: + * buffer.buf = self._buffer # <<<<<<<<<<<<<< + * buffer.len = self._buffer_len + * self._buffer_refcnt += 1 + */ + __pyx_v_buffer->buf = ((char *)((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self)->_buffer); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":726 + * else: + * buffer.buf = 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-2.2/src/lxml/xslt.pxi":727 + * buffer.buf = 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 += 1; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":728 + * buffer.len = self._buffer_len + * self._buffer_refcnt += 1 + * if flags & python.PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * buffer.readonly = 0 + * else: + */ + __pyx_t_3 = (__pyx_v_flags & PyBUF_WRITABLE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":729 + * 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-2.2/src/lxml/xslt.pxi":731 + * 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-2.2/src/lxml/xslt.pxi":732 + * else: + * buffer.readonly = 1 + * if flags & python.PyBUF_FORMAT: # <<<<<<<<<<<<<< + * buffer.format = "B" + * else: + */ + __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":733 + * buffer.readonly = 1 + * if flags & python.PyBUF_FORMAT: + * buffer.format = "B" # <<<<<<<<<<<<<< + * else: + * buffer.format = NULL + */ + __pyx_v_buffer->format = __pyx_k_626; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":735 + * 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-2.2/src/lxml/xslt.pxi":736 + * else: + * buffer.format = NULL + * buffer.ndim = 0 # <<<<<<<<<<<<<< + * buffer.shape = NULL + * buffer.strides = NULL + */ + __pyx_v_buffer->ndim = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":737 + * 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-2.2/src/lxml/xslt.pxi":738 + * 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-2.2/src/lxml/xslt.pxi":739 + * 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-2.2/src/lxml/xslt.pxi":740 + * buffer.strides = NULL + * buffer.suboffsets = NULL + * buffer.itemsize = 1 # <<<<<<<<<<<<<< + * buffer.internal = NULL + * + */ + __pyx_v_buffer->itemsize = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":741 + * 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_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":743 + * buffer.internal = NULL + * + * def __releasebuffer__(self, Py_buffer* buffer): # <<<<<<<<<<<<<< + * if buffer is NULL: + * return # UNLOCK + */ + +static void __pyx_pf_4lxml_5etree_15_XSLTResultTree___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/ +static void __pyx_pf_4lxml_5etree_15_XSLTResultTree___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__releasebuffer__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":744 + * + * def __releasebuffer__(self, Py_buffer* buffer): + * if buffer is NULL: # <<<<<<<<<<<<<< + * return # UNLOCK + * if buffer.buf is self._buffer: + */ + __pyx_t_1 = (__pyx_v_buffer == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":745 + * def __releasebuffer__(self, Py_buffer* buffer): + * if buffer is NULL: + * return # UNLOCK # <<<<<<<<<<<<<< + * if buffer.buf is self._buffer: + * self._buffer_refcnt -= 1 + */ + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":746 + * if buffer is NULL: + * return # UNLOCK + * if 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-2.2/src/lxml/xslt.pxi":747 + * return # UNLOCK + * if 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 -= 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":748 + * if 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-2.2/src/lxml/xslt.pxi":749 + * 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-2.2/src/lxml/xslt.pxi":750 + * if self._buffer_refcnt == 0: + * tree.xmlFree(self._buffer) + * self._buffer = NULL # <<<<<<<<<<<<<< + * else: + * tree.xmlFree(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-2.2/src/lxml/xslt.pxi":752 + * self._buffer = NULL + * else: + * tree.xmlFree(buffer.buf) # <<<<<<<<<<<<<< + * buffer.buf = NULL + * + */ + xmlFree(((char *)__pyx_v_buffer->buf)); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":753 + * else: + * tree.xmlFree(buffer.buf) + * buffer.buf = NULL # <<<<<<<<<<<<<< + * + * property xslt_profile: + */ + __pyx_v_buffer->buf = NULL; + + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":758 + * 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__get__"); + __pyx_v_root = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":760 + * 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-2.2/src/lxml/xslt.pxi":761 + * 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-2.2/src/lxml/xslt.pxi":762 + * 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 = 762; __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-2.2/src/lxml/xslt.pxi":763 + * 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-2.2/src/lxml/xslt.pxi":764 + * 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-2.2/src/lxml/xslt.pxi":765 + * if root is None: + * return None + * return ElementTree(root) # <<<<<<<<<<<<<< + * + * def __del__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ElementTree); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_root); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_root); + __Pyx_GIVEREF(__pyx_v_root); + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._XSLTResultTree.xslt_profile.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_root); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":767 + * return ElementTree(root) + * + * def __del__(self): # <<<<<<<<<<<<<< + * self._profile = None + * + */ + +static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_SetupRefcountContext("__del__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":768 + * + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":770 + * 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_SetupRefcountContext("_xsltResultTreeFactory"); + __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":772 + * 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 = 772; __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-2.2/src/lxml/xslt.pxi":773 + * cdef _XSLTResultTree result + * result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree) + * result._xslt = xslt # <<<<<<<<<<<<<< + * result._profile = profile + * result._buffer = NULL + */ + __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-2.2/src/lxml/xslt.pxi":774 + * result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree) + * result._xslt = xslt + * result._profile = profile # <<<<<<<<<<<<<< + * result._buffer = NULL + * result._buffer_refcnt = 0 + */ + __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-2.2/src/lxml/xslt.pxi":775 + * result._xslt = xslt + * result._profile = profile + * result._buffer = NULL # <<<<<<<<<<<<<< + * result._buffer_refcnt = 0 + * result._buffer_len = 0 + */ + __pyx_v_result->_buffer = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":776 + * result._profile = profile + * result._buffer = NULL + * result._buffer_refcnt = 0 # <<<<<<<<<<<<<< + * result._buffer_len = 0 + * return result + */ + __pyx_v_result->_buffer_refcnt = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":777 + * result._buffer = NULL + * result._buffer_refcnt = 0 + * result._buffer_len = 0 # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_v_result->_buffer_len = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":778 + * result._buffer_refcnt = 0 + * result._buffer_len = 0 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":806 + * __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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_findStylesheetByID"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":808 + * 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-2.2/src/lxml/xslt.pxi":810 + * if __findStylesheetByID is None: + * __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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_627)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_627)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_627)); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":811 + * __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_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_2)); + if (PyDict_SetItem(__pyx_2, ((PyObject *)__pyx_kp_628), ((PyObject *)__pyx_kp_629)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, ((PyObject *)__pyx_2)) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; + __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 809; __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_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree_XPath))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/xslt.pxi":812 + * 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 = 812; __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_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_2)); + if (PyDict_SetItem(__pyx_2, __pyx_kp_id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree._findStylesheetByID"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":815 + * + * cdef class _XSLTProcessingInstruction(PIBase): + * def parseXSL(self, parser=None): # <<<<<<<<<<<<<< + * u"""Try to parse the stylesheet referenced by this PI and return an + * ElementTree for it. If the stylesheet is embedded in the same + */ + +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[] = "Try to parse the stylesheet referenced by this PI and return an\n ElementTree for it. If the stylesheet is embedded in the same\n document (referenced via xml:id), find and return an ElementTree for\n 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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_parser,0}; + __Pyx_SetupRefcountContext("parseXSL"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_parser); + if (unlikely(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 = 815; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_parser = values[0]; + } else { + __pyx_v_parser = 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 = 815; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL"); + 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-2.2/src/lxml/xslt.pxi":828 + * cdef char* c_href + * cdef xmlAttr* c_attr + * 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_1 = (((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":829 + * cdef xmlAttr* c_attr + * 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_630), 0); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":830 + * 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_2 = __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_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_kp_631), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 830; __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 = 830; __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_HREF, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 830; __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_hrefs); + __pyx_v_hrefs = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":831 + * 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_4 = PyObject_Length(__pyx_v_hrefs); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__pyx_t_4 != 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":832 + * 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_632), 0); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":833 + * if len(hrefs) != 1: + * raise ValueError, u"malformed PI attributes" + * href_utf = utf8(hrefs[0]) # <<<<<<<<<<<<<< + * c_href = _cstr(href_utf) + * + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = utf8(__pyx_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_href_utf); + __pyx_v_href_utf = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":834 + * 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 = PyString_AS_STRING(__pyx_v_href_utf); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":836 + * c_href = _cstr(href_utf) + * + * if c_href[0] != c'#': # <<<<<<<<<<<<<< + * # normal URL, try to parse from it + * c_href = tree.xmlBuildURI( + */ + __pyx_t_1 = ((__pyx_v_c_href[0]) != '#'); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":840 + * 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-2.2/src/lxml/xslt.pxi":841 + * 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_1 = (__pyx_v_c_href != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":842 + * 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 = __Pyx_PyBytes_FromString(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_href_utf); + __pyx_v_href_utf = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":843 + * 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-2.2/src/lxml/xslt.pxi":844 + * href_utf = c_href + * tree.xmlFree(c_href) + * result_doc = _parseDocumentFromURL(href_utf, parser) # <<<<<<<<<<<<<< + * return _elementTreeFactory(result_doc, None) + * + */ + if (!(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 844; __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 = 844; __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-2.2/src/lxml/xslt.pxi":845 + * 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 = 845; __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-2.2/src/lxml/xslt.pxi":849 + * # ID reference to embedded stylesheet + * # try XML:ID lookup + * 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 += 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":850 + * # try XML:ID lookup + * 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-2.2/src/lxml/xslt.pxi":851 + * 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) + */ + if ((__pyx_v_c_attr != NULL)) { + __pyx_t_1 = (__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); + } else { + __pyx_t_1 = (__pyx_v_c_attr != NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":852 + * 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 *)__pyx_f_4lxml_5etree__elementFactory(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc, __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_result_node)); + __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":853 + * 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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_result_node->_doc, __pyx_v_result_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 853; __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_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":856 + * + * # 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 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_f_4lxml_5etree__findStylesheetByID(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 856; __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_root); + __pyx_v_root = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":857 + * # 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_1 = __Pyx_PyObject_IsTrue(__pyx_v_root); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_1); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":858 + * 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_633), 0); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":859 + * 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_4 = PyObject_Length(__pyx_v_root); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 > 1); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":860 + * 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_634), 0); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":861 + * elif len(root) > 1: + * raise ValueError, u"ambiguous reference to embedded stylesheet" + * result_node = root[0] # <<<<<<<<<<<<<< + * return _elementTreeFactory(result_node._doc, result_node) + * + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_root, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4lxml_5etree__Element))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_result_node)); + __pyx_v_result_node = ((struct LxmlElement *)__pyx_1); + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":862 + * 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_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_result_node->_doc, __pyx_v_result_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 862; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":864 + * return _elementTreeFactory(result_node._doc, result_node) + * + * def set(self, key, value): # <<<<<<<<<<<<<< + * if key != u"href": + * raise AttributeError, \ + */ + +static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_set(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; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_key,&__pyx_kp_value,0}; + __Pyx_SetupRefcountContext("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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 864; __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 = 864; __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 = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_attrib = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":865 + * + * def set(self, key, value): + * if key != u"href": # <<<<<<<<<<<<<< + * raise AttributeError, \ + * u"only setting the 'href' attribute is supported on XSLT-PIs" + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_kp_635), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 865; __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[18]; __pyx_lineno = 865; __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-2.2/src/lxml/xslt.pxi":867 + * if key != u"href": + * raise AttributeError, \ + * u"only setting the 'href' attribute is supported on XSLT-PIs" # <<<<<<<<<<<<<< + * if value is None: + * attrib = u"" + */ + __Pyx_Raise(__pyx_builtin_AttributeError, ((PyObject *)__pyx_kp_636), 0); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":868 + * 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_2 = (__pyx_v_value == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":869 + * 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_637)); + __Pyx_DECREF(__pyx_v_attrib); + __pyx_v_attrib = ((PyObject *)__pyx_kp_637); + goto __pyx_L7; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":870 + * 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_2 = (PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_638))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __pyx_t_3 = (PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_639))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 870; __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-2.2/src/lxml/xslt.pxi":871 + * 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_640), 0); + {__pyx_filename = __pyx_f[18]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":873 + * 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_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_641), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_attrib); + __pyx_v_attrib = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":874 + * else: + * attrib = u' href="%s"' % value + * text = u' ' + self.text # <<<<<<<<<<<<<< + * if _FIND_PI_HREF(text): + * self.text = _REPLACE_PI_HREF(attrib, text) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_642), __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":875 + * 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 = 875; __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_1 = PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_HREF, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":876 + * text = u' ' + self.text + * if _FIND_PI_HREF(text): + * self.text = _REPLACE_PI_HREF(attrib, text) # <<<<<<<<<<<<<< + * else: + * self.text = text + attrib + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_attrib); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_attrib); + __Pyx_GIVEREF(__pyx_v_attrib); + __Pyx_INCREF(__pyx_v_text); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_text); + __Pyx_GIVEREF(__pyx_v_text); + __pyx_t_5 = PyObject_Call(__pyx_v_4lxml_5etree__REPLACE_PI_HREF, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 876; __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-2.2/src/lxml/xslt.pxi":878 + * 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, __pyx_v_attrib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 878; __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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":880 + * self.text = text + attrib + * + * def get(self, key, default=None): # <<<<<<<<<<<<<< + * for attr, value in _FIND_PI_ATTRIBUTES(u' ' + self.text): + * if attr == key: + */ + +static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_get(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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_key,&__pyx_kp_default,0}; + __Pyx_SetupRefcountContext("get"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = 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_kp_key); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default); + if (unlikely(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 = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_key = values[0]; + __pyx_v_default = values[1]; + } else { + __pyx_v_default = 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 = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.get"); + 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-2.2/src/lxml/xslt.pxi":881 + * + * def get(self, key, default=None): + * for attr, value in _FIND_PI_ATTRIBUTES(u' ' + self.text): # <<<<<<<<<<<<<< + * if attr == key: + * return value + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_kp_643), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __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 = 881; __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 = 881; __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 = 881; __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 = 881; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_attr); + __pyx_v_attr = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_attr); + __pyx_v_attr = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":882 + * def get(self, key, default=None): + * 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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":883 + * 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-2.2/src/lxml/xslt.pxi":884 + * 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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 "; +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_kp_context,&__pyx_kp_self_node,&__pyx_kp_input_node,&__pyx_kp_output_parent,0}; + __Pyx_SetupRefcountContext("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_kp_context); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_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_kp_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_kp_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"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":18 + * pass + * + * def apply_templates(self, _XSLTContext context not None, node): # <<<<<<<<<<<<<< + * u"""apply_templates(self, context, node) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_apply_templates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_13XSLTExtension_apply_templates[] = "apply_templates(self, context, node)\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 "; +static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_apply_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; + xmlNode *__pyx_v_c_parent; + xmlNode *__pyx_v_c_node; + xmlNode *__pyx_v_c_next; + xmlNode *__pyx_v_c_context_node; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_proxy; + PyObject *__pyx_v_results; + PyObject *__pyx_r = NULL; + xmlNode *__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_kp_context,&__pyx_kp_node,0}; + __Pyx_SetupRefcountContext("apply_templates"); + 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_kp_context); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_node); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply_templates", 1, 2, 2, 1); {__pyx_filename = __pyx_f[19]; __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), "apply_templates") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]); + __pyx_v_node = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_node = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply_templates", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_results = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":33 + * cdef _ReadOnlyElementProxy proxy + * cdef list results + * 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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_context_node = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":38 + * + * 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_644, NULL); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":40 + * 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-2.2/src/lxml/xsltext.pxi":41 + * + * 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-2.2/src/lxml/xsltext.pxi":43 + * 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-2.2/src/lxml/xsltext.pxi":44 + * xslt.xsltProcessOneNode( + * context._xsltCtxt, c_context_node, NULL) + * context._xsltCtxt.insert = c_node # <<<<<<<<<<<<<< + * + * results = [] # or maybe _collectAttributes(c_parent, 2) ? + */ + __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":46 + * context._xsltCtxt.insert = c_node + * + * results = [] # or maybe _collectAttributes(c_parent, 2) ? # <<<<<<<<<<<<<< + * c_node = c_parent.children + * try: + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_results)); + __pyx_v_results = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":47 + * + * results = [] # or maybe _collectAttributes(c_parent, 2) ? + * c_node = c_parent.children # <<<<<<<<<<<<<< + * try: + * while c_node is not NULL: + */ + __pyx_v_c_node = __pyx_v_c_parent->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":48 + * results = [] # or maybe _collectAttributes(c_parent, 2) ? + * c_node = c_parent.children + * try: # <<<<<<<<<<<<<< + * while c_node is not NULL: + * c_next = c_node.next + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":49 + * c_node = c_parent.children + * try: + * while c_node is not NULL: # <<<<<<<<<<<<<< + * c_next = c_node.next + * if c_node.type == tree.XML_TEXT_NODE: + */ + while (1) { + __pyx_t_3 = (__pyx_v_c_node != NULL); + if (!__pyx_t_3) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":50 + * try: + * 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-2.2/src/lxml/xsltext.pxi":51 + * 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_3 = (__pyx_v_c_node->type == XML_TEXT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":52 + * 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( + */ + __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_results), __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L11; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":53 + * 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_3 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":55 + * 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_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_context->_extension_element_proxy, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_proxy)); + __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":56 + * 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) + */ + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_results), ((PyObject *)__pyx_v_proxy)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L7;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":58 + * 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-2.2/src/lxml/xsltext.pxi":59 + * # 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__ReadOnlyElementProxy *)__pyx_v_proxy->__pyx_vtab)->free_after_use(__pyx_v_proxy); + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":62 + * else: + * raise TypeError, \ + * u"unsupported XSLT result type: %d" % c_node.type # <<<<<<<<<<<<<< + * c_node = c_next + * finally: + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_645), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[19]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7;} + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":63 + * raise TypeError, \ + * u"unsupported XSLT result type: %d" % c_node.type + * c_node = c_next # <<<<<<<<<<<<<< + * finally: + * # free all intermediate nodes that will not be freed by proxies + */ + __pyx_v_c_node = __pyx_v_c_next; + } + } + /*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_5); __pyx_t_5 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":66 + * finally: + * # free all intermediate nodes that will not be freed by proxies + * tree.xmlFreeNode(c_parent) # <<<<<<<<<<<<<< + * return results + * + */ + xmlFreeNode(__pyx_v_c_parent); + 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-2.2/src/lxml/xsltext.pxi":67 + * # free all intermediate nodes that will not be freed by proxies + * tree.xmlFreeNode(c_parent) + * 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_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_proxy); + __Pyx_DECREF(__pyx_v_results); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":70 + * + * + * 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; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/xsltext.pxi":72 + * 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 = 72; __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 = 72; __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_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_ns_utf); + __pyx_v_ns_utf = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_name_utf); + __pyx_v_name_utf = __pyx_3; + __pyx_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":74 + * 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, PyString_AS_STRING(__pyx_v_name_utf), PyString_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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":76 + * 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; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_context_node; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self_node; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_output_parent; + PyObject *__pyx_v_e; + PyObject *__pyx_v_message; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_SetupRefcountContext("_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_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_self_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_output_parent = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_e = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_message = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":85 + * cdef char* c_uri + * cdef _ReadOnlyElementProxy context_node, self_node, output_parent + * 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-2.2/src/lxml/xsltext.pxi":86 + * cdef _ReadOnlyElementProxy context_node, self_node, output_parent + * 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-2.2/src/lxml/xsltext.pxi":88 + * 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-2.2/src/lxml/xsltext.pxi":89 + * # 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-2.2/src/lxml/xsltext.pxi":91 + * 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-2.2/src/lxml/xsltext.pxi":92 + * # just for safety, should never happen + * return + * context = <_XSLTContext>c_ctxt.xpathCtxt.userData # <<<<<<<<<<<<<< + * try: + * dict_result = python.PyDict_GetItem( + */ + __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-2.2/src/lxml/xsltext.pxi":93 + * return + * context = <_XSLTContext>c_ctxt.xpathCtxt.userData + * 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-2.2/src/lxml/xsltext.pxi":95 + * 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 = __Pyx_PyBytes_FromString(__pyx_v_c_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_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_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_context->_extension_elements), ((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":96 + * 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-2.2/src/lxml/xsltext.pxi":98 + * if dict_result is NULL: + * raise KeyError, \ + * u"extension element %s not found" % funicode(c_inst_node.name) # <<<<<<<<<<<<<< + * extension = dict_result + * + */ + __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_646), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_KeyError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[19]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":99 + * raise KeyError, \ + * u"extension element %s not found" % funicode(c_inst_node.name) + * extension = dict_result # <<<<<<<<<<<<<< + * + * try: + */ + if (!(__Pyx_TypeTest(((PyObject *)__pyx_v_dict_result), __pyx_ptype_4lxml_5etree_XSLTExtension))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_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-2.2/src/lxml/xsltext.pxi":101 + * extension = dict_result + * + * try: # <<<<<<<<<<<<<< + * self_node = _newReadOnlyProxy(None, c_inst_node) + * context_node = _newReadOnlyProxy(self_node, c_context_node) + */ + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":102 + * + * try: + * self_node = _newReadOnlyProxy(None, c_inst_node) # <<<<<<<<<<<<<< + * context_node = _newReadOnlyProxy(self_node, c_context_node) + * output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert) + */ + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None), __pyx_v_c_inst_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L17;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_self_node)); + __pyx_v_self_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":103 + * try: + * self_node = _newReadOnlyProxy(None, c_inst_node) + * context_node = _newReadOnlyProxy(self_node, c_context_node) # <<<<<<<<<<<<<< + * output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert) + * + */ + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_context_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L17;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_context_node)); + __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":104 + * self_node = _newReadOnlyProxy(None, c_inst_node) + * context_node = _newReadOnlyProxy(self_node, c_context_node) + * output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert) # <<<<<<<<<<<<<< + * + * context._extension_element_proxy = self_node + */ + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__newAppendOnlyProxy(__pyx_v_self_node, __pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L17;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_output_parent)); + __pyx_v_output_parent = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":106 + * output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert) + * + * context._extension_element_proxy = self_node # <<<<<<<<<<<<<< + * extension.execute(context, self_node, context_node, output_parent) + * finally: + */ + __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 = __pyx_v_self_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":107 + * + * context._extension_element_proxy = self_node + * extension.execute(context, self_node, context_node, output_parent) # <<<<<<<<<<<<<< + * finally: + * context._extension_element_proxy = None + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_extension), __pyx_kp_execute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L17;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L17;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_v_context)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_context)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_context)); + __Pyx_INCREF(((PyObject *)__pyx_v_self_node)); + PyTuple_SET_ITEM(__pyx_t_4, 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_4, 2, ((PyObject *)__pyx_v_context_node)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_context_node)); + __Pyx_INCREF(((PyObject *)__pyx_v_output_parent)); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_output_parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_output_parent)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L17;} + __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_t_2); __pyx_t_2 = 0; + } + /*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_L18; + __pyx_L17: { + __pyx_why = 4; + __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; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":109 + * extension.execute(context, self_node, context_node, output_parent) + * finally: + * context._extension_element_proxy = None # <<<<<<<<<<<<<< + * if self_node is not None: + * _freeReadOnlyProxies(self_node) + */ + __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-2.2/src/lxml/xsltext.pxi":110 + * finally: + * context._extension_element_proxy = None + * if self_node is not None: # <<<<<<<<<<<<<< + * _freeReadOnlyProxies(self_node) + * except Exception, e: + */ + __pyx_t_1 = (((PyObject *)__pyx_v_self_node) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":111 + * context._extension_element_proxy = None + * if self_node is not None: + * _freeReadOnlyProxies(self_node) # <<<<<<<<<<<<<< + * except Exception, e: + * e = unicode(e).encode(u"UTF-8") + */ + __pyx_t_2 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L19_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L20; + } + __pyx_L20:; + goto __pyx_L21; + __pyx_L19_error:; + if (__pyx_why == 4) { + Py_XDECREF(__pyx_exc_type); + Py_XDECREF(__pyx_exc_value); + Py_XDECREF(__pyx_exc_tb); + } + goto __pyx_L5_error; + __pyx_L21:; + 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_L5_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_L12_try_end; + __pyx_L5_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-2.2/src/lxml/xsltext.pxi":112 + * if self_node is not None: + * _freeReadOnlyProxies(self_node) + * except Exception, e: # <<<<<<<<<<<<<< + * e = unicode(e).encode(u"UTF-8") + * message = python.PyString_FromFormat( + */ + __pyx_1 = PyErr_ExceptionMatches(__pyx_builtin_Exception); + if (__pyx_1) { + __Pyx_AddTraceback("lxml.etree._callExtensionElement"); + if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_4); + __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_v_e); + __pyx_v_e = __pyx_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":113 + * _freeReadOnlyProxies(self_node) + * except Exception, e: + * e = unicode(e).encode(u"UTF-8") # <<<<<<<<<<<<<< + * message = python.PyString_FromFormat( + * "Error executing extension element '%s': %s", + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_e); + __Pyx_GIVEREF(__pyx_v_e); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_647)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_647)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_647)); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_except_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_DECREF(__pyx_v_e); + __pyx_v_e = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":116 + * message = python.PyString_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_3 = PyString_FromFormat(__pyx_k_648, __pyx_v_c_inst_node->name, PyString_AS_STRING(__pyx_v_e)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_except_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-2.2/src/lxml/xsltext.pxi":117 + * "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_5 = __Pyx_PyBytes_AsString(__pyx_v_message); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":118 + * 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_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + goto __pyx_L6_exception_handled; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":119 + * xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message) + * context._exc._store_raised() + * except: # <<<<<<<<<<<<<< + * # just in case + * message = python.PyString_FromFormat( + */ + /*except:*/ { + __Pyx_AddTraceback("lxml.etree._callExtensionElement"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":122 + * # just in case + * message = python.PyString_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_6 = PyString_FromFormat(__pyx_k_649, __pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":123 + * message = python.PyString_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_5 = __Pyx_PyBytes_AsString(__pyx_v_message); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_t_5); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xsltext.pxi":124 + * "Error executing extension element '%s'", c_inst_node.name) + * xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message) + * 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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_WriteUnraisable("lxml.etree._callExtensionElement"); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_context); + __Pyx_DECREF((PyObject *)__pyx_v_extension); + __Pyx_DECREF((PyObject *)__pyx_v_context_node); + __Pyx_DECREF((PyObject *)__pyx_v_self_node); + __Pyx_DECREF((PyObject *)__pyx_v_output_parent); + __Pyx_DECREF(__pyx_v_e); + __Pyx_DECREF(__pyx_v_message); + __Pyx_FinishRefcountContext(); + PyGILState_Release(_save); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2738 + * u"Base class for XML validators." + * cdef _ErrorLog _error_log + * def __init__(self): # <<<<<<<<<<<<<< + * u"__init__(self)" + * self._error_log = _ErrorLog() + */ + +static int __pyx_pf_4lxml_5etree_10_Validator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_10_Validator___init__[] = "__init__(self)"; +static int __pyx_pf_4lxml_5etree_10_Validator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__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-2.2/src/lxml/lxml.etree.pyx":2740 + * def __init__(self): + * u"__init__(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 = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2742 + * self._error_log = _ErrorLog() + * + * def validate(self, etree): # <<<<<<<<<<<<<< + * u"""validate(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_10_Validator_validate(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/ +static char __pyx_doc_4lxml_5etree_10_Validator_validate[] = "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_validate(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("validate"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2749 + * 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 = 2749; __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 = 2749; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2751 + * return self(etree) + * + * def assertValid(self, etree): # <<<<<<<<<<<<<< + * u"""assertValid(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_10_Validator_assertValid(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/ +static char __pyx_doc_4lxml_5etree_10_Validator_assertValid[] = "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_assertValid(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("assertValid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2756 + * 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 = 2756; __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 = 2756; __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 = 2756; __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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2757 + * """ + * if not self(etree): + * raise DocumentInvalid(self._error_log._buildExceptionMessage( # <<<<<<<<<<<<<< + * u"Document does not comply with schema"), + * self._error_log) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DocumentInvalid); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2758 + * if not self(etree): + * raise DocumentInvalid(self._error_log._buildExceptionMessage( + * u"Document does not comply with schema"), # <<<<<<<<<<<<<< + * self._error_log) + * + */ + __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_650)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2759 + * raise DocumentInvalid(self._error_log._buildExceptionMessage( + * u"Document does not comply with schema"), + * self._error_log) # <<<<<<<<<<<<<< + * + * def assert_(self, etree): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __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__Validator *)__pyx_v_self)->_error_log)); + PyTuple_SET_ITEM(__pyx_t_1, 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_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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[0]; __pyx_lineno = 2757; __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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.etree._Validator.assertValid"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2761 + * self._error_log) + * + * def assert_(self, etree): # <<<<<<<<<<<<<< + * u"""assert_(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_10_Validator_assert_(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/ +static char __pyx_doc_4lxml_5etree_10_Validator_assert_[] = "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_assert_(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_SetupRefcountContext("assert_"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2766 + * 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 = 2766; __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 = 2766; __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 = 2766; __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) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2768 + * if not self(etree): + * raise AssertionError, self._error_log._buildExceptionMessage( + * u"Document does not comply with schema") # <<<<<<<<<<<<<< + * + * property error_log: + */ + __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_651)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __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 = 2767; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2772 + * property error_log: + * u"The log of validation errors and warnings." + * def __get__(self): # <<<<<<<<<<<<<< + * 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; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2773 + * u"The log of validation errors and warnings." + * def __get__(self): + * return self._error_log.copy() # <<<<<<<<<<<<<< + * + * include "dtd.pxi" # DTD + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self)->_error_log), __pyx_kp_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __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 = 2773; __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._Validator.error_log.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":31 + * """ + * cdef tree.xmlDtd* _c_dtd + * def __init__(self, file=None, *, external_id=None): # <<<<<<<<<<<<<< + * self._c_dtd = NULL + * _Validator.__init__(self) + */ + +static int __pyx_pf_4lxml_5etree_3DTD___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_3DTD___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_1 = 0; + 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_kp_file,&__pyx_kp_external_id,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_file); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_file = values[0]; + __pyx_v_external_id = values[1]; + } else { + __pyx_v_file = Py_None; + __pyx_v_external_id = 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 = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.DTD.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_file); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":32 + * cdef tree.xmlDtd* _c_dtd + * def __init__(self, file=None, *, external_id=None): + * self._c_dtd = NULL # <<<<<<<<<<<<<< + * _Validator.__init__(self) + * if file is not None: + */ + ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self)->_c_dtd = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":33 + * def __init__(self, file=None, *, external_id=None): + * self._c_dtd = NULL + * _Validator.__init__(self) # <<<<<<<<<<<<<< + * if file is not None: + * if _isString(file): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 33; __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 = 33; __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 = 33; __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-2.2/src/lxml/dtd.pxi":34 + * self._c_dtd = NULL + * _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-2.2/src/lxml/dtd.pxi":35 + * _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-2.2/src/lxml/dtd.pxi":36 + * 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 = 36; __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-2.2/src/lxml/dtd.pxi":37 + * 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-2.2/src/lxml/dtd.pxi":38 + * 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, PyString_AS_STRING(__pyx_v_file)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":39 + * 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-2.2/src/lxml/dtd.pxi":40 + * 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_kp_652)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":41 + * 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 = 41; __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-2.2/src/lxml/dtd.pxi":43 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_653), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[20]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + goto __pyx_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":44 + * 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-2.2/src/lxml/dtd.pxi":45 + * 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-2.2/src/lxml/dtd.pxi":46 + * 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 = __Pyx_PyBytes_AsString(__pyx_v_external_id); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 46; __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-2.2/src/lxml/dtd.pxi":47 + * 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-2.2/src/lxml/dtd.pxi":49 + * self._error_log.disconnect() + * else: + * raise DTDParseError, u"either filename or external ID required" # <<<<<<<<<<<<<< + * + * if self._c_dtd is NULL: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_654), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[20]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":51 + * 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-2.2/src/lxml/dtd.pxi":52 + * + * if self._c_dtd is NULL: + * raise DTDParseError( # <<<<<<<<<<<<<< + * self._error_log._buildExceptionMessage(u"error parsing DTD"), + * self._error_log) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":53 + * if self._c_dtd is NULL: + * raise DTDParseError( + * self._error_log._buildExceptionMessage(u"error parsing DTD"), # <<<<<<<<<<<<<< + * self._error_log) + * + */ + __pyx_t_3 = ((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_655)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":54 + * raise DTDParseError( + * self._error_log._buildExceptionMessage(u"error parsing DTD"), + * self._error_log) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 52; __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_DTD *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_2, 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_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_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[20]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":56 + * self._error_log) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * tree.xmlFreeDtd(self._c_dtd) + * + */ + +static void __pyx_pf_4lxml_5etree_3DTD___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_3DTD___dealloc__(PyObject *__pyx_v_self) { + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":57 + * + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":59 + * tree.xmlFreeDtd(self._c_dtd) + * + * def __call__(self, etree): # <<<<<<<<<<<<<< + * u"""__call__(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_3DTD___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_3DTD___call__[] = "__call__(self, etree)\n\n Validate doc using the DTD.\n\n Returns true if the document is valid, false if not.\n "; +static PyObject *__pyx_pf_4lxml_5etree_3DTD___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_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + xmlDoc *__pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree,0}; + __Pyx_SetupRefcountContext("__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_kp_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 = 59; __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.DTD.__call__"); + 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-2.2/src/lxml/dtd.pxi":72 + * cdef int ret + * + * 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 = 72; __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-2.2/src/lxml/dtd.pxi":73 + * + * 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 = 73; __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-2.2/src/lxml/dtd.pxi":75 + * 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-2.2/src/lxml/dtd.pxi":76 + * + * 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-2.2/src/lxml/dtd.pxi":77 + * 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-2.2/src/lxml/dtd.pxi":78 + * 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-2.2/src/lxml/dtd.pxi":79 + * if valid_ctxt is NULL: + * self._error_log.disconnect() + * raise DTDError(u"Failed to create validation context", # <<<<<<<<<<<<<< + * self._error_log) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":80 + * 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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_656)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_656)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_656)); + __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_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[20]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":82 + * 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_4 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_4; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":83 + * + * 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) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":84 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":85 + * 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-2.2/src/lxml/dtd.pxi":87 + * _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-2.2/src/lxml/dtd.pxi":89 + * 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-2.2/src/lxml/dtd.pxi":90 + * + * 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-2.2/src/lxml/dtd.pxi":91 + * self._error_log.disconnect() + * if ret == -1: + * raise DTDValidateError(u"Internal error in DTD validation", # <<<<<<<<<<<<<< + * self._error_log) + * if ret == 1: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDValidateError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":92 + * 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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_657)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_657)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_657)); + __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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":93 + * 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-2.2/src/lxml/dtd.pxi":94 + * 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 = 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; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":96 + * 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 = 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_L11:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":99 + * + * + * 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_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_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-2.2/src/lxml/dtd.pxi":104 + * 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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ExceptionContext))) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/dtd.pxi":105 + * 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 = 105; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__FileReaderContext))) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/dtd.pxi":106 + * 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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ErrorLog))) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/dtd.pxi":108 + * 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-2.2/src/lxml/dtd.pxi":109 + * + * 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-2.2/src/lxml/dtd.pxi":110 + * 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-2.2/src/lxml/dtd.pxi":112 + * 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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":113 + * + * 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-2.2/src/lxml/dtd.pxi":114 + * exc_context._raise_if_stored() + * if c_dtd is NULL: + * raise DTDParseError(u"error parsing DTD", error_log) # <<<<<<<<<<<<<< + * return c_dtd + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_658)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_658)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_658)); + __Pyx_INCREF(((PyObject *)__pyx_v_error_log)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_error_log)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_error_log)); + __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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[20]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":115 + * 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_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":121 + * 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_SetupRefcountContext("_dtdFactory"); + __pyx_v_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":124 + * # 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-2.2/src/lxml/dtd.pxi":125 + * 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-2.2/src/lxml/dtd.pxi":126 + * 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 = 126; __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-2.2/src/lxml/dtd.pxi":127 + * 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-2.2/src/lxml/dtd.pxi":128 + * 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-2.2/src/lxml/dtd.pxi":129 + * 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 = 129; __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-2.2/src/lxml/dtd.pxi":130 + * 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_kp___init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 130; __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 = 130; __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 = 130; __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-2.2/src/lxml/dtd.pxi":131 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":30 + * """ + * cdef relaxng.xmlRelaxNG* _c_schema + * def __init__(self, etree=None, *, file=None): # <<<<<<<<<<<<<< + * cdef _Document doc + * cdef _Element root_node + */ + +static int __pyx_pf_4lxml_5etree_7RelaxNG___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_7RelaxNG___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_1 = 0; + 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_kp_etree,&__pyx_kp_file,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_etree); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_etree = values[0]; + __pyx_v_file = values[1]; + } else { + __pyx_v_etree = Py_None; + __pyx_v_file = 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 = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__"); + 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-2.2/src/lxml/relaxng.pxi":37 + * cdef char* c_href + * cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt + * _Validator.__init__(self) # <<<<<<<<<<<<<< + * self._c_schema = NULL + * fake_c_doc = NULL + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 37; __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 = 37; __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 = 37; __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-2.2/src/lxml/relaxng.pxi":38 + * cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt + * _Validator.__init__(self) + * self._c_schema = NULL # <<<<<<<<<<<<<< + * fake_c_doc = NULL + * if etree is not None: + */ + ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":39 + * _Validator.__init__(self) + * self._c_schema = NULL + * fake_c_doc = NULL # <<<<<<<<<<<<<< + * if etree is not None: + * doc = _documentOrRaise(etree) + */ + __pyx_v_fake_c_doc = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":40 + * self._c_schema = NULL + * 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-2.2/src/lxml/relaxng.pxi":41 + * 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 = 41; __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-2.2/src/lxml/relaxng.pxi":42 + * 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 = 42; __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-2.2/src/lxml/relaxng.pxi":43 + * 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-2.2/src/lxml/relaxng.pxi":45 + * 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-2.2/src/lxml/relaxng.pxi":46 + * # 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-2.2/src/lxml/relaxng.pxi":47 + * 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: + */ + if (!(__pyx_v_c_href == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":49 + * 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" + * self._error_log.connect() + */ + __pyx_t_4 = (strcmp(__pyx_v_c_href, __pyx_k_659) != 0); + } else { + __pyx_t_4 = (__pyx_v_c_href == NULL); + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":50 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_660), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[21]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":51 + * '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-2.2/src/lxml/relaxng.pxi":52 + * 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_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[21]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_fake_c_doc = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":53 + * 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-2.2/src/lxml/relaxng.pxi":54 + * 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_4 = (__pyx_v_file != Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":55 + * parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc) + * elif file is not None: + * if _isString(file): # <<<<<<<<<<<<<< + * filename = _encodeFilename(file) + * self._error_log.connect() + */ + __pyx_t_4 = _isString(__pyx_v_file); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":56 + * 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 = 56; __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-2.2/src/lxml/relaxng.pxi":57 + * 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-2.2/src/lxml/relaxng.pxi":58 + * filename = _encodeFilename(file) + * self._error_log.connect() + * parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename)) # <<<<<<<<<<<<<< + * else: + * doc = _parseDocument(file, None, None) + */ + __pyx_v_parser_ctxt = xmlRelaxNGNewParserCtxt(PyString_AS_STRING(__pyx_v_filename)); + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":60 + * 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 = 60; __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-2.2/src/lxml/relaxng.pxi":61 + * 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-2.2/src/lxml/relaxng.pxi":62 + * 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-2.2/src/lxml/relaxng.pxi":64 + * parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc) + * else: + * raise RelaxNGParseError, u"No tree or file given" # <<<<<<<<<<<<<< + * + * if parser_ctxt is NULL: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_661), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[21]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":66 + * 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_4 = (__pyx_v_parser_ctxt == NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":67 + * + * 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-2.2/src/lxml/relaxng.pxi":68 + * 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_4 = (__pyx_v_fake_c_doc != NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":69 + * 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-2.2/src/lxml/relaxng.pxi":70 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":72 + * raise RelaxNGParseError( + * self._error_log._buildExceptionMessage( + * u"Document is not parsable as Relax NG"), # <<<<<<<<<<<<<< + * self._error_log) + * self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt) + */ + __pyx_t_3 = ((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_662)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":73 + * 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_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 70; __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_RelaxNG *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_2, 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_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_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[21]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":74 + * 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-2.2/src/lxml/relaxng.pxi":75 + * 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-2.2/src/lxml/relaxng.pxi":77 + * self._error_log.disconnect() + * + * if _LIBXML_VERSION_INT >= 20624: # <<<<<<<<<<<<<< + * relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt) + * if self._c_schema is NULL: + */ + __pyx_t_4 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20624); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":78 + * + * 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-2.2/src/lxml/relaxng.pxi":79 + * 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_4 = (((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self)->_c_schema == NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":80 + * 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_4 = (__pyx_v_fake_c_doc != NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":81 + * 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_4 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":82 + * 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-2.2/src/lxml/relaxng.pxi":83 + * 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-2.2/src/lxml/relaxng.pxi":84 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":86 + * raise RelaxNGParseError( + * self._error_log._buildExceptionMessage( + * u"Document is not valid Relax NG"), # <<<<<<<<<<<<<< + * self._error_log) + * if fake_c_doc is not NULL: + */ + __pyx_t_3 = ((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_663)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":87 + * 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_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 84; __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_RelaxNG *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_2, 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_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_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[21]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":88 + * 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_4 = (__pyx_v_fake_c_doc != NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":89 + * 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_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":91 + * _destroyFakeDoc(doc._c_doc, fake_c_doc) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * relaxng.xmlRelaxNGFree(self._c_schema) + * + */ + +static void __pyx_pf_4lxml_5etree_7RelaxNG___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_7RelaxNG___dealloc__(PyObject *__pyx_v_self) { + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":92 + * + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":94 + * relaxng.xmlRelaxNGFree(self._c_schema) + * + * def __call__(self, etree): # <<<<<<<<<<<<<< + * u"""__call__(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_7RelaxNG___call__[] = "__call__(self, etree)\n\n Validate doc using Relax NG.\n\n Returns true if document is valid, false if not."; +static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG___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_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + xmlDoc *__pyx_t_3; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree,0}; + __Pyx_SetupRefcountContext("__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_kp_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 = 94; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__"); + 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-2.2/src/lxml/relaxng.pxi":106 + * cdef int ret + * + * 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 = 106; __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-2.2/src/lxml/relaxng.pxi":107 + * + * 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 = 107; __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-2.2/src/lxml/relaxng.pxi":109 + * 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-2.2/src/lxml/relaxng.pxi":110 + * + * 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-2.2/src/lxml/relaxng.pxi":111 + * 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-2.2/src/lxml/relaxng.pxi":112 + * 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-2.2/src/lxml/relaxng.pxi":113 + * 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 = 113; __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-2.2/src/lxml/relaxng.pxi":115 + * 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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":116 + * + * 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) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":117 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":118 + * 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-2.2/src/lxml/relaxng.pxi":120 + * _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-2.2/src/lxml/relaxng.pxi":122 + * 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-2.2/src/lxml/relaxng.pxi":123 + * + * 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-2.2/src/lxml/relaxng.pxi":124 + * self._error_log.disconnect() + * if ret == -1: + * raise RelaxNGValidateError( # <<<<<<<<<<<<<< + * u"Internal error in Relax NG validation", + * self._error_log) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_209); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":126 + * raise RelaxNGValidateError( + * u"Internal error in Relax NG validation", + * self._error_log) # <<<<<<<<<<<<<< + * if ret == 0: + * return True + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_664)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_664)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_664)); + __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_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[21]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":127 + * 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-2.2/src/lxml/relaxng.pxi":128 + * self._error_log) + * if ret == 0: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 128; __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_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":130 + * return True + * else: + * return False # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 130; __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_L11:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":40 + * cdef bint _add_attribute_defaults + * + * def __init__(self, etree=None, *, file=None, attribute_defaults=False): # <<<<<<<<<<<<<< + * cdef _Document doc + * cdef _Element root_node + */ + +static int __pyx_pf_4lxml_5etree_9XMLSchema___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_9XMLSchema___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; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + xmlDoc *__pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree,&__pyx_kp_file,&__pyx_kp_attribute_defaults,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[0] = Py_None; + values[1] = Py_None; + values[2] = __pyx_k_218; + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_etree); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_file); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 40; __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 = Py_None; + __pyx_v_file = Py_None; + __pyx_v_attribute_defaults = __pyx_k_218; + 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 = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XMLSchema.__init__"); + 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-2.2/src/lxml/xmlschema.pxi":48 + * cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt + * + * self._has_default_attributes = True # play safe # <<<<<<<<<<<<<< + * self._add_attribute_defaults = attribute_defaults + * self._c_schema = NULL + */ + ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_has_default_attributes = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":49 + * + * self._has_default_attributes = True # play safe + * self._add_attribute_defaults = attribute_defaults # <<<<<<<<<<<<<< + * self._c_schema = NULL + * _Validator.__init__(self) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 49; __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-2.2/src/lxml/xmlschema.pxi":50 + * self._has_default_attributes = True # play safe + * self._add_attribute_defaults = attribute_defaults + * self._c_schema = NULL # <<<<<<<<<<<<<< + * _Validator.__init__(self) + * fake_c_doc = NULL + */ + ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":51 + * self._add_attribute_defaults = attribute_defaults + * self._c_schema = NULL + * _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_kp___init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 51; __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 = 51; __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 = 51; __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-2.2/src/lxml/xmlschema.pxi":52 + * self._c_schema = NULL + * _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-2.2/src/lxml/xmlschema.pxi":53 + * _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-2.2/src/lxml/xmlschema.pxi":54 + * 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 = 54; __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-2.2/src/lxml/xmlschema.pxi":55 + * 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 = 55; __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-2.2/src/lxml/xmlschema.pxi":58 + * + * # 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-2.2/src/lxml/xmlschema.pxi":59 + * # 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-2.2/src/lxml/xmlschema.pxi":60 + * 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-2.2/src/lxml/xmlschema.pxi":61 + * 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" + */ + if (!(__pyx_v_c_href == NULL)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":62 + * 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 = (strcmp(__pyx_v_c_href, __pyx_k_665) != 0); + } else { + __pyx_t_1 = (__pyx_v_c_href == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":63 + * 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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSchemaParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_666), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[22]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":65 + * 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_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[22]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_fake_c_doc = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":66 + * + * 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-2.2/src/lxml/xmlschema.pxi":67 + * 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-2.2/src/lxml/xmlschema.pxi":68 + * self._error_log.connect() + * parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc) + * elif file is not None: # <<<<<<<<<<<<<< + * if _isString(file): + * doc = None + */ + __pyx_t_1 = (__pyx_v_file != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":69 + * parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc) + * elif file is not None: + * if _isString(file): # <<<<<<<<<<<<<< + * doc = None + * filename = _encodeFilename(file) + */ + __pyx_t_1 = _isString(__pyx_v_file); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":70 + * 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-2.2/src/lxml/xmlschema.pxi":71 + * 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 = 71; __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-2.2/src/lxml/xmlschema.pxi":72 + * 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-2.2/src/lxml/xmlschema.pxi":73 + * filename = _encodeFilename(file) + * self._error_log.connect() + * parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename)) # <<<<<<<<<<<<<< + * else: + * doc = _parseDocument(file, None, None) + */ + __pyx_v_parser_ctxt = xmlSchemaNewParserCtxt(PyString_AS_STRING(__pyx_v_filename)); + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":75 + * 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 = 75; __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-2.2/src/lxml/xmlschema.pxi":76 + * 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-2.2/src/lxml/xmlschema.pxi":77 + * 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-2.2/src/lxml/xmlschema.pxi":79 + * parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc) + * else: + * raise XMLSchemaParseError, u"No tree or file given" # <<<<<<<<<<<<<< + * + * if parser_ctxt is not NULL: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSchemaParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_667), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[22]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":81 + * raise XMLSchemaParseError, u"No tree or file given" + * + * if parser_ctxt is not NULL: # <<<<<<<<<<<<<< + * if doc is None: + * with nogil: + */ + __pyx_t_1 = (__pyx_v_parser_ctxt != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":82 + * + * if parser_ctxt is not NULL: + * if doc is None: # <<<<<<<<<<<<<< + * with nogil: + * self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":83 + * if parser_ctxt is not NULL: + * if doc is None: + * with nogil: # <<<<<<<<<<<<<< + * self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt) + * else: + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":84 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":90 + * # 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() + */ + ((struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT->__pyx_vtab)->pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_doc->_parser); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":91 + * # 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-2.2/src/lxml/xmlschema.pxi":92 + * __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-2.2/src/lxml/xmlschema.pxi":94 + * __GLOBAL_PARSER_CONTEXT.popImpliedContext() + * + * if _LIBXML_VERSION_INT >= 20624: # <<<<<<<<<<<<<< + * xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt) + * + */ + __pyx_t_1 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20624); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":95 + * + * 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-2.2/src/lxml/xmlschema.pxi":97 + * 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-2.2/src/lxml/xmlschema.pxi":99 + * self._error_log.disconnect() + * + * if fake_c_doc is not NULL: # <<<<<<<<<<<<<< + * _destroyFakeDoc(doc._c_doc, fake_c_doc) + * + */ + __pyx_t_1 = (__pyx_v_fake_c_doc != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":100 + * + * 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-2.2/src/lxml/xmlschema.pxi":102 + * _destroyFakeDoc(doc._c_doc, fake_c_doc) + * + * if self._c_schema is NULL: # <<<<<<<<<<<<<< + * raise XMLSchemaParseError( + * self._error_log._buildExceptionMessage( + */ + __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_c_schema == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":103 + * + * if self._c_schema is NULL: + * raise XMLSchemaParseError( # <<<<<<<<<<<<<< + * self._error_log._buildExceptionMessage( + * u"Document is not valid XML Schema"), + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSchemaParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":105 + * raise XMLSchemaParseError( + * self._error_log._buildExceptionMessage( + * u"Document is not valid XML Schema"), # <<<<<<<<<<<<<< + * self._error_log) + * + */ + __pyx_t_4 = ((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_668)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":106 + * self._error_log._buildExceptionMessage( + * u"Document is not valid XML Schema"), + * self._error_log) # <<<<<<<<<<<<<< + * + * if doc is not None: + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 103; __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_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_3, 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_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_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[22]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":108 + * 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_1 = (((PyObject *)__pyx_v_doc) != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":109 + * + * 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_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_v_doc)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_doc)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_doc)); + __pyx_t_3 = PyObject_Call(((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_has_default_attributes = __pyx_t_1; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":110 + * 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_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":111 + * 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_3 = __Pyx_PyBool_FromLong(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_has_default_attributes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __Pyx_INCREF(__pyx_v_attribute_defaults); + __pyx_t_4 = __pyx_v_attribute_defaults; + } + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":110 + * 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_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":113 + * self._has_default_attributes + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * xmlschema.xmlSchemaFree(self._c_schema) + * + */ + +static void __pyx_pf_4lxml_5etree_9XMLSchema___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_9XMLSchema___dealloc__(PyObject *__pyx_v_self) { + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":114 + * + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":116 + * xmlschema.xmlSchemaFree(self._c_schema) + * + * def __call__(self, etree): # <<<<<<<<<<<<<< + * u"""__call__(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_9XMLSchema___call__[] = "__call__(self, etree)\n\n Validate doc using XML Schema.\n\n Returns true if document is valid, false if not.\n "; +static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema___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_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + xmlDoc *__pyx_t_3; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree,0}; + __Pyx_SetupRefcountContext("__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_kp_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 = 116; __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__"); + 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-2.2/src/lxml/xmlschema.pxi":129 + * cdef int ret + * + * 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 = 129; __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-2.2/src/lxml/xmlschema.pxi":130 + * + * 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 = 130; __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-2.2/src/lxml/xmlschema.pxi":132 + * 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-2.2/src/lxml/xmlschema.pxi":133 + * + * 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-2.2/src/lxml/xmlschema.pxi":134 + * 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-2.2/src/lxml/xmlschema.pxi":135 + * 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-2.2/src/lxml/xmlschema.pxi":136 + * 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 = 136; __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-2.2/src/lxml/xmlschema.pxi":138 + * return python.PyErr_NoMemory() + * + * if self._add_attribute_defaults: # <<<<<<<<<<<<<< + * xmlschema.xmlSchemaSetValidOptions( + * valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE) + */ + __pyx_t_2 = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->_add_attribute_defaults; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":140 + * 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-2.2/src/lxml/xmlschema.pxi":142 + * 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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":143 + * + * 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) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":144 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":145 + * 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-2.2/src/lxml/xmlschema.pxi":147 + * _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-2.2/src/lxml/xmlschema.pxi":149 + * 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-2.2/src/lxml/xmlschema.pxi":150 + * + * 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-2.2/src/lxml/xmlschema.pxi":151 + * self._error_log.disconnect() + * if ret == -1: + * raise XMLSchemaValidateError( # <<<<<<<<<<<<<< + * u"Internal error in XML Schema validation.", + * self._error_log) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_213); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":153 + * raise XMLSchemaValidateError( + * u"Internal error in XML Schema validation.", + * self._error_log) # <<<<<<<<<<<<<< + * if ret == 0: + * return True + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_669)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_669)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_669)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_1, 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_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[22]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":154 + * 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-2.2/src/lxml/xmlschema.pxi":155 + * self._error_log) + * if ret == 0: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 155; __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_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":157 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * cdef _ParserSchemaValidationContext _newSaxValidator( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 157; __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_L12:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":159 + * 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_SetupRefcountContext("_newSaxValidator"); + __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":162 + * self, bint add_default_attributes): + * cdef _ParserSchemaValidationContext context + * context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext) # <<<<<<<<<<<<<< + * context._schema = self + * context._valid_ctxt = NULL + */ + __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 = 162; __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-2.2/src/lxml/xmlschema.pxi":163 + * cdef _ParserSchemaValidationContext context + * context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext) + * context._schema = self # <<<<<<<<<<<<<< + * context._valid_ctxt = NULL + * context._sax_plug = NULL + */ + __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-2.2/src/lxml/xmlschema.pxi":164 + * context = NEW_SCHEMA_CONTEXT(_ParserSchemaValidationContext) + * context._schema = self + * context._valid_ctxt = NULL # <<<<<<<<<<<<<< + * context._sax_plug = NULL + * context._add_default_attributes = (self._has_default_attributes and ( + */ + __pyx_v_context->_valid_ctxt = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":165 + * context._schema = self + * context._valid_ctxt = NULL + * context._sax_plug = NULL # <<<<<<<<<<<<<< + * context._add_default_attributes = (self._has_default_attributes and ( + * add_default_attributes or self._add_attribute_defaults)) + */ + __pyx_v_context->_sax_plug = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":166 + * context._valid_ctxt = NULL + * context._sax_plug = NULL + * 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-2.2/src/lxml/xmlschema.pxi":167 + * context._sax_plug = NULL + * 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-2.2/src/lxml/xmlschema.pxi":166 + * context._valid_ctxt = NULL + * context._sax_plug = NULL + * 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-2.2/src/lxml/xmlschema.pxi":168 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":176 + * cdef bint _add_default_attributes + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.disconnect() + * if self._valid_ctxt: + */ + +static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":177 + * + * 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-2.2/src/lxml/xmlschema.pxi":178 + * 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-2.2/src/lxml/xmlschema.pxi":179 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":181 + * xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt) + * + * cdef _ParserSchemaValidationContext copy(self): # <<<<<<<<<<<<<< + * return self._schema._newSaxValidator( + * self._add_default_attributes) + */ + +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; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("copy"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":182 + * + * cdef _ParserSchemaValidationContext copy(self): + * return self._schema._newSaxValidator( # <<<<<<<<<<<<<< + * self._add_default_attributes) + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":183 + * cdef _ParserSchemaValidationContext copy(self): + * return self._schema._newSaxValidator( + * self._add_default_attributes) # <<<<<<<<<<<<<< + * + * cdef void inject_default_attributes(self, xmlDoc* c_doc): + */ + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, __pyx_v_self->_add_default_attributes)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1); + __pyx_t_1 = 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_1); + __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.copy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":185 + * 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) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("inject_default_attributes"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":189 + * # 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) + */ + __pyx_t_1 = __pyx_v_self->_add_default_attributes; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":190 + * # time + * if self._add_default_attributes: + * with nogil: # <<<<<<<<<<<<<< + * xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc) + * + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":191 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":193 + * 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_SetupRefcountContext("connect"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":194 + * + * 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-2.2/src/lxml/xmlschema.pxi":195 + * 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-2.2/src/lxml/xmlschema.pxi":197 + * 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-2.2/src/lxml/xmlschema.pxi":198 + * 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 = 198; __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 = 198; __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-2.2/src/lxml/xmlschema.pxi":199 + * if self._valid_ctxt is NULL: + * return python.PyErr_NoMemory() + * if self._add_default_attributes: # <<<<<<<<<<<<<< + * xmlschema.xmlSchemaSetValidOptions( + * self._valid_ctxt, + */ + __pyx_t_1 = __pyx_v_self->_add_default_attributes; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":202 + * 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-2.2/src/lxml/xmlschema.pxi":203 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":206 + * 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_SetupRefcountContext("disconnect"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":207 + * + * 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-2.2/src/lxml/xmlschema.pxi":208 + * 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-2.2/src/lxml/xmlschema.pxi":209 + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":211 + * 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_SetupRefcountContext("isvalid"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":212 + * + * 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-2.2/src/lxml/xmlschema.pxi":213 + * 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-2.2/src/lxml/xmlschema.pxi":214 + * 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":73 + * cdef schematron.xmlSchematron* _c_schema + * cdef xmlDoc* _c_schema_doc + * def __init__(self, etree=None, *, file=None): # <<<<<<<<<<<<<< + * cdef _Document doc + * cdef _Element root_node + */ + +static int __pyx_pf_4lxml_5etree_10Schematron___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_5etree_10Schematron___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_1 = 0; + 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_kp_etree,&__pyx_kp_file,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[0] = Py_None; + values[1] = 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_etree); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_kp_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 = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_etree = values[0]; + __pyx_v_file = values[1]; + } else { + __pyx_v_etree = Py_None; + __pyx_v_file = 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 = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Schematron.__init__"); + 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-2.2/src/lxml/schematron.pxi":79 + * cdef char* c_href + * cdef schematron.xmlSchematronParserCtxt* parser_ctxt + * self._c_schema = NULL # <<<<<<<<<<<<<< + * self._c_schema_doc = NULL + * _Validator.__init__(self) + */ + ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":80 + * cdef schematron.xmlSchematronParserCtxt* parser_ctxt + * self._c_schema = NULL + * self._c_schema_doc = NULL # <<<<<<<<<<<<<< + * _Validator.__init__(self) + * if not config.ENABLE_SCHEMATRON: + */ + ((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->_c_schema_doc = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":81 + * self._c_schema = NULL + * self._c_schema_doc = NULL + * _Validator.__init__(self) # <<<<<<<<<<<<<< + * if not config.ENABLE_SCHEMATRON: + * raise SchematronError, \ + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 81; __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 = 81; __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 = 81; __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-2.2/src/lxml/schematron.pxi":82 + * self._c_schema_doc = NULL + * _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-2.2/src/lxml/schematron.pxi":83 + * _Validator.__init__(self) + * if not config.ENABLE_SCHEMATRON: + * raise SchematronError, \ # <<<<<<<<<<<<<< + * u"lxml.etree was compiled without Schematron support." + * if etree is not None: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_SchematronError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":84 + * if not config.ENABLE_SCHEMATRON: + * raise SchematronError, \ + * u"lxml.etree was compiled without Schematron support." # <<<<<<<<<<<<<< + * if etree is not None: + * doc = _documentOrRaise(etree) + */ + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_670), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":85 + * 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-2.2/src/lxml/schematron.pxi":86 + * 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 = 86; __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-2.2/src/lxml/schematron.pxi":87 + * 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 = 87; __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-2.2/src/lxml/schematron.pxi":88 + * 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 = 88; __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-2.2/src/lxml/schematron.pxi":89 + * 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-2.2/src/lxml/schematron.pxi":91 + * 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-2.2/src/lxml/schematron.pxi":92 + * 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-2.2/src/lxml/schematron.pxi":93 + * 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 = 93; __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-2.2/src/lxml/schematron.pxi":94 + * 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-2.2/src/lxml/schematron.pxi":96 + * 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-2.2/src/lxml/schematron.pxi":97 + * # 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 = 97; __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-2.2/src/lxml/schematron.pxi":98 + * 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-2.2/src/lxml/schematron.pxi":99 + * 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(PyString_AS_STRING(__pyx_v_filename)); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":101 + * parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename)) + * else: + * raise SchematronParseError, u"No tree or file given" # <<<<<<<<<<<<<< + * + * if parser_ctxt is NULL: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_220); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_Raise(__pyx_1, ((PyObject *)__pyx_kp_671), 0); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + {__pyx_filename = __pyx_f[23]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":103 + * 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-2.2/src/lxml/schematron.pxi":104 + * + * 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-2.2/src/lxml/schematron.pxi":105 + * 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-2.2/src/lxml/schematron.pxi":106 + * 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-2.2/src/lxml/schematron.pxi":107 + * 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-2.2/src/lxml/schematron.pxi":108 + * 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 = 108; __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-2.2/src/lxml/schematron.pxi":109 + * 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-2.2/src/lxml/schematron.pxi":111 + * 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-2.2/src/lxml/schematron.pxi":112 + * + * 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-2.2/src/lxml/schematron.pxi":114 + * 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-2.2/src/lxml/schematron.pxi":115 + * + * 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-2.2/src/lxml/schematron.pxi":116 + * schematron.xmlSchematronFreeParserCtxt(parser_ctxt) + * if self._c_schema is NULL: + * raise SchematronParseError( # <<<<<<<<<<<<<< + * u"Document is not a valid Schematron schema", + * self._error_log) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_220); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":118 + * raise SchematronParseError( + * u"Document is not a valid Schematron schema", + * self._error_log) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_672)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_672)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_672)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_3, 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_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_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[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":120 + * self._error_log) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * schematron.xmlSchematronFree(self._c_schema) + * if _LIBXML_VERSION_INT >= 20631: + */ + +static void __pyx_pf_4lxml_5etree_10Schematron___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_5etree_10Schematron___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":121 + * + * 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-2.2/src/lxml/schematron.pxi":122 + * 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-2.2/src/lxml/schematron.pxi":125 + * # 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-2.2/src/lxml/schematron.pxi":126 + * # 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":128 + * tree.xmlFreeDoc(self._c_schema_doc) + * + * def __call__(self, etree): # <<<<<<<<<<<<<< + * u"""__call__(self, etree) + * + */ + +static PyObject *__pyx_pf_4lxml_5etree_10Schematron___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_5etree_10Schematron___call__[] = "__call__(self, etree)\n\n Validate doc using Schematron.\n\n Returns true if document is valid, false if not."; +static PyObject *__pyx_pf_4lxml_5etree_10Schematron___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_1 = 0; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + xmlDoc *__pyx_t_3; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_etree,0}; + __Pyx_SetupRefcountContext("__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_kp_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 = 128; __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 = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.etree.Schematron.__call__"); + 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-2.2/src/lxml/schematron.pxi":141 + * cdef int options + * + * 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 = 141; __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-2.2/src/lxml/schematron.pxi":142 + * + * 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 = 142; __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-2.2/src/lxml/schematron.pxi":144 + * root_node = _rootNodeOrRaise(etree) + * + * if _LIBXML_VERSION_INT >= 20632 and \ # <<<<<<<<<<<<<< + * schematron.XML_SCHEMATRON_OUT_ERROR != 0: + * options = schematron.XML_SCHEMATRON_OUT_ERROR + */ + if ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":145 + * + * if _LIBXML_VERSION_INT >= 20632 and \ + * schematron.XML_SCHEMATRON_OUT_ERROR != 0: # <<<<<<<<<<<<<< + * options = schematron.XML_SCHEMATRON_OUT_ERROR + * else: + */ + __pyx_t_2 = (XML_SCHEMATRON_OUT_ERROR != 0); + } else { + __pyx_t_2 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":146 + * 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-2.2/src/lxml/schematron.pxi":148 + * 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-2.2/src/lxml/schematron.pxi":150 + * 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-2.2/src/lxml/schematron.pxi":153 + * + * 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-2.2/src/lxml/schematron.pxi":154 + * valid_ctxt = schematron.xmlSchematronNewValidCtxt( + * self._c_schema, options) + * if valid_ctxt is NULL: # <<<<<<<<<<<<<< + * return python.PyErr_NoMemory() + * + */ + __pyx_t_2 = (__pyx_v_valid_ctxt == NULL); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":155 + * 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 = 155; __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-2.2/src/lxml/schematron.pxi":157 + * 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-2.2/src/lxml/schematron.pxi":158 + * + * self._error_log.connect() + * if _LIBXML_VERSION_INT >= 20632: # <<<<<<<<<<<<<< + * schematron.xmlSchematronSetValidStructuredErrors( + * valid_ctxt, _receiveError, self._error_log) + */ + __pyx_t_2 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":160 + * if _LIBXML_VERSION_INT >= 20632: + * schematron.xmlSchematronSetValidStructuredErrors( + * valid_ctxt, _receiveError, 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-2.2/src/lxml/schematron.pxi":161 + * schematron.xmlSchematronSetValidStructuredErrors( + * valid_ctxt, _receiveError, self._error_log) + * c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node) # <<<<<<<<<<<<<< + * with nogil: + * ret = schematron.xmlSchematronValidateDoc(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[23]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_doc = __pyx_t_3; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":162 + * valid_ctxt, _receiveError, 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) + */ + { PyThreadState *_save; + Py_UNBLOCK_THREADS + /*try:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":163 + * 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); + } + /*finally:*/ { + Py_BLOCK_THREADS + } + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":164 + * 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-2.2/src/lxml/schematron.pxi":165 + * 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-2.2/src/lxml/schematron.pxi":167 + * self._error_log.disconnect() + * + * schematron.xmlSchematronFreeValidCtxt(valid_ctxt) # <<<<<<<<<<<<<< + * + * if ret == -1: + */ + xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":169 + * schematron.xmlSchematronFreeValidCtxt(valid_ctxt) + * + * if ret == -1: # <<<<<<<<<<<<<< + * raise SchematronValidateError( + * u"Internal error in Schematron validation", + */ + __pyx_t_2 = (__pyx_v_ret == -1); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":170 + * + * if ret == -1: + * raise SchematronValidateError( # <<<<<<<<<<<<<< + * u"Internal error in Schematron validation", + * self._error_log) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_222); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":172 + * raise SchematronValidateError( + * u"Internal error in Schematron validation", + * self._error_log) # <<<<<<<<<<<<<< + * if ret == 0: + * return True + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_673)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_673)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_673)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self)->__pyx_base._error_log)); + PyTuple_SET_ITEM(__pyx_t_1, 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_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[23]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":173 + * u"Internal error in Schematron 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-2.2/src/lxml/schematron.pxi":174 + * self._error_log) + * if ret == 0: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 174; __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_L13; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":176 + * return True + * else: + * return False # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 176; __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_L13:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("deepcopyNodeToDocument"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("elementTreeFactory"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":12 + * return newElementTree(context_node, _ElementTree) + * + * cdef public api _ElementTree newElementTree(_Element context_node, # <<<<<<<<<<<<<< + * object subclass): + * if 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; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("newElementTree"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":14 + * cdef public api _ElementTree newElementTree(_Element context_node, + * object subclass): + * if context_node is NULL or context_node is None: # <<<<<<<<<<<<<< + * raise TypeError + * + */ + if (!(((void *)__pyx_v_context_node) == NULL)) { + __pyx_t_1 = (((PyObject *)__pyx_v_context_node) == Py_None); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (((void *)__pyx_v_context_node) == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":15 + * object subclass): + * if 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-2.2/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_3 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_context_node->_doc, __pyx_v_context_node, __pyx_v_subclass)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct LxmlElementTree *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = ((struct LxmlElementTree *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.newElementTree"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("elementFactory"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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) + */ + if (!(__pyx_v_c_node == NULL)) { + __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = (__pyx_v_c_node == NULL); + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.etree.elementFactory"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("makeElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 (!(__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("makeSubElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("setElementClassLookupFunction"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("lookupDefaultElementClass"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 (!(__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("lookupNamespaceElementClass"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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 (!(__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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("callLookupFallback"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("tagMatches"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("documentOrRaise"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("rootNodeOrRaise"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("hasText"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("hasTail"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("textOf"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("tailOf"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("setNodeText"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("setTailText"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("attributeValue"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("attributeValueFromNsName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("getAttributeValue"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("iterattributes"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":94 + * + * cdef public api object iterattributes(_Element element, int keysvalues): + * return _attributeIteratorFactory(element, keysvalues) # <<<<<<<<<<<<<< + * + * cdef public api object 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":96 + * return _attributeIteratorFactory(element, keysvalues) + * + * cdef public api object 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_SetupRefcountContext("collectAttributes"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":97 + * + * cdef public api object collectAttributes(xmlNode* c_element, int keysvalues): + * return _collectAttributes(c_element, keysvalues) # <<<<<<<<<<<<<< + * + * cdef public api int setAttributeValue(_Element element, key, value) except -1: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = __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.collectAttributes"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("setAttributeValue"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("delAttribute"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("delAttributeFromNsName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("hasChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("findChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("findChildForwards"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("findChildBackwards"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("nextElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("previousElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("appendChild"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_SetupRefcountContext("pyunicode"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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-2.2/src/lxml/public-api.pxi":133 + * if s is NULL: + * raise TypeError + * return funicode(s) # <<<<<<<<<<<<<< + * + * cdef public api object 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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":135 + * return funicode(s) + * + * cdef public api object utf8(object s): # <<<<<<<<<<<<<< + * return _utf8(s) + * + */ + + DL_EXPORT(PyObject) *utf8(PyObject *__pyx_v_s) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("utf8"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":136 + * + * cdef public api object utf8(object s): + * return _utf8(s) # <<<<<<<<<<<<<< + * + * cdef public api object getNsTag(object tag): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = __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.utf8"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":138 + * return _utf8(s) + * + * cdef public api object getNsTag(object tag): # <<<<<<<<<<<<<< + * return _getNsTag(tag) + * + */ + + DL_EXPORT(PyObject) *getNsTag(PyObject *__pyx_v_tag) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("getNsTag"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":139 + * + * cdef public api object getNsTag(object tag): + * return _getNsTag(tag) # <<<<<<<<<<<<<< + * + * cdef public api object namespacedName(xmlNode* c_node): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __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 = __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.getNsTag"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":141 + * return _getNsTag(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_SetupRefcountContext("namespacedName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":142 + * + * 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 = 142; __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":144 + * 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_SetupRefcountContext("namespacedNameFromNsName"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":145 + * + * 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 = 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.namespacedNameFromNsName"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":147 + * 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_SetupRefcountContext("iteratorStoreNext"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":148 + * + * 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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":150 + * 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_SetupRefcountContext("initTagMatch"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":151 + * + * 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 = 151; __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_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":153 + * 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_SetupRefcountContext("findOrBuildNodeNsPrefix"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":155 + * 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) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":156 + * _Document doc, xmlNode* c_node, char* href, char* prefix) except NULL: + * if doc is None: + * raise TypeError # <<<<<<<<<<<<<< + * return doc._findOrBuildNodeNs(c_node, href, prefix) + */ + __Pyx_Raise(__pyx_builtin_TypeError, 0, 0); + {__pyx_filename = __pyx_f[24]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/public-api.pxi":157 + * if doc is None: + * raise TypeError + * return doc._findOrBuildNodeNs(c_node, href, prefix) # <<<<<<<<<<<<<< + */ + __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); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 157; __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_FinishRefcountContext(); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 = 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(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 = 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +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); + p->_attrib = 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___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_XDECREF(p->_attrib); + (*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; + } + if (p->_attrib) { + e = (*v)(p->_attrib, 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); + tmp = ((PyObject*)p->_attrib); + p->_attrib = 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___setitem__(o, i, v); + } + else { + return __pyx_pf_4lxml_5etree_8_Element___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___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___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___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___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___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct 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___deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element___deepcopy__)}, + {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element___copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element___copy__)}, + {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_set)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_append)}, + {__Pyx_NAMESTR("addnext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_addnext, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_addnext)}, + {__Pyx_NAMESTR("addprevious"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_addprevious, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_addprevious)}, + {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_extend)}, + {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_clear, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_clear)}, + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_insert)}, + {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_remove, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_remove)}, + {__Pyx_NAMESTR("replace"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_replace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_replace)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element___repr__)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element___getitem__)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element___iter__)}, + {__Pyx_NAMESTR("__reversed__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element___reversed__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element___reversed__)}, + {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_index)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_get)}, + {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_keys)}, + {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_values)}, + {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_items)}, + {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_getchildren)}, + {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_getparent, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_getparent)}, + {__Pyx_NAMESTR("getnext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_getnext, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_getnext)}, + {__Pyx_NAMESTR("getprevious"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_getprevious, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_getprevious)}, + {__Pyx_NAMESTR("itersiblings"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_itersiblings, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_itersiblings)}, + {__Pyx_NAMESTR("iterancestors"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_iterancestors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_iterancestors)}, + {__Pyx_NAMESTR("iterdescendants"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_iterdescendants, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_iterdescendants)}, + {__Pyx_NAMESTR("iterchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_iterchildren, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_iterchildren)}, + {__Pyx_NAMESTR("getroottree"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_getroottree, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_getroottree)}, + {__Pyx_NAMESTR("getiterator"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_getiterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_getiterator)}, + {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_iter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_iter)}, + {__Pyx_NAMESTR("itertext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_itertext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_itertext)}, + {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_makeelement)}, + {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_find, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_find)}, + {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_findtext)}, + {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_findall, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_findall)}, + {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_iterfind, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_iterfind)}, + {__Pyx_NAMESTR("xpath"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Element_xpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_xpath)}, + {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_k_12, 0}, + {(char *)"attrib", __pyx_getprop_4lxml_5etree_8_Element_attrib, 0, __pyx_k_13, 0}, + {(char *)"text", __pyx_getprop_4lxml_5etree_8_Element_text, __pyx_setprop_4lxml_5etree_8_Element_text, __pyx_k_14, 0}, + {(char *)"tail", __pyx_getprop_4lxml_5etree_8_Element_tail, __pyx_setprop_4lxml_5etree_8_Element_tail, __pyx_k_15, 0}, + {(char *)"prefix", __pyx_getprop_4lxml_5etree_8_Element_prefix, 0, __pyx_k_16, 0}, + {(char *)"sourceline", __pyx_getprop_4lxml_5etree_8_Element_sourceline, __pyx_setprop_4lxml_5etree_8_Element_sourceline, __pyx_k_17, 0}, + {(char *)"nsmap", __pyx_getprop_4lxml_5etree_8_Element_nsmap, 0, __pyx_k_18, 0}, + {(char *)"base", __pyx_getprop_4lxml_5etree_8_Element_base, __pyx_setprop_4lxml_5etree_8_Element_base, __pyx_k_19, 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___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__Element = { + __pyx_pf_4lxml_5etree_8_Element___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___contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping__Element = { + __pyx_pf_4lxml_5etree_8_Element___len__, /*mp_length*/ + __pyx_pf_4lxml_5etree_8_Element___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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_8_Element___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__BaseParser[] = { + {__Pyx_NAMESTR("setElementClassLookup"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_setElementClassLookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_setElementClassLookup)}, + {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_set_element_class_lookup)}, + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_copy)}, + {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pf_4lxml_5etree_11_BaseParser_makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_makeelement)}, + {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_k_25, 0}, + {(char *)"resolvers", __pyx_getprop_4lxml_5etree_11_BaseParser_resolvers, 0, __pyx_k_26, 0}, + {(char *)"version", __pyx_getprop_4lxml_5etree_11_BaseParser_version, 0, __pyx_k_27, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +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 struct PyMethodDef __pyx_methods_4lxml_5etree_QName[] = { + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_5etree_5QName___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree_QName[] = { + {(char *)"text", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_QName, text), READONLY, 0}, + {(char *)"localname", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_QName, localname), READONLY, 0}, + {(char *)"namespace", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_QName, namespace), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___hash__, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_4lxml_5etree_5QName___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_5etree_QName, /*tp_methods*/ + __pyx_members_4lxml_5etree_QName, /*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_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*/ +}; +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->domain = Py_None; Py_INCREF(Py_None); + p->type = Py_None; Py_INCREF(Py_None); + p->level = Py_None; Py_INCREF(Py_None); + p->line = Py_None; Py_INCREF(Py_None); + p->column = Py_None; Py_INCREF(Py_None); + 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->domain); + Py_XDECREF(p->type); + Py_XDECREF(p->level); + Py_XDECREF(p->line); + Py_XDECREF(p->column); + 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->domain) { + e = (*v)(p->domain, a); if (e) return e; + } + if (p->type) { + e = (*v)(p->type, a); if (e) return e; + } + if (p->level) { + e = (*v)(p->level, a); if (e) return e; + } + if (p->line) { + e = (*v)(p->line, a); if (e) return e; + } + if (p->column) { + e = (*v)(p->column, a); if (e) return e; + } + 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->domain); + p->domain = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->type); + p->type = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->level); + p->level = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->line); + p->line = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->column); + p->column = Py_None; Py_INCREF(Py_None); + Py_XDECREF(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 struct PyMethodDef __pyx_methods_4lxml_5etree__LogEntry[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_9_LogEntry___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree__LogEntry[] = { + {(char *)"domain", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, domain), READONLY, 0}, + {(char *)"type", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, type), READONLY, 0}, + {(char *)"level", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, level), READONLY, 0}, + {(char *)"line", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, line), READONLY, 0}, + {(char *)"column", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, column), READONLY, 0}, + {(char *)"message", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, message), READONLY, 0}, + {(char *)"filename", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__LogEntry, filename), READONLY, 0}, + {0, 0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_5etree__LogEntry[] = { + {(char *)"domain_name", __pyx_getprop_4lxml_5etree_9_LogEntry_domain_name, 0, 0, 0}, + {(char *)"type_name", __pyx_getprop_4lxml_5etree_9_LogEntry_type_name, 0, 0, 0}, + {(char *)"level_name", __pyx_getprop_4lxml_5etree_9_LogEntry_level_name, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*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*/ + __pyx_members_4lxml_5etree__LogEntry, /*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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__BaseErrorLog[] = { + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_13_BaseErrorLog_copy, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_13_BaseErrorLog___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree__BaseErrorLog[] = { + {(char *)"last_error", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__BaseErrorLog, last_error), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_13_BaseErrorLog___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_members_4lxml_5etree__BaseErrorLog, /*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_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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__ListErrorLog[] = { + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_copy)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("filter_domains"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_domains, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_domains)}, + {__Pyx_NAMESTR("filter_types"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_types, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_types)}, + {__Pyx_NAMESTR("filter_levels"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_levels, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_levels)}, + {__Pyx_NAMESTR("filter_from_level"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_from_level, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_from_level)}, + {__Pyx_NAMESTR("filter_from_fatals"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_from_fatals, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_from_fatals)}, + {__Pyx_NAMESTR("filter_from_errors"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_from_errors, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_from_errors)}, + {__Pyx_NAMESTR("filter_from_warnings"), (PyCFunction)__pyx_pf_4lxml_5etree_13_ListErrorLog_filter_from_warnings, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_filter_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___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__ListErrorLog = { + __pyx_pf_4lxml_5etree_13_ListErrorLog___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___contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping__ListErrorLog = { + __pyx_pf_4lxml_5etree_13_ListErrorLog___len__, /*mp_length*/ + __pyx_pf_4lxml_5etree_13_ListErrorLog___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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_13_ListErrorLog___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__ErrorLog[] = { + {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog_clear, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog_copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_ErrorLog_copy)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_9_ErrorLog_receive, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__DomainErrorLog[] = { + {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_15_DomainErrorLog_receive, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__RotatingErrorLog[] = { + {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_17_RotatingErrorLog_receive, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 = 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(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 = 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 struct PyMethodDef __pyx_methods_4lxml_5etree_PyErrorLog[] = { + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_10PyErrorLog_copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_copy)}, + {__Pyx_NAMESTR("log"), (PyCFunction)__pyx_pf_4lxml_5etree_10PyErrorLog_log, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_log)}, + {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pf_4lxml_5etree_10PyErrorLog_receive, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_receive)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree_PyErrorLog[] = { + {(char *)"level_map", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_PyErrorLog, level_map), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("PyErrorLog(self, logger_name=None)\n A global error log that connects to the Python stdlib logging package.\n\n The constructor accepts an optional logger name.\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*/ + __pyx_members_4lxml_5etree_PyErrorLog, /*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_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*/ +}; + +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); + 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___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 struct 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_k_2, 0}, + {(char *)"public_id", __pyx_getprop_4lxml_5etree_7DocInfo_public_id, 0, __pyx_k_3, 0}, + {(char *)"system_url", __pyx_getprop_4lxml_5etree_7DocInfo_system_url, 0, __pyx_k_4, 0}, + {(char *)"xml_version", __pyx_getprop_4lxml_5etree_7DocInfo_xml_version, 0, __pyx_k_5, 0}, + {(char *)"encoding", __pyx_getprop_4lxml_5etree_7DocInfo_encoding, 0, __pyx_k_6, 0}, + {(char *)"standalone", __pyx_getprop_4lxml_5etree_7DocInfo_standalone, 0, __pyx_k_7, 0}, + {(char *)"URL", __pyx_getprop_4lxml_5etree_7DocInfo_URL, __pyx_setprop_4lxml_5etree_7DocInfo_URL, __pyx_k_8, 0}, + {(char *)"doctype", __pyx_getprop_4lxml_5etree_7DocInfo_doctype, 0, __pyx_k_9, 0}, + {(char *)"internalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_internalDTD, 0, __pyx_k_10, 0}, + {(char *)"externalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_externalDTD, 0, __pyx_k_11, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_7DocInfo___init__, /*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*/ +}; +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___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___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct 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_append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_append)}, + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_insert)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement___getitem__)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_get)}, + {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_keys)}, + {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_items)}, + {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_20__ContentOnlyElement_values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_values)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___ContentOnlyElement = { + __pyx_pf_4lxml_5etree_20__ContentOnlyElement___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___len__, /*mp_length*/ + __pyx_pf_4lxml_5etree_20__ContentOnlyElement___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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__Comment[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_8_Comment___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree__ProcessingInstruction[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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___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 struct PyMethodDef __pyx_methods_4lxml_5etree__Entity[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Entity___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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__setroot, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree__setroot)}, + {__Pyx_NAMESTR("getroot"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_getroot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_getroot)}, + {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree___copy__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree___deepcopy__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_write)}, + {__Pyx_NAMESTR("getpath"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_getpath, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_getpath)}, + {__Pyx_NAMESTR("getiterator"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_getiterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_getiterator)}, + {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_iter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_iter)}, + {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_find, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_find)}, + {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_findtext)}, + {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_findall, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_findall)}, + {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_iterfind, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_iterfind)}, + {__Pyx_NAMESTR("xpath"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_xpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_xpath)}, + {__Pyx_NAMESTR("xslt"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_xslt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_xslt)}, + {__Pyx_NAMESTR("relaxng"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_relaxng, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_relaxng)}, + {__Pyx_NAMESTR("xmlschema"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_xmlschema, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_xmlschema)}, + {__Pyx_NAMESTR("xinclude"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_xinclude, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_xinclude)}, + {__Pyx_NAMESTR("write_c14n"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ElementTree_write_c14n, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_write_c14n)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementTree[] = { + {(char *)"docinfo", __pyx_getprop_4lxml_5etree_12_ElementTree_docinfo, 0, __pyx_k_20, 0}, + {(char *)"parser", __pyx_getprop_4lxml_5etree_12_ElementTree_parser, 0, __pyx_k_21, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +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); + 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___setitem__(o, i, v); + } + else { + return __pyx_pf_4lxml_5etree_7_Attrib___delitem__(o, i); + } +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree__Attrib[] = { + {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_update, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("pop"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_pop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_clear, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_keys, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_iterkeys, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_values, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_itervalues, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_items, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_iteritems, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pf_4lxml_5etree_7_Attrib_has_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___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__Attrib = { + __pyx_pf_4lxml_5etree_7_Attrib___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___contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping__Attrib = { + __pyx_pf_4lxml_5etree_7_Attrib___len__, /*mp_length*/ + __pyx_pf_4lxml_5etree_7_Attrib___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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_7_Attrib___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_4lxml_5etree_7_Attrib___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*/ + __pyx_pf_4lxml_5etree_7_Attrib___init__, /*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*/ +}; + +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 struct PyMethodDef __pyx_methods_4lxml_5etree__AttribIterator[] = { + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_15_AttribIterator___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_15_AttribIterator___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__ElementIterator[] = { + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_16_ElementIterator___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_16_ElementIterator___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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; + return o; +} + +static struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_20ElementChildIterator___init__, /*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*/ +}; +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; + return o; +} + +static struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_16SiblingsIterator___init__, /*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*/ +}; +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; + return o; +} + +static struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_17AncestorsIterator___init__, /*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*/ +}; +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); + 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 struct PyMethodDef __pyx_methods_4lxml_5etree_ElementDepthFirstIterator[] = { + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___iter__, /*tp_iter*/ + __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___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*/ + __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___init__, /*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*/ +}; + +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); + 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 struct PyMethodDef __pyx_methods_4lxml_5etree_ElementTextIterator[] = { + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_19ElementTextIterator___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_19ElementTextIterator___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___iter__, /*tp_iter*/ + __pyx_pf_4lxml_5etree_19ElementTextIterator___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*/ + __pyx_pf_4lxml_5etree_19ElementTextIterator___init__, /*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*/ +}; + +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o); + p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy; + p->_source_proxy = Py_None; Py_INCREF(Py_None); + p->_dependent_proxies = ((PyObject *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_5etree__ReadOnlyElementProxy(PyObject *o) { + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o; + Py_XDECREF(p->_source_proxy); + Py_XDECREF(((PyObject *)p->_dependent_proxies)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4lxml_5etree__ReadOnlyElementProxy(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o; + if (p->_source_proxy) { + e = (*v)(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__ReadOnlyElementProxy(PyObject *o) { + struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o; + PyObject* tmp; + tmp = ((PyObject*)p->_source_proxy); + p->_source_proxy = 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__ReadOnlyElementProxy(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_21_ReadOnlyElementProxy_tag(PyObject *o, void *x) { + return __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_3tag___get__(o); +} + +static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_text(PyObject *o, void *x) { + return __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4text___get__(o); +} + +static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_tail(PyObject *o, void *x) { + return __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4tail___get__(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 PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_sourceline(PyObject *o, void *x) { + return __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_10sourceline___get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyElementProxy[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___getitem__)}, + {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___deepcopy__)}, + {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy___copy__)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iterchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_iterchildren, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_iterchildren)}, + {__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_keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_keys)}, + {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_values)}, + {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_items)}, + {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getchildren)}, + {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getparent, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getparent)}, + {__Pyx_NAMESTR("getnext"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getnext, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getnext)}, + {__Pyx_NAMESTR("getprevious"), (PyCFunction)__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_getprevious, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_getprevious)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy[] = { + {(char *)"tag", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_tag, 0, __pyx_k_12, 0}, + {(char *)"text", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_text, 0, __pyx_k_14, 0}, + {(char *)"tail", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_tail, 0, __pyx_k_15, 0}, + {(char *)"attrib", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib, 0, 0, 0}, + {(char *)"prefix", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix, 0, __pyx_k_16, 0}, + {(char *)"sourceline", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_sourceline, 0, __pyx_k_17, 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*/ + __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__ReadOnlyElementProxy = { + __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4lxml_5etree__ReadOnlyElementProxy, /*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 = { + __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___len__, /*mp_length*/ + __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___getitem__, /*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 +}; + +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__ReadOnlyElementProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___repr__, /*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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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__ReadOnlyElementProxy, /*tp_traverse*/ + __pyx_tp_clear_4lxml_5etree__ReadOnlyElementProxy, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy___iter__, /*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*/ +}; +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__ReadOnlyElementProxy(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy*)__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___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct 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_extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_extend)}, + {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_k_23, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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__ReadOnlyElementProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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__ReadOnlyElementProxy, /*tp_traverse*/ + __pyx_tp_clear_4lxml_5etree__ReadOnlyElementProxy, /*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*/ +}; + +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("All custom Comment classes must inherit from this one.\n\n Note that you cannot (and must not) instantiate this class or its\n subclasses.\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*/ + 0, /*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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("All custom Processing Instruction classes must inherit from this one.\n\n Note that you cannot (and must not) instantiate this class or its\n subclasses.\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*/ + 0, /*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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("All custom Entity classes must inherit from this one.\n\n Note that you cannot (and must not) instantiate this class or its\n subclasses.\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*/ + 0, /*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*/ +}; + +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_FallbackElementClassLookup[] = { + {__Pyx_NAMESTR("set_fallback"), (PyCFunction)__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_set_fallback, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26FallbackElementClassLookup_set_fallback)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree_FallbackElementClassLookup[] = { + {(char *)"fallback", T_OBJECT, offsetof(struct LxmlFallbackElementClassLookup, fallback), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_members_4lxml_5etree_FallbackElementClassLookup, /*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_26FallbackElementClassLookup___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*/ +}; + +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 struct PyMethodDef __pyx_methods_4lxml_5etree_ElementDefaultClassLookup[] = { + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree_ElementDefaultClassLookup[] = { + {(char *)"element_class", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup, element_class), READONLY, 0}, + {(char *)"comment_class", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup, comment_class), READONLY, 0}, + {(char *)"pi_class", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup, pi_class), READONLY, 0}, + {(char *)"entity_class", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup, entity_class), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_members_4lxml_5etree_ElementDefaultClassLookup, /*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_25ElementDefaultClassLookup___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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_CustomElementClassLookup[] = { + {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_24CustomElementClassLookup_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24CustomElementClassLookup_lookup)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_PythonElementClassLookup[] = { + {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_24PythonElementClassLookup_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24PythonElementClassLookup_lookup)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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); + 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___delitem__(o, i); + } +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree__NamespaceRegistry[] = { + {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_update, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_18_NamespaceRegistry_update)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_items, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_iteritems, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_4lxml_5etree_18_NamespaceRegistry_clear, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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___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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ + __pyx_pf_4lxml_5etree_18_NamespaceRegistry___init__, /*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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__ClassNamespaceRegistry[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 = Py_None; Py_INCREF(Py_None); + 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(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 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup[] = { + {__Pyx_NAMESTR("get_namespace"), (PyCFunction)__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_get_namespace, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_get_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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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___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___set__(o, v); + } + else { + return __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(o); + } +} + +static struct 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_k_24, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +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 struct 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_resolve_empty, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_resolve_empty)}, + {__Pyx_NAMESTR("resolve_string"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_resolve_string, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_resolve_string)}, + {__Pyx_NAMESTR("resolve_filename"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_resolve_filename, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_resolve_filename)}, + {__Pyx_NAMESTR("resolve_file"), (PyCFunction)__pyx_pf_4lxml_5etree_8Resolver_resolve_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_resolve_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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*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*/ +}; +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); + 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 struct PyMethodDef __pyx_methods_4lxml_5etree__ResolverRegistry[] = { + {__Pyx_NAMESTR("add"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_add, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_add)}, + {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_remove, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_remove)}, + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_copy)}, + {__Pyx_NAMESTR("resolve"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry_resolve, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_resolve)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_17_ResolverRegistry___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_17_ResolverRegistry___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_17_ResolverRegistry___init__, /*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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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); + 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___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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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); + 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___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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +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->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None); + 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 struct PyMethodDef __pyx_methods_4lxml_5etree__Validator[] = { + {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_validate, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_validate)}, + {__Pyx_NAMESTR("assertValid"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_assertValid, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_assertValid)}, + {__Pyx_NAMESTR("assert_"), (PyCFunction)__pyx_pf_4lxml_5etree_10_Validator_assert_, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_assert_)}, + {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_k_35, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_10_Validator___init__, /*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*/ +}; +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_vtab = __pyx_vtabptr_4lxml_5etree_XMLSchema; + 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___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __pyx_tp_dealloc_4lxml_5etree__Validator(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree_XMLSchema[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_9XMLSchema___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9XMLSchema___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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); + 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___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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___init__, /*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*/ +}; +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_18_FileReaderContext___init__, /*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*/ +}; +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 struct 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_close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_FeedParser_close)}, + {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_k_30, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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, 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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_TreeBuilder[] = { + {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_close)}, + {__Pyx_NAMESTR("data"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_data, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_data)}, + {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_start)}, + {__Pyx_NAMESTR("end"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_end, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_end)}, + {__Pyx_NAMESTR("pi"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_pi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_pi)}, + {__Pyx_NAMESTR("comment"), (PyCFunction)__pyx_pf_4lxml_5etree_11TreeBuilder_comment, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_comment)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___init__, /*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*/ +}; +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_15_FilelikeWriter___init__, /*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*/ +}; +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_17_IterparseContext___init__, /*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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_iterparse[] = { + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_9iterparse_copy, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_9iterparse___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_9iterparse___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree_iterparse[] = { + {(char *)"root", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_iterparse, root), READONLY, 0}, + {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_k_31, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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\nIncremental parser.\n\nParses XML into a tree and generates tuples (event, element) in a\nSAX-like fashion. ``event`` is any of 'start', 'end', 'start-ns',\n'end-ns'.\n\nFor 'start' and 'end', ``element`` is the Element that the parser just\nfound opening or closing. For 'start-ns', it is a tuple (prefix, URI) of\na new namespace declaration. For 'end-ns', it is simply None. Note that\nall start and end events are guaranteed to be properly nested.\n\nThe keyword argument ``events`` specifies a sequence of event type names\nthat should be generated. By default, only 'end' events will be\ngenerated.\n\nThe additional ``tag`` argument restricts the 'start' and 'end' events to\nthose elements that match the given tag. By default, events are generated\nfor all elements. Note that the 'start-ns' and 'end-ns' events are not\nimpacted by this restriction.\n\nThe other keyword arguments in the constructor are mainly based on the\nlibxml2 parser configuration. A DTD will also be loaded if validation or\nattribute default values are requested.\n\nAvailable 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\nOther 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___iter__, /*tp_iter*/ + __pyx_pf_4lxml_5etree_9iterparse___next__, /*tp_iternext*/ + __pyx_methods_4lxml_5etree_iterparse, /*tp_methods*/ + __pyx_members_4lxml_5etree_iterparse, /*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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_iterwalk[] = { + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_8iterwalk___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4lxml_5etree_8iterwalk___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___iter__, /*tp_iter*/ + __pyx_pf_4lxml_5etree_8iterwalk___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*/ +}; +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); + 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 struct PyMethodDef __pyx_methods_4lxml_5etree__IDDict[] = { + {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_copy, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_get, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_has_key, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_keys, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_iterkeys, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_items, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_iteritems, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_values, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4lxml_5etree_7_IDDict_itervalues, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__IDDict = { + __pyx_pf_4lxml_5etree_7_IDDict___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___contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping__IDDict = { + __pyx_pf_4lxml_5etree_7_IDDict___len__, /*mp_length*/ + __pyx_pf_4lxml_5etree_7_IDDict___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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_7_IDDict___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ + __pyx_pf_4lxml_5etree_7_IDDict___init__, /*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*/ +}; + +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 struct PyMethodDef __pyx_methods_4lxml_5etree_XInclude[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_8XInclude___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8XInclude___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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); + 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 struct PyMethodDef __pyx_methods_4lxml_5etree__ExsltRegExp[] = { + {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ExsltRegExp_test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("match"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ExsltRegExp_match, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("replace"), (PyCFunction)__pyx_pf_4lxml_5etree_12_ExsltRegExp_replace, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_12_ExsltRegExp___init__, /*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*/ +}; +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->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None); + 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->_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->_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->_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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; + +static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p; + PyObject *o = __pyx_ptype_4lxml_6python_unicode->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); + 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); + __pyx_ptype_4lxml_6python_unicode->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 (__pyx_ptype_4lxml_6python_unicode->tp_traverse) { + e = __pyx_ptype_4lxml_6python_unicode->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; + } + 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 (__pyx_ptype_4lxml_6python_unicode->tp_clear) { + __pyx_ptype_4lxml_6python_unicode->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); + return 0; +} + +static struct 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 PyMemberDef __pyx_members_4lxml_5etree__ElementUnicodeResult[] = { + {(char *)"is_tail", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult, is_tail), READONLY, 0}, + {(char *)"is_text", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult, is_text), READONLY, 0}, + {(char *)"is_attribute", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult, is_attribute), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_members_4lxml_5etree__ElementUnicodeResult, /*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__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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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); + 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___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 struct PyMethodDef __pyx_methods_4lxml_5etree__XPathEvaluatorBase[] = { + {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_19_XPathEvaluatorBase_evaluate)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_XPathElementEvaluator[] = { + {__Pyx_NAMESTR("register_namespace"), (PyCFunction)__pyx_pf_4lxml_5etree_21XPathElementEvaluator_register_namespace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_register_namespace)}, + {__Pyx_NAMESTR("register_namespaces"), (PyCFunction)__pyx_pf_4lxml_5etree_21XPathElementEvaluator_register_namespaces, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_register_namespaces)}, + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_21XPathElementEvaluator___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct PyMethodDef __pyx_methods_4lxml_5etree_XPathDocumentEvaluator[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22XPathDocumentEvaluator___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 = Py_None; Py_INCREF(Py_None); + 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___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(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 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree_XPath[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_5XPath___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_5XPath___call__)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_5XPath___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_5etree_XPath[] = { + {(char *)"path", T_OBJECT, offsetof(struct __pyx_obj_4lxml_5etree_XPath, path), READONLY, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_5XPath___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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_members_4lxml_5etree_XPath, /*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_5XPath___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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("ETXPath(self, path, extensions=None, regexp=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*/ +}; +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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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; + 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___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 struct PyMethodDef __pyx_methods_4lxml_5etree_XSLTAccessControl[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_5etree_17XSLTAccessControl___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLTAccessControl[] = { + {(char *)"options", __pyx_getprop_4lxml_5etree_17XSLTAccessControl_options, 0, __pyx_k_32, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_5etree_17XSLTAccessControl___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*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*/ + __pyx_pf_4lxml_5etree_17XSLTAccessControl___init__, /*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*/ +}; +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; + +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); + 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 struct 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ + __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___init__, /*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*/ +}; +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); + 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___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 struct PyMethodDef __pyx_methods_4lxml_5etree_XSLT[] = { + {__Pyx_NAMESTR("strparam"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_strparam, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_strparam)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_apply)}, + {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT_tostring, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_tostring)}, + {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT___deepcopy__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT___copy__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_4XSLT___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT___call__)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLT[] = { + {(char *)"error_log", __pyx_getprop_4lxml_5etree_4XSLT_error_log, 0, __pyx_k_33, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; +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); + 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___del__(o); + } +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree__XSLTResultTree[] = { + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_5etree_15_XSLTResultTree___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pf_4lxml_5etree_15_XSLTResultTree___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_k_34, 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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___getbuffer__, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + __pyx_pf_4lxml_5etree_15_XSLTResultTree___releasebuffer__, /*bf_releasebuffer*/ + #endif +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; +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 struct 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_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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*/ +}; + +static PyObject *__pyx_tp_new_4lxml_5etree_XSLTExtension(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_XSLTExtension(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static struct 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_apply_templates, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_apply_templates)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*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*/ +}; + +static PyObject *__pyx_tp_new_4lxml_5etree_DTD(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k); + if (!o) return 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___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __pyx_tp_dealloc_4lxml_5etree__Validator(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree_DTD[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_3DTD___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_3DTD___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; + +static PyObject *__pyx_tp_new_4lxml_5etree_RelaxNG(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k); + if (!o) return 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___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __pyx_tp_dealloc_4lxml_5etree__Validator(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree_RelaxNG[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_7RelaxNG___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_7RelaxNG___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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___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*/ +}; + +static PyObject *__pyx_tp_new_4lxml_5etree_Schematron(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k); + if (!o) return 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___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __pyx_tp_dealloc_4lxml_5etree__Validator(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_5etree_Schematron[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_5etree_10Schematron___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10Schematron___call__)}, + {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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 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 +}; + +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*/ + 0, /*tp_compare*/ + 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___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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|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 ... \n ... \n ... \n ... Attribute\n ... is forbidden\n ... \n ... \n ... \n ... \n ... '''))\n\n >>> xml = etree.XML('''\n ... \n ... \n ... \n ... \n ... ''')\n\n >>> schematron.validate(xml)\n 0\n\n >>> xml = etree.XML('''\n ... \n ... \n ... \n ... \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___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*/ +}; + +static struct PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("clear_error_log"), (PyCFunction)__pyx_pf_4lxml_5etree_clear_error_log, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_clear_error_log)}, + {__Pyx_NAMESTR("use_global_python_log"), (PyCFunction)__pyx_pf_4lxml_5etree_use_global_python_log, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_use_global_python_log)}, + {__Pyx_NAMESTR("Element"), (PyCFunction)__pyx_pf_4lxml_5etree_Element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_Element)}, + {__Pyx_NAMESTR("Comment"), (PyCFunction)__pyx_pf_4lxml_5etree_Comment, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_Comment)}, + {__Pyx_NAMESTR("ProcessingInstruction"), (PyCFunction)__pyx_pf_4lxml_5etree_ProcessingInstruction, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_ProcessingInstruction)}, + {__Pyx_NAMESTR("Entity"), (PyCFunction)__pyx_pf_4lxml_5etree_Entity, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_Entity)}, + {__Pyx_NAMESTR("SubElement"), (PyCFunction)__pyx_pf_4lxml_5etree_SubElement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_SubElement)}, + {__Pyx_NAMESTR("ElementTree"), (PyCFunction)__pyx_pf_4lxml_5etree_ElementTree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_ElementTree)}, + {__Pyx_NAMESTR("HTML"), (PyCFunction)__pyx_pf_4lxml_5etree_HTML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_HTML)}, + {__Pyx_NAMESTR("XML"), (PyCFunction)__pyx_pf_4lxml_5etree_XML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_XML)}, + {__Pyx_NAMESTR("fromstring"), (PyCFunction)__pyx_pf_4lxml_5etree_fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_fromstring)}, + {__Pyx_NAMESTR("fromstringlist"), (PyCFunction)__pyx_pf_4lxml_5etree_fromstringlist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_fromstringlist)}, + {__Pyx_NAMESTR("iselement"), (PyCFunction)__pyx_pf_4lxml_5etree_iselement, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_iselement)}, + {__Pyx_NAMESTR("dump"), (PyCFunction)__pyx_pf_4lxml_5etree_dump, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_dump)}, + {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pf_4lxml_5etree_tostring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_tostring)}, + {__Pyx_NAMESTR("tostringlist"), (PyCFunction)__pyx_pf_4lxml_5etree_tostringlist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_tostringlist)}, + {__Pyx_NAMESTR("tounicode"), (PyCFunction)__pyx_pf_4lxml_5etree_tounicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_tounicode)}, + {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4lxml_5etree_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_parse)}, + {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pf_4lxml_5etree_set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_set_element_class_lookup)}, + {__Pyx_NAMESTR("FunctionNamespace"), (PyCFunction)__pyx_pf_4lxml_5etree_FunctionNamespace, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_FunctionNamespace)}, + {__Pyx_NAMESTR("set_default_parser"), (PyCFunction)__pyx_pf_4lxml_5etree_set_default_parser, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_set_default_parser)}, + {__Pyx_NAMESTR("get_default_parser"), (PyCFunction)__pyx_pf_4lxml_5etree_get_default_parser, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_get_default_parser)}, + {__Pyx_NAMESTR("XMLID"), (PyCFunction)__pyx_pf_4lxml_5etree_XMLID, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_XMLID)}, + {__Pyx_NAMESTR("XMLDTDID"), (PyCFunction)__pyx_pf_4lxml_5etree_XMLDTDID, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_XMLDTDID)}, + {__Pyx_NAMESTR("parseid"), (PyCFunction)__pyx_pf_4lxml_5etree_parseid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_parseid)}, + {__Pyx_NAMESTR("cleanup_namespaces"), (PyCFunction)__pyx_pf_4lxml_5etree_cleanup_namespaces, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_cleanup_namespaces)}, + {__Pyx_NAMESTR("strip_attributes"), (PyCFunction)__pyx_pf_4lxml_5etree_strip_attributes, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_strip_attributes)}, + {__Pyx_NAMESTR("strip_elements"), (PyCFunction)__pyx_pf_4lxml_5etree_strip_elements, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_strip_elements)}, + {__Pyx_NAMESTR("strip_tags"), (PyCFunction)__pyx_pf_4lxml_5etree_strip_tags, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_strip_tags)}, + {__Pyx_NAMESTR("Extension"), (PyCFunction)__pyx_pf_4lxml_5etree_Extension, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_Extension)}, + {__Pyx_NAMESTR("XPathEvaluator"), (PyCFunction)__pyx_pf_4lxml_5etree_XPathEvaluator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_XPathEvaluator)}, + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("etree"), + __Pyx_DOCSTR(__pyx_mdoc), /* 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___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, + {&__pyx_kp___repr__, __pyx_k___repr__, sizeof(__pyx_k___repr__), 1, 1, 1}, + {&__pyx_kp_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 1, 1, 1}, + {&__pyx_kp___iter__, __pyx_k___iter__, sizeof(__pyx_k___iter__), 1, 1, 1}, + {&__pyx_kp___getitem__, __pyx_k___getitem__, sizeof(__pyx_k___getitem__), 1, 1, 1}, + {&__pyx_kp___len__, __pyx_k___len__, sizeof(__pyx_k___len__), 1, 1, 1}, + {&__pyx_kp___contains__, __pyx_k___contains__, sizeof(__pyx_k___contains__), 1, 1, 1}, + {&__pyx_kp___nonzero__, __pyx_k___nonzero__, sizeof(__pyx_k___nonzero__), 1, 1, 1}, + {&__pyx_kp_filter_domains, __pyx_k_filter_domains, sizeof(__pyx_k_filter_domains), 1, 1, 1}, + {&__pyx_kp_filter_types, __pyx_k_filter_types, sizeof(__pyx_k_filter_types), 1, 1, 1}, + {&__pyx_kp_filter_levels, __pyx_k_filter_levels, sizeof(__pyx_k_filter_levels), 1, 1, 1}, + {&__pyx_kp_filter_from_level, __pyx_k_filter_from_level, sizeof(__pyx_k_filter_from_level), 1, 1, 1}, + {&__pyx_kp_filter_from_fatals, __pyx_k_filter_from_fatals, sizeof(__pyx_k_filter_from_fatals), 1, 1, 1}, + {&__pyx_kp_filter_from_errors, __pyx_k_filter_from_errors, sizeof(__pyx_k_filter_from_errors), 1, 1, 1}, + {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 1, 1, 1}, + {&__pyx_kp_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 1, 1, 1}, + {&__pyx_kp_receive, __pyx_k_receive, sizeof(__pyx_k_receive), 1, 1, 1}, + {&__pyx_kp_log, __pyx_k_log, sizeof(__pyx_k_log), 1, 1, 1}, + {&__pyx_kp___dealloc__, __pyx_k___dealloc__, sizeof(__pyx_k___dealloc__), 1, 1, 1}, + {&__pyx_kp__init, __pyx_k__init, sizeof(__pyx_k__init), 1, 1, 1}, + {&__pyx_kp___setitem__, __pyx_k___setitem__, sizeof(__pyx_k___setitem__), 1, 1, 1}, + {&__pyx_kp___delitem__, __pyx_k___delitem__, sizeof(__pyx_k___delitem__), 1, 1, 1}, + {&__pyx_kp___deepcopy__, __pyx_k___deepcopy__, sizeof(__pyx_k___deepcopy__), 1, 1, 1}, + {&__pyx_kp___copy__, __pyx_k___copy__, sizeof(__pyx_k___copy__), 1, 1, 1}, + {&__pyx_kp_set, __pyx_k_set, sizeof(__pyx_k_set), 1, 1, 1}, + {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, + {&__pyx_kp_addnext, __pyx_k_addnext, sizeof(__pyx_k_addnext), 1, 1, 1}, + {&__pyx_kp_addprevious, __pyx_k_addprevious, sizeof(__pyx_k_addprevious), 1, 1, 1}, + {&__pyx_kp_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 1, 1, 1}, + {&__pyx_kp_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 1, 1, 1}, + {&__pyx_kp_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 1, 1, 1}, + {&__pyx_kp_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 1, 1, 1}, + {&__pyx_kp___reversed__, __pyx_k___reversed__, sizeof(__pyx_k___reversed__), 1, 1, 1}, + {&__pyx_kp_index, __pyx_k_index, sizeof(__pyx_k_index), 1, 1, 1}, + {&__pyx_kp_get, __pyx_k_get, sizeof(__pyx_k_get), 1, 1, 1}, + {&__pyx_kp_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 1, 1, 1}, + {&__pyx_kp_values, __pyx_k_values, sizeof(__pyx_k_values), 1, 1, 1}, + {&__pyx_kp_items, __pyx_k_items, sizeof(__pyx_k_items), 1, 1, 1}, + {&__pyx_kp_getchildren, __pyx_k_getchildren, sizeof(__pyx_k_getchildren), 1, 1, 1}, + {&__pyx_kp_getparent, __pyx_k_getparent, sizeof(__pyx_k_getparent), 1, 1, 1}, + {&__pyx_kp_getnext, __pyx_k_getnext, sizeof(__pyx_k_getnext), 1, 1, 1}, + {&__pyx_kp_getprevious, __pyx_k_getprevious, sizeof(__pyx_k_getprevious), 1, 1, 1}, + {&__pyx_kp_itersiblings, __pyx_k_itersiblings, sizeof(__pyx_k_itersiblings), 1, 1, 1}, + {&__pyx_kp_iterancestors, __pyx_k_iterancestors, sizeof(__pyx_k_iterancestors), 1, 1, 1}, + {&__pyx_kp_iterdescendants, __pyx_k_iterdescendants, sizeof(__pyx_k_iterdescendants), 1, 1, 1}, + {&__pyx_kp_iterchildren, __pyx_k_iterchildren, sizeof(__pyx_k_iterchildren), 1, 1, 1}, + {&__pyx_kp_getroottree, __pyx_k_getroottree, sizeof(__pyx_k_getroottree), 1, 1, 1}, + {&__pyx_kp_getiterator, __pyx_k_getiterator, sizeof(__pyx_k_getiterator), 1, 1, 1}, + {&__pyx_kp_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 1, 1, 1}, + {&__pyx_kp_itertext, __pyx_k_itertext, sizeof(__pyx_k_itertext), 1, 1, 1}, + {&__pyx_kp_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 1, 1, 1}, + {&__pyx_kp_find, __pyx_k_find, sizeof(__pyx_k_find), 1, 1, 1}, + {&__pyx_kp_findtext, __pyx_k_findtext, sizeof(__pyx_k_findtext), 1, 1, 1}, + {&__pyx_kp_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 1, 1, 1}, + {&__pyx_kp_iterfind, __pyx_k_iterfind, sizeof(__pyx_k_iterfind), 1, 1, 1}, + {&__pyx_kp_xpath, __pyx_k_xpath, sizeof(__pyx_k_xpath), 1, 1, 1}, + {&__pyx_kp___str__, __pyx_k___str__, sizeof(__pyx_k___str__), 1, 1, 1}, + {&__pyx_kp___hash__, __pyx_k___hash__, sizeof(__pyx_k___hash__), 1, 1, 1}, + {&__pyx_kp___richcmp__, __pyx_k___richcmp__, sizeof(__pyx_k___richcmp__), 1, 1, 1}, + {&__pyx_kp_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 1, 1, 1}, + {&__pyx_kp__setroot, __pyx_k__setroot, sizeof(__pyx_k__setroot), 1, 1, 1}, + {&__pyx_kp_getroot, __pyx_k_getroot, sizeof(__pyx_k_getroot), 1, 1, 1}, + {&__pyx_kp_write, __pyx_k_write, sizeof(__pyx_k_write), 1, 1, 1}, + {&__pyx_kp_getpath, __pyx_k_getpath, sizeof(__pyx_k_getpath), 1, 1, 1}, + {&__pyx_kp_xslt, __pyx_k_xslt, sizeof(__pyx_k_xslt), 1, 1, 1}, + {&__pyx_kp_relaxng, __pyx_k_relaxng, sizeof(__pyx_k_relaxng), 1, 1, 1}, + {&__pyx_kp_xmlschema, __pyx_k_xmlschema, sizeof(__pyx_k_xmlschema), 1, 1, 1}, + {&__pyx_kp_xinclude, __pyx_k_xinclude, sizeof(__pyx_k_xinclude), 1, 1, 1}, + {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 1, 1, 1}, + {&__pyx_kp_update, __pyx_k_update, sizeof(__pyx_k_update), 1, 1, 1}, + {&__pyx_kp_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 1, 1, 1}, + {&__pyx_kp_iterkeys, __pyx_k_iterkeys, sizeof(__pyx_k_iterkeys), 1, 1, 1}, + {&__pyx_kp_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 1, 1, 1}, + {&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1}, + {&__pyx_kp_has_key, __pyx_k_has_key, sizeof(__pyx_k_has_key), 1, 1, 1}, + {&__pyx_kp___next__, __pyx_k___next__, sizeof(__pyx_k___next__), 1, 1, 1}, + {&__pyx_kp___cinit__, __pyx_k___cinit__, sizeof(__pyx_k___cinit__), 1, 1, 1}, + {&__pyx_kp_set_fallback, __pyx_k_set_fallback, sizeof(__pyx_k_set_fallback), 1, 1, 1}, + {&__pyx_kp_lookup, __pyx_k_lookup, sizeof(__pyx_k_lookup), 1, 1, 1}, + {&__pyx_kp_get_namespace, __pyx_k_get_namespace, sizeof(__pyx_k_get_namespace), 1, 1, 1}, + {&__pyx_kp_resolve, __pyx_k_resolve, sizeof(__pyx_k_resolve), 1, 1, 1}, + {&__pyx_kp_resolve_empty, __pyx_k_resolve_empty, sizeof(__pyx_k_resolve_empty), 1, 1, 1}, + {&__pyx_kp_resolve_string, __pyx_k_resolve_string, sizeof(__pyx_k_resolve_string), 1, 1, 1}, + {&__pyx_kp_resolve_filename, __pyx_k_resolve_filename, sizeof(__pyx_k_resolve_filename), 1, 1, 1}, + {&__pyx_kp_resolve_file, __pyx_k_resolve_file, sizeof(__pyx_k_resolve_file), 1, 1, 1}, + {&__pyx_kp_add, __pyx_k_add, sizeof(__pyx_k_add), 1, 1, 1}, + {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 1, 1, 1}, + {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 1, 1, 1}, + {&__pyx_kp_feed, __pyx_k_feed, sizeof(__pyx_k_feed), 1, 1, 1}, + {&__pyx_kp_close, __pyx_k_close, sizeof(__pyx_k_close), 1, 1, 1}, + {&__pyx_kp_data, __pyx_k_data, sizeof(__pyx_k_data), 1, 1, 1}, + {&__pyx_kp_start, __pyx_k_start, sizeof(__pyx_k_start), 1, 1, 1}, + {&__pyx_kp_end, __pyx_k_end, sizeof(__pyx_k_end), 1, 1, 1}, + {&__pyx_kp_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 1, 1, 1}, + {&__pyx_kp_comment, __pyx_k_comment, sizeof(__pyx_k_comment), 1, 1, 1}, + {&__pyx_kp___call__, __pyx_k___call__, sizeof(__pyx_k___call__), 1, 1, 1}, + {&__pyx_kp_test, __pyx_k_test, sizeof(__pyx_k_test), 1, 1, 1}, + {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, + {&__pyx_kp_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 1, 1, 1}, + {&__pyx_kp_register_namespace, __pyx_k_register_namespace, sizeof(__pyx_k_register_namespace), 1, 1, 1}, + {&__pyx_kp_register_namespaces, __pyx_k_register_namespaces, sizeof(__pyx_k_register_namespaces), 1, 1, 1}, + {&__pyx_kp_DENY_ALL, __pyx_k_DENY_ALL, sizeof(__pyx_k_DENY_ALL), 1, 1, 1}, + {&__pyx_kp_DENY_WRITE, __pyx_k_DENY_WRITE, sizeof(__pyx_k_DENY_WRITE), 1, 1, 1}, + {&__pyx_kp_strparam, __pyx_k_strparam, sizeof(__pyx_k_strparam), 1, 1, 1}, + {&__pyx_kp_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 1, 1, 1}, + {&__pyx_kp_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 1, 1, 1}, + {&__pyx_kp___unicode__, __pyx_k___unicode__, sizeof(__pyx_k___unicode__), 1, 1, 1}, + {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, + {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, + {&__pyx_kp_parseXSL, __pyx_k_parseXSL, sizeof(__pyx_k_parseXSL), 1, 1, 1}, + {&__pyx_kp_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 1, 1, 1}, + {&__pyx_kp_apply_templates, __pyx_k_apply_templates, sizeof(__pyx_k_apply_templates), 1, 1, 1}, + {&__pyx_kp_validate, __pyx_k_validate, sizeof(__pyx_k_validate), 1, 1, 1}, + {&__pyx_kp_assertValid, __pyx_k_assertValid, sizeof(__pyx_k_assertValid), 1, 1, 1}, + {&__pyx_kp_assert_, __pyx_k_assert_, sizeof(__pyx_k_assert_), 1, 1, 1}, + {&__pyx_kp_self, __pyx_k_self, sizeof(__pyx_k_self), 1, 1, 1}, + {&__pyx_kp_message, __pyx_k_message, sizeof(__pyx_k_message), 1, 1, 1}, + {&__pyx_kp_error_log, __pyx_k_error_log, sizeof(__pyx_k_error_log), 1, 1, 1}, + {&__pyx_kp_first_error, __pyx_k_first_error, sizeof(__pyx_k_first_error), 1, 1, 1}, + {&__pyx_kp_last_error, __pyx_k_last_error, sizeof(__pyx_k_last_error), 1, 1, 1}, + {&__pyx_kp_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 1, 1, 1}, + {&__pyx_kp_error_type, __pyx_k_error_type, sizeof(__pyx_k_error_type), 1, 1, 1}, + {&__pyx_kp_domains, __pyx_k_domains, sizeof(__pyx_k_domains), 1, 1, 1}, + {&__pyx_kp_types, __pyx_k_types, sizeof(__pyx_k_types), 1, 1, 1}, + {&__pyx_kp_levels, __pyx_k_levels, sizeof(__pyx_k_levels), 1, 1, 1}, + {&__pyx_kp_level, __pyx_k_level, sizeof(__pyx_k_level), 1, 1, 1}, + {&__pyx_kp_entry, __pyx_k_entry, sizeof(__pyx_k_entry), 1, 1, 1}, + {&__pyx_kp_max_len, __pyx_k_max_len, sizeof(__pyx_k_max_len), 1, 1, 1}, + {&__pyx_kp_logger_name, __pyx_k_logger_name, sizeof(__pyx_k_logger_name), 1, 1, 1}, + {&__pyx_kp_log_entry, __pyx_k_log_entry, sizeof(__pyx_k_log_entry), 1, 1, 1}, + {&__pyx_kp_tree, __pyx_k_tree, sizeof(__pyx_k_tree), 1, 1, 1}, + {&__pyx_kp_url, __pyx_k_url, sizeof(__pyx_k_url), 1, 1, 1}, + {&__pyx_kp_x, __pyx_k_x, sizeof(__pyx_k_x), 1, 1, 1}, + {&__pyx_kp_value, __pyx_k_value, sizeof(__pyx_k_value), 1, 1, 1}, + {&__pyx_kp_memo, __pyx_k_memo, sizeof(__pyx_k_memo), 1, 1, 1}, + {&__pyx_kp_key, __pyx_k_key, sizeof(__pyx_k_key), 1, 1, 1}, + {&__pyx_kp_element, __pyx_k_element, sizeof(__pyx_k_element), 1, 1, 1}, + {&__pyx_kp_elements, __pyx_k_elements, sizeof(__pyx_k_elements), 1, 1, 1}, + {&__pyx_kp_old_element, __pyx_k_old_element, sizeof(__pyx_k_old_element), 1, 1, 1}, + {&__pyx_kp_new_element, __pyx_k_new_element, sizeof(__pyx_k_new_element), 1, 1, 1}, + {&__pyx_kp_line, __pyx_k_line, sizeof(__pyx_k_line), 1, 1, 1}, + {&__pyx_kp_child, __pyx_k_child, sizeof(__pyx_k_child), 1, 1, 1}, + {&__pyx_kp_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 1, 1, 1}, + {&__pyx_kp_default, __pyx_k_default, sizeof(__pyx_k_default), 1, 1, 1}, + {&__pyx_kp_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 1, 1, 1}, + {&__pyx_kp_preceding, __pyx_k_preceding, sizeof(__pyx_k_preceding), 1, 1, 1}, + {&__pyx_kp_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 1, 1, 1}, + {&__pyx_kp_with_tail, __pyx_k_with_tail, sizeof(__pyx_k_with_tail), 1, 1, 1}, + {&__pyx_kp__tag, __pyx_k__tag, sizeof(__pyx_k__tag), 1, 1, 1}, + {&__pyx_kp_attrib, __pyx_k_attrib, sizeof(__pyx_k_attrib), 1, 1, 1}, + {&__pyx_kp_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 1, 1, 1}, + {&__pyx_kp_path, __pyx_k_path, sizeof(__pyx_k_path), 1, 1, 1}, + {&__pyx_kp__path, __pyx_k__path, sizeof(__pyx_k__path), 1, 1, 1}, + {&__pyx_kp_namespaces, __pyx_k_namespaces, sizeof(__pyx_k_namespaces), 1, 1, 1}, + {&__pyx_kp_extensions, __pyx_k_extensions, sizeof(__pyx_k_extensions), 1, 1, 1}, + {&__pyx_kp_smart_strings, __pyx_k_smart_strings, sizeof(__pyx_k_smart_strings), 1, 1, 1}, + {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 1, 1, 1}, + {&__pyx_kp_one, __pyx_k_one, sizeof(__pyx_k_one), 1, 1, 1}, + {&__pyx_kp_other, __pyx_k_other, sizeof(__pyx_k_other), 1, 1, 1}, + {&__pyx_kp_op, __pyx_k_op, sizeof(__pyx_k_op), 1, 1, 1}, + {&__pyx_kp_source, __pyx_k_source, sizeof(__pyx_k_source), 1, 1, 1}, + {&__pyx_kp_parser, __pyx_k_parser, sizeof(__pyx_k_parser), 1, 1, 1}, + {&__pyx_kp_base_url, __pyx_k_base_url, sizeof(__pyx_k_base_url), 1, 1, 1}, + {&__pyx_kp_root, __pyx_k_root, sizeof(__pyx_k_root), 1, 1, 1}, + {&__pyx_kp_file, __pyx_k_file, sizeof(__pyx_k_file), 1, 1, 1}, + {&__pyx_kp_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 1, 1, 1}, + {&__pyx_kp_method, __pyx_k_method, sizeof(__pyx_k_method), 1, 1, 1}, + {&__pyx_kp_pretty_print, __pyx_k_pretty_print, sizeof(__pyx_k_pretty_print), 1, 1, 1}, + {&__pyx_kp_xml_declaration, __pyx_k_xml_declaration, sizeof(__pyx_k_xml_declaration), 1, 1, 1}, + {&__pyx_kp_standalone, __pyx_k_standalone, sizeof(__pyx_k_standalone), 1, 1, 1}, + {&__pyx_kp_compression, __pyx_k_compression, sizeof(__pyx_k_compression), 1, 1, 1}, + {&__pyx_kp__xslt, __pyx_k__xslt, sizeof(__pyx_k__xslt), 1, 1, 1}, + {&__pyx_kp_access_control, __pyx_k_access_control, sizeof(__pyx_k_access_control), 1, 1, 1}, + {&__pyx_kp_exclusive, __pyx_k_exclusive, sizeof(__pyx_k_exclusive), 1, 1, 1}, + {&__pyx_kp_with_comments, __pyx_k_with_comments, sizeof(__pyx_k_with_comments), 1, 1, 1}, + {&__pyx_kp_sequence_or_dict, __pyx_k_sequence_or_dict, sizeof(__pyx_k_sequence_or_dict), 1, 1, 1}, + {&__pyx_kp_node, __pyx_k_node, sizeof(__pyx_k_node), 1, 1, 1}, + {&__pyx_kp_inclusive, __pyx_k_inclusive, sizeof(__pyx_k_inclusive), 1, 1, 1}, + {&__pyx_kp_text, __pyx_k_text, sizeof(__pyx_k_text), 1, 1, 1}, + {&__pyx_kp_target, __pyx_k_target, sizeof(__pyx_k_target), 1, 1, 1}, + {&__pyx_kp_name, __pyx_k_name, sizeof(__pyx_k_name), 1, 1, 1}, + {&__pyx_kp__parent, __pyx_k__parent, sizeof(__pyx_k__parent), 1, 1, 1}, + {&__pyx_kp_strings, __pyx_k_strings, sizeof(__pyx_k_strings), 1, 1, 1}, + {&__pyx_kp_elem, __pyx_k_elem, sizeof(__pyx_k_elem), 1, 1, 1}, + {&__pyx_kp_element_or_tree, __pyx_k_element_or_tree, sizeof(__pyx_k_element_or_tree), 1, 1, 1}, + {&__pyx_kp_other_element, __pyx_k_other_element, sizeof(__pyx_k_other_element), 0, 1, 1}, + {&__pyx_kp_fallback, __pyx_k_fallback, sizeof(__pyx_k_fallback), 1, 1, 1}, + {&__pyx_kp_entity, __pyx_k_entity, sizeof(__pyx_k_entity), 1, 1, 1}, + {&__pyx_kp_attribute_name, __pyx_k_attribute_name, sizeof(__pyx_k_attribute_name), 1, 1, 1}, + {&__pyx_kp_class_mapping, __pyx_k_class_mapping, sizeof(__pyx_k_class_mapping), 1, 1, 1}, + {&__pyx_kp_type, __pyx_k_type, sizeof(__pyx_k_type), 1, 1, 1}, + {&__pyx_kp_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 1, 1, 1}, + {&__pyx_kp_namespace, __pyx_k_namespace, sizeof(__pyx_k_namespace), 1, 1, 1}, + {&__pyx_kp_ns_uri, __pyx_k_ns_uri, sizeof(__pyx_k_ns_uri), 1, 1, 1}, + {&__pyx_kp_class_dict_iterable, __pyx_k_class_dict_iterable, sizeof(__pyx_k_class_dict_iterable), 1, 1, 1}, + {&__pyx_kp_item, __pyx_k_item, sizeof(__pyx_k_item), 1, 1, 1}, + {&__pyx_kp_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 1, 1, 1}, + {&__pyx_kp_system_url, __pyx_k_system_url, sizeof(__pyx_k_system_url), 1, 1, 1}, + {&__pyx_kp_public_id, __pyx_k_public_id, sizeof(__pyx_k_public_id), 1, 1, 1}, + {&__pyx_kp_context, __pyx_k_context, sizeof(__pyx_k_context), 1, 1, 1}, + {&__pyx_kp_string, __pyx_k_string, sizeof(__pyx_k_string), 1, 1, 1}, + {&__pyx_kp_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 1, 1, 1}, + {&__pyx_kp_f, __pyx_k_f, sizeof(__pyx_k_f), 1, 1, 1}, + {&__pyx_kp_default_resolver, __pyx_k_default_resolver, sizeof(__pyx_k_default_resolver), 1, 1, 1}, + {&__pyx_kp_resolver, __pyx_k_resolver, sizeof(__pyx_k_resolver), 1, 1, 1}, + {&__pyx_kp_code, __pyx_k_code, sizeof(__pyx_k_code), 1, 1, 1}, + {&__pyx_kp_column, __pyx_k_column, sizeof(__pyx_k_column), 1, 1, 1}, + {&__pyx_kp_filelike, __pyx_k_filelike, sizeof(__pyx_k_filelike), 1, 1, 1}, + {&__pyx_kp_exc_context, __pyx_k_exc_context, sizeof(__pyx_k_exc_context), 1, 1, 1}, + {&__pyx_kp_parse_options, __pyx_k_parse_options, sizeof(__pyx_k_parse_options), 1, 1, 1}, + {&__pyx_kp_for_html, __pyx_k_for_html, sizeof(__pyx_k_for_html), 1, 1, 1}, + {&__pyx_kp_schema, __pyx_k_schema, sizeof(__pyx_k_schema), 1, 1, 1}, + {&__pyx_kp_remove_comments, __pyx_k_remove_comments, sizeof(__pyx_k_remove_comments), 1, 1, 1}, + {&__pyx_kp_remove_pis, __pyx_k_remove_pis, sizeof(__pyx_k_remove_pis), 1, 1, 1}, + {&__pyx_kp_strip_cdata, __pyx_k_strip_cdata, sizeof(__pyx_k_strip_cdata), 1, 1, 1}, + {&__pyx_kp_attribute_defaults, __pyx_k_attribute_defaults, sizeof(__pyx_k_attribute_defaults), 1, 1, 1}, + {&__pyx_kp_dtd_validation, __pyx_k_dtd_validation, sizeof(__pyx_k_dtd_validation), 1, 1, 1}, + {&__pyx_kp_load_dtd, __pyx_k_load_dtd, sizeof(__pyx_k_load_dtd), 1, 1, 1}, + {&__pyx_kp_no_network, __pyx_k_no_network, sizeof(__pyx_k_no_network), 1, 1, 1}, + {&__pyx_kp_ns_clean, __pyx_k_ns_clean, sizeof(__pyx_k_ns_clean), 1, 1, 1}, + {&__pyx_kp_recover, __pyx_k_recover, sizeof(__pyx_k_recover), 1, 1, 1}, + {&__pyx_kp_huge_tree, __pyx_k_huge_tree, sizeof(__pyx_k_huge_tree), 1, 1, 1}, + {&__pyx_kp_remove_blank_text, __pyx_k_remove_blank_text, sizeof(__pyx_k_remove_blank_text), 1, 1, 1}, + {&__pyx_kp_resolve_entities, __pyx_k_resolve_entities, sizeof(__pyx_k_resolve_entities), 1, 1, 1}, + {&__pyx_kp_compact, __pyx_k_compact, sizeof(__pyx_k_compact), 1, 1, 1}, + {&__pyx_kp_element_factory, __pyx_k_element_factory, sizeof(__pyx_k_element_factory), 1, 1, 1}, + {&__pyx_kp_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 1, 1, 1}, + {&__pyx_kp_result, __pyx_k_result, sizeof(__pyx_k_result), 1, 1, 1}, + {&__pyx_kp_events, __pyx_k_events, sizeof(__pyx_k_events), 1, 1, 1}, + {&__pyx_kp_html, __pyx_k_html, sizeof(__pyx_k_html), 1, 1, 1}, + {&__pyx_kp_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 1, 1, 1}, + {&__pyx_kp_id_name, __pyx_k_id_name, sizeof(__pyx_k_id_name), 1, 1, 1}, + {&__pyx_kp_tree_or_element, __pyx_k_tree_or_element, sizeof(__pyx_k_tree_or_element), 1, 1, 1}, + {&__pyx_kp_enable_regexp, __pyx_k_enable_regexp, sizeof(__pyx_k_enable_regexp), 1, 1, 1}, + {&__pyx_kp_build_smart_strings, __pyx_k_build_smart_strings, sizeof(__pyx_k_build_smart_strings), 1, 1, 1}, + {&__pyx_kp_module, __pyx_k_module, sizeof(__pyx_k_module), 1, 1, 1}, + {&__pyx_kp_function_mapping, __pyx_k_function_mapping, sizeof(__pyx_k_function_mapping), 1, 1, 1}, + {&__pyx_kp_ns, __pyx_k_ns, sizeof(__pyx_k_ns), 1, 1, 1}, + {&__pyx_kp_ctxt, __pyx_k_ctxt, sizeof(__pyx_k_ctxt), 1, 1, 1}, + {&__pyx_kp_s, __pyx_k_s, sizeof(__pyx_k_s), 1, 1, 1}, + {&__pyx_kp_rexp, __pyx_k_rexp, sizeof(__pyx_k_rexp), 1, 1, 1}, + {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, + {&__pyx_kp_replacement, __pyx_k_replacement, sizeof(__pyx_k_replacement), 1, 1, 1}, + {&__pyx_kp_variables, __pyx_k_variables, sizeof(__pyx_k_variables), 1, 1, 1}, + {&__pyx_kp__eval_arg, __pyx_k__eval_arg, sizeof(__pyx_k__eval_arg), 1, 1, 1}, + {&__pyx_kp_regexp, __pyx_k_regexp, sizeof(__pyx_k_regexp), 1, 1, 1}, + {&__pyx_kp_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 1, 1, 1}, + {&__pyx_kp_etree_or_element, __pyx_k_etree_or_element, sizeof(__pyx_k_etree_or_element), 1, 1, 1}, + {&__pyx_kp__etree_or_element, __pyx_k__etree_or_element, sizeof(__pyx_k__etree_or_element), 1, 1, 1}, + {&__pyx_kp_read_file, __pyx_k_read_file, sizeof(__pyx_k_read_file), 1, 1, 1}, + {&__pyx_kp_write_file, __pyx_k_write_file, sizeof(__pyx_k_write_file), 1, 1, 1}, + {&__pyx_kp_create_dir, __pyx_k_create_dir, sizeof(__pyx_k_create_dir), 1, 1, 1}, + {&__pyx_kp_read_network, __pyx_k_read_network, sizeof(__pyx_k_read_network), 1, 1, 1}, + {&__pyx_kp_write_network, __pyx_k_write_network, sizeof(__pyx_k_write_network), 1, 1, 1}, + {&__pyx_kp_strval, __pyx_k_strval, sizeof(__pyx_k_strval), 1, 1, 1}, + {&__pyx_kp_xslt_input, __pyx_k_xslt_input, sizeof(__pyx_k_xslt_input), 1, 1, 1}, + {&__pyx_kp__input, __pyx_k__input, sizeof(__pyx_k__input), 1, 1, 1}, + {&__pyx_kp_profile_run, __pyx_k_profile_run, sizeof(__pyx_k_profile_run), 1, 1, 1}, + {&__pyx_kp_result_tree, __pyx_k_result_tree, sizeof(__pyx_k_result_tree), 1, 1, 1}, + {&__pyx_kp_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 1, 1, 1}, + {&__pyx_kp_self_node, __pyx_k_self_node, sizeof(__pyx_k_self_node), 1, 1, 1}, + {&__pyx_kp_input_node, __pyx_k_input_node, sizeof(__pyx_k_input_node), 1, 1, 1}, + {&__pyx_kp_output_parent, __pyx_k_output_parent, sizeof(__pyx_k_output_parent), 1, 1, 1}, + {&__pyx_kp_external_id, __pyx_k_external_id, sizeof(__pyx_k_external_id), 1, 1, 1}, + {&__pyx_kp___docformat__, __pyx_k___docformat__, sizeof(__pyx_k___docformat__), 1, 1, 1}, + {&__pyx_kp___builtin__, __pyx_k___builtin__, sizeof(__pyx_k___builtin__), 1, 1, 1}, + {&__pyx_kp_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 1, 1, 1}, + {&__pyx_kp_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 1, 1, 1}, + {&__pyx_kp_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 1, 1, 1}, + {&__pyx_kp_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 1, 1, 1}, + {&__pyx_kp_str, __pyx_k_str, sizeof(__pyx_k_str), 1, 1, 1}, + {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 1, 1, 1}, + {&__pyx_kp_abspath, __pyx_k_abspath, sizeof(__pyx_k_abspath), 1, 1, 1}, + {&__pyx_kp_io, __pyx_k_io, sizeof(__pyx_k_io), 1, 1, 1}, + {&__pyx_kp_BytesIO, __pyx_k_BytesIO, sizeof(__pyx_k_BytesIO), 1, 1, 1}, + {&__pyx_kp_StringIO, __pyx_k_StringIO, sizeof(__pyx_k_StringIO), 1, 1, 1}, + {&__pyx_kp__elementpath, __pyx_k__elementpath, sizeof(__pyx_k__elementpath), 1, 1, 1}, + {&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1}, + {&__pyx_kp_re, __pyx_k_re, sizeof(__pyx_k_re), 1, 1, 1}, + {&__pyx_kp_gzip, __pyx_k_gzip, sizeof(__pyx_k_gzip), 1, 1, 1}, + {&__pyx_kp_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 1, 1, 1}, + {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 1, 1, 1}, + {&__pyx_kp_getdefaultencoding, __pyx_k_getdefaultencoding, sizeof(__pyx_k_getdefaultencoding), 1, 1, 1}, + {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0}, + {&__pyx_kp_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 1, 1, 1}, + {&__pyx_kp_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 1, 0}, + {&__pyx_kp_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 1, 0}, + {&__pyx_kp_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 1, 0}, + {&__pyx_kp_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 1, 0}, + {&__pyx_kp_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 1, 0}, + {&__pyx_kp_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 1, 0}, + {&__pyx_kp_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 1, 0}, + {&__pyx_kp_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 1, 0}, + {&__pyx_kp_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 1, 1}, + {&__pyx_kp_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 1, 1, 1}, + {&__pyx_kp_LxmlError, __pyx_k_LxmlError, sizeof(__pyx_k_LxmlError), 0, 1, 1}, + {&__pyx_kp_LxmlSyntaxError, __pyx_k_LxmlSyntaxError, sizeof(__pyx_k_LxmlSyntaxError), 0, 1, 1}, + {&__pyx_kp_SyntaxError, __pyx_k_SyntaxError, sizeof(__pyx_k_SyntaxError), 1, 1, 1}, + {&__pyx_kp_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 1, 1}, + {&__pyx_kp_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 1, 1, 1}, + {&__pyx_kp_63, __pyx_k_63, sizeof(__pyx_k_63), 1, 1, 0}, + {&__pyx_kp_group, __pyx_k_group, sizeof(__pyx_k_group), 1, 1, 1}, + {&__pyx_kp_65, __pyx_k_65, sizeof(__pyx_k_65), 1, 1, 0}, + {&__pyx_kp_LIBXML_VERSION, __pyx_k_LIBXML_VERSION, sizeof(__pyx_k_LIBXML_VERSION), 1, 1, 1}, + {&__pyx_kp_66, __pyx_k_66, sizeof(__pyx_k_66), 1, 1, 1}, + {&__pyx_kp_LXML_VERSION, __pyx_k_LXML_VERSION, sizeof(__pyx_k_LXML_VERSION), 1, 1, 1}, + {&__pyx_kp_67, __pyx_k_67, sizeof(__pyx_k_67), 1, 1, 0}, + {&__pyx_kp___version__, __pyx_k___version__, sizeof(__pyx_k___version__), 1, 1, 1}, + {&__pyx_kp_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 1, 1, 1}, + {&__pyx_kp_U, __pyx_k_U, sizeof(__pyx_k_U), 1, 1, 1}, + {&__pyx_kp_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 1, 1, 1}, + {&__pyx_kp_ErrorLevels, __pyx_k_ErrorLevels, sizeof(__pyx_k_ErrorLevels), 0, 1, 1}, + {&__pyx_kp_ErrorDomains, __pyx_k_ErrorDomains, sizeof(__pyx_k_ErrorDomains), 0, 1, 1}, + {&__pyx_kp_ErrorTypes, __pyx_k_ErrorTypes, sizeof(__pyx_k_ErrorTypes), 0, 1, 1}, + {&__pyx_kp_RelaxNGErrorTypes, __pyx_k_RelaxNGErrorTypes, sizeof(__pyx_k_RelaxNGErrorTypes), 0, 1, 1}, + {&__pyx_kp_91, __pyx_k_91, sizeof(__pyx_k_91), 1, 1, 0}, + {&__pyx_kp_101, __pyx_k_101, sizeof(__pyx_k_101), 1, 1, 1}, + {&__pyx_kp_PI, __pyx_k_PI, sizeof(__pyx_k_PI), 1, 1, 1}, + {&__pyx_kp_104, __pyx_k_104, sizeof(__pyx_k_104), 1, 1, 0}, + {&__pyx_kp_107, __pyx_k_107, sizeof(__pyx_k_107), 1, 1, 0}, + {&__pyx_kp_LxmlRegistryError, __pyx_k_LxmlRegistryError, sizeof(__pyx_k_LxmlRegistryError), 0, 1, 1}, + {&__pyx_kp_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 1, 1}, + {&__pyx_kp_ParseError, __pyx_k_ParseError, sizeof(__pyx_k_ParseError), 0, 1, 1}, + {&__pyx_kp_XMLSyntaxError, __pyx_k_XMLSyntaxError, sizeof(__pyx_k_XMLSyntaxError), 0, 1, 1}, + {&__pyx_kp_ParserError, __pyx_k_ParserError, sizeof(__pyx_k_ParserError), 0, 1, 1}, + {&__pyx_kp_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 1, 1, 1}, + {&__pyx_kp_getargspec, __pyx_k_getargspec, sizeof(__pyx_k_getargspec), 1, 1, 1}, + {&__pyx_kp__TargetParserResult, __pyx_k__TargetParserResult, sizeof(__pyx_k__TargetParserResult), 0, 1, 1}, + {&__pyx_kp_SerialisationError, __pyx_k_SerialisationError, sizeof(__pyx_k_SerialisationError), 0, 1, 1}, + {&__pyx_kp_151, __pyx_k_151, sizeof(__pyx_k_151), 1, 1, 0}, + {&__pyx_kp_165, __pyx_k_165, sizeof(__pyx_k_165), 1, 1, 0}, + {&__pyx_kp_XIncludeError, __pyx_k_XIncludeError, sizeof(__pyx_k_XIncludeError), 0, 1, 1}, + {&__pyx_kp_XPathError, __pyx_k_XPathError, sizeof(__pyx_k_XPathError), 0, 1, 1}, + {&__pyx_kp_XPathEvalError, __pyx_k_XPathEvalError, sizeof(__pyx_k_XPathEvalError), 0, 1, 1}, + {&__pyx_kp_XPathFunctionError, __pyx_k_XPathFunctionError, sizeof(__pyx_k_XPathFunctionError), 0, 1, 1}, + {&__pyx_kp_XPathResultError, __pyx_k_XPathResultError, sizeof(__pyx_k_XPathResultError), 0, 1, 1}, + {&__pyx_kp_174, __pyx_k_174, sizeof(__pyx_k_174), 0, 1, 1}, + {&__pyx_kp_XPathSyntaxError, __pyx_k_XPathSyntaxError, sizeof(__pyx_k_XPathSyntaxError), 0, 1, 1}, + {&__pyx_kp_XSLTError, __pyx_k_XSLTError, sizeof(__pyx_k_XSLTError), 0, 1, 1}, + {&__pyx_kp_XSLTParseError, __pyx_k_XSLTParseError, sizeof(__pyx_k_XSLTParseError), 0, 1, 1}, + {&__pyx_kp_XSLTApplyError, __pyx_k_XSLTApplyError, sizeof(__pyx_k_XSLTApplyError), 0, 1, 1}, + {&__pyx_kp_XSLTSaveError, __pyx_k_XSLTSaveError, sizeof(__pyx_k_XSLTSaveError), 0, 1, 1}, + {&__pyx_kp_XSLTExtensionError, __pyx_k_XSLTExtensionError, sizeof(__pyx_k_XSLTExtensionError), 0, 1, 1}, + {&__pyx_kp_192, __pyx_k_192, sizeof(__pyx_k_192), 1, 1, 1}, + {&__pyx_kp_LIBXSLT_VERSION, __pyx_k_LIBXSLT_VERSION, sizeof(__pyx_k_LIBXSLT_VERSION), 1, 1, 1}, + {&__pyx_kp_DocumentInvalid, __pyx_k_DocumentInvalid, sizeof(__pyx_k_DocumentInvalid), 0, 1, 1}, + {&__pyx_kp_DTDError, __pyx_k_DTDError, sizeof(__pyx_k_DTDError), 0, 1, 1}, + {&__pyx_kp_DTDParseError, __pyx_k_DTDParseError, sizeof(__pyx_k_DTDParseError), 0, 1, 1}, + {&__pyx_kp_DTDValidateError, __pyx_k_DTDValidateError, sizeof(__pyx_k_DTDValidateError), 0, 1, 1}, + {&__pyx_kp_RelaxNGError, __pyx_k_RelaxNGError, sizeof(__pyx_k_RelaxNGError), 0, 1, 1}, + {&__pyx_kp_RelaxNGParseError, __pyx_k_RelaxNGParseError, sizeof(__pyx_k_RelaxNGParseError), 0, 1, 1}, + {&__pyx_kp_209, __pyx_k_209, sizeof(__pyx_k_209), 0, 1, 1}, + {&__pyx_kp_XMLSchemaError, __pyx_k_XMLSchemaError, sizeof(__pyx_k_XMLSchemaError), 0, 1, 1}, + {&__pyx_kp_XMLSchemaParseError, __pyx_k_XMLSchemaParseError, sizeof(__pyx_k_XMLSchemaParseError), 0, 1, 1}, + {&__pyx_kp_213, __pyx_k_213, sizeof(__pyx_k_213), 0, 1, 1}, + {&__pyx_kp_216, __pyx_k_216, sizeof(__pyx_k_216), 1, 1, 0}, + {&__pyx_kp_SchematronError, __pyx_k_SchematronError, sizeof(__pyx_k_SchematronError), 0, 1, 1}, + {&__pyx_kp_220, __pyx_k_220, sizeof(__pyx_k_220), 0, 1, 1}, + {&__pyx_kp_222, __pyx_k_222, sizeof(__pyx_k_222), 0, 1, 1}, + {&__pyx_kp_super, __pyx_k_super, sizeof(__pyx_k_super), 1, 1, 1}, + {&__pyx_kp_224, __pyx_k_224, sizeof(__pyx_k_224), 1, 1, 0}, + {&__pyx_kp_split, __pyx_k_split, sizeof(__pyx_k_split), 1, 1, 1}, + {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, + {&__pyx_kp_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 1, 1, 1}, + {&__pyx_kp_228, __pyx_k_228, sizeof(__pyx_k_228), 1, 1, 0}, + {&__pyx_kp_229, __pyx_k_229, sizeof(__pyx_k_229), 1, 1, 0}, + {&__pyx_kp_230, __pyx_k_230, sizeof(__pyx_k_230), 1, 1, 0}, + {&__pyx_kp_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 1, 1, 1}, + {&__pyx_kp_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 1, 1, 1}, + {&__pyx_kp_238, __pyx_k_238, sizeof(__pyx_k_238), 1, 1, 0}, + {&__pyx_kp_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 1, 1, 1}, + {&__pyx_kp_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 1, 1, 1}, + {&__pyx_kp_UnicodeEncodeError, __pyx_k_UnicodeEncodeError, sizeof(__pyx_k_UnicodeEncodeError), 1, 1, 1}, + {&__pyx_kp_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 1, 1, 1}, + {&__pyx_kp_275, __pyx_k_275, sizeof(__pyx_k_275), 1, 1, 0}, + {&__pyx_kp_276, __pyx_k_276, sizeof(__pyx_k_276), 1, 1, 0}, + {&__pyx_kp_277, __pyx_k_277, sizeof(__pyx_k_277), 1, 1, 0}, + {&__pyx_kp_python, __pyx_k_python, sizeof(__pyx_k_python), 1, 1, 1}, + {&__pyx_kp_278, __pyx_k_278, sizeof(__pyx_k_278), 1, 1, 1}, + {&__pyx_kp_279, __pyx_k_279, sizeof(__pyx_k_279), 0, 1, 0}, + {&__pyx_kp_level_name, __pyx_k_level_name, sizeof(__pyx_k_level_name), 1, 1, 1}, + {&__pyx_kp_domain_name, __pyx_k_domain_name, sizeof(__pyx_k_domain_name), 1, 1, 1}, + {&__pyx_kp_type_name, __pyx_k_type_name, sizeof(__pyx_k_type_name), 1, 1, 1}, + {&__pyx_kp__getName, __pyx_k__getName, sizeof(__pyx_k__getName), 1, 1, 1}, + {&__pyx_kp_283, __pyx_k_283, sizeof(__pyx_k_283), 1, 1, 0}, + {&__pyx_kp_RELAXNGV, __pyx_k_RELAXNGV, sizeof(__pyx_k_RELAXNGV), 1, 1, 1}, + {&__pyx_kp_284, __pyx_k_284, sizeof(__pyx_k_284), 1, 1, 0}, + {&__pyx_kp_285, __pyx_k_285, sizeof(__pyx_k_285), 1, 1, 0}, + {&__pyx_kp_join, __pyx_k_join, sizeof(__pyx_k_join), 1, 1, 1}, + {&__pyx_kp_FATAL, __pyx_k_FATAL, sizeof(__pyx_k_FATAL), 1, 1, 1}, + {&__pyx_kp_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 1, 1, 1}, + {&__pyx_kp_WARNING, __pyx_k_WARNING, sizeof(__pyx_k_WARNING), 1, 1, 1}, + {&__pyx_kp__accepted_domains, __pyx_k__accepted_domains, sizeof(__pyx_k__accepted_domains), 1, 1, 1}, + {&__pyx_kp_domain, __pyx_k_domain, sizeof(__pyx_k_domain), 1, 1, 1}, + {&__pyx_kp_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 1, 1, 1}, + {&__pyx_kp_CRITICAL, __pyx_k_CRITICAL, sizeof(__pyx_k_CRITICAL), 1, 1, 1}, + {&__pyx_kp_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 1, 1, 1}, + {&__pyx_kp_292, __pyx_k_292, sizeof(__pyx_k_292), 1, 1, 0}, + {&__pyx_kp_293, __pyx_k_293, sizeof(__pyx_k_293), 1, 1, 0}, + {&__pyx_kp_294, __pyx_k_294, sizeof(__pyx_k_294), 1, 1, 0}, + {&__pyx_kp__names, __pyx_k__names, sizeof(__pyx_k__names), 1, 1, 1}, + {&__pyx_kp_304, __pyx_k_304, sizeof(__pyx_k_304), 0, 1, 0}, + {&__pyx_kp_305, __pyx_k_305, sizeof(__pyx_k_305), 0, 1, 0}, + {&__pyx_kp_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 1, 1, 1}, + {&__pyx_kp_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 1, 1, 1}, + {&__pyx_kp_id, __pyx_k_id, sizeof(__pyx_k_id), 1, 1, 1}, + {&__pyx_kp_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 1, 1, 1}, + {&__pyx_kp_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 1, 1, 1}, + {&__pyx_kp_FutureWarning, __pyx_k_FutureWarning, sizeof(__pyx_k_FutureWarning), 1, 1, 1}, + {&__pyx_kp_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 1, 1, 1}, + {&__pyx_kp_Entity, __pyx_k_Entity, sizeof(__pyx_k_Entity), 1, 1, 1}, + {&__pyx_kp_349, __pyx_k_349, sizeof(__pyx_k_349), 1, 1, 0}, + {&__pyx_kp_350, __pyx_k_350, sizeof(__pyx_k_350), 1, 1, 0}, + {&__pyx_kp_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 1, 1, 1}, + {&__pyx_kp_352, __pyx_k_352, sizeof(__pyx_k_352), 1, 1, 0}, + {&__pyx_kp_353, __pyx_k_353, sizeof(__pyx_k_353), 1, 1, 0}, + {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, + {&__pyx_kp_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 1, 1, 1}, + {&__pyx_kp_373, __pyx_k_373, sizeof(__pyx_k_373), 1, 1, 0}, + {&__pyx_kp_374, __pyx_k_374, sizeof(__pyx_k_374), 1, 1, 0}, + {&__pyx_kp_375, __pyx_k_375, sizeof(__pyx_k_375), 1, 1, 0}, + {&__pyx_kp_376, __pyx_k_376, sizeof(__pyx_k_376), 1, 1, 0}, + {&__pyx_kp_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 1, 1, 1}, + {&__pyx_kp_382, __pyx_k_382, sizeof(__pyx_k_382), 1, 1, 0}, + {&__pyx_kp_384, __pyx_k_384, sizeof(__pyx_k_384), 1, 1, 0}, + {&__pyx_kp_386, __pyx_k_386, sizeof(__pyx_k_386), 1, 1, 0}, + {&__pyx_kp__doc, __pyx_k__doc, sizeof(__pyx_k__doc), 1, 1, 1}, + {&__pyx_kp_NAMESPACE, __pyx_k_NAMESPACE, sizeof(__pyx_k_NAMESPACE), 1, 1, 1}, + {&__pyx_kp_TAG, __pyx_k_TAG, sizeof(__pyx_k_TAG), 1, 1, 1}, + {&__pyx_kp___class__, __pyx_k___class__, sizeof(__pyx_k___class__), 1, 1, 1}, + {&__pyx_kp___name__, __pyx_k___name__, sizeof(__pyx_k___name__), 1, 1, 1}, + {&__pyx_kp_PARSER, __pyx_k_PARSER, sizeof(__pyx_k_PARSER), 1, 1, 1}, + {&__pyx_kp_HTML, __pyx_k_HTML, sizeof(__pyx_k_HTML), 1, 1, 1}, + {&__pyx_kp_408, __pyx_k_408, sizeof(__pyx_k_408), 1, 1, 0}, + {&__pyx_kp_409, __pyx_k_409, sizeof(__pyx_k_409), 1, 1, 0}, + {&__pyx_kp_410, __pyx_k_410, sizeof(__pyx_k_410), 1, 1, 0}, + {&__pyx_kp_411, __pyx_k_411, sizeof(__pyx_k_411), 1, 1, 0}, + {&__pyx_kp_412, __pyx_k_412, sizeof(__pyx_k_412), 1, 1, 0}, + {&__pyx_kp_413, __pyx_k_413, sizeof(__pyx_k_413), 1, 1, 0}, + {&__pyx_kp_414, __pyx_k_414, sizeof(__pyx_k_414), 1, 1, 0}, + {&__pyx_kp_read, __pyx_k_read, sizeof(__pyx_k_read), 1, 1, 1}, + {&__pyx_kp_discard, __pyx_k_discard, sizeof(__pyx_k_discard), 1, 1, 1}, + {&__pyx_kp_position, __pyx_k_position, sizeof(__pyx_k_position), 1, 1, 1}, + {&__pyx_kp_426, __pyx_k_426, sizeof(__pyx_k_426), 1, 1, 0}, + {&__pyx_kp_427, __pyx_k_427, sizeof(__pyx_k_427), 1, 1, 0}, + {&__pyx_kp_428, __pyx_k_428, sizeof(__pyx_k_428), 1, 1, 0}, + {&__pyx_kp_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 1, 1, 1}, + {&__pyx_kp_443, __pyx_k_443, sizeof(__pyx_k_443), 1, 1, 1}, + {&__pyx_kp_444, __pyx_k_444, sizeof(__pyx_k_444), 1, 1, 1}, + {&__pyx_kp_LookupError, __pyx_k_LookupError, sizeof(__pyx_k_LookupError), 1, 1, 1}, + {&__pyx_kp_455, __pyx_k_455, sizeof(__pyx_k_455), 1, 1, 0}, + {&__pyx_kp_456, __pyx_k_456, sizeof(__pyx_k_456), 1, 1, 0}, + {&__pyx_kp_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 1, 1, 1}, + {&__pyx_kp_getvalue, __pyx_k_getvalue, sizeof(__pyx_k_getvalue), 1, 1, 1}, + {&__pyx_kp_457, __pyx_k_457, sizeof(__pyx_k_457), 1, 1, 0}, + {&__pyx_kp_doctype, __pyx_k_doctype, sizeof(__pyx_k_doctype), 1, 1, 1}, + {&__pyx_kp_472, __pyx_k_472, sizeof(__pyx_k_472), 1, 1, 0}, + {&__pyx_kp_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 1, 1, 1}, + {&__pyx_kp_473, __pyx_k_473, sizeof(__pyx_k_473), 1, 1, 0}, + {&__pyx_kp_474, __pyx_k_474, sizeof(__pyx_k_474), 1, 1, 0}, + {&__pyx_kp_475, __pyx_k_475, sizeof(__pyx_k_475), 1, 1, 0}, + {&__pyx_kp_479, __pyx_k_479, sizeof(__pyx_k_479), 1, 1, 0}, + {&__pyx_kp_GzipFile, __pyx_k_GzipFile, sizeof(__pyx_k_GzipFile), 1, 1, 1}, + {&__pyx_kp_fileobj, __pyx_k_fileobj, sizeof(__pyx_k_fileobj), 1, 1, 1}, + {&__pyx_kp_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 1, 1, 1}, + {&__pyx_kp_503, __pyx_k_503, sizeof(__pyx_k_503), 1, 1, 0}, + {&__pyx_kp_compresslevel, __pyx_k_compresslevel, sizeof(__pyx_k_compresslevel), 1, 1, 1}, + {&__pyx_kp_506, __pyx_k_506, sizeof(__pyx_k_506), 1, 1, 0}, + {&__pyx_kp_open, __pyx_k_open, sizeof(__pyx_k_open), 1, 1, 1}, + {&__pyx_kp_507, __pyx_k_507, sizeof(__pyx_k_507), 1, 1, 0}, + {&__pyx_kp_510, __pyx_k_510, sizeof(__pyx_k_510), 1, 1, 0}, + {&__pyx_kp_512, __pyx_k_512, sizeof(__pyx_k_512), 1, 1, 0}, + {&__pyx_kp_517, __pyx_k_517, sizeof(__pyx_k_517), 1, 1, 0}, + {&__pyx_kp_518, __pyx_k_518, sizeof(__pyx_k_518), 1, 1, 0}, + {&__pyx_kp_521, __pyx_k_521, sizeof(__pyx_k_521), 1, 1, 0}, + {&__pyx_kp_522, __pyx_k_522, sizeof(__pyx_k_522), 1, 1, 0}, + {&__pyx_kp_530, __pyx_k_530, sizeof(__pyx_k_530), 1, 1, 0}, + {&__pyx_kp_531, __pyx_k_531, sizeof(__pyx_k_531), 1, 1, 0}, + {&__pyx_kp_533, __pyx_k_533, sizeof(__pyx_k_533), 1, 1, 0}, + {&__pyx_kp_534, __pyx_k_534, sizeof(__pyx_k_534), 1, 1, 0}, + {&__pyx_kp_535, __pyx_k_535, sizeof(__pyx_k_535), 1, 1, 0}, + {&__pyx_kp_536, __pyx_k_536, sizeof(__pyx_k_536), 1, 1, 0}, + {&__pyx_kp_544, __pyx_k_544, sizeof(__pyx_k_544), 1, 1, 0}, + {&__pyx_kp_545, __pyx_k_545, sizeof(__pyx_k_545), 1, 1, 0}, + {&__pyx_kp_XML, __pyx_k_XML, sizeof(__pyx_k_XML), 1, 1, 1}, + {&__pyx_kp_548, __pyx_k_548, sizeof(__pyx_k_548), 1, 1, 0}, + {&__pyx_kp_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 1, 1, 1}, + {&__pyx_kp_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 1, 1, 1}, + {&__pyx_kp_565, __pyx_k_565, sizeof(__pyx_k_565), 1, 1, 0}, + {&__pyx_kp_UNICODE, __pyx_k_UNICODE, sizeof(__pyx_k_UNICODE), 1, 1, 1}, + {&__pyx_kp_IGNORECASE, __pyx_k_IGNORECASE, sizeof(__pyx_k_IGNORECASE), 1, 1, 1}, + {&__pyx_kp_567, __pyx_k_567, sizeof(__pyx_k_567), 1, 1, 0}, + {&__pyx_kp_search, __pyx_k_search, sizeof(__pyx_k_search), 1, 1, 1}, + {&__pyx_kp_568, __pyx_k_568, sizeof(__pyx_k_568), 1, 1, 0}, + {&__pyx_kp_569, __pyx_k_569, sizeof(__pyx_k_569), 1, 1, 0}, + {&__pyx_kp_groups, __pyx_k_groups, sizeof(__pyx_k_groups), 1, 1, 1}, + {&__pyx_kp_571, __pyx_k_571, sizeof(__pyx_k_571), 1, 1, 0}, + {&__pyx_kp_SubElement, __pyx_k_SubElement, sizeof(__pyx_k_SubElement), 1, 1, 1}, + {&__pyx_kp_573, __pyx_k_573, sizeof(__pyx_k_573), 1, 1, 0}, + {&__pyx_kp_574, __pyx_k_574, sizeof(__pyx_k_574), 1, 1, 0}, + {&__pyx_kp_575, __pyx_k_575, sizeof(__pyx_k_575), 1, 1, 0}, + {&__pyx_kp_577, __pyx_k_577, sizeof(__pyx_k_577), 0, 1, 0}, + {&__pyx_kp_578, __pyx_k_578, sizeof(__pyx_k_578), 0, 1, 0}, + {&__pyx_kp_579, __pyx_k_579, sizeof(__pyx_k_579), 0, 1, 0}, + {&__pyx_kp_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 1, 1, 1}, + {&__pyx_kp_583, __pyx_k_583, sizeof(__pyx_k_583), 1, 1, 0}, + {&__pyx_kp_584, __pyx_k_584, sizeof(__pyx_k_584), 1, 1, 0}, + {&__pyx_kp_585, __pyx_k_585, sizeof(__pyx_k_585), 1, 1, 0}, + {&__pyx_kp_586, __pyx_k_586, sizeof(__pyx_k_586), 1, 1, 0}, + {&__pyx_kp_is_attribute, __pyx_k_is_attribute, sizeof(__pyx_k_is_attribute), 1, 1, 1}, + {&__pyx_kp_is_tail, __pyx_k_is_tail, sizeof(__pyx_k_is_tail), 1, 1, 1}, + {&__pyx_kp_is_text, __pyx_k_is_text, sizeof(__pyx_k_is_text), 1, 1, 1}, + {&__pyx_kp_resolvers, __pyx_k_resolvers, sizeof(__pyx_k_resolvers), 1, 1, 1}, + {&__pyx_kp_607, __pyx_k_607, sizeof(__pyx_k_607), 1, 1, 0}, + {&__pyx_kp_608, __pyx_k_608, sizeof(__pyx_k_608), 1, 1, 0}, + {&__pyx_kp_609, __pyx_k_609, sizeof(__pyx_k_609), 1, 1, 0}, + {&__pyx_kp_610, __pyx_k_610, sizeof(__pyx_k_610), 1, 1, 0}, + {&__pyx_kp_611, __pyx_k_611, sizeof(__pyx_k_611), 1, 1, 0}, + {&__pyx_kp_options, __pyx_k_options, sizeof(__pyx_k_options), 1, 1, 1}, + {&__pyx_kp_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 1, 1, 1}, + {&__pyx_kp_628, __pyx_k_628, sizeof(__pyx_k_628), 1, 1, 0}, + {&__pyx_kp_635, __pyx_k_635, sizeof(__pyx_k_635), 1, 1, 0}, + {&__pyx_kp_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 1, 1, 1}, + {&__pyx_kp_652, __pyx_k_652, sizeof(__pyx_k_652), 1, 1, 0}, + {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 1, 0, 0}, + {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 1, 0, 0}, + {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 0}, + {&__pyx_kp_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 0}, + {&__pyx_kp_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 0}, + {&__pyx_kp_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 0}, + {&__pyx_kp_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 0}, + {&__pyx_kp_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 0}, + {&__pyx_kp_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 0}, + {&__pyx_kp_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 0}, + {&__pyx_kp_58, __pyx_k_58, sizeof(__pyx_k_58), 1, 0, 0}, + {&__pyx_kp_59, __pyx_k_59, sizeof(__pyx_k_59), 1, 0, 0}, + {&__pyx_kp_61, __pyx_k_61, sizeof(__pyx_k_61), 1, 0, 0}, + {&__pyx_kp_62, __pyx_k_62, sizeof(__pyx_k_62), 1, 0, 0}, + {&__pyx_kp_64, __pyx_k_64, sizeof(__pyx_k_64), 1, 0, 0}, + {&__pyx_kp_68, __pyx_k_68, sizeof(__pyx_k_68), 1, 0, 0}, + {&__pyx_kp_69, __pyx_k_69, sizeof(__pyx_k_69), 1, 0, 0}, + {&__pyx_kp_70, __pyx_k_70, sizeof(__pyx_k_70), 1, 0, 0}, + {&__pyx_kp_71, __pyx_k_71, sizeof(__pyx_k_71), 1, 0, 0}, + {&__pyx_kp_72, __pyx_k_72, sizeof(__pyx_k_72), 1, 0, 0}, + {&__pyx_kp_73, __pyx_k_73, sizeof(__pyx_k_73), 1, 0, 0}, + {&__pyx_kp_74, __pyx_k_74, sizeof(__pyx_k_74), 1, 0, 0}, + {&__pyx_kp_75, __pyx_k_75, sizeof(__pyx_k_75), 1, 0, 0}, + {&__pyx_kp_76, __pyx_k_76, sizeof(__pyx_k_76), 1, 0, 0}, + {&__pyx_kp_77, __pyx_k_77, sizeof(__pyx_k_77), 1, 0, 0}, + {&__pyx_kp_78, __pyx_k_78, sizeof(__pyx_k_78), 1, 0, 0}, + {&__pyx_kp_79, __pyx_k_79, sizeof(__pyx_k_79), 1, 0, 0}, + {&__pyx_kp_80, __pyx_k_80, sizeof(__pyx_k_80), 1, 0, 0}, + {&__pyx_kp_81, __pyx_k_81, sizeof(__pyx_k_81), 1, 0, 0}, + {&__pyx_kp_82, __pyx_k_82, sizeof(__pyx_k_82), 1, 0, 0}, + {&__pyx_kp_83, __pyx_k_83, sizeof(__pyx_k_83), 1, 0, 0}, + {&__pyx_kp_84, __pyx_k_84, sizeof(__pyx_k_84), 1, 0, 0}, + {&__pyx_kp_85, __pyx_k_85, sizeof(__pyx_k_85), 1, 0, 0}, + {&__pyx_kp_86, __pyx_k_86, sizeof(__pyx_k_86), 1, 0, 0}, + {&__pyx_kp_111, __pyx_k_111, sizeof(__pyx_k_111), 1, 0, 0}, + {&__pyx_kp_113, __pyx_k_113, sizeof(__pyx_k_113), 1, 0, 0}, + {&__pyx_kp_114, __pyx_k_114, sizeof(__pyx_k_114), 1, 0, 0}, + {&__pyx_kp_115, __pyx_k_115, sizeof(__pyx_k_115), 1, 0, 0}, + {&__pyx_kp_116, __pyx_k_116, sizeof(__pyx_k_116), 1, 0, 0}, + {&__pyx_kp_150, __pyx_k_150, sizeof(__pyx_k_150), 1, 0, 0}, + {&__pyx_kp_167, __pyx_k_167, sizeof(__pyx_k_167), 1, 0, 0}, + {&__pyx_kp_168, __pyx_k_168, sizeof(__pyx_k_168), 1, 0, 0}, + {&__pyx_kp_169, __pyx_k_169, sizeof(__pyx_k_169), 1, 0, 0}, + {&__pyx_kp_170, __pyx_k_170, sizeof(__pyx_k_170), 1, 0, 0}, + {&__pyx_kp_171, __pyx_k_171, sizeof(__pyx_k_171), 1, 0, 0}, + {&__pyx_kp_183, __pyx_k_183, sizeof(__pyx_k_183), 0, 0, 0}, + {&__pyx_kp_184, __pyx_k_184, sizeof(__pyx_k_184), 0, 0, 0}, + {&__pyx_kp_187, __pyx_k_187, sizeof(__pyx_k_187), 1, 0, 0}, + {&__pyx_kp_188, __pyx_k_188, sizeof(__pyx_k_188), 1, 0, 0}, + {&__pyx_kp_189, __pyx_k_189, sizeof(__pyx_k_189), 1, 0, 0}, + {&__pyx_kp_190, __pyx_k_190, sizeof(__pyx_k_190), 1, 0, 0}, + {&__pyx_kp_191, __pyx_k_191, sizeof(__pyx_k_191), 1, 0, 0}, + {&__pyx_kp_201, __pyx_k_201, sizeof(__pyx_k_201), 1, 0, 0}, + {&__pyx_kp_202, __pyx_k_202, sizeof(__pyx_k_202), 1, 0, 0}, + {&__pyx_kp_203, __pyx_k_203, sizeof(__pyx_k_203), 1, 0, 0}, + {&__pyx_kp_204, __pyx_k_204, sizeof(__pyx_k_204), 1, 0, 0}, + {&__pyx_kp_205, __pyx_k_205, sizeof(__pyx_k_205), 1, 0, 0}, + {&__pyx_kp_206, __pyx_k_206, sizeof(__pyx_k_206), 1, 0, 0}, + {&__pyx_kp_207, __pyx_k_207, sizeof(__pyx_k_207), 1, 0, 0}, + {&__pyx_kp_208, __pyx_k_208, sizeof(__pyx_k_208), 1, 0, 0}, + {&__pyx_kp_210, __pyx_k_210, sizeof(__pyx_k_210), 1, 0, 0}, + {&__pyx_kp_211, __pyx_k_211, sizeof(__pyx_k_211), 1, 0, 0}, + {&__pyx_kp_212, __pyx_k_212, sizeof(__pyx_k_212), 1, 0, 0}, + {&__pyx_kp_214, __pyx_k_214, sizeof(__pyx_k_214), 1, 0, 0}, + {&__pyx_kp_215, __pyx_k_215, sizeof(__pyx_k_215), 1, 0, 0}, + {&__pyx_kp_217, __pyx_k_217, sizeof(__pyx_k_217), 1, 0, 0}, + {&__pyx_kp_219, __pyx_k_219, sizeof(__pyx_k_219), 1, 0, 0}, + {&__pyx_kp_221, __pyx_k_221, sizeof(__pyx_k_221), 1, 0, 0}, + {&__pyx_kp_223, __pyx_k_223, sizeof(__pyx_k_223), 1, 0, 0}, + {&__pyx_kp_225, __pyx_k_225, sizeof(__pyx_k_225), 1, 0, 0}, + {&__pyx_kp_226, __pyx_k_226, sizeof(__pyx_k_226), 1, 0, 0}, + {&__pyx_kp_227, __pyx_k_227, sizeof(__pyx_k_227), 1, 0, 0}, + {&__pyx_kp_231, __pyx_k_231, sizeof(__pyx_k_231), 1, 0, 0}, + {&__pyx_kp_232, __pyx_k_232, sizeof(__pyx_k_232), 1, 0, 0}, + {&__pyx_kp_233, __pyx_k_233, sizeof(__pyx_k_233), 1, 0, 0}, + {&__pyx_kp_234, __pyx_k_234, sizeof(__pyx_k_234), 1, 0, 0}, + {&__pyx_kp_235, __pyx_k_235, sizeof(__pyx_k_235), 1, 0, 0}, + {&__pyx_kp_236, __pyx_k_236, sizeof(__pyx_k_236), 1, 0, 0}, + {&__pyx_kp_237, __pyx_k_237, sizeof(__pyx_k_237), 1, 0, 0}, + {&__pyx_kp_239, __pyx_k_239, sizeof(__pyx_k_239), 1, 0, 0}, + {&__pyx_kp_240, __pyx_k_240, sizeof(__pyx_k_240), 1, 0, 0}, + {&__pyx_kp_241, __pyx_k_241, sizeof(__pyx_k_241), 0, 0, 0}, + {&__pyx_kp_242, __pyx_k_242, sizeof(__pyx_k_242), 0, 0, 0}, + {&__pyx_kp_243, __pyx_k_243, sizeof(__pyx_k_243), 0, 0, 0}, + {&__pyx_kp_244, __pyx_k_244, sizeof(__pyx_k_244), 1, 0, 0}, + {&__pyx_kp_245, __pyx_k_245, sizeof(__pyx_k_245), 0, 0, 0}, + {&__pyx_kp_246, __pyx_k_246, sizeof(__pyx_k_246), 0, 0, 0}, + {&__pyx_kp_248, __pyx_k_248, sizeof(__pyx_k_248), 1, 0, 0}, + {&__pyx_kp_249, __pyx_k_249, sizeof(__pyx_k_249), 1, 0, 0}, + {&__pyx_kp_250, __pyx_k_250, sizeof(__pyx_k_250), 1, 0, 0}, + {&__pyx_kp_251, __pyx_k_251, sizeof(__pyx_k_251), 1, 0, 0}, + {&__pyx_kp_252, __pyx_k_252, sizeof(__pyx_k_252), 1, 0, 0}, + {&__pyx_kp_253, __pyx_k_253, sizeof(__pyx_k_253), 1, 0, 0}, + {&__pyx_kp_254, __pyx_k_254, sizeof(__pyx_k_254), 1, 0, 0}, + {&__pyx_kp_255, __pyx_k_255, sizeof(__pyx_k_255), 1, 0, 0}, + {&__pyx_kp_256, __pyx_k_256, sizeof(__pyx_k_256), 1, 0, 0}, + {&__pyx_kp_258, __pyx_k_258, sizeof(__pyx_k_258), 1, 0, 0}, + {&__pyx_kp_260, __pyx_k_260, sizeof(__pyx_k_260), 1, 0, 0}, + {&__pyx_kp_261, __pyx_k_261, sizeof(__pyx_k_261), 1, 0, 0}, + {&__pyx_kp_262, __pyx_k_262, sizeof(__pyx_k_262), 1, 0, 0}, + {&__pyx_kp_263, __pyx_k_263, sizeof(__pyx_k_263), 1, 0, 0}, + {&__pyx_kp_264, __pyx_k_264, sizeof(__pyx_k_264), 1, 0, 0}, + {&__pyx_kp_266, __pyx_k_266, sizeof(__pyx_k_266), 1, 0, 0}, + {&__pyx_kp_268, __pyx_k_268, sizeof(__pyx_k_268), 1, 0, 0}, + {&__pyx_kp_270, __pyx_k_270, sizeof(__pyx_k_270), 1, 0, 0}, + {&__pyx_kp_280, __pyx_k_280, sizeof(__pyx_k_280), 1, 0, 0}, + {&__pyx_kp_281, __pyx_k_281, sizeof(__pyx_k_281), 1, 0, 0}, + {&__pyx_kp_282, __pyx_k_282, sizeof(__pyx_k_282), 1, 0, 0}, + {&__pyx_kp_286, __pyx_k_286, sizeof(__pyx_k_286), 1, 0, 0}, + {&__pyx_kp_287, __pyx_k_287, sizeof(__pyx_k_287), 1, 0, 0}, + {&__pyx_kp_288, __pyx_k_288, sizeof(__pyx_k_288), 1, 0, 0}, + {&__pyx_kp_289, __pyx_k_289, sizeof(__pyx_k_289), 1, 0, 0}, + {&__pyx_kp_290, __pyx_k_290, sizeof(__pyx_k_290), 1, 0, 0}, + {&__pyx_kp_291, __pyx_k_291, sizeof(__pyx_k_291), 1, 0, 0}, + {&__pyx_kp_302, __pyx_k_302, sizeof(__pyx_k_302), 1, 0, 0}, + {&__pyx_kp_306, __pyx_k_306, sizeof(__pyx_k_306), 1, 0, 0}, + {&__pyx_kp_308, __pyx_k_308, sizeof(__pyx_k_308), 1, 0, 0}, + {&__pyx_kp_309, __pyx_k_309, sizeof(__pyx_k_309), 1, 0, 0}, + {&__pyx_kp_310, __pyx_k_310, sizeof(__pyx_k_310), 1, 0, 0}, + {&__pyx_kp_311, __pyx_k_311, sizeof(__pyx_k_311), 1, 0, 0}, + {&__pyx_kp_312, __pyx_k_312, sizeof(__pyx_k_312), 1, 0, 0}, + {&__pyx_kp_313, __pyx_k_313, sizeof(__pyx_k_313), 1, 0, 0}, + {&__pyx_kp_314, __pyx_k_314, sizeof(__pyx_k_314), 1, 0, 0}, + {&__pyx_kp_315, __pyx_k_315, sizeof(__pyx_k_315), 1, 0, 0}, + {&__pyx_kp_316, __pyx_k_316, sizeof(__pyx_k_316), 1, 0, 0}, + {&__pyx_kp_317, __pyx_k_317, sizeof(__pyx_k_317), 1, 0, 0}, + {&__pyx_kp_318, __pyx_k_318, sizeof(__pyx_k_318), 1, 0, 0}, + {&__pyx_kp_319, __pyx_k_319, sizeof(__pyx_k_319), 1, 0, 0}, + {&__pyx_kp_320, __pyx_k_320, sizeof(__pyx_k_320), 1, 0, 0}, + {&__pyx_kp_323, __pyx_k_323, sizeof(__pyx_k_323), 1, 0, 0}, + {&__pyx_kp_324, __pyx_k_324, sizeof(__pyx_k_324), 1, 0, 0}, + {&__pyx_kp_325, __pyx_k_325, sizeof(__pyx_k_325), 1, 0, 0}, + {&__pyx_kp_326, __pyx_k_326, sizeof(__pyx_k_326), 1, 0, 0}, + {&__pyx_kp_327, __pyx_k_327, sizeof(__pyx_k_327), 1, 0, 0}, + {&__pyx_kp_328, __pyx_k_328, sizeof(__pyx_k_328), 1, 0, 0}, + {&__pyx_kp_329, __pyx_k_329, sizeof(__pyx_k_329), 1, 0, 0}, + {&__pyx_kp_330, __pyx_k_330, sizeof(__pyx_k_330), 1, 0, 0}, + {&__pyx_kp_331, __pyx_k_331, sizeof(__pyx_k_331), 1, 0, 0}, + {&__pyx_kp_332, __pyx_k_332, sizeof(__pyx_k_332), 1, 0, 0}, + {&__pyx_kp_333, __pyx_k_333, sizeof(__pyx_k_333), 0, 0, 0}, + {&__pyx_kp_334, __pyx_k_334, sizeof(__pyx_k_334), 1, 0, 0}, + {&__pyx_kp_335, __pyx_k_335, sizeof(__pyx_k_335), 1, 0, 0}, + {&__pyx_kp_336, __pyx_k_336, sizeof(__pyx_k_336), 1, 0, 0}, + {&__pyx_kp_337, __pyx_k_337, sizeof(__pyx_k_337), 1, 0, 0}, + {&__pyx_kp_338, __pyx_k_338, sizeof(__pyx_k_338), 1, 0, 0}, + {&__pyx_kp_339, __pyx_k_339, sizeof(__pyx_k_339), 1, 0, 0}, + {&__pyx_kp_340, __pyx_k_340, sizeof(__pyx_k_340), 1, 0, 0}, + {&__pyx_kp_341, __pyx_k_341, sizeof(__pyx_k_341), 1, 0, 0}, + {&__pyx_kp_342, __pyx_k_342, sizeof(__pyx_k_342), 1, 0, 0}, + {&__pyx_kp_343, __pyx_k_343, sizeof(__pyx_k_343), 0, 0, 0}, + {&__pyx_kp_346, __pyx_k_346, sizeof(__pyx_k_346), 1, 0, 0}, + {&__pyx_kp_347, __pyx_k_347, sizeof(__pyx_k_347), 1, 0, 0}, + {&__pyx_kp_348, __pyx_k_348, sizeof(__pyx_k_348), 1, 0, 0}, + {&__pyx_kp_351, __pyx_k_351, sizeof(__pyx_k_351), 1, 0, 0}, + {&__pyx_kp_354, __pyx_k_354, sizeof(__pyx_k_354), 1, 0, 0}, + {&__pyx_kp_355, __pyx_k_355, sizeof(__pyx_k_355), 1, 0, 0}, + {&__pyx_kp_356, __pyx_k_356, sizeof(__pyx_k_356), 1, 0, 0}, + {&__pyx_kp_357, __pyx_k_357, sizeof(__pyx_k_357), 1, 0, 0}, + {&__pyx_kp_358, __pyx_k_358, sizeof(__pyx_k_358), 0, 0, 0}, + {&__pyx_kp_359, __pyx_k_359, sizeof(__pyx_k_359), 0, 0, 0}, + {&__pyx_kp_360, __pyx_k_360, sizeof(__pyx_k_360), 1, 0, 0}, + {&__pyx_kp_361, __pyx_k_361, sizeof(__pyx_k_361), 1, 0, 0}, + {&__pyx_kp_362, __pyx_k_362, sizeof(__pyx_k_362), 0, 0, 0}, + {&__pyx_kp_363, __pyx_k_363, sizeof(__pyx_k_363), 0, 0, 0}, + {&__pyx_kp_364, __pyx_k_364, sizeof(__pyx_k_364), 1, 0, 0}, + {&__pyx_kp_365, __pyx_k_365, sizeof(__pyx_k_365), 1, 0, 0}, + {&__pyx_kp_366, __pyx_k_366, sizeof(__pyx_k_366), 0, 0, 0}, + {&__pyx_kp_367, __pyx_k_367, sizeof(__pyx_k_367), 0, 0, 0}, + {&__pyx_kp_368, __pyx_k_368, sizeof(__pyx_k_368), 1, 0, 0}, + {&__pyx_kp_369, __pyx_k_369, sizeof(__pyx_k_369), 1, 0, 0}, + {&__pyx_kp_370, __pyx_k_370, sizeof(__pyx_k_370), 0, 0, 0}, + {&__pyx_kp_371, __pyx_k_371, sizeof(__pyx_k_371), 0, 0, 0}, + {&__pyx_kp_372, __pyx_k_372, sizeof(__pyx_k_372), 1, 0, 0}, + {&__pyx_kp_377, __pyx_k_377, sizeof(__pyx_k_377), 0, 0, 0}, + {&__pyx_kp_378, __pyx_k_378, sizeof(__pyx_k_378), 0, 0, 0}, + {&__pyx_kp_379, __pyx_k_379, sizeof(__pyx_k_379), 1, 0, 0}, + {&__pyx_kp_380, __pyx_k_380, sizeof(__pyx_k_380), 1, 0, 0}, + {&__pyx_kp_381, __pyx_k_381, sizeof(__pyx_k_381), 1, 0, 0}, + {&__pyx_kp_383, __pyx_k_383, sizeof(__pyx_k_383), 1, 0, 0}, + {&__pyx_kp_385, __pyx_k_385, sizeof(__pyx_k_385), 1, 0, 0}, + {&__pyx_kp_387, __pyx_k_387, sizeof(__pyx_k_387), 1, 0, 0}, + {&__pyx_kp_388, __pyx_k_388, sizeof(__pyx_k_388), 1, 0, 0}, + {&__pyx_kp_389, __pyx_k_389, sizeof(__pyx_k_389), 1, 0, 0}, + {&__pyx_kp_390, __pyx_k_390, sizeof(__pyx_k_390), 1, 0, 0}, + {&__pyx_kp_391, __pyx_k_391, sizeof(__pyx_k_391), 1, 0, 0}, + {&__pyx_kp_392, __pyx_k_392, sizeof(__pyx_k_392), 0, 0, 0}, + {&__pyx_kp_395, __pyx_k_395, sizeof(__pyx_k_395), 1, 0, 0}, + {&__pyx_kp_396, __pyx_k_396, sizeof(__pyx_k_396), 1, 0, 0}, + {&__pyx_kp_397, __pyx_k_397, sizeof(__pyx_k_397), 0, 0, 0}, + {&__pyx_kp_398, __pyx_k_398, sizeof(__pyx_k_398), 0, 0, 0}, + {&__pyx_kp_399, __pyx_k_399, sizeof(__pyx_k_399), 0, 0, 0}, + {&__pyx_kp_400, __pyx_k_400, sizeof(__pyx_k_400), 1, 0, 0}, + {&__pyx_kp_401, __pyx_k_401, sizeof(__pyx_k_401), 1, 0, 0}, + {&__pyx_kp_402, __pyx_k_402, sizeof(__pyx_k_402), 1, 0, 0}, + {&__pyx_kp_403, __pyx_k_403, sizeof(__pyx_k_403), 1, 0, 0}, + {&__pyx_kp_407, __pyx_k_407, sizeof(__pyx_k_407), 1, 0, 0}, + {&__pyx_kp_415, __pyx_k_415, sizeof(__pyx_k_415), 1, 0, 0}, + {&__pyx_kp_416, __pyx_k_416, sizeof(__pyx_k_416), 1, 0, 0}, + {&__pyx_kp_417, __pyx_k_417, sizeof(__pyx_k_417), 1, 0, 0}, + {&__pyx_kp_418, __pyx_k_418, sizeof(__pyx_k_418), 1, 0, 0}, + {&__pyx_kp_419, __pyx_k_419, sizeof(__pyx_k_419), 1, 0, 0}, + {&__pyx_kp_420, __pyx_k_420, sizeof(__pyx_k_420), 1, 0, 0}, + {&__pyx_kp_421, __pyx_k_421, sizeof(__pyx_k_421), 1, 0, 0}, + {&__pyx_kp_422, __pyx_k_422, sizeof(__pyx_k_422), 0, 0, 0}, + {&__pyx_kp_423, __pyx_k_423, sizeof(__pyx_k_423), 0, 0, 0}, + {&__pyx_kp_424, __pyx_k_424, sizeof(__pyx_k_424), 0, 0, 0}, + {&__pyx_kp_425, __pyx_k_425, sizeof(__pyx_k_425), 1, 0, 0}, + {&__pyx_kp_436, __pyx_k_436, sizeof(__pyx_k_436), 0, 0, 0}, + {&__pyx_kp_437, __pyx_k_437, sizeof(__pyx_k_437), 1, 0, 0}, + {&__pyx_kp_438, __pyx_k_438, sizeof(__pyx_k_438), 1, 0, 0}, + {&__pyx_kp_439, __pyx_k_439, sizeof(__pyx_k_439), 1, 0, 0}, + {&__pyx_kp_440, __pyx_k_440, sizeof(__pyx_k_440), 1, 0, 0}, + {&__pyx_kp_441, __pyx_k_441, sizeof(__pyx_k_441), 1, 0, 0}, + {&__pyx_kp_442, __pyx_k_442, sizeof(__pyx_k_442), 1, 0, 0}, + {&__pyx_kp_446, __pyx_k_446, sizeof(__pyx_k_446), 1, 0, 0}, + {&__pyx_kp_447, __pyx_k_447, sizeof(__pyx_k_447), 1, 0, 0}, + {&__pyx_kp_449, __pyx_k_449, sizeof(__pyx_k_449), 1, 0, 0}, + {&__pyx_kp_450, __pyx_k_450, sizeof(__pyx_k_450), 1, 0, 0}, + {&__pyx_kp_451, __pyx_k_451, sizeof(__pyx_k_451), 1, 0, 0}, + {&__pyx_kp_452, __pyx_k_452, sizeof(__pyx_k_452), 1, 0, 0}, + {&__pyx_kp_453, __pyx_k_453, sizeof(__pyx_k_453), 1, 0, 0}, + {&__pyx_kp_458, __pyx_k_458, sizeof(__pyx_k_458), 1, 0, 0}, + {&__pyx_kp_459, __pyx_k_459, sizeof(__pyx_k_459), 1, 0, 0}, + {&__pyx_kp_460, __pyx_k_460, sizeof(__pyx_k_460), 1, 0, 0}, + {&__pyx_kp_461, __pyx_k_461, sizeof(__pyx_k_461), 1, 0, 0}, + {&__pyx_kp_462, __pyx_k_462, sizeof(__pyx_k_462), 0, 0, 0}, + {&__pyx_kp_464, __pyx_k_464, sizeof(__pyx_k_464), 1, 0, 0}, + {&__pyx_kp_465, __pyx_k_465, sizeof(__pyx_k_465), 0, 0, 0}, + {&__pyx_kp_466, __pyx_k_466, sizeof(__pyx_k_466), 1, 0, 0}, + {&__pyx_kp_467, __pyx_k_467, sizeof(__pyx_k_467), 1, 0, 0}, + {&__pyx_kp_468, __pyx_k_468, sizeof(__pyx_k_468), 1, 0, 0}, + {&__pyx_kp_469, __pyx_k_469, sizeof(__pyx_k_469), 1, 0, 0}, + {&__pyx_kp_470, __pyx_k_470, sizeof(__pyx_k_470), 1, 0, 0}, + {&__pyx_kp_471, __pyx_k_471, sizeof(__pyx_k_471), 1, 0, 0}, + {&__pyx_kp_476, __pyx_k_476, sizeof(__pyx_k_476), 1, 0, 0}, + {&__pyx_kp_477, __pyx_k_477, sizeof(__pyx_k_477), 1, 0, 0}, + {&__pyx_kp_478, __pyx_k_478, sizeof(__pyx_k_478), 1, 0, 0}, + {&__pyx_kp_482, __pyx_k_482, sizeof(__pyx_k_482), 1, 0, 0}, + {&__pyx_kp_483, __pyx_k_483, sizeof(__pyx_k_483), 1, 0, 0}, + {&__pyx_kp_485, __pyx_k_485, sizeof(__pyx_k_485), 1, 0, 0}, + {&__pyx_kp_504, __pyx_k_504, sizeof(__pyx_k_504), 1, 0, 0}, + {&__pyx_kp_505, __pyx_k_505, sizeof(__pyx_k_505), 1, 0, 0}, + {&__pyx_kp_508, __pyx_k_508, sizeof(__pyx_k_508), 1, 0, 0}, + {&__pyx_kp_509, __pyx_k_509, sizeof(__pyx_k_509), 1, 0, 0}, + {&__pyx_kp_511, __pyx_k_511, sizeof(__pyx_k_511), 1, 0, 0}, + {&__pyx_kp_513, __pyx_k_513, sizeof(__pyx_k_513), 1, 0, 0}, + {&__pyx_kp_514, __pyx_k_514, sizeof(__pyx_k_514), 1, 0, 0}, + {&__pyx_kp_515, __pyx_k_515, sizeof(__pyx_k_515), 1, 0, 0}, + {&__pyx_kp_519, __pyx_k_519, sizeof(__pyx_k_519), 1, 0, 0}, + {&__pyx_kp_520, __pyx_k_520, sizeof(__pyx_k_520), 1, 0, 0}, + {&__pyx_kp_523, __pyx_k_523, sizeof(__pyx_k_523), 1, 0, 0}, + {&__pyx_kp_524, __pyx_k_524, sizeof(__pyx_k_524), 1, 0, 0}, + {&__pyx_kp_525, __pyx_k_525, sizeof(__pyx_k_525), 0, 0, 0}, + {&__pyx_kp_526, __pyx_k_526, sizeof(__pyx_k_526), 1, 0, 0}, + {&__pyx_kp_527, __pyx_k_527, sizeof(__pyx_k_527), 1, 0, 0}, + {&__pyx_kp_528, __pyx_k_528, sizeof(__pyx_k_528), 0, 0, 0}, + {&__pyx_kp_529, __pyx_k_529, sizeof(__pyx_k_529), 0, 0, 0}, + {&__pyx_kp_532, __pyx_k_532, sizeof(__pyx_k_532), 1, 0, 0}, + {&__pyx_kp_537, __pyx_k_537, sizeof(__pyx_k_537), 1, 0, 0}, + {&__pyx_kp_538, __pyx_k_538, sizeof(__pyx_k_538), 1, 0, 0}, + {&__pyx_kp_539, __pyx_k_539, sizeof(__pyx_k_539), 1, 0, 0}, + {&__pyx_kp_540, __pyx_k_540, sizeof(__pyx_k_540), 1, 0, 0}, + {&__pyx_kp_541, __pyx_k_541, sizeof(__pyx_k_541), 1, 0, 0}, + {&__pyx_kp_542, __pyx_k_542, sizeof(__pyx_k_542), 1, 0, 0}, + {&__pyx_kp_543, __pyx_k_543, sizeof(__pyx_k_543), 1, 0, 0}, + {&__pyx_kp_546, __pyx_k_546, sizeof(__pyx_k_546), 1, 0, 0}, + {&__pyx_kp_547, __pyx_k_547, sizeof(__pyx_k_547), 1, 0, 0}, + {&__pyx_kp_549, __pyx_k_549, sizeof(__pyx_k_549), 1, 0, 0}, + {&__pyx_kp_550, __pyx_k_550, sizeof(__pyx_k_550), 1, 0, 0}, + {&__pyx_kp_551, __pyx_k_551, sizeof(__pyx_k_551), 1, 0, 0}, + {&__pyx_kp_552, __pyx_k_552, sizeof(__pyx_k_552), 1, 0, 0}, + {&__pyx_kp_553, __pyx_k_553, sizeof(__pyx_k_553), 0, 0, 0}, + {&__pyx_kp_554, __pyx_k_554, sizeof(__pyx_k_554), 0, 0, 0}, + {&__pyx_kp_555, __pyx_k_555, sizeof(__pyx_k_555), 0, 0, 0}, + {&__pyx_kp_172, __pyx_k_172, sizeof(__pyx_k_172), 1, 0, 0}, + {&__pyx_kp_173, __pyx_k_173, sizeof(__pyx_k_173), 1, 0, 0}, + {&__pyx_kp_556, __pyx_k_556, sizeof(__pyx_k_556), 1, 0, 0}, + {&__pyx_kp_557, __pyx_k_557, sizeof(__pyx_k_557), 1, 0, 0}, + {&__pyx_kp_558, __pyx_k_558, sizeof(__pyx_k_558), 1, 0, 0}, + {&__pyx_kp_559, __pyx_k_559, sizeof(__pyx_k_559), 1, 0, 0}, + {&__pyx_kp_560, __pyx_k_560, sizeof(__pyx_k_560), 1, 0, 0}, + {&__pyx_kp_561, __pyx_k_561, sizeof(__pyx_k_561), 1, 0, 0}, + {&__pyx_kp_562, __pyx_k_562, sizeof(__pyx_k_562), 1, 0, 0}, + {&__pyx_kp_563, __pyx_k_563, sizeof(__pyx_k_563), 1, 0, 0}, + {&__pyx_kp_564, __pyx_k_564, sizeof(__pyx_k_564), 1, 0, 0}, + {&__pyx_kp_566, __pyx_k_566, sizeof(__pyx_k_566), 1, 0, 0}, + {&__pyx_kp_570, __pyx_k_570, sizeof(__pyx_k_570), 1, 0, 0}, + {&__pyx_kp_572, __pyx_k_572, sizeof(__pyx_k_572), 1, 0, 0}, + {&__pyx_kp_576, __pyx_k_576, sizeof(__pyx_k_576), 0, 0, 0}, + {&__pyx_kp_580, __pyx_k_580, sizeof(__pyx_k_580), 1, 0, 0}, + {&__pyx_kp_581, __pyx_k_581, sizeof(__pyx_k_581), 1, 0, 0}, + {&__pyx_kp_582, __pyx_k_582, sizeof(__pyx_k_582), 1, 0, 0}, + {&__pyx_kp_587, __pyx_k_587, sizeof(__pyx_k_587), 1, 0, 0}, + {&__pyx_kp_588, __pyx_k_588, sizeof(__pyx_k_588), 1, 0, 0}, + {&__pyx_kp_589, __pyx_k_589, sizeof(__pyx_k_589), 1, 0, 0}, + {&__pyx_kp_590, __pyx_k_590, sizeof(__pyx_k_590), 1, 0, 0}, + {&__pyx_kp_591, __pyx_k_591, sizeof(__pyx_k_591), 1, 0, 0}, + {&__pyx_kp_592, __pyx_k_592, sizeof(__pyx_k_592), 1, 0, 0}, + {&__pyx_kp_593, __pyx_k_593, sizeof(__pyx_k_593), 1, 0, 0}, + {&__pyx_kp_594, __pyx_k_594, sizeof(__pyx_k_594), 1, 0, 0}, + {&__pyx_kp_595, __pyx_k_595, sizeof(__pyx_k_595), 1, 0, 0}, + {&__pyx_kp_596, __pyx_k_596, sizeof(__pyx_k_596), 0, 0, 0}, + {&__pyx_kp_602, __pyx_k_602, sizeof(__pyx_k_602), 0, 0, 0}, + {&__pyx_kp_606, __pyx_k_606, sizeof(__pyx_k_606), 1, 0, 0}, + {&__pyx_kp_612, __pyx_k_612, sizeof(__pyx_k_612), 1, 0, 0}, + {&__pyx_kp_613, __pyx_k_613, sizeof(__pyx_k_613), 1, 0, 0}, + {&__pyx_kp_614, __pyx_k_614, sizeof(__pyx_k_614), 1, 0, 0}, + {&__pyx_kp_615, __pyx_k_615, sizeof(__pyx_k_615), 1, 0, 0}, + {&__pyx_kp_616, __pyx_k_616, sizeof(__pyx_k_616), 1, 0, 0}, + {&__pyx_kp_617, __pyx_k_617, sizeof(__pyx_k_617), 1, 0, 0}, + {&__pyx_kp_618, __pyx_k_618, sizeof(__pyx_k_618), 1, 0, 0}, + {&__pyx_kp_619, __pyx_k_619, sizeof(__pyx_k_619), 1, 0, 0}, + {&__pyx_kp_620, __pyx_k_620, sizeof(__pyx_k_620), 1, 0, 0}, + {&__pyx_kp_621, __pyx_k_621, sizeof(__pyx_k_621), 1, 0, 0}, + {&__pyx_kp_622, __pyx_k_622, sizeof(__pyx_k_622), 0, 0, 0}, + {&__pyx_kp_623, __pyx_k_623, sizeof(__pyx_k_623), 1, 0, 0}, + {&__pyx_kp_627, __pyx_k_627, sizeof(__pyx_k_627), 1, 0, 0}, + {&__pyx_kp_629, __pyx_k_629, sizeof(__pyx_k_629), 1, 0, 0}, + {&__pyx_kp_630, __pyx_k_630, sizeof(__pyx_k_630), 1, 0, 0}, + {&__pyx_kp_631, __pyx_k_631, sizeof(__pyx_k_631), 1, 0, 0}, + {&__pyx_kp_632, __pyx_k_632, sizeof(__pyx_k_632), 1, 0, 0}, + {&__pyx_kp_633, __pyx_k_633, sizeof(__pyx_k_633), 1, 0, 0}, + {&__pyx_kp_634, __pyx_k_634, sizeof(__pyx_k_634), 1, 0, 0}, + {&__pyx_kp_636, __pyx_k_636, sizeof(__pyx_k_636), 1, 0, 0}, + {&__pyx_kp_637, __pyx_k_637, sizeof(__pyx_k_637), 1, 0, 0}, + {&__pyx_kp_638, __pyx_k_638, sizeof(__pyx_k_638), 1, 0, 0}, + {&__pyx_kp_639, __pyx_k_639, sizeof(__pyx_k_639), 1, 0, 0}, + {&__pyx_kp_640, __pyx_k_640, sizeof(__pyx_k_640), 1, 0, 0}, + {&__pyx_kp_641, __pyx_k_641, sizeof(__pyx_k_641), 1, 0, 0}, + {&__pyx_kp_642, __pyx_k_642, sizeof(__pyx_k_642), 1, 0, 0}, + {&__pyx_kp_643, __pyx_k_643, sizeof(__pyx_k_643), 1, 0, 0}, + {&__pyx_kp_645, __pyx_k_645, sizeof(__pyx_k_645), 1, 0, 0}, + {&__pyx_kp_646, __pyx_k_646, sizeof(__pyx_k_646), 1, 0, 0}, + {&__pyx_kp_647, __pyx_k_647, sizeof(__pyx_k_647), 1, 0, 0}, + {&__pyx_kp_650, __pyx_k_650, sizeof(__pyx_k_650), 1, 0, 0}, + {&__pyx_kp_651, __pyx_k_651, sizeof(__pyx_k_651), 1, 0, 0}, + {&__pyx_kp_653, __pyx_k_653, sizeof(__pyx_k_653), 1, 0, 0}, + {&__pyx_kp_654, __pyx_k_654, sizeof(__pyx_k_654), 1, 0, 0}, + {&__pyx_kp_655, __pyx_k_655, sizeof(__pyx_k_655), 1, 0, 0}, + {&__pyx_kp_656, __pyx_k_656, sizeof(__pyx_k_656), 1, 0, 0}, + {&__pyx_kp_657, __pyx_k_657, sizeof(__pyx_k_657), 1, 0, 0}, + {&__pyx_kp_658, __pyx_k_658, sizeof(__pyx_k_658), 1, 0, 0}, + {&__pyx_kp_660, __pyx_k_660, sizeof(__pyx_k_660), 1, 0, 0}, + {&__pyx_kp_661, __pyx_k_661, sizeof(__pyx_k_661), 1, 0, 0}, + {&__pyx_kp_662, __pyx_k_662, sizeof(__pyx_k_662), 1, 0, 0}, + {&__pyx_kp_663, __pyx_k_663, sizeof(__pyx_k_663), 1, 0, 0}, + {&__pyx_kp_664, __pyx_k_664, sizeof(__pyx_k_664), 1, 0, 0}, + {&__pyx_kp_666, __pyx_k_666, sizeof(__pyx_k_666), 1, 0, 0}, + {&__pyx_kp_667, __pyx_k_667, sizeof(__pyx_k_667), 1, 0, 0}, + {&__pyx_kp_668, __pyx_k_668, sizeof(__pyx_k_668), 1, 0, 0}, + {&__pyx_kp_669, __pyx_k_669, sizeof(__pyx_k_669), 1, 0, 0}, + {&__pyx_kp_670, __pyx_k_670, sizeof(__pyx_k_670), 1, 0, 0}, + {&__pyx_kp_671, __pyx_k_671, sizeof(__pyx_k_671), 1, 0, 0}, + {&__pyx_kp_672, __pyx_k_672, sizeof(__pyx_k_672), 1, 0, 0}, + {&__pyx_kp_673, __pyx_k_673, sizeof(__pyx_k_673), 1, 0, 0}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_kp_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_kp_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_kp_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_SyntaxError = __Pyx_GetName(__pyx_b, __pyx_kp_SyntaxError); if (!__pyx_builtin_SyntaxError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_kp_super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_kp_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_kp_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_UnicodeEncodeError = __Pyx_GetName(__pyx_b, __pyx_kp_UnicodeEncodeError); if (!__pyx_builtin_UnicodeEncodeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_UnicodeDecodeError = __Pyx_GetName(__pyx_b, __pyx_kp_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_kp_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_kp_id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_FutureWarning = __Pyx_GetName(__pyx_b, __pyx_kp_FutureWarning); if (!__pyx_builtin_FutureWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_kp_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_LookupError = __Pyx_GetName(__pyx_b, __pyx_kp_LookupError); if (!__pyx_builtin_LookupError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_kp_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_kp_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_kp_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_AssertionError = __Pyx_GetName(__pyx_b, __pyx_kp_AssertionError); if (!__pyx_builtin_AssertionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __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_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_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_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_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_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_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_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_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_32768 = PyInt_FromLong(32768); if (unlikely(!__pyx_int_32768)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #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;}; + 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_1 = 0; + int __pyx_2; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + 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; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("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;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __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;} + #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_mdoc, 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;}; + if (__pyx_module_is_main_lxml__etree) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 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;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- 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__LxmlError = 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 = 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__XMLSyntaxError = 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("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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TempStore.add = (void(*)(void))__pyx_f_4lxml_5etree_10_TempStore_add; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TempStore.clear = (void(*)(void))__pyx_f_4lxml_5etree_10_TempStore_clear; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__TempStore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __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 = 194; __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 = 194; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExceptionContext.clear = (void(*)(void))__pyx_f_4lxml_5etree_17_ExceptionContext_clear; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExceptionContext._store_raised = (void(*)(void))__pyx_f_4lxml_5etree_17_ExceptionContext__store_raised; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExceptionContext._store_exception = (void(*)(void))__pyx_f_4lxml_5etree_17_ExceptionContext__store_exception; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExceptionContext._has_raised = (void(*)(void))__pyx_f_4lxml_5etree_17_ExceptionContext__has_raised; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExceptionContext._raise_if_stored = (void(*)(void))__pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__ExceptionContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __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 = 208; __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 = 208; __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; + #if PY_MAJOR_VERSION >= 3 + __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 *))__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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document.getroot = (void(*)(void))__pyx_f_4lxml_5etree_9_Document_getroot; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document.hasdoctype = (void(*)(void))__pyx_f_4lxml_5etree_9_Document_hasdoctype; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document.getdoctype = (void(*)(void))__pyx_f_4lxml_5etree_9_Document_getdoctype; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document.getxmlinfo = (void(*)(void))__pyx_f_4lxml_5etree_9_Document_getxmlinfo; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document.isstandalone = (void(*)(void))__pyx_f_4lxml_5etree_9_Document_isstandalone; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document.buildNewPrefix = (void(*)(void))__pyx_f_4lxml_5etree_9_Document_buildNewPrefix; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document._findOrBuildNodeNs = (void(*)(void))__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__Document._setNodeNs = (void(*)(void))__pyx_f_4lxml_5etree_9_Document__setNodeNs; + #endif + if (PyType_Ready(&LxmlDocumentType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __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 = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_Document", (PyObject *)&LxmlDocumentType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __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 = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_Element", (PyObject *)&LxmlElementType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree__Element = &LxmlElementType; + __pyx_vtabptr_4lxml_5etree__BaseParser = &__pyx_vtable_4lxml_5etree__BaseParser; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._getParserContext = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__getParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._getPushParserContext = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._createContext = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__createContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._newParserCtxt = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._newPushParserCtxt = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._copy = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__copy; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._parseUnicodeDoc = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._parseDoc = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__parseDoc; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFile = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFilelike = (void(*)(void))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 676; __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[2]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_BaseParser", (PyObject *)&__pyx_type_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 676; __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 = 1475; __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 = 1475; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__LogEntry._setError = (void(*)(void))__pyx_f_4lxml_5etree_9_LogEntry__setError; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__LogEntry._setGeneric = (void(*)(void))__pyx_f_4lxml_5etree_9_LogEntry__setGeneric; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[7]; __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[7]; __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[7]; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseErrorLog._receive = (void(*)(void))__pyx_f_4lxml_5etree_13_BaseErrorLog__receive; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseErrorLog._receiveGeneric = (void(*)(void))__pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseErrorLog._buildParseException = (void(*)(void))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseErrorLog._buildExceptionMessage = (void(*)(void))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __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[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_BaseErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __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[7]; __pyx_lineno = 192; __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[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ListErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ErrorLog.connect = (void(*)(void))__pyx_f_4lxml_5etree_9_ErrorLog_connect; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ErrorLog.disconnect = (void(*)(void))__pyx_f_4lxml_5etree_9_ErrorLog_disconnect; + #endif + __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[7]; __pyx_lineno = 312; __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[7]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 312; __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[7]; __pyx_lineno = 342; __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[7]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_DomainErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 342; __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[7]; __pyx_lineno = 351; __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[7]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_RotatingErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 351; __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[7]; __pyx_lineno = 362; __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[7]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PyErrorLog", (PyObject *)&__pyx_type_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 362; __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 = 410; __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 = 410; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree___ContentOnlyElement._raiseImmutable = (int (*)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *))__pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree___ContentOnlyElement._raiseImmutable = (void(*)(void))__pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable; + #endif + __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 = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_4lxml_5etree___ContentOnlyElement.tp_dict, __pyx_vtabptr_4lxml_5etree___ContentOnlyElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __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 = 1349; __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 = 1418; __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 = 1418; __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 = 1418; __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 = 1426; __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 = 1426; __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 = 1426; __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 = 1448; __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 = 1448; __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 = 1448; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree__ElementTree._assertHasRoot = (PyObject *(*)(struct LxmlElementTree *))__pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ElementTree._assertHasRoot = (void(*)(void))__pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot; + #endif + if (PyType_Ready(&LxmlElementTreeType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __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 = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ElementTree", (PyObject *)&LxmlElementTreeType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __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 = 1936; __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 = 1936; __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 = 2056; __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 = 2056; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree__ElementTagMatcher._initTagMatch = (PyObject *(*)(struct LxmlElementTagMatcher *, PyObject *))__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ElementTagMatcher._initTagMatch = (void(*)(void))__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch; + #endif + if (PyType_Ready(&LxmlElementTagMatcherType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __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 = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ElementTagMatcher", (PyObject *)&LxmlElementTagMatcherType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree__ElementIterator._storeNext = (void (*)(struct LxmlElementIterator *, struct LxmlElement *))__pyx_f_4lxml_5etree_16_ElementIterator__storeNext; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ElementIterator._storeNext = (void(*)(void))__pyx_f_4lxml_5etree_16_ElementIterator__storeNext; + #endif + LxmlElementIteratorType.tp_base = __pyx_ptype_4lxml_5etree__ElementTagMatcher; + if (PyType_Ready(&LxmlElementIteratorType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2125; __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 = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ElementIterator", (PyObject *)&LxmlElementIteratorType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2125; __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 = 2157; __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 = 2157; __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 = 2157; __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 = 2180; __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 = 2180; __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 = 2180; __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 = 2194; __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 = 2194; __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 = 2194; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeAnyTag = (void(*)(void))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeMatchTag = (void(*)(void))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag; + #endif + __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 = 2203; __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 = 2203; __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 = 2203; __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 = 2281; __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 = 2281; __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 = 2390; __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 = 2390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree_CDATA = &__pyx_type_4lxml_5etree_CDATA; + __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *))__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy__assertNode; + __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.free_after_use = (void (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *))__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy_free_after_use; + __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.getchildren = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy_getchildren; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy._assertNode = (void(*)(void))__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy__assertNode; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.free_after_use = (void(*)(void))__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy_free_after_use; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.getchildren = (void(*)(void))__pyx_f_4lxml_5etree_21_ReadOnlyElementProxy_getchildren; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __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 = 3; __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 = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = &__pyx_type_4lxml_5etree__ReadOnlyElementProxy; + __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy = &__pyx_vtable_4lxml_5etree__AppendOnlyElementProxy; + __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.append = (void(*)(void))__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append; + #endif + __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 = 279; __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 = 279; __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 = 279; __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;} + 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 = 99; __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 = 99; __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 = 99; __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 = 113; __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 = 113; __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 = 113; __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 = 127; __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 = 127; __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 = 127; __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 = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ElementClassLookup", (PyObject *)&LxmlElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree_ElementClassLookup = &LxmlElementClassLookupType; + __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup = &__pyx_vtable_4lxml_5etree_FallbackElementClassLookup; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree_FallbackElementClassLookup._setFallback = (void (*)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *))__pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_FallbackElementClassLookup._setFallback = (void(*)(void))__pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback; + #endif + LxmlFallbackElementClassLookupType.tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup; + if (PyType_Ready(&LxmlFallbackElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FallbackElementClassLookup", (PyObject *)&LxmlFallbackElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __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 = 199; __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 = 199; __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 = 280; __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 = 280; __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 = 280; __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 = 330; __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 = 330; __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 = 330; __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 = 347; __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 = 347; __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 = 347; __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 = 405; __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 = 405; __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 = 405; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__NamespaceRegistry._get = (void(*)(void))__pyx_f_4lxml_5etree_18_NamespaceRegistry__get; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__NamespaceRegistry._getForString = (void(*)(void))__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString; + #endif + 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 = 186; __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 = 186; __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 = 186; __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 = 199; __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 = 199; __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 = 199; __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 = 9; __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 = 9; __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 = 15; __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 = 15; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ResolverRegistry._copy = (void(*)(void))__pyx_f_4lxml_5etree_17_ResolverRegistry__copy; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__ResolverRegistry) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 101; __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 = 101; __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 = 101; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base.clear = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_16_ResolverContext_clear; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base.clear = (void(*)(void))__pyx_f_4lxml_5etree_16_ResolverContext_clear; + #endif + __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 = 148; __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 = 148; __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 = 148; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext._copy = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext__copy; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext._initParserContext = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext__initParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext._resetParserContext = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext__resetParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext.prepare = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext_prepare; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext.cleanup = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext_cleanup; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext._handleParseResult = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserContext._handleParseResultDoc = (void(*)(void))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc; + #endif + __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[2]; __pyx_lineno = 470; __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[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ParserContext", (PyObject *)&__pyx_type_4lxml_5etree__ParserContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base._initParserContext = (void(*)(void))__pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserContext._setSaxParserTarget = (void(*)(void))__pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserContext._handleSaxException = (void(*)(void))__pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._copy = (void(*)(void))__pyx_f_4lxml_5etree_20_TargetParserContext__copy; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResult = (void(*)(void))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResultDoc = (void(*)(void))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TargetParserContext._setTarget = (void(*)(void))__pyx_f_4lxml_5etree_20_TargetParserContext__setTarget; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__TargetParserContext._cleanupTargetParserContext = (void(*)(void))__pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.copy = (void(*)(void))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.inject_default_attributes = (void(*)(void))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.connect = (void(*)(void))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.disconnect = (void(*)(void))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.isvalid = (void(*)(void))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserSchemaValidationContext) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 170; __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 = 170; __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = &__pyx_type_4lxml_5etree__ParserSchemaValidationContext; + if (PyType_Ready(&__pyx_type_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2735; __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 = 2735; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_XMLSchema._newSaxValidator = (void(*)(void))__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator; + #endif + __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;} + 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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.initMainParserContext = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext._findThreadParserContext = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.setDefaultParser = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.getDefaultParser = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext._getThreadDict = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.initThreadDictRef = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.initParserDict = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.initXPathParserDict = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.initDocDict = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.findImpliedContext = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContextFromParser = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContext = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ParserDictionaryContext.popImpliedContext = (void(*)(void))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserDictionaryContext) < 0) {__pyx_filename = __pyx_f[2]; __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[2]; __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[2]; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FileReaderContext._createParserInputBuffer = (void(*)(void))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FileReaderContext._createParserInput = (void(*)(void))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FileReaderContext._readDtd = (void(*)(void))__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FileReaderContext._readDoc = (void(*)(void))__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FileReaderContext.copyToBuffer = (void(*)(void))__pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 259; __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[2]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_FileReaderContext", (PyObject *)&__pyx_type_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 259; __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[2]; __pyx_lineno = 1006; __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[2]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_FeedParser", (PyObject *)&__pyx_type_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1006; __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[2]; __pyx_lineno = 1185; __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[2]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "XMLParser", (PyObject *)&__pyx_type_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1185; __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[2]; __pyx_lineno = 1267; __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[2]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ETCompatXMLParser", (PyObject *)&__pyx_type_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1267; __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[2]; __pyx_lineno = 1343; __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[2]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "HTMLParser", (PyObject *)&__pyx_type_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1343; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxStart = (void(*)(void))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxEnd = (void(*)(void))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxData = (void(*)(void))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxDoctype = (void(*)(void))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxPi = (void(*)(void))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxComment = (void(*)(void))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment; + #endif + 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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxStart = (void(*)(void))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxEnd = (void(*)(void))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxData = (void(*)(void))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxPi = (void(*)(void))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxComment = (void(*)(void))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_TreeBuilder._flush = (void(*)(void))__pyx_f_4lxml_5etree_11TreeBuilder__flush; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxStart = (void(*)(void))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxEnd = (void(*)(void))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxData = (void(*)(void))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxDoctype = (void(*)(void))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxPi = (void(*)(void))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxComment = (void(*)(void))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FilelikeWriter._createOutputBuffer = (void(*)(void))__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FilelikeWriter.write = (void(*)(void))__pyx_f_4lxml_5etree_15_FilelikeWriter_write; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__FilelikeWriter.close = (void(*)(void))__pyx_f_4lxml_5etree_15_FilelikeWriter_close; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 304; __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[3]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_FilelikeWriter", (PyObject *)&__pyx_type_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 304; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IterparseContext.__pyx_base._initParserContext = (void(*)(void))__pyx_f_4lxml_5etree_17_IterparseContext__initParserContext; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IterparseContext._setEventFilter = (void(*)(void))__pyx_f_4lxml_5etree_17_IterparseContext__setEventFilter; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IterparseContext.startNode = (void(*)(void))__pyx_f_4lxml_5etree_17_IterparseContext_startNode; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IterparseContext.endNode = (void(*)(void))__pyx_f_4lxml_5etree_17_IterparseContext_endNode; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IterparseContext.pushEvent = (void(*)(void))__pyx_f_4lxml_5etree_17_IterparseContext_pushEvent; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IterparseContext._assureDocGetsFreed = (void(*)(void))__pyx_f_4lxml_5etree_17_IterparseContext__assureDocGetsFreed; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_iterparse.__pyx_base._createContext = (void(*)(void))__pyx_f_4lxml_5etree_9iterparse__createContext; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_iterwalk._setTagFilter = (void(*)(void))__pyx_f_4lxml_5etree_8iterwalk__setTagFilter; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_iterwalk._start_node = (void(*)(void))__pyx_f_4lxml_5etree_8iterwalk__start_node; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_iterwalk._end_node = (void(*)(void))__pyx_f_4lxml_5etree_8iterwalk__end_node; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 527; __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 = 527; __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 = 527; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IDDict._build_keys = (void(*)(void))__pyx_f_4lxml_5etree_7_IDDict__build_keys; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__IDDict._build_items = (void(*)(void))__pyx_f_4lxml_5etree_7_IDDict__build_items; + #endif + 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;} + 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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExsltRegExp._make_string = (void(*)(void))__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExsltRegExp._compile = (void(*)(void))__pyx_f_4lxml_5etree_12_ExsltRegExp__compile; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__ExsltRegExp._register_in_context = (void(*)(void))__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __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[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ExsltRegExp", (PyObject *)&__pyx_type_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._copy = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__copy; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._to_utf = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__to_utf; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._set_xpath_context = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._register_context = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__register_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._cleanup_context = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._release_context = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__release_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.addNamespace = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_addNamespace; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.registerNamespace = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.registerLocalNamespaces = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.registerGlobalNamespaces = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalNamespaces = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._unregisterNamespace = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._addLocalExtensionFunction = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.registerGlobalFunctions = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.registerLocalFunctions = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.unregisterAllFunctions = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalFunctions = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._find_cached_function = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._release_temp_refs = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__BaseContext._hold = (void(*)(void))__pyx_f_4lxml_5etree_12_BaseContext__hold; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseContext) < 0) {__pyx_filename = __pyx_f[5]; __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[5]; __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[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree__BaseContext = &__pyx_type_4lxml_5etree__BaseContext; + #if PY_MAJOR_VERSION >= 3 + __pyx_ptype_4lxml_6python_unicode = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "str", sizeof(PyUnicodeObject)); if (unlikely(!__pyx_ptype_4lxml_6python_unicode)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_ptype_4lxml_6python_unicode = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "unicode", sizeof(PyUnicodeObject)); if (unlikely(!__pyx_ptype_4lxml_6python_unicode)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __pyx_type_4lxml_5etree__ElementUnicodeResult.tp_base = __pyx_ptype_4lxml_6python_unicode; + if (PyType_Ready(&__pyx_type_4lxml_5etree__ElementUnicodeResult) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ElementUnicodeResult", (PyObject *)&__pyx_type_4lxml_5etree__ElementUnicodeResult) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 590; __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; + #if PY_MAJOR_VERSION >= 3 + __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.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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext.set_context = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext_set_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext.register_context = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext_register_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext.unregister_context = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext_unregister_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext.registerVariables = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext_registerVariables; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext.registerVariable = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext_registerVariable; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext._registerVariable = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext__registerVariable; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathContext._setupDict = (void(*)(void))__pyx_f_4lxml_5etree_13_XPathContext__setupDict; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase.set_context = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase._checkAbsolutePath = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase._lock = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase._unlock = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase._raise_parse_error = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_parse_error; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase._raise_eval_error = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_eval_error; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XPathEvaluatorBase._handle_result = (void(*)(void))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 102; __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 = 102; __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 = 102; __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 = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPathElementEvaluator.tp_dict, __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 224; __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 = 224; __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 = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPathDocumentEvaluator.tp_dict, __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 299; __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 = 299; __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 = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPath.tp_dict, __pyx_vtabptr_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 379; __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 = 379; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree_ETXPath._nsextract_path = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *))__pyx_f_4lxml_5etree_7ETXPath__nsextract_path; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_ETXPath._nsextract_path = (void(*)(void))__pyx_f_4lxml_5etree_7ETXPath__nsextract_path; + #endif + __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 = 451; __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 = 451; __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 = 451; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XSLTResolverContext._copy = (void(*)(void))__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy; + #endif + __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_XSLTAccessControl._setAccess = (void(*)(void))__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_XSLTAccessControl._register_in_context = (void(*)(void))__pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree_XSLTAccessControl._optval = (void(*)(void))__pyx_f_4lxml_5etree_17XSLTAccessControl__optval; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 167; __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 = 167; __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 = 167; __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; + #if PY_MAJOR_VERSION >= 3 + __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; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base._copy = (void(*)(void))__pyx_f_4lxml_5etree_12_XSLTContext__copy; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XSLTContext.register_context = (void(*)(void))__pyx_f_4lxml_5etree_12_XSLTContext_register_context; + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XSLTContext.free_context = (void(*)(void))__pyx_f_4lxml_5etree_12_XSLTContext_free_context; + #endif + __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 = 270; __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 = 270; __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 = 270; __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 = 318; __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 = 318; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree_XSLT._run_transform = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, PyObject *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *))__pyx_f_4lxml_5etree_4XSLT__run_transform; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree_XSLT._run_transform = (void(*)(void))__pyx_f_4lxml_5etree_4XSLT__run_transform; + #endif + if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLT.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 327; __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 = 327; __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; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_4lxml_5etree__XSLTResultTree._saveToStringAndSize = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, char **, int *))__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize; + #else + *(void(**)(void))&__pyx_vtable_4lxml_5etree__XSLTResultTree._saveToStringAndSize = (void(*)(void))__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize; + #endif + __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 = 660; __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 = 660; __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 = 660; __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 = 814; __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 = 814; __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 = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = &__pyx_type_4lxml_5etree__XSLTProcessingInstruction; + 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_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_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;} + 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_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;} + 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_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;} + 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 ---*/ + __pyx_ptype_4lxml_6python_slice = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "slice", sizeof(PySliceObject)); if (unlikely(!__pyx_ptype_4lxml_6python_slice)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":5 + * """ + * + * __docformat__ = u"restructuredtext en" # <<<<<<<<<<<<<< + * + * cimport tree, python, config + */ + if (PyObject_SetAttr(__pyx_m, __pyx_kp___docformat__, ((PyObject *)__pyx_kp_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":14 + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":15 + * + * try: + * import __builtin__ # <<<<<<<<<<<<<< + * except ImportError: + * # Python 3 + */ + __pyx_1 = __Pyx_Import(__pyx_kp___builtin__, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_GOTREF(__pyx_1); + if (PyObject_SetAttr(__pyx_m, __pyx_kp___builtin__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_DECREF(__pyx_1); __pyx_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_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":16 + * try: + * import __builtin__ + * except ImportError: # <<<<<<<<<<<<<< + * # Python 3 + * import builtins as __builtin__ + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_ImportError); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":18 + * except ImportError: + * # Python 3 + * import builtins as __builtin__ # <<<<<<<<<<<<<< + * + * cdef object _unicode + */ + __pyx_1 = __Pyx_Import(__pyx_kp_builtins, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;} + __Pyx_GOTREF(__pyx_1); + if (PyObject_SetAttr(__pyx_m, __pyx_kp___builtin__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __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; + goto __pyx_L3_exception_handled; + } + __pyx_L4_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":21 + * + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":22 + * cdef object _unicode + * try: + * _unicode = __builtin__.unicode # <<<<<<<<<<<<<< + * except AttributeError: + * # Python 3 + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp___builtin__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_unicode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":23 + * try: + * _unicode = __builtin__.unicode + * except AttributeError: # <<<<<<<<<<<<<< + * # Python 3 + * _unicode = __builtin__.str + */ + __pyx_2 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":25 + * except AttributeError: + * # Python 3 + * _unicode = __builtin__.str # <<<<<<<<<<<<<< + * + * del __builtin__ + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp___builtin__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_1, __pyx_kp_str); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_5etree__unicode); + __Pyx_DECREF(__pyx_v_4lxml_5etree__unicode); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree__unicode = __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; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L13_exception_handled; + } + __pyx_L14_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":27 + * _unicode = __builtin__.str + * + * del __builtin__ # <<<<<<<<<<<<<< + * + * cdef object os_path_abspath + */ + if (__Pyx_DelAttrString(__pyx_m, "__builtin__") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":30 + * + * 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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_abspath); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_abspath); + __Pyx_GIVEREF(__pyx_kp_abspath); + __pyx_1 = __Pyx_Import(__pyx_kp_38, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_abspath); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_os_path_abspath); + __Pyx_DECREF(__pyx_v_4lxml_5etree_os_path_abspath); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_os_path_abspath = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":33 + * + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":34 + * cdef object BytesIO, StringIO + * try: + * from io import BytesIO, StringIO # <<<<<<<<<<<<<< + * except (ImportError, AttributeError): + * from StringIO import StringIO, StringIO as BytesIO + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L22_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_BytesIO); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_BytesIO); + __Pyx_GIVEREF(__pyx_kp_BytesIO); + __Pyx_INCREF(__pyx_kp_StringIO); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_StringIO); + __Pyx_GIVEREF(__pyx_kp_StringIO); + __pyx_1 = __Pyx_Import(__pyx_kp_io, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L22_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_BytesIO); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L22_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_BytesIO); + __Pyx_DECREF(__pyx_v_4lxml_5etree_BytesIO); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_BytesIO = __pyx_3; + __pyx_3 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_StringIO); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L22_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_StringIO); + __Pyx_DECREF(__pyx_v_4lxml_5etree_StringIO); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_StringIO = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __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; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":35 + * try: + * from io import BytesIO, StringIO + * except (ImportError, AttributeError): # <<<<<<<<<<<<<< + * from StringIO import StringIO, StringIO as BytesIO + * + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_builtin_ImportError); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_ImportError); + __Pyx_GIVEREF(__pyx_builtin_ImportError); + __Pyx_INCREF(__pyx_builtin_AttributeError); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_AttributeError); + __Pyx_GIVEREF(__pyx_builtin_AttributeError); + __pyx_2 = PyErr_ExceptionMatches(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":36 + * from io import BytesIO, StringIO + * except (ImportError, AttributeError): + * from StringIO import StringIO, StringIO as BytesIO # <<<<<<<<<<<<<< + * + * cdef object _elementpath + */ + __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_StringIO); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_StringIO); + __Pyx_GIVEREF(__pyx_kp_StringIO); + __Pyx_INCREF(__pyx_kp_StringIO); + PyList_SET_ITEM(__pyx_t_4, 1, __pyx_kp_StringIO); + __Pyx_GIVEREF(__pyx_kp_StringIO); + __pyx_1 = __Pyx_Import(__pyx_kp_StringIO, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_StringIO); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_StringIO); + __Pyx_DECREF(__pyx_v_4lxml_5etree_StringIO); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_StringIO = __pyx_3; + __pyx_3 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_StringIO); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_BytesIO); + __Pyx_DECREF(__pyx_v_4lxml_5etree_BytesIO); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_BytesIO = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __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; + goto __pyx_L23_exception_handled; + } + __pyx_L24_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":39 + * + * cdef object _elementpath + * import _elementpath # <<<<<<<<<<<<<< + * + * cdef object sys + */ + __pyx_1 = __Pyx_Import(__pyx_kp__elementpath, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__elementpath); + __Pyx_DECREF(__pyx_v_4lxml_5etree__elementpath); + __Pyx_GIVEREF(__pyx_1); + __pyx_v_4lxml_5etree__elementpath = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":42 + * + * cdef object sys + * import sys # <<<<<<<<<<<<<< + * + * cdef object re + */ + __pyx_3 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_sys); + __Pyx_DECREF(__pyx_v_4lxml_5etree_sys); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_sys = __pyx_3; + __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":45 + * + * cdef object re + * import re # <<<<<<<<<<<<<< + * + * cdef object gzip + */ + __pyx_1 = __Pyx_Import(__pyx_kp_re, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_re); + __Pyx_DECREF(__pyx_v_4lxml_5etree_re); + __Pyx_GIVEREF(__pyx_1); + __pyx_v_4lxml_5etree_re = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":48 + * + * cdef object gzip + * import gzip # <<<<<<<<<<<<<< + * + * cdef object ITER_EMPTY + */ + __pyx_3 = __Pyx_Import(__pyx_kp_gzip, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_gzip); + __Pyx_DECREF(__pyx_v_4lxml_5etree_gzip); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_gzip = __pyx_3; + __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":51 + * + * 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 = 51; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":54 + * + * cdef object EMPTY_READ_ONLY_DICT + * EMPTY_READ_ONLY_DICT = python.PyDictProxy_New({}) # <<<<<<<<<<<<<< + * + * # the rules + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_3 = PyDictProxy_New(((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 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_3); + __pyx_v_4lxml_5etree_EMPTY_READ_ONLY_DICT = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":70 + * + * # make the compiled-in debug state publicly available + * DEBUG = __DEBUG # <<<<<<<<<<<<<< + * + * # global per-thread setup + */ + if (PyObject_SetAttr(__pyx_m, __pyx_kp_DEBUG, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":73 + * + * # global per-thread setup + * tree.xmlThrDefIndentTreeOutput(1) # <<<<<<<<<<<<<< + * tree.xmlThrDefLineNumbersDefaultValue(1) + * + */ + xmlThrDefIndentTreeOutput(1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":74 + * # global per-thread setup + * tree.xmlThrDefIndentTreeOutput(1) + * tree.xmlThrDefLineNumbersDefaultValue(1) # <<<<<<<<<<<<<< + * + * _initThreadLogging() + */ + xmlThrDefLineNumbersDefaultValue(1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":76 + * tree.xmlThrDefLineNumbersDefaultValue(1) + * + * _initThreadLogging() # <<<<<<<<<<<<<< + * + * # initialize parser (and threading) + */ + __pyx_f_4lxml_5etree__initThreadLogging(); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":79 + * + * # initialize parser (and threading) + * xmlparser.xmlInitParser() # <<<<<<<<<<<<<< + * + * # filename encoding + */ + xmlInitParser(); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":83 + * # filename encoding + * cdef object _FILENAME_ENCODING + * _FILENAME_ENCODING = sys.getfilesystemencoding() # <<<<<<<<<<<<<< + * if _FILENAME_ENCODING is None: + * _FILENAME_ENCODING = sys.getdefaultencoding() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_kp_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __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[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_2); + __pyx_v_4lxml_5etree__FILENAME_ENCODING = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":84 + * cdef object _FILENAME_ENCODING + * _FILENAME_ENCODING = sys.getfilesystemencoding() + * if _FILENAME_ENCODING is None: # <<<<<<<<<<<<<< + * _FILENAME_ENCODING = sys.getdefaultencoding() + * if _FILENAME_ENCODING is None: + */ + __pyx_t_5 = (__pyx_v_4lxml_5etree__FILENAME_ENCODING == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":85 + * _FILENAME_ENCODING = sys.getfilesystemencoding() + * if _FILENAME_ENCODING is None: + * _FILENAME_ENCODING = sys.getdefaultencoding() # <<<<<<<<<<<<<< + * if _FILENAME_ENCODING is None: + * _FILENAME_ENCODING = 'ascii' + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_5etree_sys, __pyx_kp_getdefaultencoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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; + goto __pyx_L32; + } + __pyx_L32:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":86 + * if _FILENAME_ENCODING is None: + * _FILENAME_ENCODING = sys.getdefaultencoding() + * if _FILENAME_ENCODING is None: # <<<<<<<<<<<<<< + * _FILENAME_ENCODING = 'ascii' + * else: + */ + __pyx_t_5 = (__pyx_v_4lxml_5etree__FILENAME_ENCODING == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":87 + * _FILENAME_ENCODING = sys.getdefaultencoding() + * if _FILENAME_ENCODING is None: + * _FILENAME_ENCODING = 'ascii' # <<<<<<<<<<<<<< + * else: + * _FILENAME_ENCODING = _FILENAME_ENCODING.encode(u"UTF-8") + */ + __Pyx_INCREF(__pyx_kp_40); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING); + __Pyx_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING); + __Pyx_GIVEREF(__pyx_kp_40); + __pyx_v_4lxml_5etree__FILENAME_ENCODING = __pyx_kp_40; + goto __pyx_L33; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":89 + * _FILENAME_ENCODING = 'ascii' + * else: + * _FILENAME_ENCODING = _FILENAME_ENCODING.encode(u"UTF-8") # <<<<<<<<<<<<<< + * cdef char* _C_FILENAME_ENCODING + * _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_5etree__FILENAME_ENCODING, __pyx_kp_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __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[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_41)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_41)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_41)); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __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_GOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING); + __Pyx_DECREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_5etree__FILENAME_ENCODING = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L33:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":91 + * _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 = PyString_AS_STRING(__pyx_v_4lxml_5etree__FILENAME_ENCODING); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":95 + * # set up some default namespace prefixes + * cdef object _DEFAULT_NAMESPACE_PREFIXES + * _DEFAULT_NAMESPACE_PREFIXES = { # <<<<<<<<<<<<<< + * "http://www.w3.org/1999/xhtml": "html", + * "http://www.w3.org/1999/XSL/Transform": "xsl", + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":96 + * cdef object _DEFAULT_NAMESPACE_PREFIXES + * _DEFAULT_NAMESPACE_PREFIXES = { + * "http://www.w3.org/1999/xhtml": "html", # <<<<<<<<<<<<<< + * "http://www.w3.org/1999/XSL/Transform": "xsl", + * "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_42, __pyx_kp_43) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":97 + * _DEFAULT_NAMESPACE_PREFIXES = { + * "http://www.w3.org/1999/xhtml": "html", + * "http://www.w3.org/1999/XSL/Transform": "xsl", # <<<<<<<<<<<<<< + * "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + * "http://schemas.xmlsoap.org/wsdl/": "wsdl", + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_44, __pyx_kp_45) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":98 + * "http://www.w3.org/1999/xhtml": "html", + * "http://www.w3.org/1999/XSL/Transform": "xsl", + * "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", # <<<<<<<<<<<<<< + * "http://schemas.xmlsoap.org/wsdl/": "wsdl", + * # xml schema + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_46, __pyx_kp_47) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":99 + * "http://www.w3.org/1999/XSL/Transform": "xsl", + * "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + * "http://schemas.xmlsoap.org/wsdl/": "wsdl", # <<<<<<<<<<<<<< + * # xml schema + * "http://www.w3.org/2001/XMLSchema": "xs", + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_48, __pyx_kp_49) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":101 + * "http://schemas.xmlsoap.org/wsdl/": "wsdl", + * # xml schema + * "http://www.w3.org/2001/XMLSchema": "xs", # <<<<<<<<<<<<<< + * "http://www.w3.org/2001/XMLSchema-instance": "xsi", + * # dublin core + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_50, __pyx_kp_51) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":102 + * # xml schema + * "http://www.w3.org/2001/XMLSchema": "xs", + * "http://www.w3.org/2001/XMLSchema-instance": "xsi", # <<<<<<<<<<<<<< + * # dublin core + * "http://purl.org/dc/elements/1.1/": "dc", + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_52, __pyx_kp_53) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":104 + * "http://www.w3.org/2001/XMLSchema-instance": "xsi", + * # dublin core + * "http://purl.org/dc/elements/1.1/": "dc", # <<<<<<<<<<<<<< + * # objectify + * "http://codespeak.net/lxml/objectify/pytype" : "py", + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_54, __pyx_kp_55) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":106 + * "http://purl.org/dc/elements/1.1/": "dc", + * # objectify + * "http://codespeak.net/lxml/objectify/pytype" : "py", # <<<<<<<<<<<<<< + * } + * + */ + if (PyDict_SetItem(__pyx_3, __pyx_kp_56, __pyx_kp_57) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __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_3)); + __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = ((PyObject *)__pyx_3); + __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":110 + * + * # Error superclass for ElementTree compatibility + * class Error(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __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_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_1), __pyx_kp_Error, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_Error, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":114 + * + * # module level superclass for all exceptions + * class LxmlError(Error): # <<<<<<<<<<<<<< + * u"""Main exception base class for lxml. All other exceptions inherit from + * this one. + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Error); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_58) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_3), __pyx_kp_LxmlError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":118 + * 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 = PyCFunction_New(&__pyx_mdef_4lxml_5etree_9LxmlError___init__, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_4 = PyMethod_New(__pyx_t_1, 0, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_1, __pyx_kp___init__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_LxmlError, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":130 + * + * cdef object _LxmlError + * _LxmlError = LxmlError # <<<<<<<<<<<<<< + * + * cdef object error_super_init + */ + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__LxmlError); + __Pyx_DECREF(__pyx_v_4lxml_5etree__LxmlError); + __Pyx_GIVEREF(__pyx_4); + __pyx_v_4lxml_5etree__LxmlError = __pyx_4; + __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":133 + * + * cdef object error_super_init + * error_super_init = Error.__init__ # <<<<<<<<<<<<<< + * + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Error); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_5etree_error_super_init); + __Pyx_DECREF(__pyx_v_4lxml_5etree_error_super_init); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_5etree_error_super_init = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":137 + * + * # superclass for all syntax errors + * class LxmlSyntaxError(LxmlError, SyntaxError): # <<<<<<<<<<<<<< + * u"""Base class for all syntax errors. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __Pyx_INCREF(__pyx_builtin_SyntaxError); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_SyntaxError); + __Pyx_GIVEREF(__pyx_builtin_SyntaxError); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_59) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_3), __pyx_kp_LxmlSyntaxError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_LxmlSyntaxError, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":142 + * pass + * + * class C14NError(LxmlError): # <<<<<<<<<<<<<< + * u"""Error during C14N serialisation. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_61) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_4), __pyx_kp_60, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_60, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":179 + * + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":181 + * 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_1 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBytes_FromString(xmlParserVersion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_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[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_63)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_63)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_63)); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __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_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_62)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_62)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_62)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_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_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_group); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L34_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; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = __pyx_t_6; + } + __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_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_4); __pyx_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":182 + * _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_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception); + if (__pyx_2) { + __Pyx_AddTraceback("lxml.etree"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":183 + * 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_3 = __Pyx_PyBytes_FromString(xmlParserVersion); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_decode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __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 = 183; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_65)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_65)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_65)); + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_64), __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__Pyx_PrintOne(__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":184 + * 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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L35_exception_handled; + } + __pyx_L36_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":186 + * _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_2 = __pyx_f_4lxml_5etree___unpackIntVersion(__pyx_v_4lxml_5etree__LIBXML_VERSION_INT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_LIBXML_VERSION, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":187 + * + * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT) + * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION) # <<<<<<<<<<<<<< + * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING) + * + */ + __pyx_t_2 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXML_VERSION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_66, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":188 + * 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_2 = __Pyx_PyBytes_FromString(LXML_VERSION_STRING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_f_4lxml_5etree___unpackDottedVersion(__pyx_t_2); 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(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_LXML_VERSION, __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":190 + * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING) + * + * __version__ = (tree.LXML_VERSION_STRING).decode(u"ASCII") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_PyBytes_FromString(LXML_VERSION_STRING); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_67)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_67)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_67)); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __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_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp___version__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":550 + * + * 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_kp_compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":551 + * 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_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_U); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_68)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_68)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_68)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 550; __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_GOTREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING); + __Pyx_DECREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree___RE_XML_ENCODING = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":554 + * + * cdef object __REPLACE_XML_ENCODING + * __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub # <<<<<<<<<<<<<< + * + * cdef object __HAS_XML_ENCODING + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_kp_sub); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING); + __Pyx_DECREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/apihelpers.pxi":557 + * + * cdef object __HAS_XML_ENCODING + * __HAS_XML_ENCODING = __RE_XML_ENCODING.match # <<<<<<<<<<<<<< + * + * cdef object _stripEncodingDeclaration(object xml_string): + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_kp_match); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING); + __Pyx_DECREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree___HAS_XML_ENCODING = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":438 + * + * cdef _BaseErrorLog __GLOBAL_ERROR_LOG + * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE) # <<<<<<<<<<<<<< + * + * cdef _BaseErrorLog _getGlobalErrorLog(): + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_int_100); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_100); + __Pyx_GIVEREF(__pyx_int_100); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__RotatingErrorLog)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseErrorLog))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":592 + * + * + * class ErrorLevels: # <<<<<<<<<<<<<< + * u"Libxml2 error levels" + * + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_69) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1), __pyx_kp_ErrorLevels, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_ErrorLevels, __pyx_3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":595 + * u"Libxml2 error levels" + * + * class ErrorDomains: # <<<<<<<<<<<<<< + * u"Libxml2 error domains" + * + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_70) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_4), __pyx_kp_ErrorDomains, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_ErrorDomains, __pyx_3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":598 + * u"Libxml2 error domains" + * + * class ErrorTypes: # <<<<<<<<<<<<<< + * u"Libxml2 error types" + * + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_71) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1), __pyx_kp_ErrorTypes, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_ErrorTypes, __pyx_3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":601 + * u"Libxml2 error types" + * + * class RelaxNGErrorTypes: # <<<<<<<<<<<<<< + * u"Libxml2 RelaxNG error types" + * + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_72) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_4), __pyx_kp_RelaxNGErrorTypes, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_RelaxNGErrorTypes, __pyx_3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":615 + * + * cdef object __ERROR_LEVELS + * __ERROR_LEVELS = (u"""\ # <<<<<<<<<<<<<< + * NONE=0 + * WARNING=1 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_73)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_73)); + __Pyx_GOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS); + __Pyx_DECREF(__pyx_v_4lxml_5etree___ERROR_LEVELS); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_v_4lxml_5etree___ERROR_LEVELS = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":623 + * + * cdef object __ERROR_DOMAINS + * __ERROR_DOMAINS = (u"""\ # <<<<<<<<<<<<<< + * NONE=0 + * PARSER=1 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_74)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_74)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_74)); + __Pyx_GOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS); + __Pyx_DECREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_v_4lxml_5etree___ERROR_DOMAINS = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":1406 + * I18N_CONV_FAILED=6003 + * """, + * u"""\ # <<<<<<<<<<<<<< + * I18N_NO_OUTPUT=6004 + * CHECK_=6005 + */ + __pyx_t_2 = PyTuple_New(11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_75)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_75)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_75)); + __Pyx_INCREF(((PyObject *)__pyx_kp_76)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_76)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_76)); + __Pyx_INCREF(((PyObject *)__pyx_kp_77)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_kp_77)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_77)); + __Pyx_INCREF(((PyObject *)__pyx_kp_78)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_kp_78)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_78)); + __Pyx_INCREF(((PyObject *)__pyx_kp_79)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_79)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_79)); + __Pyx_INCREF(((PyObject *)__pyx_kp_80)); + PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_80)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_80)); + __Pyx_INCREF(((PyObject *)__pyx_kp_81)); + PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_kp_81)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_81)); + __Pyx_INCREF(((PyObject *)__pyx_kp_82)); + PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_kp_82)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_82)); + __Pyx_INCREF(((PyObject *)__pyx_kp_83)); + PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_kp_83)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_83)); + __Pyx_INCREF(((PyObject *)__pyx_kp_84)); + PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_kp_84)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_84)); + __Pyx_INCREF(((PyObject *)__pyx_kp_85)); + PyTuple_SET_ITEM(__pyx_t_2, 10, ((PyObject *)__pyx_kp_85)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_85)); + __Pyx_GOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES); + __Pyx_DECREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":1413 + * + * cdef object __RELAXNG_ERROR_TYPES + * __RELAXNG_ERROR_TYPES = (u"""\ # <<<<<<<<<<<<<< + * RELAXNG_OK=0 + * RELAXNG_ERR_MEMORY=1 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 1413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_86)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_86)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_86)); + __Pyx_GOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES); + __Pyx_DECREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlerror.pxi":1457 + * # --- END: GENERATED CONSTANTS --- + * + * __initErrorConstants() # <<<<<<<<<<<<<< + */ + __pyx_f_4lxml_5etree___initErrorConstants(); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":392 + * + * cdef object _PREFIX_CACHE + * _PREFIX_CACHE = __initPrefixCache() # <<<<<<<<<<<<<< + * + * cdef extern from "etree_defs.h": + */ + __pyx_t_2 = __pyx_f_4lxml_5etree___initPrefixCache(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__PREFIX_CACHE); + __Pyx_DECREF(__pyx_v_4lxml_5etree__PREFIX_CACHE); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_5etree__PREFIX_CACHE = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1159 + * return _elementFactory(self._doc, c_node) + * + * def itersiblings(self, tag=None, *, preceding=False): # <<<<<<<<<<<<<< + * u"""itersiblings(self, tag=None, preceding=False) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_87 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_87); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1192 + * return ElementDepthFirstIterator(self, tag, inclusive=False) + * + * def iterchildren(self, tag=None, *, reversed=False): # <<<<<<<<<<<<<< + * u"""iterchildren(self, tag=None, reversed=False) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_88 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_88); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1251 + * return ElementDepthFirstIterator(self, tag) + * + * def itertext(self, tag=None, *, with_tail=True): # <<<<<<<<<<<<<< + * u"""itertext(self, tag=None, with_tail=True) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_89 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_89); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1309 + * + * 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_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_90 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_90); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1641 + * + * def write(self, file, *, encoding=None, method=u"xml", + * pretty_print=False, xml_declaration=None, with_tail=True, # <<<<<<<<<<<<<< + * standalone=None, compression=0): + * u"""write(self, file, encoding=None, method="xml", + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_92 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_92); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_93 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_93); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1811 + * + * 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_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_94 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_94); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1906 + * 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_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_95 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_95); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_96 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_96); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2161 + * Iterates over the children of an element. + * """ + * def __init__(self, _Element node not None, tag=None, *, reversed=False): # <<<<<<<<<<<<<< + * cdef xmlNode* c_node + * self._initTagMatch(tag) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_97 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_97); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2186 + * You can pass the boolean keyword ``preceding`` to specify the direction. + * """ + * def __init__(self, _Element node not None, tag=None, *, preceding=False): # <<<<<<<<<<<<<< + * self._initTagMatch(tag) + * if preceding: + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_98 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_98); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2227 + * cdef _Element _next_node + * cdef _Element _top_node + * def __init__(self, _Element node not None, tag=None, *, inclusive=True): # <<<<<<<<<<<<<< + * self._top_node = node + * self._next_node = node + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_99 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_99); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2293 + * cdef object _nextEvent + * cdef _Element _start_element + * def __init__(self, _Element element not None, tag=None, *, with_tail=True): # <<<<<<<<<<<<<< + * if with_tail: + * events = (u"start", u"end") + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_100 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_100); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2388 + * return _elementFactory(doc, c_node) + * + * PI = ProcessingInstruction # <<<<<<<<<<<<<< + * + * cdef class CDATA: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_101); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_PI, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2561 + * return isinstance(element, _Element) + * + * def dump(_Element elem not None, *, pretty_print=True, with_tail=True): # <<<<<<<<<<<<<< + * u"""dump(elem, pretty_print=True, with_tail=True) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_102 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_102); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_103 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_103); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2570 + * + * def tostring(element_or_tree, *, encoding=None, method=u"xml", + * xml_declaration=None, pretty_print=False, with_tail=True, # <<<<<<<<<<<<<< + * standalone=None): + * u"""tostring(element_or_tree, encoding=None, method="xml", + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_105 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_105); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_106 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_106); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2646 + * return [tostring(element_or_tree, *args, **kwargs)] + * + * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False, # <<<<<<<<<<<<<< + * with_tail=True): + * u"""tounicode(element_or_tree, method="xml", pretty_print=False, + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_108 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_108); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2647 + * + * def tounicode(element_or_tree, *, method=u"xml", pretty_print=False, + * with_tail=True): # <<<<<<<<<<<<<< + * u"""tounicode(element_or_tree, method="xml", pretty_print=False, + * with_tail=True) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_109 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_109); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/readonlytree.pxi":157 + * return iter(self.getchildren()) + * + * def iterchildren(self, tag=None, *, reversed=False): # <<<<<<<<<<<<<< + * u"""iterchildren(self, tag=None, reversed=False) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_110 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_k_110); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":499 + * # 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_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_2); + __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":501 + * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup() + * + * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP) # <<<<<<<<<<<<<< + */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_29); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP)); + __pyx_t_4 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_3); __pyx_3 = 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-2.2/src/lxml/nsclasses.pxi":3 + * # module-level API for namespace implementations + * + * class LxmlRegistryError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class of lxml registry errors. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_111) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_LxmlRegistryError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_LxmlRegistryError, __pyx_3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":8 + * pass + * + * class NamespaceRegistryError(LxmlRegistryError): # <<<<<<<<<<<<<< + * u"""Error registering a namespace extension. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlRegistryError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_113) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_112, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_112, __pyx_4) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/nsclasses.pxi":165 + * + * cdef dict __FUNCTION_NAMESPACE_REGISTRIES + * __FUNCTION_NAMESPACE_REGISTRIES = {} # <<<<<<<<<<<<<< + * + * def FunctionNamespace(ns_uri): + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES)); + __Pyx_GIVEREF(((PyObject *)__pyx_3)); + __pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = __pyx_3; + __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":13 + * cdef class XMLSchema(_Validator) + * + * class ParseError(LxmlSyntaxError): # <<<<<<<<<<<<<< + * u"""Syntax error while parsing an XML document. + * + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_114) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_ParseError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_ParseError, __pyx_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":20 + * pass + * + * class XMLSyntaxError(ParseError): # <<<<<<<<<<<<<< + * u"""Syntax error while parsing an XML document. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_ParseError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_115) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_XMLSyntaxError, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":23 + * u"""Syntax error while parsing an XML document. + * """ + * def __init__(self, message, code, line, column): # <<<<<<<<<<<<<< + * if python.PY_VERSION_HEX >= 0x02050000: + * # Python >= 2.5 uses new style class exceptions + */ + __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4lxml_5etree_14XMLSyntaxError___init__, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_3 = PyMethod_New(__pyx_t_4, 0, __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_4, __pyx_kp___init__, __pyx_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XMLSyntaxError, __pyx_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":33 + * + * cdef object _XMLSyntaxError + * _XMLSyntaxError = XMLSyntaxError # <<<<<<<<<<<<<< + * + * class ParserError(LxmlError): + */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSyntaxError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__XMLSyntaxError); + __Pyx_DECREF(__pyx_v_4lxml_5etree__XMLSyntaxError); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree__XMLSyntaxError = __pyx_3; + __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":35 + * _XMLSyntaxError = XMLSyntaxError + * + * class ParserError(LxmlError): # <<<<<<<<<<<<<< + * u"""Internal lxml parser error. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_116) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_ParserError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_ParserError, __pyx_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":182 + * + * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT + * __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext() # <<<<<<<<<<<<<< + * __GLOBAL_PARSER_CONTEXT.initMainParserContext() + * + */ + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserDictionaryContext)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__ParserDictionaryContext))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":183 + * 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-2.2/src/lxml/parser.pxi":201 + * # name of Python unicode encoding as known to libxml2 + * cdef char* _UNICODE_ENCODING + * _UNICODE_ENCODING = NULL # <<<<<<<<<<<<<< + * + * cdef void _setupPythonUnicode(): + */ + __pyx_v_4lxml_5etree__UNICODE_ENCODING = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":253 + * return tree.xmlGetCharEncodingName(enc) + * + * _setupPythonUnicode() # <<<<<<<<<<<<<< + * + * ############################################################ + */ + __pyx_f_4lxml_5etree__setupPythonUnicode(); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":462 + * + * 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-2.2/src/lxml/parser.pxi":464 + * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader() + * + * xmlparser.xmlSetExternalEntityLoader(_local_resolver) # <<<<<<<<<<<<<< + * + * ############################################################ + */ + xmlSetExternalEntityLoader(__pyx_f_4lxml_5etree__local_resolver); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1182 + * 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-2.2/src/lxml/parser.pxi":1229 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_117 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_117); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1230 + * """ + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_118 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_118); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_119 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_119); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_120 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_120); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1231 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_121 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_121); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_122 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_122); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1232 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_123 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_123); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_124 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_124); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_125 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_125); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1233 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_126 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_126); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_127 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_127); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_128 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_128); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1234 + * 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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_129 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_129); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1282 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_130 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_130); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1283 + * """ + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_131 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_131); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_132 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_132); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_133 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_133); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1284 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_134 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_134); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_135 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_135); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1285 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_136 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_136); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_137 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_137); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_138 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_138); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1286 + * 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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_139 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_139); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_140 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_140); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_141 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_141); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1287 + * 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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_142 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_142); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1308 + * + * cdef XMLParser __DEFAULT_XML_PARSER + * __DEFAULT_XML_PARSER = XMLParser() # <<<<<<<<<<<<<< + * + * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER) + */ + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree_XMLParser))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER)); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = ((struct __pyx_obj_4lxml_5etree_XMLParser *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1310 + * __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-2.2/src/lxml/parser.pxi":1340 + * 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-2.2/src/lxml/parser.pxi":1375 + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_143 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_143); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1376 + * """ + * 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_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_144 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_144); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_145 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_145); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_146 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_146); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1377 + * 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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_147 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_147); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1378 + * 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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_148 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_148); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_149 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_149); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parser.pxi":1395 + * + * cdef HTMLParser __DEFAULT_HTML_PARSER + * __DEFAULT_HTML_PARSER = HTMLParser() # <<<<<<<<<<<<<< + * + * ############################################################ + */ + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree_HTMLParser))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER)); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/parsertarget.pxi":4 + * + * cdef object inspect_getargspec + * from inspect import getargspec as inspect_getargspec # <<<<<<<<<<<<<< + * + * class _TargetParserResult(Exception): + */ + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_getargspec); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_kp_getargspec); + __Pyx_GIVEREF(__pyx_kp_getargspec); + __pyx_1 = __Pyx_Import(__pyx_kp_inspect, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_getargspec); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_GOTREF(__pyx_v_4lxml_5etree_inspect_getargspec); + __Pyx_DECREF(__pyx_v_4lxml_5etree_inspect_getargspec); + __Pyx_GIVEREF(__pyx_3); + __pyx_v_4lxml_5etree_inspect_getargspec = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_t_4 = PyTuple_New(1); 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)); + __Pyx_INCREF(__pyx_builtin_Exception); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception); + __Pyx_GIVEREF(__pyx_builtin_Exception); + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp__TargetParserResult, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = PyCFunction_New(&__pyx_mdef_4lxml_5etree_19_TargetParserResult___init__, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_3 = PyMethod_New(__pyx_t_4, 0, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_1, __pyx_kp___init__, __pyx_3) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp__TargetParserResult, __pyx_1) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/serializer.pxi":3 + * # XML serialization and output functions + * + * class SerialisationError(LxmlError): # <<<<<<<<<<<<<< + * u"""A libxml2 error that occurred during serialisation. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_150) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_SerialisationError, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_SerialisationError, __pyx_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":363 + * cdef int (*_parse_chunk)(xmlparser.xmlParserCtxt* ctxt, + * 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_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_151)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_151)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_151)); + __pyx_k_152 = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_152); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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, + * 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 = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_153 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_153); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_154 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_154); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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, + * 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 = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_155 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_155); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); 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_156 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_156); + __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_157 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_157); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":366 + * 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 = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_158 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_158); + __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_159 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_159); + __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_160 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_160); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":367 + * 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 = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_161 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_161); + __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_162 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_162); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":368 + * 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 = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_163 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_163); + __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_164 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_164); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/iterparse.pxi":543 + * cdef char* _tag_name + * + * def __init__(self, element_or_tree, events=(u"end",), tag=None): # <<<<<<<<<<<<<< + * cdef _Element root + * cdef int ns_count + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_165)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_165)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_165)); + __pyx_k_166 = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_166); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xinclude.pxi":5 + * cimport xinclude + * + * class XIncludeError(LxmlError): # <<<<<<<<<<<<<< + * u"""Error during XInclude processing. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_4 = PyTuple_New(1); 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)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_167) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_XIncludeError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XIncludeError, __pyx_3) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":3 + * # support for extension functions in XPath and XSLT + * + * class XPathError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class of all XPath errors. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_168) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_XPathError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XPathError, __pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":8 + * pass + * + * class XPathEvalError(XPathError): # <<<<<<<<<<<<<< + * u"""Error during XPath evaluation. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_169) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_XPathEvalError, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XPathEvalError, __pyx_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":13 + * pass + * + * class XPathFunctionError(XPathEvalError): # <<<<<<<<<<<<<< + * u"""Internal error looking up an XPath extension function. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathEvalError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_170) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_XPathFunctionError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XPathFunctionError, __pyx_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":18 + * pass + * + * class XPathResultError(XPathEvalError): # <<<<<<<<<<<<<< + * u"""Error handling an XPath result. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathEvalError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_171) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_XPathResultError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XPathResultError, __pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":599 + * return self._parent + * + * class _ElementStringResult(str): # <<<<<<<<<<<<<< + * # we need to use a Python class here, str cannot be C-subclassed + * # in Pyrex/Cython + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)&PyString_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type))); + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_174, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/extensions.pxi":602 + * # we need to use a Python class here, str cannot be C-subclassed + * # in Pyrex/Cython + * def getparent(self): # <<<<<<<<<<<<<< + * return self._parent + * + */ + __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4lxml_5etree_20_ElementStringResult_getparent, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_4 = PyMethod_New(__pyx_t_4, 0, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_1, __pyx_kp_getparent, __pyx_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_174, __pyx_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":3 + * # XPath evaluation + * + * class XPathSyntaxError(LxmlSyntaxError, XPathError): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlSyntaxError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_XPathError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(2); 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)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_1 = 0; + __pyx_3 = 0; + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_XPathSyntaxError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XPathSyntaxError, __pyx_1) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_2 = PyInt_FromLong(XML_XPATH_UNFINISHED_LITERAL_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PyInt_FromLong(XML_XPATH_VARIABLE_REF_ERROR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyInt_FromLong(XML_XPATH_INVALID_PREDICATE_ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_8 = PyInt_FromLong(XML_XPATH_UNCLOSED_ERROR); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":16 + * xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR, + * xmlerror.XML_XPATH_UNCLOSED_ERROR, + * xmlerror.XML_XPATH_INVALID_CHAR_ERROR # <<<<<<<<<<<<<< + * ) + * + */ + __pyx_t_7 = PyInt_FromLong(XML_XPATH_INVALID_CHAR_ERROR); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __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_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 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-2.2/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-2.2/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_7 = PyInt_FromLong(XML_XPATH_UNDEF_PREFIX_ERROR); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_8 = PyInt_FromLong(XML_XPATH_UNKNOWN_FUNC_ERROR); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_3 = PyInt_FromLong(XML_XPATH_INVALID_OPERAND); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_1 = PyInt_FromLong(XML_XPATH_INVALID_TYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_2 = PyInt_FromLong(XML_XPATH_INVALID_ARITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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-2.2/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_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + 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_7 = 0; + __pyx_t_8 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_2 = 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-2.2/src/lxml/xpath.pxi":97 + * + * cdef bint _XPATH_VERSION_WARNING_REQUIRED + * if _LIBXML_VERSION_INT == 20627: # <<<<<<<<<<<<<< + * _XPATH_VERSION_WARNING_REQUIRED = 1 + * else: + */ + __pyx_t_5 = (__pyx_v_4lxml_5etree__LIBXML_VERSION_INT == 20627); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":98 + * 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-2.2/src/lxml/xpath.pxi":100 + * _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-2.2/src/lxml/xpath.pxi":239 + * 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 = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_175 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_175); + __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_176 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_176); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":310 + * """ + * 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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_177 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_177); + __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_178 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_178); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":355 + * + * 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 = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_179 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_179); + __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_180 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_180); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":395 + * + * 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 = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_181 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_181); + __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_182 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_182); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":448 + * cdef object _replace_strings + * cdef object _find_namespaces + * _replace_strings = re.compile('("[^"]*")|(\'[^\']*\')').sub # <<<<<<<<<<<<<< + * _find_namespaces = re.compile('({[^}]+})').findall + * + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_compile); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 448; __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[17]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_kp_183); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_183); + __Pyx_GIVEREF(__pyx_kp_183); + __pyx_t_4 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_sub); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_5etree__replace_strings); + __Pyx_DECREF(__pyx_v_4lxml_5etree__replace_strings); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_v_4lxml_5etree__replace_strings = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":449 + * cdef object _find_namespaces + * _replace_strings = re.compile('("[^"]*")|(\'[^\']*\')').sub + * _find_namespaces = re.compile('({[^}]+})').findall # <<<<<<<<<<<<<< + * + * cdef class ETXPath(XPath): + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_compile); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 449; __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[17]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_184); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_184); + __Pyx_GIVEREF(__pyx_kp_184); + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 449; __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_kp_findall); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 449; __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_namespaces); + __Pyx_DECREF(__pyx_v_4lxml_5etree__find_namespaces); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree__find_namespaces = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xpath.pxi":460 + * you pass ``smart_strings=False``. + * """ + * 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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_185 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_185); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_186 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_186); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":5 + * cimport xslt + * + * class XSLTError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class of all XSLT errors. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __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_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_187) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_XSLTError, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XSLTError, __pyx_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":10 + * pass + * + * class XSLTParseError(XSLTError): # <<<<<<<<<<<<<< + * u"""Error parsing a stylesheet document. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __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_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_188) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_XSLTParseError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XSLTParseError, __pyx_3) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":15 + * pass + * + * class XSLTApplyError(XSLTError): # <<<<<<<<<<<<<< + * u"""Error running an XSL transformation. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __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_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_189) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_XSLTApplyError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XSLTApplyError, __pyx_1) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":20 + * pass + * + * class XSLTSaveError(XSLTError): # <<<<<<<<<<<<<< + * u"""Error serialising an XSLT result. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __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_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_190) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_XSLTSaveError, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XSLTSaveError, __pyx_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":25 + * pass + * + * class XSLTExtensionError(XSLTError): # <<<<<<<<<<<<<< + * u"""Error registering an XSLT extension. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_XSLTError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __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_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_191) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_XSLTExtensionError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XSLTExtensionError, __pyx_3) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":31 + * + * # version information + * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION) # <<<<<<<<<<<<<< + * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion) + * + */ + __pyx_t_4 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXSLT_VERSION); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_192, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":32 + * # version information + * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION) + * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __pyx_f_4lxml_5etree___unpackIntVersion(xsltLibxsltVersion); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_LIBXSLT_VERSION, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":160 + * + * 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-2.2/src/lxml/xslt.pxi":162 + * 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-2.2/src/lxml/xslt.pxi":189 + * """ + * cdef xslt.xsltSecurityPrefs* _prefs + * def __init__(self, *, read_file=True, write_file=True, create_dir=True, # <<<<<<<<<<<<<< + * read_network=True, write_network=True): + * self._prefs = xslt.xsltNewSecurityPrefs() + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_193 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_193); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_194 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_194); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_195 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_195); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":190 + * cdef xslt.xsltSecurityPrefs* _prefs + * def __init__(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_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_196 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_196); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_197 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_197); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":200 + * 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_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":201 + * + * DENY_ALL = XSLTAccessControl( + * read_file=False, write_file=False, create_dir=False, # <<<<<<<<<<<<<< + * read_network=False, write_network=False) + * + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_4, __pyx_kp_read_file, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_4, __pyx_kp_write_file, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_4, __pyx_kp_create_dir, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":202 + * DENY_ALL = XSLTAccessControl( + * read_file=False, write_file=False, create_dir=False, + * read_network=False, write_network=False) # <<<<<<<<<<<<<< + * + * DENY_WRITE = XSLTAccessControl( + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_4, __pyx_kp_read_network, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_4, __pyx_kp_write_network, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __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_XSLTAccessControl)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dict, __pyx_kp_DENY_ALL, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":204 + * 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_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":205 + * + * DENY_WRITE = XSLTAccessControl( + * read_file=True, write_file=False, create_dir=False, # <<<<<<<<<<<<<< + * read_network=True, write_network=False) + * + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_3, __pyx_kp_read_file, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_3, __pyx_kp_write_file, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_3, __pyx_kp_create_dir, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":206 + * DENY_WRITE = XSLTAccessControl( + * read_file=True, write_file=False, create_dir=False, + * read_network=True, write_network=False) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_3, __pyx_kp_read_network, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_3, __pyx_kp_write_network, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __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_XSLTAccessControl)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dict, __pyx_kp_DENY_WRITE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":268 + * NULL) + * + * cdef dict EMPTY_DICT = {} # <<<<<<<<<<<<<< + * + * cdef class _XSLTContext(_BaseContext): + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_5etree_EMPTY_DICT)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_5etree_EMPTY_DICT)); + __Pyx_GIVEREF(((PyObject *)__pyx_1)); + __pyx_v_4lxml_5etree_EMPTY_DICT = __pyx_1; + __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":359 + * cdef _ErrorLog _error_log + * + * def __init__(self, xslt_input, *, extensions=None, regexp=True, # <<<<<<<<<<<<<< + * access_control=None): + * cdef xslt.xsltStylesheet* c_style + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_198 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_198); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":424 + * + * @classmethod + * def strparam(_, strval): # <<<<<<<<<<<<<< + * u"""strparam(strval) + * + */ + __pyx_4 = __Pyx_GetName((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_kp_strparam); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_4 = __Pyx_Method_ClassMethod(__pyx_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLT->tp_dict, __pyx_kp_strparam, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":437 + * return _XSLTQuotedStringParam(strval) + * + * def apply(self, _input, *, profile_run=False, **kw): # <<<<<<<<<<<<<< + * u"""apply(self, _input, profile_run=False, **kw) + * + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_199 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_199); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":458 + * return _copyXSLT(self) + * + * def __call__(self, _input, *, profile_run=False, **kw): # <<<<<<<<<<<<<< + * u"""__call__(self, _input, profile_run=False, **kw) + * + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_200 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_k_200); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":782 + * # 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-2.2/src/lxml/xslt.pxi":785 + * + * # enable EXSLT support for XSLT + * xslt.exsltRegisterAll() # <<<<<<<<<<<<<< + * + * + */ + exsltRegisterAll(); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":792 + * + * 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_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_compile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_U); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_201)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_201)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_201)); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_kp_findall); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __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_10); + __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":795 + * + * cdef object _RE_PI_HREF + * _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*["\']([^"\']+)["\']') # <<<<<<<<<<<<<< + * + * cdef object _FIND_PI_HREF + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_4lxml_5etree_re, __pyx_kp_compile); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_INCREF(((PyObject *)__pyx_kp_202)); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_202)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_202)); + __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_5etree__RE_PI_HREF); + __Pyx_DECREF(__pyx_v_4lxml_5etree__RE_PI_HREF); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree__RE_PI_HREF = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":798 + * + * cdef object _FIND_PI_HREF + * _FIND_PI_HREF = _RE_PI_HREF.findall # <<<<<<<<<<<<<< + * + * cdef object _REPLACE_PI_HREF + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_kp_findall); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__FIND_PI_HREF); + __Pyx_DECREF(__pyx_v_4lxml_5etree__FIND_PI_HREF); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree__FIND_PI_HREF = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":801 + * + * cdef object _REPLACE_PI_HREF + * _REPLACE_PI_HREF = _RE_PI_HREF.sub # <<<<<<<<<<<<<< + * + * cdef XPath __findStylesheetByID + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_kp_sub); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF); + __Pyx_DECREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_5etree__REPLACE_PI_HREF = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xslt.pxi":804 + * + * 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":2727 + * # Validation + * + * class DocumentInvalid(LxmlError): # <<<<<<<<<<<<<< + * u"""Validation error. + * + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_203) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_DocumentInvalid, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_DocumentInvalid, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":4 + * cimport dtdvalid + * + * class DTDError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class for DTD errors. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_204) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_DTDError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_DTDError, __pyx_3) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":9 + * pass + * + * class DTDParseError(DTDError): # <<<<<<<<<<<<<< + * u"""Error while parsing a DTD. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_205) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_DTDParseError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_DTDParseError, __pyx_1) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/dtd.pxi":14 + * pass + * + * class DTDValidateError(DTDError): # <<<<<<<<<<<<<< + * u"""Error while validating an XML document with a DTD. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_DTDError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_206) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_DTDValidateError, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_DTDValidateError, __pyx_4) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":4 + * cimport relaxng + * + * class RelaxNGError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class for RelaxNG errors. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_207) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_RelaxNGError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_RelaxNGError, __pyx_3) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":9 + * pass + * + * class RelaxNGParseError(RelaxNGError): # <<<<<<<<<<<<<< + * u"""Error while parsing an XML document as RelaxNG. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_208) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_RelaxNGParseError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_RelaxNGParseError, __pyx_1) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/relaxng.pxi":14 + * pass + * + * class RelaxNGValidateError(RelaxNGError): # <<<<<<<<<<<<<< + * u"""Error while validating an XML document with a RelaxNG schema. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_RelaxNGError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_210) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_209, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_209, __pyx_4) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":4 + * cimport xmlschema + * + * class XMLSchemaError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class of all XML Schema errors + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_211) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1), __pyx_kp_XMLSchemaError, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XMLSchemaError, __pyx_3) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":9 + * pass + * + * class XMLSchemaParseError(XMLSchemaError): # <<<<<<<<<<<<<< + * u"""Error while parsing an XML document as XML Schema. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSchemaError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_212) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_4), __pyx_kp_XMLSchemaParseError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_XMLSchemaParseError, __pyx_1) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":14 + * pass + * + * class XMLSchemaValidateError(XMLSchemaError): # <<<<<<<<<<<<<< + * u"""Error while validating an XML document with an XML Schema. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_XMLSchemaError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_214) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_3), __pyx_kp_213, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_213, __pyx_4) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":23 + * + * 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_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_215)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_215)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_215)); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/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_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + if (PyDict_SetItem(__pyx_4, ((PyObject *)__pyx_kp_216), ((PyObject *)__pyx_kp_217)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_1, __pyx_kp_namespaces, ((PyObject *)__pyx_4)) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + __pyx_t_11 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_4lxml_5etree_XPath))) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_11); + __pyx_v_4lxml_5etree__check_for_default_attributes = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/xmlschema.pxi":40 + * cdef bint _add_attribute_defaults + * + * def __init__(self, etree=None, *, file=None, attribute_defaults=False): # <<<<<<<<<<<<<< + * cdef _Document doc + * cdef _Element root_node + */ + __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_k_218 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_GIVEREF(__pyx_k_218); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":4 + * cimport schematron + * + * class SchematronError(LxmlError): # <<<<<<<<<<<<<< + * u"""Base class of all Schematron errors. + * """ + */ + __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_3)); + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_LxmlError); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_4); + __Pyx_GIVEREF(__pyx_4); + __pyx_4 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_3), "__doc__", __pyx_kp_219) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_11), ((PyObject *)__pyx_3), __pyx_kp_SchematronError, "lxml.etree"); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_SchematronError, __pyx_1) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":9 + * pass + * + * class SchematronParseError(SchematronError): # <<<<<<<<<<<<<< + * u"""Error while parsing an XML document as Schematron schema. + * """ + */ + __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_SchematronError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_4), "__doc__", __pyx_kp_221) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_11), ((PyObject *)__pyx_4), __pyx_kp_220, "lxml.etree"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_220, __pyx_3) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/schematron.pxi":14 + * pass + * + * class SchematronValidateError(SchematronError): # <<<<<<<<<<<<<< + * u"""Error while validating an XML document with a Schematron schema. + * """ + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_SchematronError); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + if (PyDict_SetItemString(((PyObject *)__pyx_1), "__doc__", __pyx_kp_223) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_11), ((PyObject *)__pyx_1), __pyx_kp_222, "lxml.etree"); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_222, __pyx_4) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/c14n.pxd":1 + * from tree cimport xmlDoc, xmlOutputBuffer # <<<<<<<<<<<<<< + * from xpath cimport xmlNodeSet + * + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __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); + 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_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "lxml.etree.pyx", + "apihelpers.pxi", + "parser.pxi", + "serializer.pxi", + "cleanup.pxi", + "extensions.pxi", + "proxy.pxi", + "xmlerror.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", + "python.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +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 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 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 int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_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; + PyErr_NormalizeException(type, value, tb); + if (PyErr_Occurred()) + goto bad; + Py_INCREF(*type); + Py_INCREF(*value); + Py_INCREF(*tb); + 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; + /* 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: + Py_XDECREF(*type); + Py_XDECREF(*value); + Py_XDECREF(*tb); + return -1; +} + + +static 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 int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (obj == Py_None || PyObject_TypeCheck(obj, type)) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + 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 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; +} + + + + +static INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static 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 INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +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(); + } +} + +static 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 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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *__import__ = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!__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(__import__, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(__import__); + Py_XDECREF(empty_dict); + return module; +} + +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 PyObject *__Pyx_CreateClass( + PyObject *bases, PyObject *dict, PyObject *name, const char *modname) +{ + PyObject *py_modname; + PyObject *result = 0; + + #if PY_MAJOR_VERSION < 3 + py_modname = PyString_FromString(modname); + #else + py_modname = PyUnicode_FromString(modname); + #endif + if (!py_modname) + goto bad; + if (PyDict_SetItemString(dict, "__module__", py_modname) < 0) + goto bad; + #if PY_MAJOR_VERSION < 3 + result = PyClass_New(bases, dict, name); + #else + result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL); + #endif +bad: + Py_XDECREF(py_modname); + return result; +} + +#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 *arg_tuple, int newline) { + PyObject *f; + PyObject* v; + int i; + + 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 *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (!__pyx_print) { + __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + if (!__pyx_print) + return -1; + } + if (!newline) { + if (!__pyx_print_kwargs) { + __pyx_print_kwargs = PyDict_New(); + if (!__pyx_print_kwargs) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (!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 (!result) + return -1; + Py_DECREF(result); + return 0; +} + +#endif + +#if PY_MAJOR_VERSION < 3 + +static int __Pyx_PrintOne(PyObject *o) { + PyObject *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(NULL, 0); +} + +#else /* Python 3 has a print function */ + +static int __Pyx_PrintOne(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(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; + return PyDescr_NewClassMethod(descr->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); + } + PyErr_Format(PyExc_TypeError, "Class-level classmethod() can only be called on a method_descriptor or instance method."); + return NULL; +} + +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) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +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 , */ + 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; +} + +static 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 0; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + 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, + (((unsigned char)-1) > ((unsigned char)0) && 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 INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + 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, + (((unsigned short)-1) > ((unsigned short)0) && 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 INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + 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, + (((unsigned int)-1) > ((unsigned int)0) && 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 INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + 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, + (((char)-1) > ((char)0) && 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 INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + 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, + (((short)-1) > ((short)0) && 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 INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + 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, + (((int)-1) > ((int)0) && 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 INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + 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, + (((signed char)-1) > ((signed char)0) && 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 INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + 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, + (((signed short)-1) > ((signed short)0) && 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 INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + 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, + (((signed int)-1) > ((signed int)0) && 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 INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && 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 (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(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 INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && 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 (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && 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 (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(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 INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && 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 (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(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 INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && 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 (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(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 INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && 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 (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(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 INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && 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 (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && 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 (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(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) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + + + d = PyObject_GetAttrString(__pyx_m, api); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, api, d) < 0) + goto bad; + } + tmp.fp = f; + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); + 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) { + PyObject *pycobj = 0; + int result; + + pycobj = PyCObject_FromVoidPtr(vtable, 0); + if (!pycobj) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#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->is_identifier)) { + *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_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *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 INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static 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 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 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 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 */ diff --git a/src/lxml/lxml.etree.h b/src/lxml/lxml.etree.h new file mode 100644 index 0000000..8fa7519 --- /dev/null +++ b/src/lxml/lxml.etree.h @@ -0,0 +1,191 @@ +#ifndef __PYX_HAVE__lxml__etree +#define __PYX_HAVE__lxml__etree +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +typedef xmlNode *(*_node_to_node_function)(xmlNode *); + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":234 + * + * # 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-2.2/src/lxml/lxml.etree.pyx":235 + * # 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; + PyObject *_attrib; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.etree.pyx":1535 + * + * + * 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-2.2/src/lxml/lxml.etree.pyx":2097 + * + * + * 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-2.2/src/lxml/lxml.etree.pyx":2125 + * 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-2.2/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; +}; + +typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocument *, xmlNode *); + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/classlookup.pxi":148 + * + * # 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-2.2/src/lxml/classlookup.pxi":157 + * 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; +}; + +#ifndef __PYX_HAVE_API__lxml__etree + +__PYX_EXTERN_C DL_IMPORT(struct LxmlElement) *deepcopyNodeToDocument(struct LxmlDocument *, xmlNode *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlElementTree) *elementTreeFactory(struct LxmlElement *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlElementTree) *newElementTree(struct LxmlElement *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlElement) *elementFactory(struct LxmlDocument *, xmlNode *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlElement) *makeElement(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlElement) *makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(void) setElementClassLookupFunction(_element_class_lookup_function, PyObject *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *lookupDefaultElementClass(PyObject *, PyObject *, xmlNode *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *lookupNamespaceElementClass(PyObject *, PyObject *, xmlNode *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); +__PYX_EXTERN_C DL_IMPORT(int) tagMatches(xmlNode *, char *, char *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlDocument) *documentOrRaise(PyObject *); +__PYX_EXTERN_C DL_IMPORT(struct LxmlElement) *rootNodeOrRaise(PyObject *); +__PYX_EXTERN_C DL_IMPORT(int) hasText(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(int) hasTail(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *textOf(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *tailOf(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(int) setNodeText(xmlNode *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(int) setTailText(xmlNode *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *attributeValue(xmlNode *, xmlAttr *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *attributeValueFromNsName(xmlNode *, char *, char *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *iterattributes(struct LxmlElement *, int); +__PYX_EXTERN_C DL_IMPORT(PyObject) *collectAttributes(xmlNode *, int); +__PYX_EXTERN_C DL_IMPORT(int) setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(int) delAttribute(struct LxmlElement *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(int) delAttributeFromNsName(xmlNode *, char *, char *); +__PYX_EXTERN_C DL_IMPORT(int) hasChild(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(xmlNode) *findChild(xmlNode *, Py_ssize_t); +__PYX_EXTERN_C DL_IMPORT(xmlNode) *findChildForwards(xmlNode *, Py_ssize_t); +__PYX_EXTERN_C DL_IMPORT(xmlNode) *findChildBackwards(xmlNode *, Py_ssize_t); +__PYX_EXTERN_C DL_IMPORT(xmlNode) *nextElement(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(xmlNode) *previousElement(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(void) appendChild(struct LxmlElement *, struct LxmlElement *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *pyunicode(char *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *utf8(PyObject *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *getNsTag(PyObject *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *namespacedName(xmlNode *); +__PYX_EXTERN_C DL_IMPORT(PyObject) *namespacedNameFromNsName(char *, char *); +__PYX_EXTERN_C DL_IMPORT(void) iteratorStoreNext(struct LxmlElementIterator *, struct LxmlElement *); +__PYX_EXTERN_C DL_IMPORT(void) initTagMatch(struct LxmlElementTagMatcher *, PyObject *); +__PYX_EXTERN_C DL_IMPORT(xmlNs) *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *, char *, char *); + +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlDocumentType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementTreeType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementTagMatcherType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementIteratorType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementBaseType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlElementClassLookupType; +__PYX_EXTERN_C DL_IMPORT(PyTypeObject) LxmlFallbackElementClassLookupType; + +#endif + +PyMODINIT_FUNC initetree(void); + +#endif diff --git a/src/lxml/lxml.etree.pyx b/src/lxml/lxml.etree.pyx new file mode 100644 index 0000000..a4df214 --- /dev/null +++ b/src/lxml/lxml.etree.pyx @@ -0,0 +1,2783 @@ +u"""The ``lxml.etree`` module implements the extended ElementTree API +for XML. +""" + +__docformat__ = u"restructuredtext en" + +cimport tree, python, config +from tree cimport xmlDoc, xmlNode, xmlAttr, xmlNs, _isElement, _getNs +from python cimport callable, _cstr, _isString +cimport xpath +cimport c14n +cimport cstd + +try: + import __builtin__ +except ImportError: + # Python 3 + import builtins as __builtin__ + +cdef object _unicode +try: + _unicode = __builtin__.unicode +except AttributeError: + # Python 3 + _unicode = __builtin__.str + +del __builtin__ + +cdef object os_path_abspath +from os.path import abspath as os_path_abspath + +cdef object BytesIO, StringIO +try: + from io import BytesIO, StringIO +except (ImportError, AttributeError): + from StringIO import StringIO, StringIO as BytesIO + +cdef object _elementpath +import _elementpath + +cdef object sys +import sys + +cdef object re +import re + +cdef object gzip +import gzip + +cdef object ITER_EMPTY +ITER_EMPTY = iter(()) + +cdef object EMPTY_READ_ONLY_DICT +EMPTY_READ_ONLY_DICT = python.PyDictProxy_New({}) + +# the rules +# any libxml C argument/variable is prefixed with c_ +# any non-public function/class is prefixed with an underscore +# instance creation is always through factories + +# what to do with libxml2/libxslt error messages? +# 0 : drop +# 1 : use log +DEF __DEBUG = 1 + +# maximum number of lines in the libxml2/xslt log if __DEBUG == 1 +DEF __MAX_LOG_SIZE = 100 + +# make the compiled-in debug state publicly available +DEBUG = __DEBUG + +# global per-thread setup +tree.xmlThrDefIndentTreeOutput(1) +tree.xmlThrDefLineNumbersDefaultValue(1) + +_initThreadLogging() + +# initialize parser (and threading) +xmlparser.xmlInitParser() + +# filename encoding +cdef object _FILENAME_ENCODING +_FILENAME_ENCODING = sys.getfilesystemencoding() +if _FILENAME_ENCODING is None: + _FILENAME_ENCODING = sys.getdefaultencoding() +if _FILENAME_ENCODING is None: + _FILENAME_ENCODING = 'ascii' +else: + _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 +cdef object _DEFAULT_NAMESPACE_PREFIXES +_DEFAULT_NAMESPACE_PREFIXES = { + "http://www.w3.org/1999/xhtml": "html", + "http://www.w3.org/1999/XSL/Transform": "xsl", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + "http://schemas.xmlsoap.org/wsdl/": "wsdl", + # xml schema + "http://www.w3.org/2001/XMLSchema": "xs", + "http://www.w3.org/2001/XMLSchema-instance": "xsi", + # dublin core + "http://purl.org/dc/elements/1.1/": "dc", + # objectify + "http://codespeak.net/lxml/objectify/pytype" : "py", +} + +# Error superclass for ElementTree compatibility +class Error(Exception): + pass + +# module level superclass for all exceptions +class LxmlError(Error): + u"""Main exception base class for lxml. All other exceptions inherit from + this one. + """ + def __init__(self, message, error_log=None): + if python.PY_VERSION_HEX >= 0x02050000: + # Python >= 2.5 uses new style class exceptions + super(_LxmlError, self).__init__(message) + else: + error_super_init(self, message) + if error_log is None: + self.error_log = __copyGlobalErrorLog() + else: + self.error_log = error_log.copy() + +cdef object _LxmlError +_LxmlError = LxmlError + +cdef object error_super_init +error_super_init = Error.__init__ + + +# superclass for all syntax errors +class LxmlSyntaxError(LxmlError, SyntaxError): + u"""Base class for all syntax errors. + """ + pass + +class C14NError(LxmlError): + u"""Error during C14N serialisation. + """ + pass + +# 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: + try: + item = int(item) + except ValueError: + if item.startswith(u'dev'): + count = item[3:] + item = -300 + elif item.startswith(u'alpha'): + count = item[5:] + item = -200 + elif item.startswith(u'beta'): + count = item[4:] + item = -100 + else: + count = 0 + if count: + item = item + int(count) + version_list.append(item) + return tuple(version_list) + +cdef __unpackIntVersion(int c_version): + return ( + ((c_version / (100*100)) % 100), + ((c_version / 100) % 100), + (c_version % 100) + ) + +cdef int _LIBXML_VERSION_INT +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") + _LIBXML_VERSION_INT = 0 + +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") + + +# class for temporary storage of Python references +cdef class _TempStore: + cdef list _storage + def __init__(self): + self._storage = [] + + cdef int add(self, obj) except -1: + self._storage.append(obj) + return 0 + + cdef int clear(self) except -1: + del self._storage[:] + return 0 + +# class for temporarily storing exceptions raised in extensions +cdef class _ExceptionContext: + cdef object _exc_info + cdef void clear(self): + self._exc_info = None + + cdef void _store_raised(self): + self._exc_info = sys.exc_info() + + cdef void _store_exception(self, exception): + self._exc_info = (exception, None, None) + + cdef bint _has_raised(self): + return self._exc_info is not None + + 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 + if value is None and traceback is None: + raise type + else: + raise type, value, traceback + + +# forward declarations +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*) + +################################################################################ +# Include submodules + +include "proxy.pxi" # Proxy handling (element backpointers/memory/etc.) +include "apihelpers.pxi" # Private helper functions +include "xmlerror.pxi" # Error and log handling + + +################################################################################ +# Public Python API + +cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]: + u"""Internal base class to reference a libxml document. + + When instances of this class are garbage collected, the libxml + document is cleaned up. + """ + cdef int _ns_counter + cdef object _prefix_tail + cdef xmlDoc* _c_doc + 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 + # the document + #print "freeing document:", self._c_doc + #displayNode(self._c_doc, 0) + #print self._c_doc, self._c_doc.dict is __GLOBAL_PARSER_CONTEXT._c_dict + #print self._c_doc, canDeallocateChildNodes(self._c_doc) + tree.xmlFreeDoc(self._c_doc) + #_deallocDocument(self._c_doc) + + cdef getroot(self): + cdef xmlNode* c_node + c_node = tree.xmlDocGetRootElement(self._c_doc) + if c_node is NULL: + return None + return _elementFactory(self, c_node) + + cdef bint hasdoctype(self): + return self._c_doc.intSubset is not NULL + + cdef getdoctype(self): + cdef tree.xmlDtd* c_dtd + cdef xmlNode* c_root_node + 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: + 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: + 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) + if c_root_node is NULL: + root_name = None + else: + root_name = funicode(c_root_node.name) + return (root_name, public_id, sys_url) + + cdef getxmlinfo(self): + cdef xmlDoc* c_doc + c_doc = self._c_doc + if c_doc.version is NULL: + version = None + else: + version = funicode(c_doc.version) + if c_doc.encoding is NULL: + encoding = None + else: + encoding = funicode(c_doc.encoding) + return (version, encoding) + + cdef isstandalone(self): + if self._c_doc.standalone == -1: + return None + else: + return (self._c_doc.standalone == 1) + + cdef buildNewPrefix(self): + if self._ns_counter < python.PyTuple_GET_SIZE(_PREFIX_CACHE): + ns = python.PyTuple_GET_ITEM(_PREFIX_CACHE, self._ns_counter) + python.Py_INCREF(ns) + else: + ns = python.PyString_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: + # overflow! + self._ns_counter = 0 + if self._prefix_tail is None: + self._prefix_tail = "A" + else: + self._prefix_tail += "A" + return ns + + cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node, + char* c_href, char* c_prefix) except NULL: + u"""Get or create namespace structure for a node. Reuses the prefix if + possible. + """ + cdef xmlNs* c_ns + 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" % ( + c_node.type, tree.XML_ELEMENT_NODE) + # look for existing ns + c_ns = tree.xmlSearchNsByHref(self._c_doc, c_node, c_href) + if c_ns is not NULL: + return c_ns + + if c_prefix is NULL: + dict_result = python.PyDict_GetItem( + _DEFAULT_NAMESPACE_PREFIXES, c_href) + if dict_result is not NULL: + prefix = dict_result + else: + prefix = self.buildNewPrefix() + c_prefix = _cstr(prefix) + + # 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) + + c_ns = tree.xmlNewNs(c_node, c_href, c_prefix) + if c_ns is NULL: + python.PyErr_NoMemory() + 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 + c_ns = self._findOrBuildNodeNs(c_node, href, NULL) + tree.xmlSetNs(c_node, c_ns) + +cdef __initPrefixCache(): + cdef int i + return tuple([ python.PyString_FromFormat("ns%d", i) + for i from 0 <= i < 30 ]) + +cdef object _PREFIX_CACHE +_PREFIX_CACHE = __initPrefixCache() + +cdef extern from "etree_defs.h": + # macro call to 't->tp_new()' for fast instantiation + cdef _Document NEW_DOCUMENT "PY_NEW" (object t) + +cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser): + cdef _Document result + result = NEW_DOCUMENT(_Document) + result._c_doc = c_doc + result._ns_counter = 0 + result._prefix_tail = None + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + result._parser = parser + return result + + +cdef class DocInfo: + u"Document information provided by parser and DTD." + cdef _Document _doc + def __init__(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): + raise ValueError, u"Could not find root node" + + 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 + + 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 + + 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 + + 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 + + property encoding: + u"Returns the encoding name as declared by the document." + def __get__(self): + xml_version, encoding = self._doc.getxmlinfo() + return encoding + + property standalone: + u"""Returns the standalone flag as declared by the document. The possible + values are True (``standalone='yes'``), False + (``standalone='no'`` or flag not provided in the declaration), + and None (unknown or no declaration found). Note that a + normal truth test on this value will always tell if the + ``standalone`` flag was set to ``'yes'`` or not. + """ + def __get__(self): + return self._doc.isstandalone() + + 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 + return _decodeFilename(self._doc._c_doc.URL) + def __set__(self, url): + cdef char* c_oldurl + url = _encodeFilename(url) + 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)) + if c_oldurl is not NULL: + tree.xmlFree(c_oldurl) + + 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: + if system_url: + return u'' % ( + root_name, public_id, system_url) + else: + return u'' % ( + root_name, public_id) + elif system_url: + return u'' % ( + root_name, system_url) + elif self._doc.hasdoctype(): + return u'' % root_name + else: + return u"" + + 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) + + 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) + + +cdef public class _Element [ type LxmlElementType, object LxmlElement ]: + u"""Element class. + + References a document object and a libxml node. + + By pointing to a Document instance, a reference is kept to + _Document as long as there is some pointer to a node in it. + """ + cdef python.PyObject* _gc_doc + cdef _Document _doc + cdef xmlNode* _c_node + cdef object _tag + cdef object _attrib + + def _init(self): + u"""_init(self) + + Called after object initialisation. Custom subclasses may override + this if they recursively call _init() in the superclasses. + """ + + def __dealloc__(self): + #print "trying to free node:", self._c_node + #displayNode(self._c_node, 0) + if self._c_node is not NULL: + _unregisterProxy(self) + attemptDeallocation(self._c_node) + _releaseProxy(self) + + # MANIPULATORS + + def __setitem__(self, x, value): + u"""__setitem__(self, x, value) + + Replaces the given subelement index or slice. + """ + cdef xmlNode* c_node + cdef xmlNode* c_next + cdef xmlDoc* c_source_doc + cdef _Element element + cdef bint left_to_right + cdef Py_ssize_t slicelength, step + if value is None: + raise ValueError, u"cannot assign None" + if python.PySlice_Check(x): + # slice assignment + _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + if step > 0: + left_to_right = 1 + else: + left_to_right = 0 + step = -step + _replaceSlice(self, c_node, slicelength, step, left_to_right, value) + return + else: + # otherwise: normal item assignment + element = value + 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 + _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): + moveNodeToDocument(self._doc, c_node.doc, c_node) + + def __delitem__(self, x): + u"""__delitem__(self, x) + + Deletes the given subelement or a slice. + """ + cdef xmlNode* c_node + cdef xmlNode* c_next + cdef Py_ssize_t step, slicelength + if python.PySlice_Check(x): + # slice deletion + if _isFullSlice(x): + 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: + c_next = _nextElement(c_node) + _removeNode(self._doc, c_node) + c_node = c_next + else: + _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + _deleteSlice(self._doc, c_node, slicelength, step) + else: + # 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) + _removeNode(self._doc, c_node) + + def __deepcopy__(self, memo): + u"__deepcopy__(self, memo)" + return self.__copy__() + + def __copy__(self): + u"__copy__(self)" + cdef xmlDoc* c_doc + cdef xmlNode* c_node + cdef _Document new_doc + 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 + # 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: + return None + return _elementFactory(new_doc, c_node) + + def set(self, key, value): + u"""set(self, key, value) + + Sets an element attribute. + """ + _setAttributeValue(self, key, value) + + def append(self, _Element element not None): + u"""append(self, element) + + Adds a subelement to the end of this element. + """ + _appendChild(self, element) + + def addnext(self, _Element element): + u"""addnext(self, element) + + Adds the element as a following sibling directly after this + element. + + This is normally used to set a processing instruction or comment after + the root node of a document. Note that tail text is automatically + discarded when adding at the root level. + """ + 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 + _appendSibling(self, element) + + def addprevious(self, _Element element): + u"""addprevious(self, element) + + Adds the element as a preceding sibling directly before this + element. + + This is normally used to set a processing instruction or comment + before the root node of a document. Note that tail text is + automatically discarded when adding at the root level. + """ + 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 + _prependSibling(self, element) + + def extend(self, elements): + u"""extend(self, elements) + + Extends the current children by the elements in the iterable. + """ + for element in elements: + _appendChild(self, element) + + def clear(self): + u"""clear(self) + + Resets an element. This function removes all subelements, clears + all attributes and sets the text and tail properties to None. + """ + cdef xmlAttr* c_attr + cdef xmlAttr* c_attr_next + cdef xmlNode* c_node + cdef xmlNode* c_node_next + c_node = self._c_node + # remove self.text and self.tail + _removeText(c_node.children) + _removeText(c_node.next) + # remove all attributes + 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 + # remove all subelements + 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: + c_node_next = _nextElement(c_node) + _removeNode(self._doc, c_node) + c_node = c_node_next + + def insert(self, index, _Element element not None): + u"""insert(self, index, element) + + Inserts a subelement at the given position in this element + """ + cdef xmlNode* c_node + cdef xmlNode* c_next + cdef xmlDoc* c_source_doc + c_node = _findChild(self._c_node, index) + if c_node is NULL: + _appendChild(self, element) + 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) + moveNodeToDocument(self._doc, c_source_doc, element._c_node) + + def remove(self, _Element element not None): + u"""remove(self, element) + + Removes a matching subelement. Unlike the find methods, this + method compares elements based on identity, not on tag value + or contents. + """ + cdef xmlNode* c_node + cdef xmlNode* c_next + 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) + _moveTail(c_next, c_node) + # fix namespace declarations + 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) + + Replaces a subelement with the element passed as second argument. + """ + cdef xmlNode* c_old_node + cdef xmlNode* c_old_next + cdef xmlNode* c_new_node + cdef xmlNode* c_new_next + cdef xmlDoc* c_source_doc + 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 + 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) + moveNodeToDocument(self._doc, c_source_doc, c_new_node) + # fix namespace declarations + moveNodeToDocument(self._doc, c_old_node.doc, c_old_node) + + # PROPERTIES + property tag: + u"""Element tag + """ + def __get__(self): + if self._tag is not None: + return self._tag + self._tag = _namespacedName(self._c_node) + return self._tag + + def __set__(self, value): + cdef _BaseParser parser + ns, name = _getNsTag(value) + parser = self._doc._parser + if parser is not None and parser._for_html: + _htmlTagValidOrRaise(name) + else: + _tagValidOrRaise(name) + self._tag = value + 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)) + + property attrib: + u"""Element attribute dictionary. Where possible, use get(), set(), + keys(), values() and items() to access element attributes. + """ + def __get__(self): + if self._attrib is None: + self._attrib = _Attrib(self) + return self._attrib + + property text: + u"""Text before the first subelement. This is either a string or + the value None, if there was no text. + """ + def __get__(self): + return _collectText(self._c_node.children) + + def __set__(self, value): + if isinstance(value, QName): + 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 + #def __del__(self): + # _setNodeText(self._c_node, None) + + property tail: + u"""Text after this element's end tag, but before the next sibling + element's start tag. This is either a string or the value None, if + there was no text. + """ + def __get__(self): + return _collectText(self._c_node.next) + + def __set__(self, value): + _setTailText(self._c_node, value) + + # using 'del el.tail' is the wrong thing to do + #def __del__(self): + # _setTailText(self._c_node, None) + + # not in ElementTree, read-only + property prefix: + 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: + return funicode(self._c_node.ns.prefix) + return None + + # not in ElementTree, read-only + property sourceline: + u"""Original line number as found by the parser or None if unknown. + """ + def __get__(self): + cdef long line + line = tree.xmlGetLineNo(self._c_node) + if line > 0: + return line + else: + return None + + def __set__(self, line): + if line < 0: + self._c_node.line = 0 + else: + self._c_node.line = line + + # not in ElementTree, read-only + property nsmap: + u"""Namespace prefix->URI mapping known in the context of this Element. + """ + def __get__(self): + cdef xmlNode* c_node + cdef xmlNs* c_ns + cdef dict nsmap = {} + 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: + prefix = None + else: + prefix = funicode(c_ns.prefix) + if not python.PyDict_GetItem(nsmap, prefix): + nsmap[prefix] = funicode(c_ns.href) + c_ns = c_ns.next + c_node = c_node.parent + return nsmap + + # not in ElementTree, read-only + property base: + u"""The base URI of the Element (xml:base or HTML base URL). + None if the base URI is unknown. + + Note that the value depends on the URL of the document that + holds the Element if there is no xml:base attribute on the + Element or its ancestors. + + Setting this property will set an xml:base attribute on the + Element, regardless of the document type (XML or HTML). + """ + def __get__(self): + cdef char* c_base + 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) + base = _decodeFilename(c_base) + tree.xmlFree(c_base) + return base + def __set__(self, url): + cdef char* c_base + if url is None: + c_base = NULL + else: + url = _encodeFilename(url) + c_base = _cstr(url) + tree.xmlNodeSetBase(self._c_node, c_base) + + # ACCESSORS + def __repr__(self): + u"__repr__(self)" + return u"" % (self.tag, id(self)) + + def __getitem__(self, x): + u"""Returns the subelement at the given position or the requested + slice. + """ + cdef xmlNode* c_node + cdef Py_ssize_t step, slicelength + cdef Py_ssize_t c, i + cdef _node_to_node_function next_element + cdef list result + if python.PySlice_Check(x): + # slicing + if _isFullSlice(x): + return _collectChildren(self) + _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + if c_node is NULL: + return [] + if step > 0: + next_element = _nextElement + else: + step = -step + next_element = _previousElement + result = [] + 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: + c_node = next_element(c_node) + return result + else: + # 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) + + def __len__(self): + u"""__len__(self) + + Returns the number of subelements. + """ + return _countElements(self._c_node.children) + + def __nonzero__(self): + u"__nonzero__(self)" + 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.", + FutureWarning + ) + # emulate old behaviour + return _hasChild(self._c_node) + + def __contains__(self, element): + u"__contains__(self, element)" + cdef xmlNode* c_node + 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 + + def __iter__(self): + u"__iter__(self)" + return ElementChildIterator(self) + + def __reversed__(self): + u"__reversed__(self)" + return ElementChildIterator(self, reversed=True) + + def index(self, _Element child not None, start=None, stop=None): + u"""index(self, child, start=None, stop=None) + + Find the position of the child within the parent. + + This method is not part of the original ElementTree API. + """ + cdef Py_ssize_t k, l + cdef Py_ssize_t c_start, c_stop + cdef xmlNode* c_child + cdef xmlNode* c_start_node + 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) + 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): + k = k + 1 + c_child = c_child.prev + return k + + # check indices + if start is None: + c_start = 0 + else: + c_start = start + if stop is None: + c_stop = 0 + 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" + + # 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: + k = -c_start + else: + 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): + 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: + 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 + 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: + if _isElement(c_child): + k = k + 1 + c_child = c_child.prev + if k < c_stop: + return k + else: + # traverse all + while c_child != NULL: + if _isElement(c_child): + k = k + 1 + c_child = c_child.prev + if c_start > 0: + if k >= c_start: + return k + else: + 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" + + def get(self, key, default=None): + u"""get(self, key, default=None) + + Gets an element attribute. + """ + return _getAttributeValue(self, key, default) + + def keys(self): + u"""keys(self) + + Gets a list of attribute names. The names are returned in an + arbitrary order (just like for an ordinary Python dictionary). + """ + return _collectAttributes(self._c_node, 1) + + def values(self): + u"""values(self) + + Gets element attribute values as a sequence of strings. The + attributes are returned in an arbitrary order. + """ + return _collectAttributes(self._c_node, 2) + + def items(self): + u"""items(self) + + Gets element attributes, as a sequence. The attributes are returned in + an arbitrary order. + """ + return _collectAttributes(self._c_node, 3) + + def getchildren(self): + u"""getchildren(self) + + Returns all direct children. The elements are returned in document + order. + + :deprecated: Note that this method has been deprecated as of + ElementTree 1.3 and lxml 2.0. New code should use + ``list(element)`` or simply iterate over elements. + """ + return _collectChildren(self) + + def getparent(self): + u"""getparent(self) + + Returns the parent of this element or None for the root element. + """ + cdef xmlNode* c_node + c_node = _parentElement(self._c_node) + if c_node is NULL: + return None + return _elementFactory(self._doc, c_node) + + def getnext(self): + u"""getnext(self) + + Returns the following sibling of this element or None. + """ + cdef xmlNode* c_node + c_node = _nextElement(self._c_node) + if c_node is NULL: + return None + return _elementFactory(self._doc, c_node) + + def getprevious(self): + u"""getprevious(self) + + Returns the preceding sibling of this element or None. + """ + cdef xmlNode* c_node + c_node = _previousElement(self._c_node) + if c_node is NULL: + return None + return _elementFactory(self._doc, c_node) + + def itersiblings(self, tag=None, *, preceding=False): + u"""itersiblings(self, tag=None, preceding=False) + + Iterate over the following or preceding siblings of this element. + + The direction is determined by the 'preceding' keyword which defaults + to False, i.e. forward iteration over the following siblings. The + generated elements can be restricted to a specific tag name with the + 'tag' keyword. + """ + return SiblingsIterator(self, tag, preceding=preceding) + + def iterancestors(self, tag=None): + u"""iterancestors(self, tag=None) + + Iterate over the ancestors of this element (from parent to parent). + + The generated elements can be restricted to a specific tag name with + the 'tag' keyword. + """ + return AncestorsIterator(self, tag) + + def iterdescendants(self, tag=None): + u"""iterdescendants(self, tag=None) + + Iterate over the descendants of this element in document order. + + As opposed to ``el.iter()``, this iterator does not yield the element + itself. The generated elements can be restricted to a specific tag + name with the 'tag' keyword. + """ + return ElementDepthFirstIterator(self, tag, inclusive=False) + + def iterchildren(self, tag=None, *, reversed=False): + u"""iterchildren(self, tag=None, reversed=False) + + Iterate over the children of this element. + + As opposed to using normal iteration on this element, the generated + elements can be restricted to a specific tag name with the 'tag' + keyword and reversed with the 'reversed' keyword. + """ + return ElementChildIterator(self, tag, reversed=reversed) + + def getroottree(self): + u"""getroottree(self) + + Return an ElementTree for the root node of the document that + contains this element. + + This is the same as following element.getparent() up the tree until it + returns None (for the root element) and then build an ElementTree for + the last parent that was returned.""" + return _elementTreeFactory(self._doc, None) + + def getiterator(self, tag=None): + u"""getiterator(self, tag=None) + + Returns a sequence or iterator of all elements in the subtree in + document order (depth first pre-order), starting with this + element. + + Can be restricted to find only elements with a specific tag + (pass ``tag="xyz"``) or from a namespace (pass ``tag="{ns}*"``). + + You can also pass the Element, Comment, ProcessingInstruction and + Entity factory functions to look only for the specific element type. + + :deprecated: Note that this method is deprecated as of + ElementTree 1.3 and lxml 2.0. It returns an iterator in + lxml, which diverges from the original ElementTree + behaviour. If you want an efficient iterator, use the + ``element.iter()`` method instead. You should only use this + method in new code if you require backwards compatibility + with older versions of lxml or ElementTree. + """ + return ElementDepthFirstIterator(self, tag) + + def iter(self, tag=None): + u"""iter(self, tag=None) + + Iterate over all elements in the subtree in document order (depth + first pre-order), starting with this element. + + Can be restricted to find only elements with a specific tag + (pass ``tag="xyz"``) or from a namespace (pass ``tag="{ns}*"``). + + You can also pass the Element, Comment, ProcessingInstruction and + Entity factory functions to look only for the specific element type. + """ + return ElementDepthFirstIterator(self, tag) + + def itertext(self, tag=None, *, with_tail=True): + u"""itertext(self, tag=None, with_tail=True) + + Iterates over the text content of a subtree. + + You can pass the ``tag`` keyword argument to restrict text content to + a specific tag name. + + You can set the ``with_tail`` keyword argument to ``False`` to skip + over tail text. + """ + 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) + + Creates a new element associated with the same document. + """ + return _makeElement(_tag, NULL, self._doc, None, None, None, + attrib, nsmap, _extra) + + def find(self, path): + u"""find(self, path) + + Finds the first matching subelement, by tag name or path. + """ + if isinstance(path, QName): + path = (path).text + return _elementpath.find(self, path) + + def findtext(self, path, default=None): + u"""findtext(self, path, default=None) + + Finds text for the first matching subelement, by tag name or path. + """ + if isinstance(path, QName): + path = (path).text + return _elementpath.findtext(self, path, default) + + def findall(self, path): + u"""findall(self, path) + + Finds all matching subelements, by tag name or path. + """ + if isinstance(path, QName): + path = (path).text + return _elementpath.findall(self, path) + + def iterfind(self, path): + u"""iterfind(self, path) + + Iterates over all matching subelements, by tag name or path. + """ + if isinstance(path, QName): + path = (path).text + return _elementpath.iterfind(self, path) + + def xpath(self, _path, *, namespaces=None, extensions=None, + smart_strings=True, **_variables): + u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables) + + Evaluate an xpath expression using the element as context node. + """ + evaluator = XPathElementEvaluator(self, namespaces=namespaces, + extensions=extensions, + smart_strings=smart_strings) + return evaluator(_path, **_variables) + + +cdef extern from "etree_defs.h": + # macro call to 't->tp_new()' for fast instantiation + cdef _Element NEW_ELEMENT "PY_NEW" (object t) + +cdef _Element _elementFactory(_Document doc, xmlNode* c_node): + cdef _Element result + result = getProxy(c_node) + if result is not None: + return result + if c_node is NULL: + return None + + 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) + result = NEW_ELEMENT(element_class) + if hasProxy(c_node): + # prevent re-entry race condition - we just called into Python + result._c_node = NULL + return getProxy(c_node) + + _registerProxy(result, doc, c_node) + if element_class is not _Element: + result._init() + return result + + +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): + u"set(self, key, value)" + self._raiseImmutable() + + def append(self, value): + u"append(self, value)" + self._raiseImmutable() + + def insert(self, index, value): + u"insert(self, index, value)" + self._raiseImmutable() + + def __setitem__(self, index, value): + u"__setitem__(self, index, value)" + self._raiseImmutable() + + property attrib: + def __get__(self): + return {} + + property text: + def __get__(self): + if self._c_node.content is NULL: + return '' + else: + return funicode(self._c_node.content) + + def __set__(self, value): + cdef tree.xmlDict* c_dict + cdef char* c_text + if value is None: + c_text = NULL + else: + value = _utf8(value) + c_text = _cstr(value) + tree.xmlNodeSetContent(self._c_node, c_text) + + # ACCESSORS + def __getitem__(self, x): + u"__getitem__(self, x)" + if python.PySlice_Check(x): + return [] + else: + raise IndexError, u"list index out of range" + + def __len__(self): + u"__len__(self)" + return 0 + + def get(self, key, default=None): + u"get(self, key, default=None)" + return None + + def keys(self): + u"keys(self)" + return [] + + def items(self): + u"items(self)" + return [] + + def values(self): + u"values(self)" + return [] + +cdef class _Comment(__ContentOnlyElement): + property tag: + def __get__(self): + return Comment + + def __repr__(self): + return u"" % self.text + +cdef class _ProcessingInstruction(__ContentOnlyElement): + property tag: + def __get__(self): + return ProcessingInstruction + + property target: + # not in ElementTree + def __get__(self): + return funicode(self._c_node.name) + + def __set__(self, value): + value = _utf8(value) + c_text = _cstr(value) + tree.xmlNodeSetName(self._c_node, c_text) + + def __repr__(self): + text = self.text + if text: + return u"" % (self.target, text) + else: + return u"" % self.target + +cdef class _Entity(__ContentOnlyElement): + property tag: + def __get__(self): + return Entity + + property name: + # not in ElementTree + def __get__(self): + return funicode(self._c_node.name) + + 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) + tree.xmlNodeSetName(self._c_node, c_text) + + property text: + # FIXME: should this be None or '&[VALUE];' or the resolved + # entity value ? + def __get__(self): + return u'&%s;' % funicode(self._c_node.name) + + def __repr__(self): + return u"&%s;" % self.name + + +cdef class QName: + u"""QName(text_or_uri, tag=None) + + QName wrapper for qualified XML names. + + Pass a tag name by itself or a namespace URI and a tag name to + create a qualified name. + + The ``text`` property holds the qualified name in + ``{namespace}tagname`` notation. The ``namespace`` and + ``localname`` properties hold the respective parts of the tag + name. + + You can pass QName objects wherever a tag name is expected. Also, + setting Element text from a QName will resolve the namespace + prefix and set a qualified text value. + """ + 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): + 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, ("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 = (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) + 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) + _tagValidOrRaise(tag_utf) + self.localname = python.PyUnicode_FromEncodedObject( + tag_utf, 'UTF-8', NULL) + if ns_utf is None: + self.namespace = None + self.text = self.localname + else: + 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 + def __hash__(self): + return self.text.__hash__() + def __richcmp__(one, other, int op): + if not _isString(one): + one = unicode(one) + if not _isString(other): + other = unicode(other) + return python.PyObject_RichCompare(one, other, op) + + +cdef public class _ElementTree [ type LxmlElementTreeType, + object LxmlElementTree ]: + cdef _Document _doc + cdef _Element _context_node + + # Note that _doc is only used to store the original document if we do not + # have a _context_node. All methods should prefer self._context_node._doc + # 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 + the caller 'forgets' to call parse() afterwards, so this is a bug in + the caller program. + """ + assert self._context_node is not None, \ + 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) + + Updates self with the content of source and returns its root + """ + cdef _Document doc = None + try: + doc = _parseDocument(source, parser, base_url) + 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 + self._context_node = result_container.result + return self._context_node + + def _setroot(self, _Element root not None): + u"""_setroot(self, root) + + Relocate the ElementTree to a new root node. + """ + 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 + + def getroot(self): + u"""getroot(self) + + Gets the root element for this tree. + """ + return self._context_node + + def __copy__(self): + return _elementTreeFactory(self._doc, self._context_node) + + def __deepcopy__(self, memo): + cdef _Element root + 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) + doc = root._doc + c_doc = self._context_node._doc._c_doc + if c_doc.intSubset and not doc._c_doc.intSubset: + doc._c_doc.intSubset = tree.xmlCopyDtd(c_doc.intSubset) + if doc._c_doc.intSubset is NULL: + python.PyErr_NoMemory() + if c_doc.extSubset and not doc._c_doc.extSubset: + 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: + 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) + else: + # so what ... + return self + + # not in ElementTree, read-only + property docinfo: + u"""Information about the document provided by parser and DTD. This + value is only defined for ElementTree objects based on the root node + of a parsed document (e.g. those returned by the parse functions), + not for trees that were built manually. + """ + def __get__(self): + self._assertHasRoot() + return DocInfo(self._context_node._doc) + + # not in ElementTree, read-only + property parser: + 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: + return self._context_node._doc._parser + if self._doc is not None: + return self._doc._parser + return None + + def write(self, file, *, encoding=None, method=u"xml", + pretty_print=False, xml_declaration=None, with_tail=True, + standalone=None, compression=0): + u"""write(self, file, encoding=None, method="xml", + pretty_print=False, xml_declaration=None, with_tail=True, + standalone=None, compression=0) + + Write the tree to a filename, file or file-like object. + + Defaults to ASCII encoding and writing a declaration as needed. + + The keyword argument 'method' selects the output method: 'xml' or + 'html'. + + Passing a boolean value to the ``standalone`` option will + output an XML declaration with the corresponding + ``standalone`` flag. + + The ``compression`` option enables GZip compression level 1-9. + """ + cdef bint write_declaration + cdef int is_standalone + self._assertHasRoot() + # 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' + elif encoding is None: + encoding = u'ASCII' + write_declaration = 0 + else: + encoding = encoding.upper() + write_declaration = encoding not in \ + (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8') + if standalone is None: + is_standalone = -1 + elif standalone: + write_declaration = 1 + is_standalone = 1 + else: + write_declaration = 1 + is_standalone = 0 + if compression is None or compression < 0: + compression = 0 + _tofilelike(file, self._context_node, encoding, method, + write_declaration, 1, pretty_print, with_tail, + is_standalone, compression) + + def getpath(self, _Element element not None): + u"""getpath(self, element) + + Returns a structural, absolute XPath expression to find that element. + """ + cdef _Document doc + cdef xmlDoc* c_doc + cdef char* c_path + doc = self._context_node._doc + if element._doc is not doc: + raise ValueError, u"Element is not in this tree." + c_doc = _fakeRootDoc(doc._c_doc, self._context_node._c_node) + 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) + tree.xmlFree(c_path) + return path + + def getiterator(self, tag=None): + u"""getiterator(self, tag=None) + + Returns a sequence or iterator of all elements in document order + (depth first pre-order), starting with the root element. + + Can be restricted to find only elements with a specific tag + (pass ``tag="xyz"`` or ``tag="{ns}xyz"``) or from a namespace + (pass ``tag="{ns}*"``). + + You can also pass the Element, Comment, ProcessingInstruction and + Entity factory functions to look only for the specific element type. + + :deprecated: Note that this method is deprecated as of + ElementTree 1.3 and lxml 2.0. It returns an iterator in + lxml, which diverges from the original ElementTree + behaviour. If you want an efficient iterator, use the + ``tree.iter()`` method instead. You should only use this + method in new code if you require backwards compatibility + with older versions of lxml or ElementTree. + """ + root = self.getroot() + if root is None: + return () + return root.getiterator(tag) + + def iter(self, tag=None): + u"""iter(self, tag=None) + + Creates an iterator for the root element. The iterator loops over + all elements in this tree, in document order. + """ + root = self.getroot() + if root is None: + return () + return root.iter(tag) + + def find(self, path): + u"""find(self, path) + + Finds the first toplevel element with given tag. Same as + ``tree.getroot().find(path)``. + """ + self._assertHasRoot() + root = self.getroot() + if _isString(path): + start = path[:1] + if start == u"/": + path = u"." + path + elif start == "/": + path = "." + path + return root.find(path) + + def findtext(self, path, default=None): + u"""findtext(self, path, default=None) + + Finds the text for the first element matching the ElementPath + expression. Same as getroot().findtext(path) + """ + self._assertHasRoot() + root = self.getroot() + if _isString(path): + start = path[:1] + if start == u"/": + path = u"." + path + elif start == "/": + path = "." + path + return root.findtext(path, default) + + def findall(self, path): + u"""findall(self, path) + + Finds all elements matching the ElementPath expression. Same as + getroot().findall(path). + """ + self._assertHasRoot() + root = self.getroot() + if _isString(path): + start = path[:1] + if start == u"/": + path = u"." + path + elif start == "/": + path = "." + path + return root.findall(path) + + def iterfind(self, path): + u"""iterfind(self, path) + + Iterates over all elements matching the ElementPath expression. + Same as getroot().finditer(path). + """ + self._assertHasRoot() + root = self.getroot() + if _isString(path): + start = path[:1] + if start == u"/": + path = u"." + path + elif start == "/": + path = "." + path + return root.iterfind(path) + + def xpath(self, _path, *, namespaces=None, extensions=None, + smart_strings=True, **_variables): + u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables) + + XPath evaluate in context of document. + + ``namespaces`` is an optional dictionary with prefix to namespace URI + mappings, used by XPath. ``extensions`` defines additional extension + functions. + + Returns a list (nodeset), or bool, float or string. + + In case of a list result, return Element for element nodes, + string for text and attribute values. + + Note: if you are going to apply multiple XPath expressions + against the same document, it is more efficient to use + XPathEvaluator directly. + """ + self._assertHasRoot() + evaluator = XPathDocumentEvaluator(self, namespaces=namespaces, + extensions=extensions, + smart_strings=smart_strings) + return evaluator(_path, **_variables) + + def xslt(self, _xslt, extensions=None, access_control=None, **_kw): + u"""xslt(self, _xslt, extensions=None, access_control=None, **_kw) + + Transform this document using other document. + + xslt is a tree that should be XSLT + keyword parameters are XSLT transformation parameters. + + Returns the transformed tree. + + Note: if you are going to apply the same XSLT stylesheet against + multiple documents, it is more efficient to use the XSLT + class directly. + """ + self._assertHasRoot() + style = XSLT(_xslt, extensions=extensions, + access_control=access_control) + return style(self, **_kw) + + def relaxng(self, relaxng): + u"""relaxng(self, relaxng) + + Validate this document using other document. + + The relaxng argument is a tree that should contain a Relax NG schema. + + Returns True or False, depending on whether validation + succeeded. + + Note: if you are going to apply the same Relax NG schema against + multiple documents, it is more efficient to use the RelaxNG + class directly. + """ + self._assertHasRoot() + schema = RelaxNG(relaxng) + return schema.validate(self) + + def xmlschema(self, xmlschema): + u"""xmlschema(self, xmlschema) + + Validate this document using other document. + + The xmlschema argument is a tree that should contain an XML Schema. + + Returns True or False, depending on whether validation + succeeded. + + Note: If you are going to apply the same XML Schema against + multiple documents, it is more efficient to use the XMLSchema + class directly. + """ + self._assertHasRoot() + schema = XMLSchema(xmlschema) + return schema.validate(self) + + def xinclude(self): + u"""xinclude(self) + + Process the XInclude nodes in this document and include the + referenced XML fragments. + + There is support for loading files through the file system, HTTP and + FTP. + + Note that XInclude does not support custom resolvers in Python space + due to restrictions of libxml2 <= 2.6.29. + """ + cdef int result + self._assertHasRoot() + 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, + compression=0) + + C14N write of document. Always writes UTF-8. + + The ``compression`` option enables GZip compression level 1-9. + """ + self._assertHasRoot() + if compression is None or compression < 0: + compression = 0 + _tofilelikeC14N(file, self._context_node, exclusive, with_comments, + compression) + +cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node): + return _newElementTree(doc, context_node, _ElementTree) + +cdef _ElementTree _newElementTree(_Document doc, _Element context_node, + object baseclass): + cdef _ElementTree result + result = baseclass() + if context_node is None and doc is not None: + context_node = doc.getroot() + if context_node is None: + result._doc = doc + result._context_node = context_node + return result + + +cdef class _Attrib: + u"""A dict-like proxy for the ``Element.attrib`` property. + """ + cdef _Element _element + def __init__(self, _Element element not None): + self._element = element + + # MANIPULATORS + def __setitem__(self, key, value): + _setAttributeValue(self._element, key, value) + + def __delitem__(self, key): + _delAttribute(self._element, key) + + 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) + + 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) + result = _getAttributeValue(self._element, key, None) + if result is None: + if python.PyTuple_GET_SIZE(default) == 0: + raise KeyError, key + else: + result = python.PyTuple_GET_ITEM(default, 0) + python.Py_INCREF(result) + else: + _delAttribute(self._element, key) + return result + + 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) + + # ACCESSORS + def __repr__(self): + return repr(dict( _attributeIteratorFactory(self._element, 3) )) + + def __getitem__(self, key): + result = _getAttributeValue(self._element, key, None) + if result is None: + raise KeyError, key + else: + return result + + 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: + return 1 + c_attr = c_attr.next + return 0 + + def __len__(self): + cdef xmlAttr* c_attr + 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: + c = c + 1 + c_attr = c_attr.next + return c + + def get(self, key, default=None): + return _getAttributeValue(self._element, key, default) + + def keys(self): + return _collectAttributes(self._element._c_node, 1) + + def __iter__(self): + return iter(_collectAttributes(self._element._c_node, 1)) + + def iterkeys(self): + return iter(_collectAttributes(self._element._c_node, 1)) + + def values(self): + return _collectAttributes(self._element._c_node, 2) + + def itervalues(self): + return iter(_collectAttributes(self._element._c_node, 2)) + + def items(self): + return _collectAttributes(self._element._c_node, 3) + + def iteritems(self): + return iter(_collectAttributes(self._element._c_node, 3)) + + def has_key(self, key): + if key in self: + return True + else: + return False + + def __contains__(self, key): + 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) + if tree.xmlHasNsProp(c_node, _cstr(tag), c_href): + return 1 + else: + return 0 + + def __richcmp__(one, other, int op): + 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) + +cdef class _AttribIterator: + u"""Attribute iterator - for internal use only! + """ + # XML attributes must not be removed while running! + cdef _Element _node + cdef xmlAttr* _c_attr + cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value) + def __iter__(self): + return self + + def __next__(self): + 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: + c_attr = c_attr.next + if c_attr is NULL: + self._node = None + raise StopIteration + + self._c_attr = c_attr.next + if self._keysvalues == 1: + return _namespacedName(c_attr) + elif self._keysvalues == 2: + return _attributeValue(self._node._c_node, c_attr) + else: + return (_namespacedName(c_attr), + _attributeValue(self._node._c_node, c_attr)) + +cdef object _attributeIteratorFactory(_Element element, int keysvalues): + cdef _AttribIterator attribs + if element._c_node.properties is NULL: + return ITER_EMPTY + attribs = _AttribIterator() + attribs._node = element + attribs._c_attr = element._c_node.properties + attribs._keysvalues = keysvalues + return attribs + + +cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher, + type LxmlElementTagMatcherType ]: + cdef object _pystrings + cdef int _node_type + cdef char* _href + cdef char* _name + cdef _initTagMatch(self, tag): + self._href = NULL + self._name = NULL + if tag is None: + 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 + elif tag is Entity: + 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 + 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': + self._name = NULL + +cdef public class _ElementIterator(_ElementTagMatcher) [ + object LxmlElementIterator, type LxmlElementIteratorType ]: + # we keep Python references here to control GC + cdef _Element _node + cdef _node_to_node_function _next_element + def __iter__(self): + return self + + 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 \ + (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 + else: + # Python ref: + self._node = _elementFactory(node._doc, c_node) + + def __next__(self): + cdef xmlNode* c_node + cdef _Element current_node + if self._node is None: + raise StopIteration + # Python ref: + current_node = self._node + self._storeNext(current_node) + return current_node + +cdef class ElementChildIterator(_ElementIterator): + u"""ElementChildIterator(self, node, tag=None, reversed=False) + Iterates over the children of an element. + """ + def __init__(self, _Element node not None, tag=None, *, reversed=False): + cdef xmlNode* c_node + self._initTagMatch(tag) + if reversed: + c_node = _findChildBackwards(node._c_node, 0) + self._next_element = _previousElement + else: + 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 \ + (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: + 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. + + You can pass the boolean keyword ``preceding`` to specify the direction. + """ + def __init__(self, _Element node not None, tag=None, *, preceding=False): + self._initTagMatch(tag) + if preceding: + self._next_element = _previousElement + else: + self._next_element = _nextElement + self._storeNext(node) + +cdef class AncestorsIterator(_ElementIterator): + u"""AncestorsIterator(self, node, tag=None) + Iterates over the ancestors of an element (from parent to parent). + """ + def __init__(self, _Element node not None, tag=None): + self._initTagMatch(tag) + self._next_element = _parentElement + 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 + first pre-order). + + Note that this also includes comments, entities and processing + instructions. To filter them out, check if the ``tag`` property + of the returned element is a string (i.e. not None and not a + factory function), or pass the ``Element`` factory for the ``tag`` + keyword. + + If the optional ``tag`` argument is not None, the iterator returns only + the elements that match the respective name and namespace. + + The optional boolean argument 'inclusive' defaults to True and can be set + to False to exclude the start element itself. + + Note that the behaviour of this iterator is completely undefined if the + tree it traverses is modified during iteration. + """ + # we keep Python references here to control GC + # keep next node to return and the (s)top node + cdef _Element _next_node + cdef _Element _top_node + def __init__(self, _Element node not None, tag=None, *, inclusive=True): + self._top_node = node + self._next_node = node + 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 + not _tagMatches(node._c_node, self._href, self._name)): + # this cannot raise StopIteration, self._next_node != None + self.__next__() + + def __iter__(self): + return self + + def __next__(self): + cdef xmlNode* c_node + cdef _Element current_node + 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: + c_node = self._nextNodeAnyTag(c_node) + else: + 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) + 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: + return c_node + tree.END_FOR_EACH_ELEMENT_FROM(c_node) + return NULL + + 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: + # 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 \ + _tagMatches(c_node, self._href, self._name): + return c_node + tree.END_FOR_EACH_ELEMENT_FROM(c_node) + return NULL + +cdef class ElementTextIterator: + u"""ElementTextIterator(self, element, tag=None, with_tail=True) + Iterates over the text content of a subtree. + + You can pass the ``tag`` keyword argument to restrict text content to a + specific tag name. + + You can set the ``with_tail`` keyword argument to ``False`` to skip over + tail text. + """ + cdef object _nextEvent + cdef _Element _start_element + def __init__(self, _Element element not None, tag=None, *, with_tail=True): + if with_tail: + events = (u"start", u"end") + else: + events = (u"start",) + self._start_element = element + self._nextEvent = iterwalk(element, events=events, tag=tag).__next__ + + def __iter__(self): + return self + + def __next__(self): + cdef _Element element + while result is None: + event, element = self._nextEvent() # raises StopIteration + if event == u"start": + result = element.text + elif element is not self._start_element: + result = element.tail + 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) + return c_node + +cdef xmlNode* _createComment(xmlDoc* c_doc, char* text): + cdef xmlNode* c_node + c_node = tree.xmlNewDocComment(c_doc, text) + 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) + return c_node + +cdef xmlNode* _createEntity(xmlDoc* c_doc, char* name): + cdef xmlNode* c_node + c_node = tree.xmlNewReference(c_doc, name) + return c_node + +# module-level API for ElementTree + +def Element(_tag, attrib=None, nsmap=None, **_extra): + u"""Element(_tag, attrib=None, nsmap=None, **_extra) + + Element factory. This function returns an object implementing the + Element interface. + + Also look at the `_Element.makeelement()` and + `_BaseParser.makeelement()` methods, which provide a faster way to + create an Element within a specific document or parser context. + """ + return _makeElement(_tag, NULL, None, None, None, None, + attrib, nsmap, _extra) + +def Comment(text=None): + u"""Comment(text=None) + + Comment element factory. This factory function creates a special element that will + be serialized as an XML comment. + """ + cdef _Document doc + cdef xmlNode* c_node + cdef xmlDoc* c_doc + if text is None: + text = '' + else: + text = _utf8(text) + c_doc = _newXMLDoc() + doc = _documentFactory(c_doc, None) + c_node = _createComment(c_doc, _cstr(text)) + tree.xmlAddChild(c_doc, c_node) + return _elementFactory(doc, c_node) + +def ProcessingInstruction(target, text=None): + u"""ProcessingInstruction(target, text=None) + + ProcessingInstruction element factory. This factory function creates a + special element that will be serialized as an XML processing instruction. + """ + cdef _Document doc + cdef xmlNode* c_node + cdef xmlDoc* c_doc + target = _utf8(target) + if text is None: + text = '' + else: + text = _utf8(text) + c_doc = _newXMLDoc() + doc = _documentFactory(c_doc, None) + c_node = _createPI(c_doc, _cstr(target), _cstr(text)) + tree.xmlAddChild(c_doc, c_node) + return _elementFactory(doc, c_node) + +PI = ProcessingInstruction + +cdef class CDATA: + u"""CDATA(data) + + CDATA factory. This factory creates an opaque data object that + can be used to set Element text. The usual way to use it is:: + + >>> from lxml import etree + >>> el = etree.Element('content') + >>> el.text = etree.CDATA('a string') + """ + cdef object _utf8_data + def __init__(self, data): + self._utf8_data = _utf8(data) + +def Entity(name): + u"""Entity(name) + + Entity factory. This factory function creates a special element + that will be serialized as an XML entity reference or character + reference. Note, however, that entities will not be automatically + declared in the document. A document that uses entity references + requires a DTD to define the entities. + """ + cdef _Document doc + cdef xmlNode* c_node + cdef xmlDoc* c_doc + cdef char* c_name + 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 + 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) + tree.xmlAddChild(c_doc, c_node) + 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) + + Subelement factory. This function creates an element instance, and + 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): + u"""ElementTree(element=None, file=None, parser=None) + + ElementTree wrapper class. + """ + cdef xmlNode* c_next + cdef xmlNode* c_node + cdef xmlNode* c_node_copy + cdef xmlDoc* c_doc + cdef _ElementTree etree + cdef _Document doc + + if element is not None: + doc = element._doc + elif file is not None: + try: + doc = _parseDocument(file, parser, None) + except _TargetParserResult, result_container: + return result_container.result + else: + c_doc = _newXMLDoc() + doc = _documentFactory(c_doc, parser) + + return _elementTreeFactory(doc, element) + +def HTML(text, _BaseParser parser=None, *, base_url=None): + u"""HTML(text, parser=None, base_url=None) + + Parses an HTML document from a string constant. Returns the root + node (or the result returned by a parser target). This function + can be used to embed "HTML literals" in Python code. + + To override the parser with a different ``HTMLParser`` you can pass it to + the ``parser`` keyword argument. + + The ``base_url`` keyword argument allows to set the original base URL of + the document to support relative Paths when looking up external entities + (DTD, XInclude, ...). + """ + cdef _Document doc + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + if not isinstance(parser, HTMLParser): + parser = __DEFAULT_HTML_PARSER + try: + doc = _parseMemoryDocument(text, base_url, parser) + return doc.getroot() + except _TargetParserResult, result_container: + return result_container.result + +def XML(text, _BaseParser parser=None, *, base_url=None): + u"""XML(text, parser=None, base_url=None) + + Parses an XML document or fragment from a string constant. + Returns the root node (or the result returned by a parser target). + This function can be used to embed "XML literals" in Python code, + like in + + >>> root = etree.XML("") + + To override the parser with a different ``XMLParser`` you can pass it to + the ``parser`` keyword argument. + + The ``base_url`` keyword argument allows to set the original base URL of + the document to support relative Paths when looking up external entities + (DTD, XInclude, ...). + """ + cdef _Document doc + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + if not isinstance(parser, XMLParser): + parser = __DEFAULT_XML_PARSER + try: + doc = _parseMemoryDocument(text, base_url, parser) + return doc.getroot() + except _TargetParserResult, result_container: + return result_container.result + +def fromstring(text, _BaseParser parser=None, *, base_url=None): + u"""fromstring(text, parser=None, base_url=None) + + Parses an XML document or fragment from a string. Returns the + root node (or the result returned by a parser target). + + To override the default parser with a different parser you can pass it to + the ``parser`` keyword argument. + + The ``base_url`` keyword argument allows to set the original base URL of + the document to support relative Paths when looking up external entities + (DTD, XInclude, ...). + """ + cdef _Document doc + try: + doc = _parseMemoryDocument(text, base_url, parser) + return doc.getroot() + except _TargetParserResult, result_container: + return result_container.result + +def fromstringlist(strings, _BaseParser parser=None): + u"""fromstringlist(strings, parser=None) + + Parses an XML document from a sequence of strings. Returns the + root node (or the result returned by a parser target). + + To override the default parser with a different parser you can pass it to + the ``parser`` keyword argument. + """ + cdef _Document doc + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + feed = parser.feed + for data in strings: + feed(data) + return parser.close() + +def iselement(element): + u"""iselement(element) + + Checks if an object appears to be a valid element object. + """ + return isinstance(element, _Element) + +def dump(_Element elem not None, *, pretty_print=True, with_tail=True): + u"""dump(elem, pretty_print=True, with_tail=True) + + Writes an element tree or element structure to sys.stdout. This function + should be used for debugging only. + """ + _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): + u"""tostring(element_or_tree, encoding=None, method="xml", + xml_declaration=None, pretty_print=False, with_tail=True, + standalone=None) + + Serialize an element to an encoded string representation of its XML + tree. + + Defaults to ASCII encoding without XML declaration. This behaviour can be + configured with the keyword arguments 'encoding' (string) and + 'xml_declaration' (bool). Note that changing the encoding to a non UTF-8 + compatible encoding will enable a declaration by default. + + You can also serialise to a Unicode string without declaration by + passing the ``unicode`` function as encoding. + + The keyword argument 'pretty_print' (bool) enables formatted XML. + + The keyword argument 'method' selects the output method: 'xml', + 'html' or plain 'text'. + + Passing a boolean value to the ``standalone`` option will output + an XML declaration with the corresponding ``standalone`` flag. + + You can prevent the tail text of the element from being serialised + by passing the boolean ``with_tail`` option. This has no impact + on the tail text of children, which will always be serialised. + """ + cdef bint write_declaration + cdef int is_standalone + if encoding is _unicode: + if xml_declaration: + raise ValueError, \ + u"Serialisation to unicode must not request an XML declaration" + write_declaration = 0 + 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: + write_declaration = xml_declaration + if encoding is None: + encoding = u'ASCII' + if standalone is None: + is_standalone = -1 + elif standalone: + write_declaration = 1 + is_standalone = 1 + else: + write_declaration = 1 + is_standalone = 0 + + if isinstance(element_or_tree, _Element): + return _tostring(<_Element>element_or_tree, encoding, method, + write_declaration, 0, pretty_print, with_tail, + is_standalone) + elif isinstance(element_or_tree, _ElementTree): + return _tostring((<_ElementTree>element_or_tree)._context_node, + encoding, method, write_declaration, 1, pretty_print, + with_tail, is_standalone) + else: + raise TypeError, u"Type '%s' cannot be serialized." % \ + python._fqtypename(element_or_tree) + +def tostringlist(element_or_tree, *args, **kwargs): + u"""tostringlist(element_or_tree, *args, **kwargs) + + Serialize an element to an encoded string representation of its XML + tree, stored in a list of partial strings. + + This is purely for ElementTree 1.3 compatibility. The result is a + single string wrapped in a list. + """ + return [tostring(element_or_tree, *args, **kwargs)] + +def tounicode(element_or_tree, *, method=u"xml", pretty_print=False, + with_tail=True): + u"""tounicode(element_or_tree, method="xml", pretty_print=False, + with_tail=True) + + Serialize an element to the Python unicode representation of its XML + tree. + + Note that the result does not carry an XML encoding declaration and is + therefore not necessarily suited for serialization to byte streams without + further treatment. + + The boolean keyword argument 'pretty_print' enables formatted XML. + + The keyword argument 'method' selects the output method: 'xml', + 'html' or plain 'text'. + + You can prevent the tail text of the element from being serialised + by passing the boolean ``with_tail`` option. This has no impact + on the tail text of children, which will always be serialised. + + :deprecated: use ``tostring(el, encoding=unicode)`` instead. + """ + if isinstance(element_or_tree, _Element): + return _tostring(<_Element>element_or_tree, _unicode, method, + 0, 0, pretty_print, with_tail, -1) + elif isinstance(element_or_tree, _ElementTree): + return _tostring((<_ElementTree>element_or_tree)._context_node, + _unicode, method, 0, 1, pretty_print, with_tail, + -1) + else: + raise TypeError, u"Type '%s' cannot be serialized." % \ + type(element_or_tree) + +def parse(source, _BaseParser parser=None, *, base_url=None): + u"""parse(source, parser=None, base_url=None) + + Return an ElementTree object loaded with source elements. If no parser + is provided as second argument, the default parser is used. + + The ``base_url`` keyword allows setting a URL for the document + when parsing from a file-like object. This is needed when looking + up external entities (DTD, XInclude, ...) with relative paths. + """ + cdef _Document doc + try: + doc = _parseDocument(source, parser, base_url) + return _elementTreeFactory(doc, None) + except _TargetParserResult, result_container: + return result_container.result + + +################################################################################ +# Include submodules + +include "readonlytree.pxi" # Read-only implementation of Element proxies +include "classlookup.pxi" # Element class lookup mechanisms +include "nsclasses.pxi" # Namespace implementation and registry +include "docloader.pxi" # Support for custom document loaders +include "parser.pxi" # XML Parser +include "saxparser.pxi" # SAX-like Parser interface and tree builder +include "parsertarget.pxi" # ET Parser target +include "serializer.pxi" # XML output functions +include "iterparse.pxi" # incremental XML parsing +include "xmlid.pxi" # XMLID and IDDict +include "xinclude.pxi" # XInclude +include "cleanup.pxi" # Cleanup and recursive element removal functions + + +################################################################################ +# Include submodules for XPath and XSLT + +include "extensions.pxi" # XPath/XSLT extension functions +include "xpath.pxi" # XPath evaluation +include "xslt.pxi" # XSL transformations +include "xsltext.pxi" # XSL extension elements + + +################################################################################ +# Validation + +class DocumentInvalid(LxmlError): + u"""Validation error. + + Raised by all document validators when their ``assertValid(tree)`` + method fails. + """ + pass + +cdef class _Validator: + u"Base class for XML validators." + cdef _ErrorLog _error_log + def __init__(self): + u"__init__(self)" + self._error_log = _ErrorLog() + + def validate(self, etree): + u"""validate(self, etree) + + Validate the document using this schema. + + Returns true if document is valid, false if not. + """ + return self(etree) + + def assertValid(self, etree): + u"""assertValid(self, etree) + + 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"), + self._error_log) + + def assert_(self, etree): + u"""assert_(self, etree) + + 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") + + property error_log: + u"The log of validation errors and warnings." + def __get__(self): + return self._error_log.copy() + +include "dtd.pxi" # DTD +include "relaxng.pxi" # RelaxNG +include "xmlschema.pxi" # XMLSchema +include "schematron.pxi" # Schematron (requires libxml2 2.6.21+) + +################################################################################ +# Public C API + +include "public-api.pxi" diff --git a/src/lxml/lxml.etree_api.h b/src/lxml/lxml.etree_api.h new file mode 100644 index 0000000..d6b51c8 --- /dev/null +++ b/src/lxml/lxml.etree_api.h @@ -0,0 +1,257 @@ +#ifndef __PYX_HAVE_API__lxml__etree +#define __PYX_HAVE_API__lxml__etree +#include "Python.h" +#include "lxml.etree.h" + +static PyTypeObject *__pyx_ptype_4lxml_5etree__Document; +#define LxmlDocumentType (*__pyx_ptype_4lxml_5etree__Document) + +static PyTypeObject *__pyx_ptype_4lxml_5etree__Element; +#define LxmlElementType (*__pyx_ptype_4lxml_5etree__Element) + +static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTree; +#define LxmlElementTreeType (*__pyx_ptype_4lxml_5etree__ElementTree) + +static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTagMatcher; +#define LxmlElementTagMatcherType (*__pyx_ptype_4lxml_5etree__ElementTagMatcher) + +static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementIterator; +#define LxmlElementIteratorType (*__pyx_ptype_4lxml_5etree__ElementIterator) + +static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementBase; +#define LxmlElementBaseType (*__pyx_ptype_4lxml_5etree_ElementBase) + +static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementClassLookup; +#define LxmlElementClassLookupType (*__pyx_ptype_4lxml_5etree_ElementClassLookup) + +static PyTypeObject *__pyx_ptype_4lxml_5etree_FallbackElementClassLookup; +#define LxmlFallbackElementClassLookupType (*__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) + +static struct LxmlElement *(*deepcopyNodeToDocument)(struct LxmlDocument *, xmlNode *); +static struct LxmlElementTree *(*elementTreeFactory)(struct LxmlElement *); +static struct LxmlElementTree *(*newElementTree)(struct LxmlElement *, PyObject *); +static struct LxmlElement *(*elementFactory)(struct LxmlDocument *, xmlNode *); +static struct LxmlElement *(*makeElement)(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); +static struct LxmlElement *(*makeSubElement)(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); +static void (*setElementClassLookupFunction)(_element_class_lookup_function, PyObject *); +static PyObject *(*lookupDefaultElementClass)(PyObject *, PyObject *, xmlNode *); +static PyObject *(*lookupNamespaceElementClass)(PyObject *, PyObject *, xmlNode *); +static PyObject *(*callLookupFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); +static int (*tagMatches)(xmlNode *, char *, char *); +static struct LxmlDocument *(*documentOrRaise)(PyObject *); +static struct LxmlElement *(*rootNodeOrRaise)(PyObject *); +static int (*hasText)(xmlNode *); +static int (*hasTail)(xmlNode *); +static PyObject *(*textOf)(xmlNode *); +static PyObject *(*tailOf)(xmlNode *); +static int (*setNodeText)(xmlNode *, PyObject *); +static int (*setTailText)(xmlNode *, PyObject *); +static PyObject *(*attributeValue)(xmlNode *, xmlAttr *); +static PyObject *(*attributeValueFromNsName)(xmlNode *, char *, char *); +static PyObject *(*getAttributeValue)(struct LxmlElement *, PyObject *, PyObject *); +static PyObject *(*iterattributes)(struct LxmlElement *, int); +static PyObject *(*collectAttributes)(xmlNode *, int); +static int (*setAttributeValue)(struct LxmlElement *, PyObject *, PyObject *); +static int (*delAttribute)(struct LxmlElement *, PyObject *); +static int (*delAttributeFromNsName)(xmlNode *, char *, char *); +static int (*hasChild)(xmlNode *); +static xmlNode *(*findChild)(xmlNode *, Py_ssize_t); +static xmlNode *(*findChildForwards)(xmlNode *, Py_ssize_t); +static xmlNode *(*findChildBackwards)(xmlNode *, Py_ssize_t); +static xmlNode *(*nextElement)(xmlNode *); +static xmlNode *(*previousElement)(xmlNode *); +static void (*appendChild)(struct LxmlElement *, struct LxmlElement *); +static PyObject *(*pyunicode)(char *); +static PyObject *(*utf8)(PyObject *); +static PyObject *(*getNsTag)(PyObject *); +static PyObject *(*namespacedName)(xmlNode *); +static PyObject *(*namespacedNameFromNsName)(char *, char *); +static void (*iteratorStoreNext)(struct LxmlElementIterator *, struct LxmlElement *); +static void (*initTagMatch)(struct LxmlElementTagMatcher *, PyObject *); +static xmlNs *(*findOrBuildNodeNsPrefix)(struct LxmlDocument *, xmlNode *, char *, char *); + +#ifndef __PYX_HAVE_API_FUNC_import_module +#define __PYX_HAVE_API_FUNC_import_module + +#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 + +#endif + + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + const char *desc; + const char *s1, *s2; + union { + void (*fp)(void); + void *p; + } tmp; + + d = PyObject_GetAttrString(module, api); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj); + *f = tmp.fp; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +static int import_lxml__etree(void) { + PyObject *module = 0; + module = __Pyx_ImportModule("lxml.etree"); + if (!module) goto bad; + if (__Pyx_ImportFunction(module, "deepcopyNodeToDocument", (void (**)(void))&deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "elementTreeFactory", (void (**)(void))&elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "newElementTree", (void (**)(void))&newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "elementFactory", (void (**)(void))&elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "makeElement", (void (**)(void))&makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "makeSubElement", (void (**)(void))&makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "setElementClassLookupFunction", (void (**)(void))&setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "lookupDefaultElementClass", (void (**)(void))&lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "lookupNamespaceElementClass", (void (**)(void))&lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "callLookupFallback", (void (**)(void))&callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "tagMatches", (void (**)(void))&tagMatches, "int (xmlNode *, char *, char *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "documentOrRaise", (void (**)(void))&documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "rootNodeOrRaise", (void (**)(void))&rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "hasText", (void (**)(void))&hasText, "int (xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "hasTail", (void (**)(void))&hasTail, "int (xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "textOf", (void (**)(void))&textOf, "PyObject *(xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "tailOf", (void (**)(void))&tailOf, "PyObject *(xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "setNodeText", (void (**)(void))&setNodeText, "int (xmlNode *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "setTailText", (void (**)(void))&setTailText, "int (xmlNode *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "attributeValue", (void (**)(void))&attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "attributeValueFromNsName", (void (**)(void))&attributeValueFromNsName, "PyObject *(xmlNode *, char *, char *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "getAttributeValue", (void (**)(void))&getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "iterattributes", (void (**)(void))&iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "collectAttributes", (void (**)(void))&collectAttributes, "PyObject *(xmlNode *, int)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "setAttributeValue", (void (**)(void))&setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "delAttribute", (void (**)(void))&delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "delAttributeFromNsName", (void (**)(void))&delAttributeFromNsName, "int (xmlNode *, char *, char *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "hasChild", (void (**)(void))&hasChild, "int (xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "findChild", (void (**)(void))&findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "findChildForwards", (void (**)(void))&findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "findChildBackwards", (void (**)(void))&findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "nextElement", (void (**)(void))&nextElement, "xmlNode *(xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "previousElement", (void (**)(void))&previousElement, "xmlNode *(xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "appendChild", (void (**)(void))&appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "pyunicode", (void (**)(void))&pyunicode, "PyObject *(char *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "utf8", (void (**)(void))&utf8, "PyObject *(PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "getNsTag", (void (**)(void))&getNsTag, "PyObject *(PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "namespacedName", (void (**)(void))&namespacedName, "PyObject *(xmlNode *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "namespacedNameFromNsName", (void (**)(void))&namespacedNameFromNsName, "PyObject *(char *, char *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "iteratorStoreNext", (void (**)(void))&iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "initTagMatch", (void (**)(void))&initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) goto bad; + if (__Pyx_ImportFunction(module, "findOrBuildNodeNsPrefix", (void (**)(void))&findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, char *, char *)") < 0) goto bad; + Py_DECREF(module); module = 0; + __pyx_ptype_4lxml_5etree__Document = __Pyx_ImportType("lxml.etree", "_Document", sizeof(struct LxmlDocument)); if (!__pyx_ptype_4lxml_5etree__Document) goto bad; + __pyx_ptype_4lxml_5etree__Element = __Pyx_ImportType("lxml.etree", "_Element", sizeof(struct LxmlElement)); if (!__pyx_ptype_4lxml_5etree__Element) goto bad; + __pyx_ptype_4lxml_5etree__ElementTree = __Pyx_ImportType("lxml.etree", "_ElementTree", sizeof(struct LxmlElementTree)); if (!__pyx_ptype_4lxml_5etree__ElementTree) goto bad; + __pyx_ptype_4lxml_5etree__ElementTagMatcher = __Pyx_ImportType("lxml.etree", "_ElementTagMatcher", sizeof(struct LxmlElementTagMatcher)); if (!__pyx_ptype_4lxml_5etree__ElementTagMatcher) goto bad; + __pyx_ptype_4lxml_5etree__ElementIterator = __Pyx_ImportType("lxml.etree", "_ElementIterator", sizeof(struct LxmlElementIterator)); if (!__pyx_ptype_4lxml_5etree__ElementIterator) goto bad; + __pyx_ptype_4lxml_5etree_ElementBase = __Pyx_ImportType("lxml.etree", "ElementBase", sizeof(struct LxmlElementBase)); if (!__pyx_ptype_4lxml_5etree_ElementBase) goto bad; + __pyx_ptype_4lxml_5etree_ElementClassLookup = __Pyx_ImportType("lxml.etree", "ElementClassLookup", sizeof(struct LxmlElementClassLookup)); if (!__pyx_ptype_4lxml_5etree_ElementClassLookup) goto bad; + __pyx_ptype_4lxml_5etree_FallbackElementClassLookup = __Pyx_ImportType("lxml.etree", "FallbackElementClassLookup", sizeof(struct LxmlFallbackElementClassLookup)); if (!__pyx_ptype_4lxml_5etree_FallbackElementClassLookup) goto bad; + return 0; + bad: + Py_XDECREF(module); + return -1; +} + +#endif diff --git a/src/lxml/lxml.objectify.c b/src/lxml/lxml.objectify.c new file mode 100644 index 0000000..b916177 --- /dev/null +++ b/src/lxml/lxml.objectify.c @@ -0,0 +1,28919 @@ +/* Generated by Cython 0.11.3 on Tue Sep 29 22:46:05 2009 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#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) +#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 PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #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 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#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 +#include +#define __PYX_HAVE_API__lxml__objectify +#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 "lxml.etree_api.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static 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; + + +#ifdef 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* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#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) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_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 int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + + +static 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, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); + } + return r; +} + +#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 INLINE int PySet_Clear(PyObject *set) { + PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static 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 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 INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +#define __Pyx_DelItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_DelItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_DelItem_Generic(o, to_py_func(i))) + +static 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 INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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 = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(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 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_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*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*/ + +/* Type declarations */ + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":4 + * # ObjectPath + * + * ctypedef struct _ObjectPath: # <<<<<<<<<<<<<< + * char* href + * char* name + */ + +typedef struct { + char *href; + char *name; + Py_ssize_t index; +} __pyx_t_4lxml_9objectify__ObjectPath; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":121 + * + * # Forward declaration + * cdef class PyType # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + +struct __pyx_obj_4lxml_9objectify_PyType { + PyObject_HEAD + PyObject *name; + PyObject *type_check; + PyObject *stringify; + PyObject *_type; + PyObject *_schema_types; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1169 + * # adapted ElementMaker supports registered PyTypes + * + * cdef class _ObjectifyElementMakerCaller: # <<<<<<<<<<<<<< + * cdef object _tag + * cdef object _nsmap + */ + +struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller { + PyObject_HEAD + PyObject *_tag; + PyObject *_nsmap; + PyObject *_element_factory; + int _annotate; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":126 + * # Element class for the main API + * + * cdef class ObjectifiedElement(ElementBase): # <<<<<<<<<<<<<< + * u"""Main XML Element class. + * + */ + +struct __pyx_obj_4lxml_9objectify_ObjectifiedElement { + struct LxmlElementBase __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":638 + * # Data type support in subclasses + * + * cdef class ObjectifiedDataElement(ObjectifiedElement): # <<<<<<<<<<<<<< + * u"""This is the base class for all data type Elements. Subclasses should + * override the 'pyval' property and possibly the __str__ method. + */ + +struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement { + struct __pyx_obj_4lxml_9objectify_ObjectifiedElement __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":658 + * cetree.setNodeText(self._c_node, s) + * + * cdef class NumberElement(ObjectifiedDataElement): # <<<<<<<<<<<<<< + * cdef object _parse_value + * def _setValueParser(self, function): + */ + +struct __pyx_obj_4lxml_9objectify_NumberElement { + struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement __pyx_base; + PyObject *_parse_value; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":760 + * self._parse_value = long + * + * cdef class FloatElement(NumberElement): # <<<<<<<<<<<<<< + * def _init(self): + * self._parse_value = float + */ + +struct __pyx_obj_4lxml_9objectify_FloatElement { + struct __pyx_obj_4lxml_9objectify_NumberElement __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":752 + * return _numericValueOf(self) ^ _numericValueOf(other) + * + * cdef class IntElement(NumberElement): # <<<<<<<<<<<<<< + * def _init(self): + * self._parse_value = int + */ + +struct __pyx_obj_4lxml_9objectify_IntElement { + struct __pyx_obj_4lxml_9objectify_NumberElement __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":848 + * return None + * + * cdef class BoolElement(IntElement): # <<<<<<<<<<<<<< + * u"""Boolean type base on string values: 'true' or 'false'. + * + */ + +struct __pyx_obj_4lxml_9objectify_BoolElement { + struct __pyx_obj_4lxml_9objectify_IntElement __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":756 + * self._parse_value = int + * + * cdef class LongElement(NumberElement): # <<<<<<<<<<<<<< + * def _init(self): + * self._parse_value = long + */ + +struct __pyx_obj_4lxml_9objectify_LongElement { + struct __pyx_obj_4lxml_9objectify_NumberElement __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1253 + * cdef _ObjectifyElementMakerCaller NEW_ELEMENT_MAKER "PY_NEW" (object t) + * + * cdef class ElementMaker: # <<<<<<<<<<<<<< + * u"""ElementMaker(self, namespace=None, nsmap=None, annotate=True, makeelement=None) + * + */ + +struct __pyx_obj_4lxml_9objectify_ElementMaker { + PyObject_HEAD + PyObject *_makeelement; + PyObject *_namespace; + PyObject *_nsmap; + int _annotate; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1391 + * # Element class lookup + * + * cdef class ObjectifyElementClassLookup(ElementClassLookup): # <<<<<<<<<<<<<< + * u"""ObjectifyElementClassLookup(self, tree_class=None, empty_data_class=None) + * Element class lookup method that uses the objectify classes. + */ + +struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup { + struct LxmlElementClassLookup __pyx_base; + PyObject *empty_data_class; + PyObject *tree_class; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":826 + * return complex(textOf(self._c_node)) + * + * cdef class NoneElement(ObjectifiedDataElement): # <<<<<<<<<<<<<< + * def __str__(self): + * return u"None" + */ + +struct __pyx_obj_4lxml_9objectify_NoneElement { + struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement __pyx_base; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":10 + * + * + * cdef class ObjectPath: # <<<<<<<<<<<<<< + * u"""ObjectPath(path) + * Immutable object that represents a compiled object path. + */ + +struct __pyx_obj_4lxml_9objectify_ObjectPath { + PyObject_HEAD + PyObject *find; + PyObject *_path; + PyObject *_path_str; + __pyx_t_4lxml_9objectify__ObjectPath *_c_path; + Py_ssize_t _path_len; +}; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":764 + * self._parse_value = float + * + * cdef class StringElement(ObjectifiedDataElement): # <<<<<<<<<<<<<< + * u"""String data class. + * + */ + +struct __pyx_obj_4lxml_9objectify_StringElement { + struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement __pyx_base; +}; +/* Module declarations from lxml.cstd */ + +/* Module declarations from lxml.tree */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from lxml.python */ + +static PyTypeObject *__pyx_ptype_4lxml_6python_slice = 0; +static PyTypeObject *__pyx_ptype_4lxml_6python_unicode = 0; +/* Module declarations from lxml.etree */ + +/* Module declarations from lxml.etreepublic */ + +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic__Document = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic__Element = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic_ElementBase = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic__ElementTree = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic_ElementClassLookup = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic_FallbackElementClassLookup = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic__ElementTagMatcher = 0; +static PyTypeObject *__pyx_ptype_4lxml_11etreepublic__ElementIterator = 0; +/* Module declarations from lxml.objectify */ + +static PyTypeObject *__pyx_ptype_4lxml_9objectify_PyType = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_ObjectifiedElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_ObjectifiedDataElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_NumberElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_IntElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_LongElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_FloatElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_StringElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_NoneElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_BoolElement = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify__ObjectifyElementMakerCaller = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_ElementMaker = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_ObjectifyElementClassLookup = 0; +static PyTypeObject *__pyx_ptype_4lxml_9objectify_ObjectPath = 0; +static PyObject *__pyx_v_4lxml_9objectify_etree = 0; +static PyObject *__pyx_v_4lxml_9objectify_re = 0; +static PyObject *__pyx_v_4lxml_9objectify_IGNORABLE_ERRORS = 0; +static PyObject *__pyx_v_4lxml_9objectify_is_special_method = 0; +static PyObject *__pyx_v_4lxml_9objectify_islice = 0; +static PyObject *__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE = 0; +static PyObject *__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8 = 0; +static char *__pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE; +static PyObject *__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME = 0; +static PyObject *__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8 = 0; +static char *__pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME; +static PyObject *__pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME = 0; +static PyObject *__pyx_v_4lxml_9objectify_XML_SCHEMA_NS = 0; +static PyObject *__pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8 = 0; +static char *__pyx_v_4lxml_9objectify__XML_SCHEMA_NS; +static PyObject *__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS = 0; +static PyObject *__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8 = 0; +static char *__pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS; +static PyObject *__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR = 0; +static PyObject *__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR = 0; +static PyObject *__pyx_v_4lxml_9objectify__PYTYPE_DICT = 0; +static PyObject *__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT = 0; +static PyObject *__pyx_v_4lxml_9objectify__TYPE_CHECKS = 0; +static struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_4lxml_9objectify_TREE_PYTYPE = 0; +static int __pyx_v_4lxml_9objectify___RECURSIVE_STR; +static PyObject *__pyx_v_4lxml_9objectify__strip_attributes = 0; +static PyObject *__pyx_v_4lxml_9objectify___DEFAULT_PARSER = 0; +static PyObject *__pyx_v_4lxml_9objectify_objectify_parser = 0; +static PyObject *__pyx_v_4lxml_9objectify__fromstring = 0; +static PyObject *__pyx_v_4lxml_9objectify__parse = 0; +static PyObject *__pyx_v_4lxml_9objectify__DEFAULT_NSMAP = 0; +static PyObject *__pyx_v_4lxml_9objectify___MATCH_PATH_SEGMENT = 0; +static PyObject *__pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT = 0; +static PyObject *__pyx_f_4lxml_9objectify__typename(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__unicodeAndUtf8(PyObject *); /*proto*/ +static INLINE int __pyx_f_4lxml_9objectify__tagMatches(xmlNode *, char *, char *); /*proto*/ +static Py_ssize_t __pyx_f_4lxml_9objectify__countSiblings(xmlNode *); /*proto*/ +static xmlNode *__pyx_f_4lxml_9objectify__findFollowingSibling(xmlNode *, char *, char *, Py_ssize_t); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__lookupChild(struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__lookupChildOrRaise(struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__buildChildTag(struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__replaceElement(struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__appendValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__setElementValue(struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__setSlice(PyObject *, struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify___parseBool(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static INLINE int __pyx_f_4lxml_9objectify___parseBoolAsInt(PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_4lxml_9objectify__parseNumber(struct __pyx_obj_4lxml_9objectify_NumberElement *); /*proto*/ +static INLINE PyObject *__pyx_f_4lxml_9objectify__strValueOf(PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_4lxml_9objectify__numericValueOf(PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_4lxml_9objectify__richcmpPyvals(PyObject *, PyObject *, int); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__lower_bool(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__pytypename(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__registerPyTypes(void); /*proto*/ +static struct __pyx_obj_4lxml_9objectify_PyType *__pyx_f_4lxml_9objectify__guessPyType(PyObject *, struct __pyx_obj_4lxml_9objectify_PyType *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__guessElementClass(xmlNode *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__add_text(struct LxmlElement *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__dump(struct LxmlElement *, int); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__setupPickle(PyObject *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__lookupElementClass(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/ +static struct __pyx_obj_4lxml_9objectify_PyType *__pyx_f_4lxml_9objectify__check_type(xmlNode *, struct __pyx_obj_4lxml_9objectify_PyType *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__annotate(struct LxmlElement *, int, int, int, int, PyObject *, PyObject *); /*proto*/ +static struct LxmlElement *__pyx_f_4lxml_9objectify__makeElement(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__parseObjectPathString(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__parseObjectPathList(PyObject *); /*proto*/ +static __pyx_t_4lxml_9objectify__ObjectPath *__pyx_f_4lxml_9objectify__buildObjectPathSegments(PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__findObjectPath(struct LxmlElement *, __pyx_t_4lxml_9objectify__ObjectPath *, Py_ssize_t, PyObject *, int); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__createObjectPath(struct LxmlElement *, __pyx_t_4lxml_9objectify__ObjectPath *, Py_ssize_t, int, PyObject *); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify__buildDescendantPaths(xmlNode *, PyObject *); /*proto*/ +static int __pyx_f_4lxml_9objectify__recursiveBuildDescendantPaths(xmlNode *, PyObject *, PyObject *); /*proto*/ +#define __Pyx_MODULE_NAME "lxml.objectify" +int __pyx_module_is_main_lxml__objectify = 0; + +/* Implementation of lxml.objectify */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_object; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_AttributeError; +static PyObject *__pyx_builtin_oct; +static PyObject *__pyx_builtin_hex; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_map; +static char __pyx_k_0[] = "0"; +static char __pyx_k_1[] = "http://codespeak.net/lxml/objectify/pytype"; +static char __pyx_k_2[] = "UTF-8"; +static char __pyx_k_3[] = "ElementChildIterator"; +static char __pyx_k_4[] = ""; +static char __pyx_k_5[] = "{%s}*"; +static char __pyx_k_6[] = "attribute '%s' of '%s' objects is not writable"; +static char __pyx_k_7[] = "assignment to root element is invalid"; +static char __pyx_k_8[] = "deleting items not supported by root element"; +static char __pyx_k_9[] = "."; +static char __pyx_k_E[] = "E"; +static char __pyx_k_U[] = "U"; +static char __pyx_k_f[] = "f"; +static char __pyx_k_10[] = "no such child: "; +static char __pyx_k_11[] = "Invalid slice"; +static char __pyx_k_12[] = "attempt to assign sequence of size %d to extended slice of size %d"; +static char __pyx_k_13[] = "invalid types for * operator"; +static char __pyx_k_14[] = "Invalid boolean value: '%s'"; +static char __pyx_k_15[] = "1"; +static char __pyx_k_16[] = "Type name must be a string"; +static char __pyx_k_17[] = "Type check function must be callable (or None)"; +static char __pyx_k_18[] = "Data classes must inherit from ObjectifiedDataElement"; +static char __pyx_k_19[] = "PyType(%s, %s)"; +static char __pyx_k_20[] = "Cannot register tree type"; +static char __pyx_k_21[] = "inconsistent before/after dependencies"; +static char __pyx_k_23[] = "{%s}"; +static char __pyx_k_24[] = "{"; + static char __pyx_k_26[] = " "; + static char __pyx_k_27[] = "%s%s = %s [%s]\n"; + static char __pyx_k_28[] = "py:"; + static char __pyx_k_29[] = "xsi:"; + static char __pyx_k_30[] = "%s * %s = %r\n"; + static char __pyx_k_31[] = "__unpickleElementTree"; + static char __pyx_k_32[] = ":"; + static char __pyx_k_42[] = "parser must inherit from lxml.etree.XMLParser"; + static char __pyx_k_43[] = "set_element_class_lookup"; + static char __pyx_k_44[] = "XSD types require the XSD namespace"; + static char __pyx_k_45[] = "xsd:"; + static char __pyx_k_46[] = "invalid number of arguments: needs one or two"; + static char __pyx_k_47[] = "index not allowed on root node"; + static char __pyx_k_48[] = "invalid path"; + static char __pyx_k_49[] = "index must be enclosed in []"; + static char __pyx_k_50[] = "root element does not match: need %s, got %s"; + static char __pyx_k_51[] = "cannot update root node"; + static char __pyx_k_52[] = "creating indexed path attributes is not supported"; + static char __pyx_k_53[] = "{}"; + static char __pyx_k_54[] = "[%d]"; + static char __pyx_k_55[] = "The list of XML Schema datatypes this Python type maps to.\n\n Note that this must be set before registering the type!\n "; + static char __pyx_k_56[] = "A fake implementation for __dict__ to support dir() etc.\n\n Note that this only considers the first child with a given name.\n "; + static char __pyx_k_57[] = "The ``lxml.objectify`` module implements a Python object API for\nXML. It is based on `lxml.etree`.\n"; + static char __pyx_k_58[] = "ObjectifiedDataElement"; + static char __pyx_k_59[] = "ObjectifyElementClassLookup"; + static char __pyx_k_60[] = "enable_recursive_str"; + static char __pyx_k_61[] = "set_pytype_attribute_tag"; + static char __pyx_k_62[] = "__.*__$"; + static char __pyx_k_63[] = "http://www.w3.org/2001/XMLSchema"; + static char __pyx_k_64[] = "http://www.w3.org/2001/XMLSchema-instance"; + static char __pyx_k_65[] = "{%s}nil"; + static char __pyx_k_66[] = "{%s}type"; + static char __pyx_k_67[] = "pickleReduceElementTree"; +static char __pyx_k_68[] = "(\\.?)\\s*(?:\\{([^}]*)\\})?\\s*([^.{}\\[\\]\\s]+)\\s*(?:\\[\\s*([-0-9]+)\\s*\\])?"; +static char __pyx_k_ID[] = "ID"; +static char __pyx_k_on[] = "on"; +static char __pyx_k_py[] = "py"; +static char __pyx_k_re[] = "re"; +static char __pyx_k_XML[] = "XML"; +static char __pyx_k_add[] = "add"; +static char __pyx_k_doc[] = "doc"; +static char __pyx_k_end[] = "end"; +static char __pyx_k_get[] = "get"; +static char __pyx_k_hex[] = "hex"; +static char __pyx_k_int[] = "int"; +static char __pyx_k_map[] = "map"; +static char __pyx_k_nil[] = "nil"; +static char __pyx_k_oct[] = "oct"; +static char __pyx_k_str[] = "str"; +static char __pyx_k_tag[] = "tag"; +static char __pyx_k_xml[] = "xml"; +static char __pyx_k_xsd[] = "xsd"; +static char __pyx_k_xsi[] = "xsi"; +static char __pyx_k_Name[] = "Name"; +static char __pyx_k_None[] = "None"; +static char __pyx_k_TREE[] = "TREE"; +static char __pyx_k__doc[] = "_doc"; +static char __pyx_k__tag[] = "_tag"; +static char __pyx_k__xsi[] = "_xsi"; +static char __pyx_k_base[] = "base"; +static char __pyx_k_bool[] = "bool"; +static char __pyx_k_byte[] = "byte"; +static char __pyx_k_dict[] = "dict"; +static char __pyx_k_dump[] = "dump"; +static char __pyx_k_find[] = "find"; +static char __pyx_k_href[] = "href"; +static char __pyx_k_join[] = "join"; +static char __pyx_k_last[] = "last"; +static char __pyx_k_long[] = "long"; +static char __pyx_k_lxml[] = "lxml"; +static char __pyx_k_name[] = "name"; +static char __pyx_k_next[] = "next"; +static char __pyx_k_none[] = "none"; +static char __pyx_k_path[] = "path"; +static char __pyx_k_prev[] = "prev"; +static char __pyx_k_root[] = "root"; +static char __pyx_k_step[] = "step"; +static char __pyx_k_tail[] = "tail"; +static char __pyx_k_text[] = "text"; +static char __pyx_k_true[] = "true"; +static char __pyx_k_type[] = "type"; +static char __pyx_k_ASCII[] = "ASCII"; +static char __pyx_k_IDREF[] = "IDREF"; +static char __pyx_k__path[] = "_path"; +static char __pyx_k__type[] = "_type"; +static char __pyx_k_after[] = "after"; +static char __pyx_k_etree[] = "etree"; +static char __pyx_k_false[] = "false"; +static char __pyx_k_float[] = "float"; +static char __pyx_k_index[] = "index"; +static char __pyx_k_items[] = "items"; +static char __pyx_k_match[] = "match"; +static char __pyx_k_nsmap[] = "nsmap"; +static char __pyx_k_parse[] = "parse"; +static char __pyx_k_pyval[] = "pyval"; +static char __pyx_k_short[] = "short"; +static char __pyx_k_split[] = "split"; +static char __pyx_k_start[] = "start"; +static char __pyx_k_strip[] = "strip"; +static char __pyx_k_token[] = "token"; +static char __pyx_k_value[] = "value"; +static char __pyx_k_ENTITY[] = "ENTITY"; +static char __pyx_k_NCName[] = "NCName"; +static char __pyx_k_PyType[] = "PyType"; +static char __pyx_k__nsmap[] = "_nsmap"; +static char __pyx_k__value[] = "_value"; +static char __pyx_k_attrib[] = "attrib"; +static char __pyx_k_before[] = "before"; +static char __pyx_k_double[] = "double"; +static char __pyx_k_groups[] = "groups"; +static char __pyx_k_insert[] = "insert"; +static char __pyx_k_islice[] = "islice"; +static char __pyx_k_object[] = "object"; +static char __pyx_k_parent[] = "parent"; +static char __pyx_k_parser[] = "parser"; +static char __pyx_k_pickle[] = "pickle"; +static char __pyx_k_prefix[] = "prefix"; +static char __pyx_k_pytype[] = "pytype"; +static char __pyx_k_remove[] = "remove"; +static char __pyx_k_string[] = "string"; +static char __pyx_k_update[] = "update"; +static char __pyx_k_values[] = "values"; +static char __pyx_k_ETXPath[] = "ETXPath"; +static char __pyx_k_Element[] = "Element"; +static char __pyx_k_NMTOKEN[] = "NMTOKEN"; +static char __pyx_k___all__[] = "__all__"; +static char __pyx_k___set__[] = "__set__"; +static char __pyx_k__c_node[] = "_c_node"; +static char __pyx_k__c_path[] = "_c_path"; +static char __pyx_k__pytype[] = "_pytype"; +static char __pyx_k_addnext[] = "addnext"; +static char __pyx_k_boolean[] = "boolean"; +static char __pyx_k_compile[] = "compile"; +static char __pyx_k_copyreg[] = "copyreg"; +static char __pyx_k_default[] = "default"; +static char __pyx_k_findall[] = "findall"; +static char __pyx_k_integer[] = "integer"; +static char __pyx_k_replace[] = "replace"; +static char __pyx_k_xsi_nil[] = "xsi_nil"; +static char __pyx_k_NoneType[] = "NoneType"; +static char __pyx_k___call__[] = "__call__"; +static char __pyx_k___copy__[] = "__copy__"; +static char __pyx_k___main__[] = "__main__"; +static char __pyx_k___name__[] = "__name__"; +static char __pyx_k_annotate[] = "annotate"; +static char __pyx_k_base_url[] = "base_url"; +static char __pyx_k_children[] = "children"; +static char __pyx_k_copy_reg[] = "copy_reg"; +static char __pyx_k_language[] = "language"; +static char __pyx_k_register[] = "register"; +static char __pyx_k_tostring[] = "tostring"; +static char __pyx_k_TypeError[] = "TypeError"; +static char __pyx_k_XMLParser[] = "XMLParser"; +static char __pyx_k__annotate[] = "_annotate"; +static char __pyx_k__path_len[] = "_path_len"; +static char __pyx_k__path_str[] = "_path_str"; +static char __pyx_k_enumerate[] = "enumerate"; +static char __pyx_k_getparent[] = "getparent"; +static char __pyx_k_itertools[] = "itertools"; +static char __pyx_k_namespace[] = "namespace"; +static char __pyx_k_stringify[] = "stringify"; +static char __pyx_k_IndexError[] = "IndexError"; +static char __pyx_k_IntElement[] = "IntElement"; +static char __pyx_k_ObjectPath[] = "ObjectPath"; +static char __pyx_k_ValueError[] = "ValueError"; +static char __pyx_k__namespace[] = "_namespace"; +static char __pyx_k_deannotate[] = "deannotate"; +static char __pyx_k_empty_type[] = "empty_type"; +static char __pyx_k_fromstring[] = "fromstring"; +static char __pyx_k_ignore_old[] = "ignore_old"; +static char __pyx_k_ignore_xsi[] = "ignore_xsi"; +static char __pyx_k_makeparser[] = "makeparser"; +static char __pyx_k_new_parser[] = "new_parser"; +static char __pyx_k_pyannotate[] = "pyannotate"; +static char __pyx_k_pytypename[] = "pytypename"; +static char __pyx_k_tree_class[] = "tree_class"; +static char __pyx_k_type_check[] = "type_check"; +static char __pyx_k_type_class[] = "type_class"; +static char __pyx_k_BoolElement[] = "BoolElement"; +static char __pyx_k_DataElement[] = "DataElement"; +static char __pyx_k_ElementTree[] = "ElementTree"; +static char __pyx_k_LongElement[] = "LongElement"; +static char __pyx_k_NoneElement[] = "NoneElement"; +static char __pyx_k___checkBool[] = "__checkBool"; +static char __pyx_k___getattr__[] = "__getattr__"; +static char __pyx_k___getitem__[] = "__getitem__"; +static char __pyx_k___parseBool[] = "__parseBool"; +static char __pyx_k___version__[] = "__version__"; +static char __pyx_k_constructor[] = "constructor"; +static char __pyx_k_makeelement[] = "makeelement"; +static char __pyx_k_unsignedInt[] = "unsignedInt"; +static char __pyx_k_xsiannotate[] = "xsiannotate"; +static char __pyx_k_ElementMaker[] = "ElementMaker"; +static char __pyx_k_FloatElement[] = "FloatElement"; +static char __pyx_k__ElementTree[] = "_ElementTree"; +static char __pyx_k___lower_bool[] = "__lower_bool"; +static char __pyx_k__makeelement[] = "_makeelement"; +static char __pyx_k__parse_value[] = "_parse_value"; +static char __pyx_k_annotate_xsi[] = "annotate_xsi"; +static char __pyx_k_empty_pytype[] = "empty_pytype"; +static char __pyx_k_iterchildren[] = "iterchildren"; +static char __pyx_k_unsignedByte[] = "unsignedByte"; +static char __pyx_k_unsignedLong[] = "unsignedLong"; +static char __pyx_k_NumberElement[] = "NumberElement"; +static char __pyx_k_StringElement[] = "StringElement"; +static char __pyx_k__schema_types[] = "_schema_types"; +static char __pyx_k_attribute_tag[] = "attribute_tag"; +static char __pyx_k_ignore_pytype[] = "ignore_pytype"; +static char __pyx_k_unsignedShort[] = "unsignedShort"; +static char __pyx_k_AttributeError[] = "AttributeError"; +static char __pyx_k_xmlSchemaTypes[] = "xmlSchemaTypes"; +static char __pyx_k_annotate_pytype[] = "annotate_pytype"; +static char __pyx_k_element_or_tree[] = "element_or_tree"; +static char __pyx_k_negativeInteger[] = "negativeInteger"; +static char __pyx_k_positiveInteger[] = "positiveInteger"; +static char __pyx_k_PYTYPE_ATTRIBUTE[] = "PYTYPE_ATTRIBUTE"; +static char __pyx_k__element_factory[] = "_element_factory"; +static char __pyx_k__lookup_function[] = "_lookup_function"; +static char __pyx_k_empty_data_class[] = "empty_data_class"; +static char __pyx_k_normalizedString[] = "normalizedString"; +static char __pyx_k_strip_attributes[] = "strip_attributes"; +static char __pyx_k_remove_blank_text[] = "remove_blank_text"; +static char __pyx_k_ObjectifiedElement[] = "ObjectifiedElement"; +static char __pyx_k_getRegisteredTypes[] = "getRegisteredTypes"; +static char __pyx_k_nonNegativeInteger[] = "nonNegativeInteger"; +static char __pyx_k_nonPositiveInteger[] = "nonPositiveInteger"; +static char __pyx_k_set_default_parser[] = "set_default_parser"; +static char __pyx_k_pickleReduceElement[] = "pickleReduceElement"; +static PyObject *__pyx_kp_u_0; +static PyObject *__pyx_kp_u_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_u_15; +static PyObject *__pyx_kp_u_16; +static PyObject *__pyx_kp_u_17; +static PyObject *__pyx_kp_u_18; +static PyObject *__pyx_kp_u_19; +static PyObject *__pyx_kp_u_20; +static PyObject *__pyx_kp_u_21; +static PyObject *__pyx_kp_u_23; +static PyObject *__pyx_kp_u_24; +static PyObject *__pyx_kp_u_26; +static PyObject *__pyx_kp_u_27; +static PyObject *__pyx_kp_u_28; +static PyObject *__pyx_kp_u_29; +static PyObject *__pyx_n_ui_3; +static PyObject *__pyx_kp_u_30; +static PyObject *__pyx_n_ui_31; +static PyObject *__pyx_kp_b_32; +static PyObject *__pyx_kp_u_32; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_42; +static PyObject *__pyx_n_ui_43; +static PyObject *__pyx_kp_u_44; +static PyObject *__pyx_kp_u_45; +static PyObject *__pyx_kp_u_46; +static PyObject *__pyx_kp_u_47; +static PyObject *__pyx_kp_u_48; +static PyObject *__pyx_kp_u_49; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_50; +static PyObject *__pyx_kp_u_51; +static PyObject *__pyx_kp_u_52; +static PyObject *__pyx_kp_u_53; +static PyObject *__pyx_kp_u_54; +static PyObject *__pyx_n_u_58; +static PyObject *__pyx_n_u_59; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_n_u_60; +static PyObject *__pyx_n_u_61; +static PyObject *__pyx_n_ui_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_n_ui_67; +static PyObject *__pyx_kp_u_68; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_ui_AttributeError; +static PyObject *__pyx_n_u_BoolElement; +static PyObject *__pyx_n_u_DataElement; +static PyObject *__pyx_n_u_E; +static PyObject *__pyx_n_ui_E; +static PyObject *__pyx_n_u_ENTITY; +static PyObject *__pyx_n_ui_ETXPath; +static PyObject *__pyx_n_u_Element; +static PyObject *__pyx_n_u_ElementMaker; +static PyObject *__pyx_n_ui_ElementTree; +static PyObject *__pyx_n_u_FloatElement; +static PyObject *__pyx_n_u_ID; +static PyObject *__pyx_n_u_IDREF; +static PyObject *__pyx_n_ui_IndexError; +static PyObject *__pyx_n_u_IntElement; +static PyObject *__pyx_n_u_LongElement; +static PyObject *__pyx_n_u_NCName; +static PyObject *__pyx_n_u_NMTOKEN; +static PyObject *__pyx_n_u_Name; +static PyObject *__pyx_n_u_None; +static PyObject *__pyx_n_u_NoneElement; +static PyObject *__pyx_n_u_NoneType; +static PyObject *__pyx_n_u_NumberElement; +static PyObject *__pyx_n_u_ObjectPath; +static PyObject *__pyx_n_u_ObjectifiedElement; +static PyObject *__pyx_n_u_PYTYPE_ATTRIBUTE; +static PyObject *__pyx_n_ui_PYTYPE_ATTRIBUTE; +static PyObject *__pyx_n_u_PyType; +static PyObject *__pyx_n_u_StringElement; +static PyObject *__pyx_n_u_TREE; +static PyObject *__pyx_n_ui_TypeError; +static PyObject *__pyx_n_ui_U; +static PyObject *__pyx_n_ui_ValueError; +static PyObject *__pyx_n_u_XML; +static PyObject *__pyx_n_ui_XMLParser; +static PyObject *__pyx_n_ui__ElementTree; +static PyObject *__pyx_n_ui___all__; +static PyObject *__pyx_n_ui___call__; +static PyObject *__pyx_n_ui___checkBool; +static PyObject *__pyx_n_ui___copy__; +static PyObject *__pyx_n_ui___getattr__; +static PyObject *__pyx_n_ui___getitem__; +static PyObject *__pyx_n_ui___lower_bool; +static PyObject *__pyx_n_ui___main__; +static PyObject *__pyx_n_ui___name__; +static PyObject *__pyx_n_ui___parseBool; +static PyObject *__pyx_n_ui___set__; +static PyObject *__pyx_n_ui___version__; +static PyObject *__pyx_n_ui__annotate; +static PyObject *__pyx_n_ui__c_node; +static PyObject *__pyx_n_ui__c_path; +static PyObject *__pyx_n_ui__doc; +static PyObject *__pyx_n_ui__element_factory; +static PyObject *__pyx_n_ui__lookup_function; +static PyObject *__pyx_n_ui__makeelement; +static PyObject *__pyx_n_ui__namespace; +static PyObject *__pyx_n_ui__nsmap; +static PyObject *__pyx_n_ui__parse_value; +static PyObject *__pyx_n_ui__path; +static PyObject *__pyx_n_ui__path_len; +static PyObject *__pyx_n_ui__path_str; +static PyObject *__pyx_n_ui__pytype; +static PyObject *__pyx_n_ui__schema_types; +static PyObject *__pyx_n_ui__tag; +static PyObject *__pyx_n_ui__type; +static PyObject *__pyx_n_ui__value; +static PyObject *__pyx_n_ui__xsi; +static PyObject *__pyx_n_ui_add; +static PyObject *__pyx_n_ui_addnext; +static PyObject *__pyx_n_ui_after; +static PyObject *__pyx_n_u_annotate; +static PyObject *__pyx_n_ui_annotate; +static PyObject *__pyx_n_ui_annotate_pytype; +static PyObject *__pyx_n_ui_annotate_xsi; +static PyObject *__pyx_n_ui_attrib; +static PyObject *__pyx_n_ui_attribute_tag; +static PyObject *__pyx_n_u_base; +static PyObject *__pyx_n_ui_base; +static PyObject *__pyx_n_ui_base_url; +static PyObject *__pyx_n_ui_before; +static PyObject *__pyx_n_u_bool; +static PyObject *__pyx_n_u_boolean; +static PyObject *__pyx_n_u_byte; +static PyObject *__pyx_n_ui_children; +static PyObject *__pyx_n_ui_compile; +static PyObject *__pyx_n_ui_constructor; +static PyObject *__pyx_n_ui_copy_reg; +static PyObject *__pyx_n_ui_copyreg; +static PyObject *__pyx_n_u_deannotate; +static PyObject *__pyx_n_ui_default; +static PyObject *__pyx_n_ui_dict; +static PyObject *__pyx_n_ui_doc; +static PyObject *__pyx_n_u_double; +static PyObject *__pyx_n_u_dump; +static PyObject *__pyx_n_ui_element_or_tree; +static PyObject *__pyx_n_ui_empty_data_class; +static PyObject *__pyx_n_ui_empty_pytype; +static PyObject *__pyx_n_ui_empty_type; +static PyObject *__pyx_n_ui_end; +static PyObject *__pyx_n_ui_enumerate; +static PyObject *__pyx_n_bi_etree; +static PyObject *__pyx_n_ui_etree; +static PyObject *__pyx_n_ui_f; +static PyObject *__pyx_n_u_false; +static PyObject *__pyx_n_ui_find; +static PyObject *__pyx_n_ui_findall; +static PyObject *__pyx_n_u_float; +static PyObject *__pyx_n_u_fromstring; +static PyObject *__pyx_n_ui_fromstring; +static PyObject *__pyx_n_ui_get; +static PyObject *__pyx_n_u_getRegisteredTypes; +static PyObject *__pyx_n_ui_getparent; +static PyObject *__pyx_n_ui_groups; +static PyObject *__pyx_n_ui_hex; +static PyObject *__pyx_n_ui_href; +static PyObject *__pyx_n_ui_ignore_old; +static PyObject *__pyx_n_ui_ignore_pytype; +static PyObject *__pyx_n_ui_ignore_xsi; +static PyObject *__pyx_n_ui_index; +static PyObject *__pyx_n_ui_insert; +static PyObject *__pyx_n_u_int; +static PyObject *__pyx_n_u_integer; +static PyObject *__pyx_n_bi_islice; +static PyObject *__pyx_n_ui_islice; +static PyObject *__pyx_n_ui_items; +static PyObject *__pyx_n_ui_iterchildren; +static PyObject *__pyx_n_ui_itertools; +static PyObject *__pyx_n_ui_join; +static PyObject *__pyx_n_u_language; +static PyObject *__pyx_n_ui_last; +static PyObject *__pyx_n_u_long; +static PyObject *__pyx_n_ui_lxml; +static PyObject *__pyx_n_ui_makeelement; +static PyObject *__pyx_n_u_makeparser; +static PyObject *__pyx_n_ui_map; +static PyObject *__pyx_n_ui_match; +static PyObject *__pyx_n_ui_name; +static PyObject *__pyx_n_ui_namespace; +static PyObject *__pyx_n_u_negativeInteger; +static PyObject *__pyx_n_ui_new_parser; +static PyObject *__pyx_n_ui_next; +static PyObject *__pyx_n_u_nonNegativeInteger; +static PyObject *__pyx_n_u_nonPositiveInteger; +static PyObject *__pyx_n_u_none; +static PyObject *__pyx_n_u_normalizedString; +static PyObject *__pyx_n_ui_nsmap; +static PyObject *__pyx_n_ui_object; +static PyObject *__pyx_n_ui_oct; +static PyObject *__pyx_n_ui_on; +static PyObject *__pyx_n_ui_parent; +static PyObject *__pyx_n_u_parse; +static PyObject *__pyx_n_ui_parse; +static PyObject *__pyx_n_ui_parser; +static PyObject *__pyx_n_ui_path; +static PyObject *__pyx_n_ui_pickle; +static PyObject *__pyx_n_ui_pickleReduceElement; +static PyObject *__pyx_n_u_positiveInteger; +static PyObject *__pyx_n_ui_prefix; +static PyObject *__pyx_n_ui_prev; +static PyObject *__pyx_n_u_py; +static PyObject *__pyx_n_u_pyannotate; +static PyObject *__pyx_n_u_pytype; +static PyObject *__pyx_n_ui_pytype; +static PyObject *__pyx_n_u_pytypename; +static PyObject *__pyx_n_u_pyval; +static PyObject *__pyx_n_ui_pyval; +static PyObject *__pyx_n_ui_re; +static PyObject *__pyx_n_ui_register; +static PyObject *__pyx_n_ui_remove; +static PyObject *__pyx_n_b_remove_blank_text; +static PyObject *__pyx_n_u_remove_blank_text; +static PyObject *__pyx_n_ui_remove_blank_text; +static PyObject *__pyx_n_ui_replace; +static PyObject *__pyx_n_ui_root; +static PyObject *__pyx_n_u_set_default_parser; +static PyObject *__pyx_n_u_short; +static PyObject *__pyx_n_ui_split; +static PyObject *__pyx_n_ui_start; +static PyObject *__pyx_n_ui_step; +static PyObject *__pyx_n_u_str; +static PyObject *__pyx_n_u_string; +static PyObject *__pyx_n_ui_stringify; +static PyObject *__pyx_n_ui_strip; +static PyObject *__pyx_n_ui_strip_attributes; +static PyObject *__pyx_n_u_tag; +static PyObject *__pyx_n_ui_tag; +static PyObject *__pyx_n_u_tail; +static PyObject *__pyx_n_u_text; +static PyObject *__pyx_n_ui_text; +static PyObject *__pyx_n_u_token; +static PyObject *__pyx_n_ui_tostring; +static PyObject *__pyx_n_ui_tree_class; +static PyObject *__pyx_n_u_true; +static PyObject *__pyx_n_ui_type; +static PyObject *__pyx_n_ui_type_check; +static PyObject *__pyx_n_ui_type_class; +static PyObject *__pyx_n_u_unsignedByte; +static PyObject *__pyx_n_u_unsignedInt; +static PyObject *__pyx_n_u_unsignedLong; +static PyObject *__pyx_n_u_unsignedShort; +static PyObject *__pyx_n_ui_update; +static PyObject *__pyx_n_u_value; +static PyObject *__pyx_n_ui_value; +static PyObject *__pyx_n_ui_values; +static PyObject *__pyx_n_ui_xml; +static PyObject *__pyx_n_ui_xmlSchemaTypes; +static PyObject *__pyx_n_u_xsd; +static PyObject *__pyx_n_u_xsi; +static PyObject *__pyx_n_ui_xsi; +static PyObject *__pyx_n_ui_xsi_nil; +static PyObject *__pyx_n_u_xsiannotate; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_k_22; +static PyObject *__pyx_k_25; +static PyObject *__pyx_k_33; +static PyObject *__pyx_k_34; +static PyObject *__pyx_k_35; +static PyObject *__pyx_k_36; +static PyObject *__pyx_k_37; +static PyObject *__pyx_k_38; +static PyObject *__pyx_k_39; +static PyObject *__pyx_k_40; +static PyObject *__pyx_k_41; + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":40 + * from itertools import islice + * + * cdef object _typename(object t): # <<<<<<<<<<<<<< + * cdef char* c_name + * cdef char* s + */ + +static PyObject *__pyx_f_4lxml_9objectify__typename(PyObject *__pyx_v_t) { + char *__pyx_v_c_name; + char *__pyx_v_s; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_typename"); + __Pyx_INCREF(__pyx_v_t); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":43 + * cdef char* c_name + * cdef char* s + * c_name = python._fqtypename(t) # <<<<<<<<<<<<<< + * s = cstd.strrchr(c_name, c'.') + * if s is not NULL: + */ + __pyx_v_c_name = _fqtypename(__pyx_v_t); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":44 + * cdef char* s + * c_name = python._fqtypename(t) + * s = cstd.strrchr(c_name, c'.') # <<<<<<<<<<<<<< + * if s is not NULL: + * c_name = s + 1 + */ + __pyx_v_s = strrchr(__pyx_v_c_name, '.'); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":45 + * c_name = python._fqtypename(t) + * s = cstd.strrchr(c_name, c'.') + * if s is not NULL: # <<<<<<<<<<<<<< + * c_name = s + 1 + * return pyunicode(c_name) + */ + __pyx_t_1 = (__pyx_v_s != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":46 + * s = cstd.strrchr(c_name, c'.') + * if s is not NULL: + * c_name = s + 1 # <<<<<<<<<<<<<< + * return pyunicode(c_name) + * + */ + __pyx_v_c_name = (__pyx_v_s + 1); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":47 + * if s is not NULL: + * c_name = s + 1 + * return pyunicode(c_name) # <<<<<<<<<<<<<< + * + * # namespace/name for "pytype" hint attribute + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = pyunicode(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __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.objectify._typename"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_t); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":63 + * TREE_PYTYPE_NAME = u"TREE" + * + * cdef _unicodeAndUtf8(s): # <<<<<<<<<<<<<< + * return (s, python.PyUnicode_AsUTF8String(s)) + * + */ + +static PyObject *__pyx_f_4lxml_9objectify__unicodeAndUtf8(PyObject *__pyx_v_s) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_unicodeAndUtf8"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":64 + * + * cdef _unicodeAndUtf8(s): + * return (s, python.PyUnicode_AsUTF8String(s)) # <<<<<<<<<<<<<< + * + * def set_pytype_attribute_tag(attribute_tag=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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[0]; __pyx_lineno = 64; __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); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__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.objectify._unicodeAndUtf8"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":66 + * return (s, python.PyUnicode_AsUTF8String(s)) + * + * def set_pytype_attribute_tag(attribute_tag=None): # <<<<<<<<<<<<<< + * u"""set_pytype_attribute_tag(attribute_tag=None) + * Change name and namespace of the XML attribute that holds Python type + */ + +static PyObject *__pyx_pf_4lxml_9objectify_set_pytype_attribute_tag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_set_pytype_attribute_tag[] = "set_pytype_attribute_tag(attribute_tag=None)\n Change name and namespace of the XML attribute that holds Python type\n information.\n\n Do not use this unless you know what you are doing.\n\n Reset by calling without argument.\n\n Default: \"{http://codespeak.net/lxml/objectify/pytype}pytype\"\n "; +static PyObject *__pyx_pf_4lxml_9objectify_set_pytype_attribute_tag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_attribute_tag = 0; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_attribute_tag,0}; + __Pyx_SetupRefcountContext("set_pytype_attribute_tag"); + __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_ui_attribute_tag); + if (unlikely(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_pytype_attribute_tag") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_attribute_tag = values[0]; + } else { + __pyx_v_attribute_tag = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: __pyx_v_attribute_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("set_pytype_attribute_tag", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.set_pytype_attribute_tag"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_attribute_tag); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":80 + * global PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 + * global PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 + * if attribute_tag is None: # <<<<<<<<<<<<<< + * PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 = \ + * _unicodeAndUtf8(u"http://codespeak.net/lxml/objectify/pytype") + */ + __pyx_t_1 = (__pyx_v_attribute_tag == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":82 + * if attribute_tag is None: + * PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 = \ + * _unicodeAndUtf8(u"http://codespeak.net/lxml/objectify/pytype") # <<<<<<<<<<<<<< + * PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + * _unicodeAndUtf8(u"pytype") + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__unicodeAndUtf8(((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":81 + * global PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 + * if attribute_tag is None: + * PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 = \ # <<<<<<<<<<<<<< + * _unicodeAndUtf8(u"http://codespeak.net/lxml/objectify/pytype") + * PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8 = __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 = 81; __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 = 81; __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8 = __pyx_t_4; + __pyx_t_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":84 + * _unicodeAndUtf8(u"http://codespeak.net/lxml/objectify/pytype") + * PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + * _unicodeAndUtf8(u"pytype") # <<<<<<<<<<<<<< + * else: + * PYTYPE_NAMESPACE_UTF8, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__unicodeAndUtf8(((PyObject *)__pyx_n_u_pytype)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __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_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":83 + * PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 = \ + * _unicodeAndUtf8(u"http://codespeak.net/lxml/objectify/pytype") + * PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ # <<<<<<<<<<<<<< + * _unicodeAndUtf8(u"pytype") + * else: + */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8 = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8 = __pyx_t_3; + __pyx_t_3 = 0; + } + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":87 + * else: + * PYTYPE_NAMESPACE_UTF8, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + * cetree.getNsTag(attribute_tag) # <<<<<<<<<<<<<< + * PYTYPE_NAMESPACE = python.PyUnicode_FromEncodedObject( + * PYTYPE_NAMESPACE_UTF8, 'UTF-8', NULL) + */ + __pyx_t_2 = getNsTag(__pyx_v_attribute_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":86 + * _unicodeAndUtf8(u"pytype") + * else: + * PYTYPE_NAMESPACE_UTF8, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ # <<<<<<<<<<<<<< + * cetree.getNsTag(attribute_tag) + * PYTYPE_NAMESPACE = python.PyUnicode_FromEncodedObject( + */ + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8 = __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 = 86; __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 = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8 = __pyx_t_4; + __pyx_t_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":89 + * cetree.getNsTag(attribute_tag) + * PYTYPE_NAMESPACE = python.PyUnicode_FromEncodedObject( + * PYTYPE_NAMESPACE_UTF8, 'UTF-8', NULL) # <<<<<<<<<<<<<< + * PYTYPE_ATTRIBUTE_NAME = python.PyUnicode_FromEncodedObject( + * PYTYPE_ATTRIBUTE_NAME_UTF8, 'UTF-8', NULL) + */ + __pyx_t_2 = PyUnicode_FromEncodedObject(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8, __pyx_k_2, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":91 + * PYTYPE_NAMESPACE_UTF8, 'UTF-8', NULL) + * PYTYPE_ATTRIBUTE_NAME = python.PyUnicode_FromEncodedObject( + * PYTYPE_ATTRIBUTE_NAME_UTF8, 'UTF-8', NULL) # <<<<<<<<<<<<<< + * + * _PYTYPE_NAMESPACE = _cstr(PYTYPE_NAMESPACE_UTF8) + */ + __pyx_t_2 = PyUnicode_FromEncodedObject(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8, __pyx_k_2, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":93 + * PYTYPE_ATTRIBUTE_NAME_UTF8, 'UTF-8', NULL) + * + * _PYTYPE_NAMESPACE = _cstr(PYTYPE_NAMESPACE_UTF8) # <<<<<<<<<<<<<< + * _PYTYPE_ATTRIBUTE_NAME = _cstr(PYTYPE_ATTRIBUTE_NAME_UTF8) + * PYTYPE_ATTRIBUTE = cetree.namespacedNameFromNsName( + */ + __pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE = PyString_AS_STRING(__pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":94 + * + * _PYTYPE_NAMESPACE = _cstr(PYTYPE_NAMESPACE_UTF8) + * _PYTYPE_ATTRIBUTE_NAME = _cstr(PYTYPE_ATTRIBUTE_NAME_UTF8) # <<<<<<<<<<<<<< + * PYTYPE_ATTRIBUTE = cetree.namespacedNameFromNsName( + * _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + */ + __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME = PyString_AS_STRING(__pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":96 + * _PYTYPE_ATTRIBUTE_NAME = _cstr(PYTYPE_ATTRIBUTE_NAME_UTF8) + * PYTYPE_ATTRIBUTE = cetree.namespacedNameFromNsName( + * _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) # <<<<<<<<<<<<<< + * + * set_pytype_attribute_tag() + */ + __pyx_t_2 = namespacedNameFromNsName(__pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE, __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_AddTraceback("lxml.objectify.set_pytype_attribute_tag"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_attribute_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":140 + * subclasses. + * """ + * def __iter__(self): # <<<<<<<<<<<<<< + * u"""Iterate over self and all siblings with the same tag. + * """ + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___iter__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement___iter__[] = "Iterate over self and all siblings with the same tag.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_parent; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("__iter__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_parent = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":143 + * u"""Iterate over self and all siblings with the same tag. + * """ + * parent = self.getparent() # <<<<<<<<<<<<<< + * if parent is None: + * return iter([self]) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui_getparent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __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 = 143; __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_parent); + __pyx_v_parent = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":144 + * """ + * parent = self.getparent() + * if parent is None: # <<<<<<<<<<<<<< + * return iter([self]) + * return etree.ElementChildIterator(parent, tag=self.tag) + */ + __pyx_t_3 = (__pyx_v_parent == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":145 + * parent = self.getparent() + * if parent is None: + * return iter([self]) # <<<<<<<<<<<<<< + * return etree.ElementChildIterator(parent, tag=self.tag) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __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; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":146 + * if parent is None: + * return iter([self]) + * return etree.ElementChildIterator(parent, tag=self.tag) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_parent); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_parent); + __Pyx_GIVEREF(__pyx_v_parent); + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_ui_tag, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __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_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_parent); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":148 + * return etree.ElementChildIterator(parent, tag=self.tag) + * + * def __str__(self): # <<<<<<<<<<<<<< + * if __RECURSIVE_STR: + * return _dump(self, 0) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__str__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":149 + * + * def __str__(self): + * if __RECURSIVE_STR: # <<<<<<<<<<<<<< + * return _dump(self, 0) + * else: + */ + __pyx_t_1 = __pyx_v_4lxml_9objectify___RECURSIVE_STR; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":150 + * def __str__(self): + * if __RECURSIVE_STR: + * return _dump(self, 0) # <<<<<<<<<<<<<< + * else: + * return textOf(self._c_node) or u'' + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_9objectify__dump(((struct LxmlElement *)__pyx_v_self), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":152 + * return _dump(self, 0) + * else: + * return textOf(self._c_node) or u'' # <<<<<<<<<<<<<< + * + * property text: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = textOf(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node); 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_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_3 = __pyx_kp_u_4; + } else { + __pyx_t_3 = __pyx_t_2; + __pyx_t_2 = 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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":155 + * + * property text: + * def __get__(self): # <<<<<<<<<<<<<< + * return textOf(self._c_node) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_4text___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_4text___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":156 + * property text: + * def __get__(self): + * return textOf(self._c_node) # <<<<<<<<<<<<<< + * + * property __dict__: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __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.objectify.ObjectifiedElement.text.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":163 + * Note that this only considers the first child with a given name. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * cdef char* c_ns + * cdef char* c_child_ns + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_8__dict_____get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_8__dict_____get__(PyObject *__pyx_v_self) { + char *__pyx_v_c_ns; + struct LxmlElement *__pyx_v_child; + PyObject *__pyx_v_children; + PyObject *__pyx_v_tag; + PyObject *__pyx_v_name; + 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; + __Pyx_SetupRefcountContext("__get__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_child = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_children = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":168 + * cdef _Element child + * cdef dict children + * c_ns = tree._getNs(self._c_node) # <<<<<<<<<<<<<< + * if c_ns is NULL: + * tag = None + */ + __pyx_v_c_ns = _getNs(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":169 + * cdef dict children + * c_ns = tree._getNs(self._c_node) + * if c_ns is NULL: # <<<<<<<<<<<<<< + * tag = None + * else: + */ + __pyx_t_1 = (__pyx_v_c_ns == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":170 + * c_ns = tree._getNs(self._c_node) + * if c_ns is NULL: + * tag = None # <<<<<<<<<<<<<< + * else: + * tag = u"{%s}*" % pyunicode(c_ns) + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = Py_None; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":172 + * tag = None + * else: + * tag = u"{%s}*" % pyunicode(c_ns) # <<<<<<<<<<<<<< + * children = {} + * for child in etree.ElementChildIterator(self, tag=tag): + */ + __pyx_t_2 = pyunicode(__pyx_v_c_ns); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_5), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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_tag); + __pyx_v_tag = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":173 + * else: + * tag = u"{%s}*" % pyunicode(c_ns) + * children = {} # <<<<<<<<<<<<<< + * for child in etree.ElementChildIterator(self, tag=tag): + * if c_ns is NULL and tree._getNs(child._c_node) is not NULL: + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_v_children)); + __pyx_v_children = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":174 + * tag = u"{%s}*" % pyunicode(c_ns) + * children = {} + * for child in etree.ElementChildIterator(self, tag=tag): # <<<<<<<<<<<<<< + * if c_ns is NULL and tree._getNs(child._c_node) is not NULL: + * continue + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __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[0]; __pyx_lineno = 174; __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_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_ui_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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[0]; __pyx_lineno = 174; __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[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + if (!(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((struct LxmlElement *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":175 + * children = {} + * for child in etree.ElementChildIterator(self, tag=tag): + * if c_ns is NULL and tree._getNs(child._c_node) is not NULL: # <<<<<<<<<<<<<< + * continue + * name = pyunicode(child._c_node.name) + */ + if ((__pyx_v_c_ns == NULL)) { + __pyx_t_1 = (_getNs(__pyx_v_child->_c_node) != NULL); + } else { + __pyx_t_1 = (__pyx_v_c_ns == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":176 + * for child in etree.ElementChildIterator(self, tag=tag): + * if c_ns is NULL and tree._getNs(child._c_node) is not NULL: + * continue # <<<<<<<<<<<<<< + * name = pyunicode(child._c_node.name) + * if python.PyDict_GetItem(children, name) is NULL: + */ + goto __pyx_L6_continue; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":177 + * if c_ns is NULL and tree._getNs(child._c_node) is not NULL: + * continue + * name = pyunicode(child._c_node.name) # <<<<<<<<<<<<<< + * if python.PyDict_GetItem(children, name) is NULL: + * children[name] = child + */ + __pyx_t_6 = pyunicode(__pyx_v_child->_c_node->name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":178 + * continue + * name = pyunicode(child._c_node.name) + * if python.PyDict_GetItem(children, name) is NULL: # <<<<<<<<<<<<<< + * children[name] = child + * return children + */ + __pyx_t_1 = (PyDict_GetItem(((PyObject *)__pyx_v_children), __pyx_v_name) == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":179 + * name = pyunicode(child._c_node.name) + * if python.PyDict_GetItem(children, name) is NULL: + * children[name] = child # <<<<<<<<<<<<<< + * return children + * + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_children), __pyx_v_name, ((PyObject *)__pyx_v_child)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + __pyx_L6_continue:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":180 + * if python.PyDict_GetItem(children, name) is NULL: + * children[name] = child + * return children # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_children)); + __pyx_r = ((PyObject *)__pyx_v_children); + 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.objectify.ObjectifiedElement.__dict__.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_children); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":182 + * return children + * + * def __len__(self): # <<<<<<<<<<<<<< + * u"""Count self and siblings with the same tag. + * """ + */ + +static Py_ssize_t __pyx_pf_4lxml_9objectify_18ObjectifiedElement___len__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement___len__[] = "Count self and siblings with the same tag.\n "; +static Py_ssize_t __pyx_pf_4lxml_9objectify_18ObjectifiedElement___len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_SetupRefcountContext("__len__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":185 + * u"""Count self and siblings with the same tag. + * """ + * return _countSiblings(self._c_node) # <<<<<<<<<<<<<< + * + * def countchildren(self): + */ + __pyx_r = __pyx_f_4lxml_9objectify__countSiblings(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":187 + * return _countSiblings(self._c_node) + * + * def countchildren(self): # <<<<<<<<<<<<<< + * u"""countchildren(self) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_countchildren(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_countchildren[] = "countchildren(self)\n\n Return the number of children of this element, regardless of their\n name.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_countchildren(PyObject *__pyx_v_self, PyObject *unused) { + Py_ssize_t __pyx_v_c; + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("countchildren"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":196 + * cdef Py_ssize_t c + * cdef tree.xmlNode* c_node + * c = 0 # <<<<<<<<<<<<<< + * c_node = self._c_node.children + * while c_node is not NULL: + */ + __pyx_v_c = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":197 + * cdef tree.xmlNode* c_node + * 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_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":198 + * 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_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":199 + * 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_1 = _isElement(__pyx_v_c_node); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":200 + * 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-2.2/src/lxml/lxml.objectify.pyx":201 + * 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-2.2/src/lxml/lxml.objectify.pyx":202 + * c = c + 1 + * c_node = c_node.next + * return c # <<<<<<<<<<<<<< + * + * def getchildren(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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.objectify.ObjectifiedElement.countchildren"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":204 + * return c + * + * def getchildren(self): # <<<<<<<<<<<<<< + * u"""getchildren(self) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_getchildren(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_getchildren[] = "getchildren(self)\n\n Returns a sequence of all direct children. The elements are\n returned in document order.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_getchildren(PyObject *__pyx_v_self, PyObject *unused) { + xmlNode *__pyx_v_c_node; + PyObject *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_SetupRefcountContext("getchildren"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":211 + * """ + * cdef tree.xmlNode* c_node + * cdef list 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[0]; __pyx_lineno = 211; __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-2.2/src/lxml/lxml.objectify.pyx":212 + * cdef tree.xmlNode* c_node + * cdef list result = [] + * 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_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":213 + * cdef list result = [] + * c_node = self._c_node.children + * while c_node is not NULL: # <<<<<<<<<<<<<< + * if tree._isElement(c_node): + * result.append(cetree.elementFactory(self._doc, c_node)) + */ + while (1) { + __pyx_t_2 = (__pyx_v_c_node != NULL); + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":214 + * c_node = self._c_node.children + * while c_node is not NULL: + * if tree._isElement(c_node): # <<<<<<<<<<<<<< + * result.append(cetree.elementFactory(self._doc, c_node)) + * c_node = c_node.next + */ + __pyx_t_2 = _isElement(__pyx_v_c_node); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":215 + * while c_node is not NULL: + * if tree._isElement(c_node): + * result.append(cetree.elementFactory(self._doc, 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[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)elementFactory(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":216 + * if tree._isElement(c_node): + * result.append(cetree.elementFactory(self._doc, c_node)) + * c_node = c_node.next # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_v_c_node = __pyx_v_c_node->next; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":217 + * result.append(cetree.elementFactory(self._doc, c_node)) + * c_node = c_node.next + * return result # <<<<<<<<<<<<<< + * + * def __getattr__(self, tag): + */ + __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.objectify.ObjectifiedElement.getchildren"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":219 + * return result + * + * def __getattr__(self, tag): # <<<<<<<<<<<<<< + * u"""Return the (first) child with the given tag name. If no namespace + * is provided, the child will be looked up in the same one as self. + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement___getattr__[] = "Return the (first) child with the given tag name. If no namespace\n is provided, the child will be looked up in the same one as self.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__getattr__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_tag); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":223 + * is provided, the child will be looked up in the same one as self. + * """ + * if is_special_method(tag): # <<<<<<<<<<<<<< + * return object.__getattr__(self, tag) + * return _lookupChildOrRaise(self, tag) + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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_4lxml_9objectify_is_special_method, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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 = 223; __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-2.2/src/lxml/lxml.objectify.pyx":224 + * """ + * if is_special_method(tag): + * return object.__getattr__(self, tag) # <<<<<<<<<<<<<< + * return _lookupChildOrRaise(self, tag) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_builtin_object, __pyx_n_ui___getattr__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __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 = 224; __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_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __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; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":225 + * if is_special_method(tag): + * return object.__getattr__(self, tag) + * return _lookupChildOrRaise(self, tag) # <<<<<<<<<<<<<< + * + * def __setattr__(self, tag, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_f_4lxml_9objectify__lookupChildOrRaise(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.__getattr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":227 + * return _lookupChildOrRaise(self, tag) + * + * def __setattr__(self, tag, value): # <<<<<<<<<<<<<< + * u"""Set the value of the (first) child with the given tag name. If no + * namespace is provided, the child will be looked up in the same one as + */ + +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement___setattr__[] = "Set the value of the (first) child with the given tag name. If no\n namespace is provided, the child will be looked up in the same one as\n self.\n "; +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_value) { + struct LxmlElement *__pyx_v_element; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_SetupRefcountContext("__setattr__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_tag); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":234 + * cdef _Element element + * # properties are looked up /after/ __setattr__, so we must emulate them + * if tag == u'text' or tag == u'pyval': # <<<<<<<<<<<<<< + * # read-only ! + * raise TypeError, u"attribute '%s' of '%s' objects is not writable" % \ + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_n_u_text), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __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 = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_n_u_pyval), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __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[0]; __pyx_lineno = 234; __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-2.2/src/lxml/lxml.objectify.pyx":237 + * # read-only ! + * raise TypeError, u"attribute '%s' of '%s' objects is not writable" % \ + * (tag, _typename(self)) # <<<<<<<<<<<<<< + * elif tag == u'tail': + * cetree.setTailText(self._c_node, value) + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__typename(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __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[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_tag); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_tag); + __Pyx_GIVEREF(__pyx_v_tag); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_1, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":238 + * raise TypeError, u"attribute '%s' of '%s' objects is not writable" % \ + * (tag, _typename(self)) + * elif tag == u'tail': # <<<<<<<<<<<<<< + * cetree.setTailText(self._c_node, value) + * return + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_n_u_tail), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __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 = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":239 + * (tag, _typename(self)) + * elif tag == u'tail': + * cetree.setTailText(self._c_node, value) # <<<<<<<<<<<<<< + * return + * elif tag == u'tag': + */ + __pyx_t_6 = setTailText(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_v_value); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":240 + * elif tag == u'tail': + * cetree.setTailText(self._c_node, value) + * return # <<<<<<<<<<<<<< + * elif tag == u'tag': + * ElementBase.tag.__set__(self, value) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":241 + * cetree.setTailText(self._c_node, value) + * return + * elif tag == u'tag': # <<<<<<<<<<<<<< + * ElementBase.tag.__set__(self, value) + * return + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_n_u_tag), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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 = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":242 + * return + * elif tag == u'tag': + * ElementBase.tag.__set__(self, value) # <<<<<<<<<<<<<< + * return + * elif tag == u'base': + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic_ElementBase)), __pyx_n_ui_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_ui___set__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __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_value); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __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_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":243 + * elif tag == u'tag': + * ElementBase.tag.__set__(self, value) + * return # <<<<<<<<<<<<<< + * elif tag == u'base': + * ElementBase.base.__set__(self, value) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":244 + * ElementBase.tag.__set__(self, value) + * return + * elif tag == u'base': # <<<<<<<<<<<<<< + * ElementBase.base.__set__(self, value) + * return + */ + __pyx_t_7 = PyObject_RichCompare(__pyx_v_tag, ((PyObject *)__pyx_n_u_base), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":245 + * return + * elif tag == u'base': + * ElementBase.base.__set__(self, value) # <<<<<<<<<<<<<< + * return + * tag = _buildChildTag(self, tag) + */ + __pyx_t_7 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic_ElementBase)), __pyx_n_ui_base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_ui___set__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __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_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":246 + * elif tag == u'base': + * ElementBase.base.__set__(self, value) + * return # <<<<<<<<<<<<<< + * tag = _buildChildTag(self, tag) + * element = _lookupChild(self, tag) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":247 + * ElementBase.base.__set__(self, value) + * return + * tag = _buildChildTag(self, tag) # <<<<<<<<<<<<<< + * element = _lookupChild(self, tag) + * if element is None: + */ + __pyx_t_5 = __pyx_f_4lxml_9objectify__buildChildTag(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":248 + * return + * tag = _buildChildTag(self, tag) + * element = _lookupChild(self, tag) # <<<<<<<<<<<<<< + * if element is None: + * _appendValue(self, tag, value) + */ + __pyx_t_5 = __pyx_f_4lxml_9objectify__lookupChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":249 + * tag = _buildChildTag(self, tag) + * element = _lookupChild(self, tag) + * if element is None: # <<<<<<<<<<<<<< + * _appendValue(self, tag, value) + * else: + */ + __pyx_t_4 = (((PyObject *)__pyx_v_element) == Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":250 + * element = _lookupChild(self, tag) + * if element is None: + * _appendValue(self, tag, value) # <<<<<<<<<<<<<< + * else: + * _replaceElement(element, value) + */ + __pyx_t_5 = __pyx_f_4lxml_9objectify__appendValue(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":252 + * _appendValue(self, tag, value) + * else: + * _replaceElement(element, value) # <<<<<<<<<<<<<< + * + * def __delattr__(self, tag): + */ + __pyx_t_5 = __pyx_f_4lxml_9objectify__replaceElement(__pyx_v_element, __pyx_v_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.__setattr__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_value); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":254 + * _replaceElement(element, value) + * + * def __delattr__(self, tag): # <<<<<<<<<<<<<< + * child = _lookupChildOrRaise(self, tag) + * self.remove(child) + */ + +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/ +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) { + PyObject *__pyx_v_child; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__delattr__"); + __pyx_v_child = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":255 + * + * def __delattr__(self, tag): + * child = _lookupChildOrRaise(self, tag) # <<<<<<<<<<<<<< + * self.remove(child) + * + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__lookupChildOrRaise(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":256 + * def __delattr__(self, tag): + * child = _lookupChildOrRaise(self, tag) + * self.remove(child) # <<<<<<<<<<<<<< + * + * def addattr(self, tag, value): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __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 = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_child); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_child); + __Pyx_GIVEREF(__pyx_v_child); + __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 = 256; __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.objectify.ObjectifiedElement.__delattr__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_child); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":258 + * self.remove(child) + * + * def addattr(self, tag, value): # <<<<<<<<<<<<<< + * u"""addattr(self, tag, value) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_addattr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_addattr[] = "addattr(self, tag, value)\n\n Add a child value to the element.\n\n As opposed to append(), it sets a data value, not an element.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_addattr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_tag = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_tag,&__pyx_n_ui_value,0}; + __Pyx_SetupRefcountContext("addattr"); + 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_ui_tag); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("addattr", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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), "addattr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tag = values[0]; + __pyx_v_value = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_tag = 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("addattr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.addattr"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":265 + * As opposed to append(), it sets a data value, not an element. + * """ + * _appendValue(self, _buildChildTag(self, tag), value) # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__buildChildTag(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__appendValue(((struct LxmlElement *)__pyx_v_self), __pyx_t_1, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __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.objectify.ObjectifiedElement.addattr"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":267 + * _appendValue(self, _buildChildTag(self, tag), value) + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * u"""Return a sibling, counting from the first child of the parent. The + * method behaves like both a dict and a sequence. + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement___getitem__[] = "Return a sibling, counting from the first child of the parent. The\n method behaves like both a dict and a sequence.\n\n * If argument is an integer, returns the sibling at that position.\n\n * If argument is a string, does the same as getattr(). This can be\n used to provide namespaces for element lookup, or to look up\n children with special names (``text`` etc.).\n\n * If argument is a slice object, returns the matching slice.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + xmlNode *__pyx_v_c_self_node; + xmlNode *__pyx_v_c_parent; + xmlNode *__pyx_v_c_node; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + __Pyx_SetupRefcountContext("__getitem__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_key); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":283 + * cdef tree.xmlNode* c_node + * cdef Py_ssize_t start, stop, step, slicelength + * if python._isString(key): # <<<<<<<<<<<<<< + * return _lookupChildOrRaise(self, key) + * elif python.PySlice_Check(key): + */ + __pyx_t_1 = _isString(__pyx_v_key); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":284 + * cdef Py_ssize_t start, stop, step, slicelength + * if python._isString(key): + * return _lookupChildOrRaise(self, key) # <<<<<<<<<<<<<< + * elif python.PySlice_Check(key): + * return list(self)[key] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_9objectify__lookupChildOrRaise(((struct LxmlElement *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __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; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":285 + * if python._isString(key): + * return _lookupChildOrRaise(self, key) + * elif python.PySlice_Check(key): # <<<<<<<<<<<<<< + * return list(self)[key] + * # normal item access + */ + __pyx_t_1 = PySlice_Check(__pyx_v_key); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":286 + * return _lookupChildOrRaise(self, key) + * elif python.PySlice_Check(key): + * return list(self)[key] # <<<<<<<<<<<<<< + * # normal item access + * c_self_node = self._c_node + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __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*)&PyList_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __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_GetItem(__pyx_t_3, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":288 + * return list(self)[key] + * # normal item access + * c_self_node = self._c_node # <<<<<<<<<<<<<< + * c_parent = c_self_node.parent + * if c_parent is NULL: + */ + __pyx_v_c_self_node = ((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":289 + * # normal item access + * c_self_node = self._c_node + * c_parent = c_self_node.parent # <<<<<<<<<<<<<< + * if c_parent is NULL: + * if key == 0: + */ + __pyx_v_c_parent = __pyx_v_c_self_node->parent; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":290 + * c_self_node = self._c_node + * c_parent = c_self_node.parent + * if c_parent is NULL: # <<<<<<<<<<<<<< + * if key == 0: + * return self + */ + __pyx_t_1 = (__pyx_v_c_parent == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":291 + * c_parent = c_self_node.parent + * if c_parent is NULL: + * if key == 0: # <<<<<<<<<<<<<< + * return self + * else: + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":292 + * if c_parent is NULL: + * if key == 0: + * return self # <<<<<<<<<<<<<< + * else: + * raise IndexError, unicode(key) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":294 + * return self + * else: + * raise IndexError, unicode(key) # <<<<<<<<<<<<<< + * if key < 0: + * c_node = c_parent.last + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __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 = 294; __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_builtin_IndexError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":295 + * else: + * raise IndexError, unicode(key) + * if key < 0: # <<<<<<<<<<<<<< + * c_node = c_parent.last + * else: + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":296 + * raise IndexError, unicode(key) + * if key < 0: + * c_node = c_parent.last # <<<<<<<<<<<<<< + * else: + * c_node = c_parent.children + */ + __pyx_v_c_node = __pyx_v_c_parent->last; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":298 + * c_node = c_parent.last + * else: + * c_node = c_parent.children # <<<<<<<<<<<<<< + * c_node = _findFollowingSibling( + * c_node, tree._getNs(c_self_node), c_self_node.name, key) + */ + __pyx_v_c_node = __pyx_v_c_parent->children; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":300 + * c_node = c_parent.children + * c_node = _findFollowingSibling( + * c_node, tree._getNs(c_self_node), c_self_node.name, key) # <<<<<<<<<<<<<< + * if c_node is NULL: + * raise IndexError, unicode(key) + */ + __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_f_4lxml_9objectify__findFollowingSibling(__pyx_v_c_node, _getNs(__pyx_v_c_self_node), __pyx_v_c_self_node->name, __pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":301 + * c_node = _findFollowingSibling( + * c_node, tree._getNs(c_self_node), c_self_node.name, key) + * if c_node is NULL: # <<<<<<<<<<<<<< + * raise IndexError, unicode(key) + * return elementFactory(self._doc, c_node) + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":302 + * c_node, tree._getNs(c_self_node), c_self_node.name, key) + * if c_node is NULL: + * raise IndexError, unicode(key) # <<<<<<<<<<<<<< + * return elementFactory(self._doc, c_node) + * + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __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 = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":303 + * if c_node is NULL: + * raise IndexError, unicode(key) + * return elementFactory(self._doc, c_node) # <<<<<<<<<<<<<< + * + * def __setitem__(self, key, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)elementFactory(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __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.objectify.ObjectifiedElement.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":305 + * return elementFactory(self._doc, c_node) + * + * def __setitem__(self, key, value): # <<<<<<<<<<<<<< + * u"""Set the value of a sibling, counting from the first child of the + * parent. Implements key assignment, item assignment and slice + */ + +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement___setitem__[] = "Set the value of a sibling, counting from the first child of the\n parent. Implements key assignment, item assignment and slice\n assignment.\n\n * If argument is an integer, sets the sibling at that position.\n\n * If argument is a string, does the same as setattr(). This is used\n to provide namespaces for element lookup.\n\n * If argument is a sequence (list, tuple, etc.), assign the contained\n items to the siblings.\n "; +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + struct LxmlElement *__pyx_v_element; + xmlNode *__pyx_v_c_node; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__setitem__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":320 + * cdef _Element element + * cdef tree.xmlNode* c_node + * if python._isString(key): # <<<<<<<<<<<<<< + * key = _buildChildTag(self, key) + * element = _lookupChild(self, key) + */ + __pyx_t_1 = _isString(__pyx_v_key); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":321 + * cdef tree.xmlNode* c_node + * if python._isString(key): + * key = _buildChildTag(self, key) # <<<<<<<<<<<<<< + * element = _lookupChild(self, key) + * if element is None: + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__buildChildTag(((struct LxmlElement *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":322 + * if python._isString(key): + * key = _buildChildTag(self, key) + * element = _lookupChild(self, key) # <<<<<<<<<<<<<< + * if element is None: + * _appendValue(self, key, value) + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__lookupChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":323 + * key = _buildChildTag(self, key) + * element = _lookupChild(self, key) + * if element is None: # <<<<<<<<<<<<<< + * _appendValue(self, key, value) + * else: + */ + __pyx_t_1 = (((PyObject *)__pyx_v_element) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":324 + * element = _lookupChild(self, key) + * if element is None: + * _appendValue(self, key, value) # <<<<<<<<<<<<<< + * else: + * _replaceElement(element, value) + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__appendValue(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":326 + * _appendValue(self, key, value) + * else: + * _replaceElement(element, value) # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__replaceElement(__pyx_v_element, __pyx_v_value); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":327 + * else: + * _replaceElement(element, value) + * return # <<<<<<<<<<<<<< + * + * if self._c_node.parent is NULL: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":329 + * return + * + * if self._c_node.parent is NULL: # <<<<<<<<<<<<<< + * # the 'root[i] = ...' case + * raise TypeError, u"assignment to root element is invalid" + */ + __pyx_t_1 = (((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->parent == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":331 + * if self._c_node.parent is NULL: + * # the 'root[i] = ...' case + * raise TypeError, u"assignment to root element is invalid" # <<<<<<<<<<<<<< + * + * if python.PySlice_Check(key): + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_7), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":333 + * raise TypeError, u"assignment to root element is invalid" + * + * if python.PySlice_Check(key): # <<<<<<<<<<<<<< + * # slice assignment + * _setSlice(key, self, value) + */ + __pyx_t_1 = PySlice_Check(__pyx_v_key); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":335 + * if python.PySlice_Check(key): + * # slice assignment + * _setSlice(key, self, value) # <<<<<<<<<<<<<< + * else: + * # normal index assignment + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__setSlice(__pyx_v_key, ((struct LxmlElement *)__pyx_v_self), __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":338 + * else: + * # normal index assignment + * if key < 0: # <<<<<<<<<<<<<< + * c_node = self._c_node.parent.last + * else: + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":339 + * # normal index assignment + * if key < 0: + * c_node = self._c_node.parent.last # <<<<<<<<<<<<<< + * else: + * c_node = self._c_node.parent.children + */ + __pyx_v_c_node = ((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->parent->last; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":341 + * c_node = self._c_node.parent.last + * else: + * c_node = self._c_node.parent.children # <<<<<<<<<<<<<< + * c_node = _findFollowingSibling( + * c_node, tree._getNs(self._c_node), self._c_node.name, key) + */ + __pyx_v_c_node = ((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->parent->children; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":343 + * c_node = self._c_node.parent.children + * c_node = _findFollowingSibling( + * c_node, tree._getNs(self._c_node), self._c_node.name, key) # <<<<<<<<<<<<<< + * if c_node is NULL: + * raise IndexError, unicode(key) + */ + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_node = __pyx_f_4lxml_9objectify__findFollowingSibling(__pyx_v_c_node, _getNs(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node), ((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node->name, __pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":344 + * c_node = _findFollowingSibling( + * c_node, tree._getNs(self._c_node), self._c_node.name, key) + * if c_node is NULL: # <<<<<<<<<<<<<< + * raise IndexError, unicode(key) + * element = elementFactory(self._doc, c_node) + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":345 + * c_node, tree._getNs(self._c_node), self._c_node.name, key) + * if c_node is NULL: + * raise IndexError, unicode(key) # <<<<<<<<<<<<<< + * element = elementFactory(self._doc, c_node) + * _replaceElement(element, value) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":346 + * if c_node is NULL: + * raise IndexError, unicode(key) + * element = elementFactory(self._doc, c_node) # <<<<<<<<<<<<<< + * _replaceElement(element, value) + * + */ + __pyx_t_4 = ((PyObject *)elementFactory(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":347 + * raise IndexError, unicode(key) + * element = elementFactory(self._doc, c_node) + * _replaceElement(element, value) # <<<<<<<<<<<<<< + * + * def __delitem__(self, key): + */ + __pyx_t_4 = __pyx_f_4lxml_9objectify__replaceElement(__pyx_v_element, __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L8:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.__setitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_key); + __Pyx_DECREF(__pyx_v_value); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":349 + * _replaceElement(element, value) + * + * def __delitem__(self, key): # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, slicelength + * parent = self.getparent() + */ + +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static int __pyx_pf_4lxml_9objectify_18ObjectifiedElement___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_parent; + PyObject *__pyx_v_del_items; + PyObject *__pyx_v_remove; + PyObject *__pyx_v_el; + PyObject *__pyx_v_sibling; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __Pyx_SetupRefcountContext("__delitem__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_key); + __pyx_v_parent = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_del_items = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_remove = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_el = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_sibling = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":351 + * def __delitem__(self, key): + * cdef Py_ssize_t start, stop, step, slicelength + * parent = self.getparent() # <<<<<<<<<<<<<< + * if parent is None: + * raise TypeError, u"deleting items not supported by root element" + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui_getparent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __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 = 351; __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_parent); + __pyx_v_parent = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":352 + * cdef Py_ssize_t start, stop, step, slicelength + * parent = self.getparent() + * if parent is None: # <<<<<<<<<<<<<< + * raise TypeError, u"deleting items not supported by root element" + * if python.PySlice_Check(key): + */ + __pyx_t_3 = (__pyx_v_parent == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":353 + * parent = self.getparent() + * if parent is None: + * raise TypeError, u"deleting items not supported by root element" # <<<<<<<<<<<<<< + * if python.PySlice_Check(key): + * # slice deletion + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_8), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":354 + * if parent is None: + * raise TypeError, u"deleting items not supported by root element" + * if python.PySlice_Check(key): # <<<<<<<<<<<<<< + * # slice deletion + * del_items = list(self)[key] + */ + __pyx_t_3 = PySlice_Check(__pyx_v_key); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":356 + * if python.PySlice_Check(key): + * # slice deletion + * del_items = list(self)[key] # <<<<<<<<<<<<<< + * remove = parent.remove + * for el in del_items: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __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_1 = PyObject_Call(((PyObject *)((PyObject*)&PyList_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __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_del_items); + __pyx_v_del_items = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":357 + * # slice deletion + * del_items = list(self)[key] + * remove = parent.remove # <<<<<<<<<<<<<< + * for el in del_items: + * remove(el) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_parent, __pyx_n_ui_remove); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_remove); + __pyx_v_remove = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":358 + * del_items = list(self)[key] + * remove = parent.remove + * for el in del_items: # <<<<<<<<<<<<<< + * remove(el) + * else: + */ + if (PyList_CheckExact(__pyx_v_del_items) || PyTuple_CheckExact(__pyx_v_del_items)) { + __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_del_items; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_del_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_el); + __pyx_v_el = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":359 + * remove = parent.remove + * for el in del_items: + * remove(el) # <<<<<<<<<<<<<< + * else: + * # normal index deletion + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_el); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_el); + __Pyx_GIVEREF(__pyx_v_el); + __pyx_t_5 = PyObject_Call(__pyx_v_remove, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":362 + * else: + * # normal index deletion + * sibling = self.__getitem__(key) # <<<<<<<<<<<<<< + * parent.remove(sibling) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui___getitem__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __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 = 362; __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_DECREF(__pyx_v_sibling); + __pyx_v_sibling = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":363 + * # normal index deletion + * sibling = self.__getitem__(key) + * parent.remove(sibling) # <<<<<<<<<<<<<< + * + * def iterfind(self, path): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_parent, __pyx_n_ui_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __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[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_sibling); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_sibling); + __Pyx_GIVEREF(__pyx_v_sibling); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); 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_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __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_5); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.__delitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_parent); + __Pyx_DECREF(__pyx_v_del_items); + __Pyx_DECREF(__pyx_v_remove); + __Pyx_DECREF(__pyx_v_el); + __Pyx_DECREF(__pyx_v_sibling); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_key); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":365 + * parent.remove(sibling) + * + * def iterfind(self, path): # <<<<<<<<<<<<<< + * u"iterfind(self, path)" + * # Reimplementation of Element.iterfind() to make it work without child + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_iterfind(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_iterfind[] = "iterfind(self, path)"; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_iterfind(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_xpath; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("iterfind"); + __pyx_v_xpath = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":369 + * # Reimplementation of Element.iterfind() to make it work without child + * # iteration. + * xpath = etree.ETXPath(path) # <<<<<<<<<<<<<< + * return iter(xpath(self)) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_ETXPath); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __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 = 369; __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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __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_xpath); + __pyx_v_xpath = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":370 + * # iteration. + * xpath = etree.ETXPath(path) + * return iter(xpath(self)) # <<<<<<<<<<<<<< + * + * def findall(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __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 = PyObject_Call(__pyx_v_xpath, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.iterfind"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_xpath); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":372 + * return iter(xpath(self)) + * + * def findall(self, path): # <<<<<<<<<<<<<< + * u"findall(self, path)" + * # Reimplementation of Element.findall() to make it work without child + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_findall(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_findall[] = "findall(self, path)"; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_findall(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_xpath; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("findall"); + __pyx_v_xpath = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":376 + * # Reimplementation of Element.findall() to make it work without child + * # iteration. + * xpath = etree.ETXPath(path) # <<<<<<<<<<<<<< + * return xpath(self) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_ETXPath); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __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 = 376; __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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __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_xpath); + __pyx_v_xpath = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":377 + * # iteration. + * xpath = etree.ETXPath(path) + * return xpath(self) # <<<<<<<<<<<<<< + * + * def find(self, path): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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 = PyObject_Call(__pyx_v_xpath, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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.objectify.ObjectifiedElement.findall"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_xpath); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":379 + * return xpath(self) + * + * def find(self, path): # <<<<<<<<<<<<<< + * u"find(self, path)" + * # Reimplementation of Element.find() to make it work without child + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_find(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_find[] = "find(self, path)"; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_find(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_SetupRefcountContext("find"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_path); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":383 + * # Reimplementation of Element.find() to make it work without child + * # iteration. + * result = self.findall(path) # <<<<<<<<<<<<<< + * if isinstance(result, list) and len(result): + * return result[0] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui_findall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __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 = 383; __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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __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_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":384 + * # iteration. + * result = self.findall(path) + * if isinstance(result, list) and len(result): # <<<<<<<<<<<<<< + * return result[0] + * elif isinstance(result, _Element): + */ + __pyx_t_4 = PyObject_TypeCheck(__pyx_v_result, ((PyTypeObject *)((PyObject*)&PyList_Type))); + if (__pyx_t_4) { + __pyx_t_5 = PyObject_Length(__pyx_v_result); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_4; + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":385 + * result = self.findall(path) + * if isinstance(result, list) and len(result): + * return result[0] # <<<<<<<<<<<<<< + * elif isinstance(result, _Element): + * return result + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __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-2.2/src/lxml/lxml.objectify.pyx":386 + * if isinstance(result, list) and len(result): + * return result[0] + * elif isinstance(result, _Element): # <<<<<<<<<<<<<< + * return result + * else: + */ + __pyx_t_6 = PyObject_TypeCheck(__pyx_v_result, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":387 + * return result[0] + * elif isinstance(result, _Element): + * return result # <<<<<<<<<<<<<< + * else: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":389 + * return result + * else: + * return None # <<<<<<<<<<<<<< + * + * def findtext(self, path, default=None): + */ + __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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.find"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":391 + * return None + * + * def findtext(self, path, default=None): # <<<<<<<<<<<<<< + * u"findtext(self, path, default=None)" + * # Reimplementation of Element.findtext() to make it work without child + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_findtext[] = "findtext(self, path, default=None)"; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_default = 0; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + 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_ui_path,&__pyx_n_ui_default,0}; + __Pyx_SetupRefcountContext("findtext"); + 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_ui_path); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_default); + if (unlikely(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), "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_path = 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_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, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.findtext"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_path); + __Pyx_INCREF(__pyx_v_default); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":395 + * # Reimplementation of Element.findtext() to make it work without child + * # iteration. + * result = self.find(path) # <<<<<<<<<<<<<< + * if isinstance(result, _Element): + * return result.text or u"" + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui_find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __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 = 395; __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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __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_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":396 + * # iteration. + * result = self.find(path) + * if isinstance(result, _Element): # <<<<<<<<<<<<<< + * return result.text or u"" + * else: + */ + __pyx_t_4 = PyObject_TypeCheck(__pyx_v_result, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":397 + * result = self.find(path) + * if isinstance(result, _Element): + * return result.text or u"" # <<<<<<<<<<<<<< + * else: + * return default + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_result, __pyx_n_ui_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_4) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_2 = __pyx_kp_u_4; + } else { + __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":399 + * return result.text or u"" + * else: + * return default # <<<<<<<<<<<<<< + * + * def descendantpaths(self, prefix=None): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_default); + __pyx_r = __pyx_v_default; + 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_AddTraceback("lxml.objectify.ObjectifiedElement.findtext"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_path); + __Pyx_DECREF(__pyx_v_default); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":401 + * return default + * + * def descendantpaths(self, prefix=None): # <<<<<<<<<<<<<< + * u"""descendantpaths(self, prefix=None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_descendantpaths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_18ObjectifiedElement_descendantpaths[] = "descendantpaths(self, prefix=None)\n\n Returns a list of object path expressions for all descendants.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_18ObjectifiedElement_descendantpaths(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_prefix = 0; + 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_ui_prefix,0}; + __Pyx_SetupRefcountContext("descendantpaths"); + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_prefix); + if (unlikely(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), "descendantpaths") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_prefix = values[0]; + } else { + __pyx_v_prefix = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: __pyx_v_prefix = 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("descendantpaths", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.descendantpaths"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_prefix); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":406 + * Returns a list of object path expressions for all descendants. + * """ + * if prefix is not None and not python._isString(prefix): # <<<<<<<<<<<<<< + * prefix = u'.'.join(prefix) + * return _buildDescendantPaths(self._c_node, prefix) + */ + __pyx_t_1 = (__pyx_v_prefix != Py_None); + if (__pyx_t_1) { + __pyx_t_2 = (!_isString(__pyx_v_prefix)); + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":407 + * """ + * if prefix is not None and not python._isString(prefix): + * prefix = u'.'.join(prefix) # <<<<<<<<<<<<<< + * return _buildDescendantPaths(self._c_node, prefix) + * + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_u_9), __pyx_n_ui_join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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[0]; __pyx_lineno = 407; __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_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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_prefix); + __pyx_v_prefix = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":408 + * if prefix is not None and not python._isString(prefix): + * prefix = u'.'.join(prefix) + * return _buildDescendantPaths(self._c_node, prefix) # <<<<<<<<<<<<<< + * + * cdef inline bint _tagMatches(tree.xmlNode* c_node, char* c_href, char* c_name): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_9objectify__buildDescendantPaths(((struct __pyx_obj_4lxml_9objectify_ObjectifiedElement *)__pyx_v_self)->__pyx_base.__pyx_base._c_node, __pyx_v_prefix)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.objectify.ObjectifiedElement.descendantpaths"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_prefix); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":410 + * return _buildDescendantPaths(self._c_node, prefix) + * + * cdef inline bint _tagMatches(tree.xmlNode* c_node, char* c_href, char* c_name): # <<<<<<<<<<<<<< + * cdef char* c_node_href + * if c_node.name != c_name: + */ + +static INLINE int __pyx_f_4lxml_9objectify__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; + __Pyx_SetupRefcountContext("_tagMatches"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":412 + * cdef inline bint _tagMatches(tree.xmlNode* c_node, char* c_href, char* c_name): + * cdef char* c_node_href + * if c_node.name != c_name: # <<<<<<<<<<<<<< + * return 0 + * if c_href == NULL: + */ + __pyx_t_1 = (__pyx_v_c_node->name != __pyx_v_c_name); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":413 + * cdef char* c_node_href + * if c_node.name != c_name: + * return 0 # <<<<<<<<<<<<<< + * if c_href == NULL: + * return 1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":414 + * if c_node.name != c_name: + * return 0 + * if c_href == NULL: # <<<<<<<<<<<<<< + * return 1 + * c_node_href = tree._getNs(c_node) + */ + __pyx_t_1 = (__pyx_v_c_href == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":415 + * return 0 + * if c_href == NULL: + * return 1 # <<<<<<<<<<<<<< + * c_node_href = tree._getNs(c_node) + * if c_node_href == NULL: + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":416 + * if c_href == NULL: + * return 1 + * c_node_href = tree._getNs(c_node) # <<<<<<<<<<<<<< + * if c_node_href == NULL: + * return c_href[0] == c'\0' + */ + __pyx_v_c_node_href = _getNs(__pyx_v_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":417 + * return 1 + * c_node_href = tree._getNs(c_node) + * if c_node_href == NULL: # <<<<<<<<<<<<<< + * return c_href[0] == c'\0' + * return cstd.strcmp(c_node_href, c_href) == 0 + */ + __pyx_t_1 = (__pyx_v_c_node_href == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":418 + * c_node_href = tree._getNs(c_node) + * if c_node_href == NULL: + * return c_href[0] == c'\0' # <<<<<<<<<<<<<< + * return cstd.strcmp(c_node_href, c_href) == 0 + * + */ + __pyx_r = ((__pyx_v_c_href[0]) == '\x00'); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":419 + * if c_node_href == NULL: + * return c_href[0] == c'\0' + * return cstd.strcmp(c_node_href, c_href) == 0 # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t _countSiblings(tree.xmlNode* c_start_node): + */ + __pyx_r = (strcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":421 + * return cstd.strcmp(c_node_href, c_href) == 0 + * + * cdef Py_ssize_t _countSiblings(tree.xmlNode* c_start_node): # <<<<<<<<<<<<<< + * cdef tree.xmlNode* c_node + * cdef char* c_href + */ + +static Py_ssize_t __pyx_f_4lxml_9objectify__countSiblings(xmlNode *__pyx_v_c_start_node) { + xmlNode *__pyx_v_c_node; + char *__pyx_v_c_href; + char *__pyx_v_c_tag; + Py_ssize_t __pyx_v_count; + Py_ssize_t __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_countSiblings"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":426 + * cdef char* c_tag + * cdef Py_ssize_t count + * c_tag = c_start_node.name # <<<<<<<<<<<<<< + * c_href = tree._getNs(c_start_node) + * count = 1 + */ + __pyx_v_c_tag = __pyx_v_c_start_node->name; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":427 + * cdef Py_ssize_t count + * c_tag = c_start_node.name + * c_href = tree._getNs(c_start_node) # <<<<<<<<<<<<<< + * count = 1 + * c_node = c_start_node.next + */ + __pyx_v_c_href = _getNs(__pyx_v_c_start_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":428 + * c_tag = c_start_node.name + * c_href = tree._getNs(c_start_node) + * count = 1 # <<<<<<<<<<<<<< + * c_node = c_start_node.next + * while c_node is not NULL: + */ + __pyx_v_count = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":429 + * c_href = tree._getNs(c_start_node) + * count = 1 + * c_node = c_start_node.next # <<<<<<<<<<<<<< + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ + */ + __pyx_v_c_node = __pyx_v_c_start_node->next; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":430 + * count = 1 + * c_node = c_start_node.next + * while c_node is not NULL: # <<<<<<<<<<<<<< + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, c_href, c_tag): + */ + while (1) { + __pyx_t_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":431 + * c_node = c_start_node.next + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ # <<<<<<<<<<<<<< + * _tagMatches(c_node, c_href, c_tag): + * count = count + 1 + */ + if ((__pyx_v_c_node->type == XML_ELEMENT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":432 + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, c_href, c_tag): # <<<<<<<<<<<<<< + * count = count + 1 + * c_node = c_node.next + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_tag); + } else { + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":433 + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, c_href, c_tag): + * count = count + 1 # <<<<<<<<<<<<<< + * c_node = c_node.next + * c_node = c_start_node.prev + */ + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":434 + * _tagMatches(c_node, c_href, c_tag): + * count = count + 1 + * c_node = c_node.next # <<<<<<<<<<<<<< + * c_node = c_start_node.prev + * while c_node is not NULL: + */ + __pyx_v_c_node = __pyx_v_c_node->next; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":435 + * count = count + 1 + * c_node = c_node.next + * c_node = c_start_node.prev # <<<<<<<<<<<<<< + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ + */ + __pyx_v_c_node = __pyx_v_c_start_node->prev; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":436 + * c_node = c_node.next + * c_node = c_start_node.prev + * while c_node is not NULL: # <<<<<<<<<<<<<< + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, c_href, c_tag): + */ + while (1) { + __pyx_t_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":437 + * c_node = c_start_node.prev + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ # <<<<<<<<<<<<<< + * _tagMatches(c_node, c_href, c_tag): + * count = count + 1 + */ + if ((__pyx_v_c_node->type == XML_ELEMENT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":438 + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, c_href, c_tag): # <<<<<<<<<<<<<< + * count = count + 1 + * c_node = c_node.prev + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_tag); + } else { + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":439 + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, c_href, c_tag): + * count = count + 1 # <<<<<<<<<<<<<< + * c_node = c_node.prev + * return count + */ + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":440 + * _tagMatches(c_node, c_href, c_tag): + * count = count + 1 + * c_node = c_node.prev # <<<<<<<<<<<<<< + * return count + * + */ + __pyx_v_c_node = __pyx_v_c_node->prev; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":441 + * count = count + 1 + * c_node = c_node.prev + * return count # <<<<<<<<<<<<<< + * + * cdef tree.xmlNode* _findFollowingSibling(tree.xmlNode* c_node, + */ + __pyx_r = __pyx_v_count; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":443 + * return count + * + * cdef tree.xmlNode* _findFollowingSibling(tree.xmlNode* c_node, # <<<<<<<<<<<<<< + * char* href, char* name, + * Py_ssize_t index): + */ + +static xmlNode *__pyx_f_4lxml_9objectify__findFollowingSibling(xmlNode *__pyx_v_c_node, char *__pyx_v_href, char *__pyx_v_name, Py_ssize_t __pyx_v_index) { + xmlNode *(*__pyx_v_next)(xmlNode *); + xmlNode *__pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_findFollowingSibling"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":447 + * Py_ssize_t index): + * cdef tree.xmlNode* (*next)(tree.xmlNode*) + * if index >= 0: # <<<<<<<<<<<<<< + * next = cetree.nextElement + * else: + */ + __pyx_t_1 = (__pyx_v_index >= 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":448 + * cdef tree.xmlNode* (*next)(tree.xmlNode*) + * if index >= 0: + * next = cetree.nextElement # <<<<<<<<<<<<<< + * else: + * index = -1 - index + */ + __pyx_v_next = nextElement; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":450 + * next = cetree.nextElement + * else: + * index = -1 - index # <<<<<<<<<<<<<< + * next = cetree.previousElement + * while c_node is not NULL: + */ + __pyx_v_index = (-1 - __pyx_v_index); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":451 + * else: + * index = -1 - index + * next = cetree.previousElement # <<<<<<<<<<<<<< + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ + */ + __pyx_v_next = previousElement; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":452 + * index = -1 - index + * next = cetree.previousElement + * while c_node is not NULL: # <<<<<<<<<<<<<< + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, href, name): + */ + while (1) { + __pyx_t_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":453 + * next = cetree.previousElement + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ # <<<<<<<<<<<<<< + * _tagMatches(c_node, href, name): + * index = index - 1 + */ + if ((__pyx_v_c_node->type == XML_ELEMENT_NODE)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":454 + * while c_node is not NULL: + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, href, name): # <<<<<<<<<<<<<< + * index = index - 1 + * if index < 0: + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__tagMatches(__pyx_v_c_node, __pyx_v_href, __pyx_v_name); + } else { + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":455 + * if c_node.type == tree.XML_ELEMENT_NODE and \ + * _tagMatches(c_node, href, name): + * index = index - 1 # <<<<<<<<<<<<<< + * if index < 0: + * return c_node + */ + __pyx_v_index = (__pyx_v_index - 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":456 + * _tagMatches(c_node, href, name): + * index = index - 1 + * if index < 0: # <<<<<<<<<<<<<< + * return c_node + * c_node = next(c_node) + */ + __pyx_t_1 = (__pyx_v_index < 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":457 + * index = index - 1 + * if index < 0: + * return c_node # <<<<<<<<<<<<<< + * c_node = next(c_node) + * return NULL + */ + __pyx_r = __pyx_v_c_node; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":458 + * if index < 0: + * return c_node + * c_node = next(c_node) # <<<<<<<<<<<<<< + * return NULL + * + */ + __pyx_v_c_node = __pyx_v_next(__pyx_v_c_node); + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":459 + * return c_node + * c_node = next(c_node) + * return NULL # <<<<<<<<<<<<<< + * + * cdef object _lookupChild(_Element parent, tag): + */ + __pyx_r = NULL; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":461 + * return NULL + * + * cdef object _lookupChild(_Element parent, tag): # <<<<<<<<<<<<<< + * cdef tree.xmlNode* c_result + * cdef tree.xmlNode* c_node + */ + +static PyObject *__pyx_f_4lxml_9objectify__lookupChild(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag) { + xmlNode *__pyx_v_c_result; + xmlNode *__pyx_v_c_node; + char *__pyx_v_c_href; + char *__pyx_v_c_tag; + PyObject *__pyx_v_ns; + 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; + __Pyx_SetupRefcountContext("_lookupChild"); + __Pyx_INCREF((PyObject *)__pyx_v_parent); + __Pyx_INCREF(__pyx_v_tag); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":466 + * cdef char* c_href + * cdef char* c_tag + * c_node = parent._c_node # <<<<<<<<<<<<<< + * ns, tag = cetree.getNsTag(tag) + * c_tag = tree.xmlDictExists( + */ + __pyx_v_c_node = __pyx_v_parent->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":467 + * cdef char* c_tag + * c_node = parent._c_node + * ns, tag = cetree.getNsTag(tag) # <<<<<<<<<<<<<< + * c_tag = tree.xmlDictExists( + * c_node.doc.dict, _cstr(tag), python.PyString_GET_SIZE(tag)) + */ + __pyx_t_1 = getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __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_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_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __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 = 467; __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 = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_3; + __pyx_t_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":469 + * ns, tag = cetree.getNsTag(tag) + * c_tag = tree.xmlDictExists( + * c_node.doc.dict, _cstr(tag), python.PyString_GET_SIZE(tag)) # <<<<<<<<<<<<<< + * if c_tag is NULL: + * return None + */ + __pyx_v_c_tag = xmlDictExists(__pyx_v_c_node->doc->dict, PyString_AS_STRING(__pyx_v_tag), PyString_GET_SIZE(__pyx_v_tag)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":470 + * c_tag = tree.xmlDictExists( + * c_node.doc.dict, _cstr(tag), python.PyString_GET_SIZE(tag)) + * if c_tag is NULL: # <<<<<<<<<<<<<< + * return None + * if ns is None: + */ + __pyx_t_5 = (__pyx_v_c_tag == NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":471 + * c_node.doc.dict, _cstr(tag), python.PyString_GET_SIZE(tag)) + * if c_tag is NULL: + * return None # <<<<<<<<<<<<<< + * if ns is None: + * c_href = tree._getNs(c_node) + */ + __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-2.2/src/lxml/lxml.objectify.pyx":472 + * if c_tag is NULL: + * return None + * if ns is None: # <<<<<<<<<<<<<< + * c_href = tree._getNs(c_node) + * else: + */ + __pyx_t_5 = (__pyx_v_ns == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":473 + * return None + * if ns is None: + * c_href = tree._getNs(c_node) # <<<<<<<<<<<<<< + * else: + * c_href = _cstr(ns) + */ + __pyx_v_c_href = _getNs(__pyx_v_c_node); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":475 + * c_href = tree._getNs(c_node) + * else: + * c_href = _cstr(ns) # <<<<<<<<<<<<<< + * c_result = _findFollowingSibling(c_node.children, c_href, c_tag, 0) + * if c_result is NULL: + */ + __pyx_v_c_href = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":476 + * else: + * c_href = _cstr(ns) + * c_result = _findFollowingSibling(c_node.children, c_href, c_tag, 0) # <<<<<<<<<<<<<< + * if c_result is NULL: + * return None + */ + __pyx_v_c_result = __pyx_f_4lxml_9objectify__findFollowingSibling(__pyx_v_c_node->children, __pyx_v_c_href, __pyx_v_c_tag, 0); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":477 + * c_href = _cstr(ns) + * c_result = _findFollowingSibling(c_node.children, c_href, c_tag, 0) + * if c_result is NULL: # <<<<<<<<<<<<<< + * return None + * return elementFactory(parent._doc, c_result) + */ + __pyx_t_5 = (__pyx_v_c_result == NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":478 + * c_result = _findFollowingSibling(c_node.children, c_href, c_tag, 0) + * if c_result is NULL: + * return None # <<<<<<<<<<<<<< + * return elementFactory(parent._doc, c_result) + * + */ + __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-2.2/src/lxml/lxml.objectify.pyx":479 + * if c_result is NULL: + * return None + * return elementFactory(parent._doc, c_result) # <<<<<<<<<<<<<< + * + * cdef object _lookupChildOrRaise(_Element parent, tag): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)elementFactory(__pyx_v_parent->_doc, __pyx_v_c_result)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __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_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify._lookupChild"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF((PyObject *)__pyx_v_parent); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":481 + * return elementFactory(parent._doc, c_result) + * + * cdef object _lookupChildOrRaise(_Element parent, tag): # <<<<<<<<<<<<<< + * element = _lookupChild(parent, tag) + * if element is None: + */ + +static PyObject *__pyx_f_4lxml_9objectify__lookupChildOrRaise(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag) { + PyObject *__pyx_v_element; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_lookupChildOrRaise"); + __Pyx_INCREF((PyObject *)__pyx_v_parent); + __Pyx_INCREF(__pyx_v_tag); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":482 + * + * cdef object _lookupChildOrRaise(_Element parent, tag): + * element = _lookupChild(parent, tag) # <<<<<<<<<<<<<< + * if element is None: + * raise AttributeError, \ + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__lookupChild(__pyx_v_parent, __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __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-2.2/src/lxml/lxml.objectify.pyx":483 + * cdef object _lookupChildOrRaise(_Element parent, tag): + * element = _lookupChild(parent, tag) + * if element is None: # <<<<<<<<<<<<<< + * raise AttributeError, \ + * u"no such child: " + _buildChildTag(parent, tag) + */ + __pyx_t_2 = (__pyx_v_element == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":485 + * if element is None: + * raise AttributeError, \ + * u"no such child: " + _buildChildTag(parent, tag) # <<<<<<<<<<<<<< + * return element + * + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__buildChildTag(__pyx_v_parent, __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_kp_u_10), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":486 + * raise AttributeError, \ + * u"no such child: " + _buildChildTag(parent, tag) + * return element # <<<<<<<<<<<<<< + * + * cdef object _buildChildTag(_Element parent, tag): + */ + __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_3); + __Pyx_AddTraceback("lxml.objectify._lookupChildOrRaise"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_element); + __Pyx_DECREF((PyObject *)__pyx_v_parent); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":488 + * return element + * + * cdef object _buildChildTag(_Element parent, tag): # <<<<<<<<<<<<<< + * cdef char* c_href + * cdef char* c_tag + */ + +static PyObject *__pyx_f_4lxml_9objectify__buildChildTag(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag) { + char *__pyx_v_c_href; + char *__pyx_v_c_tag; + PyObject *__pyx_v_ns; + 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; + __Pyx_SetupRefcountContext("_buildChildTag"); + __Pyx_INCREF((PyObject *)__pyx_v_parent); + __Pyx_INCREF(__pyx_v_tag); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":491 + * cdef char* c_href + * cdef char* c_tag + * ns, tag = cetree.getNsTag(tag) # <<<<<<<<<<<<<< + * c_tag = _cstr(tag) + * if ns is None: + */ + __pyx_t_1 = getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __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_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_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __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 = 491; __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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_3; + __pyx_t_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":492 + * cdef char* c_tag + * ns, tag = cetree.getNsTag(tag) + * c_tag = _cstr(tag) # <<<<<<<<<<<<<< + * if ns is None: + * c_href = tree._getNs(parent._c_node) + */ + __pyx_v_c_tag = PyString_AS_STRING(__pyx_v_tag); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":493 + * ns, tag = cetree.getNsTag(tag) + * c_tag = _cstr(tag) + * if ns is None: # <<<<<<<<<<<<<< + * c_href = tree._getNs(parent._c_node) + * else: + */ + __pyx_t_5 = (__pyx_v_ns == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":494 + * c_tag = _cstr(tag) + * if ns is None: + * c_href = tree._getNs(parent._c_node) # <<<<<<<<<<<<<< + * else: + * c_href = _cstr(ns) + */ + __pyx_v_c_href = _getNs(__pyx_v_parent->_c_node); + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":496 + * c_href = tree._getNs(parent._c_node) + * else: + * c_href = _cstr(ns) # <<<<<<<<<<<<<< + * return cetree.namespacedNameFromNsName(c_href, c_tag) + * + */ + __pyx_v_c_href = PyString_AS_STRING(__pyx_v_ns); + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":497 + * else: + * c_href = _cstr(ns) + * return cetree.namespacedNameFromNsName(c_href, c_tag) # <<<<<<<<<<<<<< + * + * cdef _replaceElement(_Element element, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __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_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify._buildChildTag"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF((PyObject *)__pyx_v_parent); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":499 + * return cetree.namespacedNameFromNsName(c_href, c_tag) + * + * cdef _replaceElement(_Element element, value): # <<<<<<<<<<<<<< + * cdef _Element new_element + * if isinstance(value, _Element): + */ + +static PyObject *__pyx_f_4lxml_9objectify__replaceElement(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_value) { + struct LxmlElement *__pyx_v_new_element; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_replaceElement"); + __Pyx_INCREF((PyObject *)__pyx_v_element); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_new_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":501 + * cdef _replaceElement(_Element element, value): + * cdef _Element new_element + * if isinstance(value, _Element): # <<<<<<<<<<<<<< + * # deep copy the new element + * new_element = cetree.deepcopyNodeToDocument( + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":504 + * # deep copy the new element + * new_element = cetree.deepcopyNodeToDocument( + * element._doc, (<_Element>value)._c_node) # <<<<<<<<<<<<<< + * new_element.tag = element.tag + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + */ + __pyx_t_2 = ((PyObject *)deepcopyNodeToDocument(__pyx_v_element->_doc, ((struct LxmlElement *)__pyx_v_value)->_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_new_element)); + __pyx_v_new_element = ((struct LxmlElement *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":505 + * new_element = cetree.deepcopyNodeToDocument( + * element._doc, (<_Element>value)._c_node) + * new_element.tag = element.tag # <<<<<<<<<<<<<< + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + * element[:] = value + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_ui_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(((PyObject *)__pyx_v_new_element), __pyx_n_ui_tag, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":506 + * element._doc, (<_Element>value)._c_node) + * new_element.tag = element.tag + * elif python.PyList_Check(value) or python.PyTuple_Check(value): # <<<<<<<<<<<<<< + * element[:] = value + * return + */ + if (!PyList_Check(__pyx_v_value)) { + __pyx_t_1 = PyTuple_Check(__pyx_v_value); + } else { + __pyx_t_1 = PyList_Check(__pyx_v_value); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":507 + * new_element.tag = element.tag + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + * element[:] = value # <<<<<<<<<<<<<< + * return + * else: + */ + if (PySequence_SetSlice(((PyObject *)__pyx_v_element), 0, PY_SSIZE_T_MAX, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":508 + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + * element[:] = value + * return # <<<<<<<<<<<<<< + * else: + * new_element = element.makeelement(element.tag) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":510 + * return + * else: + * new_element = element.makeelement(element.tag) # <<<<<<<<<<<<<< + * _setElementValue(new_element, value) + * element.getparent().replace(element, new_element) + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_ui_makeelement); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_ui_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __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[0]; __pyx_lineno = 510; __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(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __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; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_new_element)); + __pyx_v_new_element = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":511 + * else: + * new_element = element.makeelement(element.tag) + * _setElementValue(new_element, value) # <<<<<<<<<<<<<< + * element.getparent().replace(element, new_element) + * + */ + __pyx_t_3 = __pyx_f_4lxml_9objectify__setElementValue(__pyx_v_new_element, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":512 + * new_element = element.makeelement(element.tag) + * _setElementValue(new_element, value) + * element.getparent().replace(element, new_element) # <<<<<<<<<<<<<< + * + * cdef _appendValue(_Element parent, tag, value): + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_ui_getparent); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __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 = 512; __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_ui_replace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_v_element)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_element)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_element)); + __Pyx_INCREF(((PyObject *)__pyx_v_new_element)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_new_element)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_new_element)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __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_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_AddTraceback("lxml.objectify._replaceElement"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_new_element); + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":514 + * element.getparent().replace(element, new_element) + * + * cdef _appendValue(_Element parent, tag, value): # <<<<<<<<<<<<<< + * cdef _Element new_element + * if isinstance(value, _Element): + */ + +static PyObject *__pyx_f_4lxml_9objectify__appendValue(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_value) { + struct LxmlElement *__pyx_v_new_element; + 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; + __Pyx_SetupRefcountContext("_appendValue"); + __Pyx_INCREF((PyObject *)__pyx_v_parent); + __Pyx_INCREF(__pyx_v_tag); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_new_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_item = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":516 + * cdef _appendValue(_Element parent, tag, value): + * cdef _Element new_element + * if isinstance(value, _Element): # <<<<<<<<<<<<<< + * # deep copy the new element + * new_element = cetree.deepcopyNodeToDocument( + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":519 + * # deep copy the new element + * new_element = cetree.deepcopyNodeToDocument( + * parent._doc, (<_Element>value)._c_node) # <<<<<<<<<<<<<< + * new_element.tag = tag + * cetree.appendChild(parent, new_element) + */ + __pyx_t_2 = ((PyObject *)deepcopyNodeToDocument(__pyx_v_parent->_doc, ((struct LxmlElement *)__pyx_v_value)->_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_new_element)); + __pyx_v_new_element = ((struct LxmlElement *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":520 + * new_element = cetree.deepcopyNodeToDocument( + * parent._doc, (<_Element>value)._c_node) + * new_element.tag = tag # <<<<<<<<<<<<<< + * cetree.appendChild(parent, new_element) + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_new_element), __pyx_n_ui_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":521 + * parent._doc, (<_Element>value)._c_node) + * new_element.tag = tag + * cetree.appendChild(parent, new_element) # <<<<<<<<<<<<<< + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + * for item in value: + */ + appendChild(__pyx_v_parent, __pyx_v_new_element); + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":522 + * new_element.tag = tag + * cetree.appendChild(parent, new_element) + * elif python.PyList_Check(value) or python.PyTuple_Check(value): # <<<<<<<<<<<<<< + * for item in value: + * _appendValue(parent, tag, item) + */ + if (!PyList_Check(__pyx_v_value)) { + __pyx_t_1 = PyTuple_Check(__pyx_v_value); + } else { + __pyx_t_1 = PyList_Check(__pyx_v_value); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":523 + * cetree.appendChild(parent, new_element) + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + * for item in value: # <<<<<<<<<<<<<< + * _appendValue(parent, tag, item) + * else: + */ + if (PyList_CheckExact(__pyx_v_value) || PyTuple_CheckExact(__pyx_v_value)) { + __pyx_t_3 = 0; __pyx_t_2 = __pyx_v_value; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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 = 523; __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-2.2/src/lxml/lxml.objectify.pyx":524 + * elif python.PyList_Check(value) or python.PyTuple_Check(value): + * for item in value: + * _appendValue(parent, tag, item) # <<<<<<<<<<<<<< + * else: + * new_element = cetree.makeElement( + */ + __pyx_t_4 = __pyx_f_4lxml_9objectify__appendValue(__pyx_v_parent, __pyx_v_tag, __pyx_v_item); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __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_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":527 + * else: + * new_element = cetree.makeElement( + * tag, parent._doc, None, None, None, None, None) # <<<<<<<<<<<<<< + * _setElementValue(new_element, value) + * cetree.appendChild(parent, new_element) + */ + __pyx_t_2 = ((PyObject *)makeElement(__pyx_v_tag, __pyx_v_parent->_doc, Py_None, Py_None, Py_None, Py_None, Py_None)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_new_element)); + __pyx_v_new_element = ((struct LxmlElement *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":528 + * new_element = cetree.makeElement( + * tag, parent._doc, None, None, None, None, None) + * _setElementValue(new_element, value) # <<<<<<<<<<<<<< + * cetree.appendChild(parent, new_element) + * + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__setElementValue(__pyx_v_new_element, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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-2.2/src/lxml/lxml.objectify.pyx":529 + * tag, parent._doc, None, None, None, None, None) + * _setElementValue(new_element, value) + * cetree.appendChild(parent, new_element) # <<<<<<<<<<<<<< + * + * cdef _setElementValue(_Element element, value): + */ + appendChild(__pyx_v_parent, __pyx_v_new_element); + } + __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_4); + __Pyx_AddTraceback("lxml.objectify._appendValue"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_new_element); + __Pyx_DECREF(__pyx_v_item); + __Pyx_DECREF((PyObject *)__pyx_v_parent); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":531 + * cetree.appendChild(parent, new_element) + * + * cdef _setElementValue(_Element element, value): # <<<<<<<<<<<<<< + * cdef python.PyObject* _pytype + * if value is None: + */ + +static PyObject *__pyx_f_4lxml_9objectify__setElementValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_value) { + PyObject *__pyx_v__pytype; + PyObject *__pyx_v_pytype_name; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("_setElementValue"); + __Pyx_INCREF((PyObject *)__pyx_v_element); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_pytype_name = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":533 + * cdef _setElementValue(_Element element, value): + * cdef python.PyObject* _pytype + * if value is None: # <<<<<<<<<<<<<< + * cetree.setAttributeValue( + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + */ + __pyx_t_1 = (__pyx_v_value == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":535 + * if value is None: + * cetree.setAttributeValue( + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") # <<<<<<<<<<<<<< + * elif isinstance(value, _Element): + * _replaceElement(element, value) + */ + __pyx_t_2 = setAttributeValue(__pyx_v_element, __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR, ((PyObject *)__pyx_n_u_true)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":536 + * cetree.setAttributeValue( + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + * elif isinstance(value, _Element): # <<<<<<<<<<<<<< + * _replaceElement(element, value) + * return + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":537 + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + * elif isinstance(value, _Element): + * _replaceElement(element, value) # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_t_3 = __pyx_f_4lxml_9objectify__replaceElement(__pyx_v_element, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __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-2.2/src/lxml/lxml.objectify.pyx":538 + * elif isinstance(value, _Element): + * _replaceElement(element, value) + * return # <<<<<<<<<<<<<< + * else: + * cetree.delAttributeFromNsName( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":541 + * else: + * cetree.delAttributeFromNsName( + * element._c_node, _XML_SCHEMA_INSTANCE_NS, "nil") # <<<<<<<<<<<<<< + * if python._isString(value): + * pytype_name = u"str" + */ + delAttributeFromNsName(__pyx_v_element->_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_nil); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":542 + * cetree.delAttributeFromNsName( + * element._c_node, _XML_SCHEMA_INSTANCE_NS, "nil") + * if python._isString(value): # <<<<<<<<<<<<<< + * pytype_name = u"str" + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + */ + __pyx_t_1 = _isString(__pyx_v_value); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":543 + * element._c_node, _XML_SCHEMA_INSTANCE_NS, "nil") + * if python._isString(value): + * pytype_name = u"str" # <<<<<<<<<<<<<< + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * else: + */ + __Pyx_INCREF(((PyObject *)__pyx_n_u_str)); + __Pyx_DECREF(__pyx_v_pytype_name); + __pyx_v_pytype_name = ((PyObject *)__pyx_n_u_str); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":544 + * if python._isString(value): + * pytype_name = u"str" + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) # <<<<<<<<<<<<<< + * else: + * pytype_name = _typename(value) + */ + __pyx_v__pytype = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v_pytype_name); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":546 + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * else: + * pytype_name = _typename(value) # <<<<<<<<<<<<<< + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * if _pytype is not NULL: + */ + __pyx_t_3 = __pyx_f_4lxml_9objectify__typename(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_pytype_name); + __pyx_v_pytype_name = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":547 + * else: + * pytype_name = _typename(value) + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) # <<<<<<<<<<<<<< + * if _pytype is not NULL: + * value = (_pytype).stringify(value) + */ + __pyx_v__pytype = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v_pytype_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":548 + * pytype_name = _typename(value) + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * if _pytype is not NULL: # <<<<<<<<<<<<<< + * value = (_pytype).stringify(value) + * else: + */ + __pyx_t_1 = (__pyx_v__pytype != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":549 + * _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * if _pytype is not NULL: + * value = (_pytype).stringify(value) # <<<<<<<<<<<<<< + * else: + * value = unicode(value) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __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_4 = PyObject_Call(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v__pytype)->stringify, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __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_value); + __pyx_v_value = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":551 + * value = (_pytype).stringify(value) + * else: + * value = unicode(value) # <<<<<<<<<<<<<< + * if _pytype is not NULL: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + */ + __pyx_t_4 = PyTuple_New(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_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __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_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L5:; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":552 + * else: + * value = unicode(value) + * if _pytype is not NULL: # <<<<<<<<<<<<<< + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + * else: + */ + __pyx_t_1 = (__pyx_v__pytype != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":553 + * value = unicode(value) + * if _pytype is not NULL: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) # <<<<<<<<<<<<<< + * else: + * cetree.delAttributeFromNsName( + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = setAttributeValue(__pyx_v_element, __pyx_t_3, __pyx_v_pytype_name); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":556 + * else: + * cetree.delAttributeFromNsName( + * element._c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) # <<<<<<<<<<<<<< + * cetree.setNodeText(element._c_node, value) + * + */ + delAttributeFromNsName(__pyx_v_element->_c_node, __pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE, __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME); + } + __pyx_L6:; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":557 + * cetree.delAttributeFromNsName( + * element._c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + * cetree.setNodeText(element._c_node, value) # <<<<<<<<<<<<<< + * + * cdef _setSlice(slice, _Element target, items): + */ + __pyx_t_2 = setNodeText(__pyx_v_element->_c_node, __pyx_v_value); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __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.objectify._setElementValue"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_pytype_name); + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":559 + * cetree.setNodeText(element._c_node, value) + * + * cdef _setSlice(slice, _Element target, items): # <<<<<<<<<<<<<< + * cdef _Element parent + * cdef tree.xmlNode* c_node + */ + +static PyObject *__pyx_f_4lxml_9objectify__setSlice(PyObject *__pyx_v_slice, struct LxmlElement *__pyx_v_target, PyObject *__pyx_v_items) { + struct LxmlElement *__pyx_v_parent; + xmlNode *__pyx_v_c_node; + Py_ssize_t __pyx_v_c_step; + Py_ssize_t __pyx_v_pos; + PyObject *__pyx_v_new_items; + PyObject *__pyx_v_del_items; + PyObject *__pyx_v_tag; + PyObject *__pyx_v_item; + PyObject *__pyx_v_new_element; + PyObject *__pyx_v_replace; + PyObject *__pyx_v_remove; + PyObject *__pyx_v_add; + 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; + PyObject *__pyx_t_6 = NULL; + __Pyx_SetupRefcountContext("_setSlice"); + __Pyx_INCREF(__pyx_v_slice); + __Pyx_INCREF((PyObject *)__pyx_v_target); + __Pyx_INCREF(__pyx_v_items); + __pyx_v_parent = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_new_items = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_del_items = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_item = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_element = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_replace = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_remove = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_add = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":565 + * cdef list new_items + * # collect existing slice + * if (slice).step is None: # <<<<<<<<<<<<<< + * c_step = 1 + * else: + */ + __pyx_t_1 = (((PySliceObject *)__pyx_v_slice)->step == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":566 + * # collect existing slice + * if (slice).step is None: + * c_step = 1 # <<<<<<<<<<<<<< + * else: + * c_step = (slice).step + */ + __pyx_v_c_step = 1; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":568 + * c_step = 1 + * else: + * c_step = (slice).step # <<<<<<<<<<<<<< + * if c_step == 0: + * raise ValueError, u"Invalid slice" + */ + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(((PySliceObject *)__pyx_v_slice)->step); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_c_step = __pyx_t_2; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":569 + * else: + * c_step = (slice).step + * if c_step == 0: # <<<<<<<<<<<<<< + * raise ValueError, u"Invalid slice" + * del_items = target[slice] + */ + __pyx_t_1 = (__pyx_v_c_step == 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":570 + * c_step = (slice).step + * if c_step == 0: + * raise ValueError, u"Invalid slice" # <<<<<<<<<<<<<< + * del_items = target[slice] + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_11), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":571 + * if c_step == 0: + * raise ValueError, u"Invalid slice" + * del_items = target[slice] # <<<<<<<<<<<<<< + * + * # collect new values + */ + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_target), __pyx_v_slice); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_del_items); + __pyx_v_del_items = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":574 + * + * # collect new values + * new_items = [] # <<<<<<<<<<<<<< + * tag = target.tag + * for item in items: + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_v_new_items)); + __pyx_v_new_items = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":575 + * # collect new values + * new_items = [] + * tag = target.tag # <<<<<<<<<<<<<< + * for item in items: + * if isinstance(item, _Element): + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_target), __pyx_n_ui_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.objectify.pyx":576 + * new_items = [] + * tag = target.tag + * for item in items: # <<<<<<<<<<<<<< + * if isinstance(item, _Element): + * # deep copy the new element + */ + if (PyList_CheckExact(__pyx_v_items) || PyTuple_CheckExact(__pyx_v_items)) { + __pyx_t_2 = 0; __pyx_t_3 = __pyx_v_items; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __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 = 576; __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-2.2/src/lxml/lxml.objectify.pyx":577 + * tag = target.tag + * for item in items: + * if isinstance(item, _Element): # <<<<<<<<<<<<<< + * # deep copy the new element + * new_element = cetree.deepcopyNodeToDocument( + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_item, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":580 + * # deep copy the new element + * new_element = cetree.deepcopyNodeToDocument( + * target._doc, (<_Element>item)._c_node) # <<<<<<<<<<<<<< + * new_element.tag = tag + * else: + */ + __pyx_t_4 = ((PyObject *)deepcopyNodeToDocument(__pyx_v_target->_doc, ((struct LxmlElement *)__pyx_v_item)->_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_new_element); + __pyx_v_new_element = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":581 + * new_element = cetree.deepcopyNodeToDocument( + * target._doc, (<_Element>item)._c_node) + * new_element.tag = tag # <<<<<<<<<<<<<< + * else: + * new_element = cetree.makeElement( + */ + if (PyObject_SetAttr(__pyx_v_new_element, __pyx_n_ui_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":584 + * else: + * new_element = cetree.makeElement( + * tag, target._doc, None, None, None, None, None) # <<<<<<<<<<<<<< + * _setElementValue(new_element, item) + * new_items.append(new_element) + */ + __pyx_t_4 = ((PyObject *)makeElement(__pyx_v_tag, __pyx_v_target->_doc, Py_None, Py_None, Py_None, Py_None, Py_None)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_new_element); + __pyx_v_new_element = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":585 + * new_element = cetree.makeElement( + * tag, target._doc, None, None, None, None, None) + * _setElementValue(new_element, item) # <<<<<<<<<<<<<< + * new_items.append(new_element) + * + */ + if (!(__Pyx_TypeTest(__pyx_v_new_element, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_f_4lxml_9objectify__setElementValue(((struct LxmlElement *)__pyx_v_new_element), __pyx_v_item); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":586 + * tag, target._doc, None, None, None, None, None) + * _setElementValue(new_element, item) + * new_items.append(new_element) # <<<<<<<<<<<<<< + * + * # sanity check - raise what a list would raise + */ + if (unlikely(__pyx_v_new_items == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_new_items), __pyx_v_new_element); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":589 + * + * # sanity check - raise what a list would raise + * if c_step != 1 and \ # <<<<<<<<<<<<<< + * python.PyList_GET_SIZE(del_items) != python.PyList_GET_SIZE(new_items): + * raise ValueError, \ + */ + if ((__pyx_v_c_step != 1)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":590 + * # sanity check - raise what a list would raise + * if c_step != 1 and \ + * python.PyList_GET_SIZE(del_items) != python.PyList_GET_SIZE(new_items): # <<<<<<<<<<<<<< + * raise ValueError, \ + * u"attempt to assign sequence of size %d to extended slice of size %d" % ( + */ + __pyx_t_1 = (PyList_GET_SIZE(__pyx_v_del_items) != PyList_GET_SIZE(((PyObject *)__pyx_v_new_items))); + } else { + __pyx_t_1 = (__pyx_v_c_step != 1); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":593 + * raise ValueError, \ + * u"attempt to assign sequence of size %d to extended slice of size %d" % ( + * python.PyList_GET_SIZE(new_items), # <<<<<<<<<<<<<< + * python.PyList_GET_SIZE(del_items)) + * + */ + __pyx_t_3 = PyInt_FromSsize_t(PyList_GET_SIZE(((PyObject *)__pyx_v_new_items))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":594 + * u"attempt to assign sequence of size %d to extended slice of size %d" % ( + * python.PyList_GET_SIZE(new_items), + * python.PyList_GET_SIZE(del_items)) # <<<<<<<<<<<<<< + * + * # replace existing items + */ + __pyx_t_4 = PyInt_FromSsize_t(PyList_GET_SIZE(__pyx_v_del_items)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __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[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":597 + * + * # replace existing items + * pos = 0 # <<<<<<<<<<<<<< + * parent = target.getparent() + * replace = parent.replace + */ + __pyx_v_pos = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":598 + * # replace existing items + * pos = 0 + * parent = target.getparent() # <<<<<<<<<<<<<< + * replace = parent.replace + * while pos < python.PyList_GET_SIZE(new_items) and \ + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_target), __pyx_n_ui_getparent); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __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[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_parent)); + __pyx_v_parent = ((struct LxmlElement *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":599 + * pos = 0 + * parent = target.getparent() + * replace = parent.replace # <<<<<<<<<<<<<< + * while pos < python.PyList_GET_SIZE(new_items) and \ + * pos < python.PyList_GET_SIZE(del_items): + */ + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_parent), __pyx_n_ui_replace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_replace); + __pyx_v_replace = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":600 + * parent = target.getparent() + * replace = parent.replace + * while pos < python.PyList_GET_SIZE(new_items) and \ # <<<<<<<<<<<<<< + * pos < python.PyList_GET_SIZE(del_items): + * replace(del_items[pos], new_items[pos]) + */ + while (1) { + if ((__pyx_v_pos < PyList_GET_SIZE(((PyObject *)__pyx_v_new_items)))) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":601 + * replace = parent.replace + * while pos < python.PyList_GET_SIZE(new_items) and \ + * pos < python.PyList_GET_SIZE(del_items): # <<<<<<<<<<<<<< + * replace(del_items[pos], new_items[pos]) + * pos += 1 + */ + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(__pyx_v_del_items)); + } else { + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(((PyObject *)__pyx_v_new_items))); + } + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":602 + * while pos < python.PyList_GET_SIZE(new_items) and \ + * pos < python.PyList_GET_SIZE(del_items): + * replace(del_items[pos], new_items[pos]) # <<<<<<<<<<<<<< + * pos += 1 + * # remove leftover items + */ + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_del_items, __pyx_v_pos, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_new_items), __pyx_v_pos, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __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[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_v_replace, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __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; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":603 + * pos < python.PyList_GET_SIZE(del_items): + * replace(del_items[pos], new_items[pos]) + * pos += 1 # <<<<<<<<<<<<<< + * # remove leftover items + * if pos < python.PyList_GET_SIZE(del_items): + */ + __pyx_v_pos += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":605 + * pos += 1 + * # remove leftover items + * if pos < python.PyList_GET_SIZE(del_items): # <<<<<<<<<<<<<< + * remove = parent.remove + * while pos < python.PyList_GET_SIZE(del_items): + */ + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(__pyx_v_del_items)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":606 + * # remove leftover items + * if pos < python.PyList_GET_SIZE(del_items): + * remove = parent.remove # <<<<<<<<<<<<<< + * while pos < python.PyList_GET_SIZE(del_items): + * remove(del_items[pos]) + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_parent), __pyx_n_ui_remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_remove); + __pyx_v_remove = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":607 + * if pos < python.PyList_GET_SIZE(del_items): + * remove = parent.remove + * while pos < python.PyList_GET_SIZE(del_items): # <<<<<<<<<<<<<< + * remove(del_items[pos]) + * pos += 1 + */ + while (1) { + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(__pyx_v_del_items)); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":608 + * remove = parent.remove + * while pos < python.PyList_GET_SIZE(del_items): + * remove(del_items[pos]) # <<<<<<<<<<<<<< + * pos += 1 + * # append remaining new items + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_del_items, __pyx_v_pos, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __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[0]; __pyx_lineno = 608; __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_remove, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __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_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":609 + * while pos < python.PyList_GET_SIZE(del_items): + * remove(del_items[pos]) + * pos += 1 # <<<<<<<<<<<<<< + * # append remaining new items + * if pos < python.PyList_GET_SIZE(new_items): + */ + __pyx_v_pos += 1; + } + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":611 + * pos += 1 + * # append remaining new items + * if pos < python.PyList_GET_SIZE(new_items): # <<<<<<<<<<<<<< + * # the sanity check above guarantees (step == 1) + * if pos > 0: + */ + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(((PyObject *)__pyx_v_new_items))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":613 + * if pos < python.PyList_GET_SIZE(new_items): + * # the sanity check above guarantees (step == 1) + * if pos > 0: # <<<<<<<<<<<<<< + * item = new_items[pos-1] + * else: + */ + __pyx_t_1 = (__pyx_v_pos > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":614 + * # the sanity check above guarantees (step == 1) + * if pos > 0: + * item = new_items[pos-1] # <<<<<<<<<<<<<< + * else: + * if (slice).start > 0: + */ + __pyx_t_2 = (__pyx_v_pos - 1); + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_new_items), __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L15; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":616 + * item = new_items[pos-1] + * else: + * if (slice).start > 0: # <<<<<<<<<<<<<< + * c_node = parent._c_node.children + * else: + */ + __pyx_t_4 = PyObject_RichCompare(((PySliceObject *)__pyx_v_slice)->start, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":617 + * else: + * if (slice).start > 0: + * c_node = parent._c_node.children # <<<<<<<<<<<<<< + * else: + * c_node = parent._c_node.last + */ + __pyx_v_c_node = __pyx_v_parent->_c_node->children; + goto __pyx_L16; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":619 + * c_node = parent._c_node.children + * else: + * c_node = parent._c_node.last # <<<<<<<<<<<<<< + * c_node = _findFollowingSibling( + * c_node, tree._getNs(target._c_node), target._c_node.name, + */ + __pyx_v_c_node = __pyx_v_parent->_c_node->last; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":622 + * c_node = _findFollowingSibling( + * c_node, tree._getNs(target._c_node), target._c_node.name, + * (slice).start - 1) # <<<<<<<<<<<<<< + * if c_node is NULL: + * while pos < python.PyList_GET_SIZE(new_items): + */ + __pyx_t_4 = PyNumber_Subtract(((PySliceObject *)__pyx_v_slice)->start, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_c_node = __pyx_f_4lxml_9objectify__findFollowingSibling(__pyx_v_c_node, _getNs(__pyx_v_target->_c_node), __pyx_v_target->_c_node->name, __pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":623 + * c_node, tree._getNs(target._c_node), target._c_node.name, + * (slice).start - 1) + * if c_node is NULL: # <<<<<<<<<<<<<< + * while pos < python.PyList_GET_SIZE(new_items): + * cetree.appendChild(parent, new_items[pos]) + */ + __pyx_t_1 = (__pyx_v_c_node == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":624 + * (slice).start - 1) + * if c_node is NULL: + * while pos < python.PyList_GET_SIZE(new_items): # <<<<<<<<<<<<<< + * cetree.appendChild(parent, new_items[pos]) + * pos += 1 + */ + while (1) { + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(((PyObject *)__pyx_v_new_items))); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":625 + * if c_node is NULL: + * while pos < python.PyList_GET_SIZE(new_items): + * cetree.appendChild(parent, new_items[pos]) # <<<<<<<<<<<<<< + * pos += 1 + * return + */ + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_new_items), __pyx_v_pos, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + appendChild(__pyx_v_parent, ((struct LxmlElement *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":626 + * while pos < python.PyList_GET_SIZE(new_items): + * cetree.appendChild(parent, new_items[pos]) + * pos += 1 # <<<<<<<<<<<<<< + * return + * item = cetree.elementFactory(parent._doc, c_node) + */ + __pyx_v_pos += 1; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":627 + * cetree.appendChild(parent, new_items[pos]) + * pos += 1 + * return # <<<<<<<<<<<<<< + * item = cetree.elementFactory(parent._doc, c_node) + * while pos < python.PyList_GET_SIZE(new_items): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":628 + * pos += 1 + * return + * item = cetree.elementFactory(parent._doc, c_node) # <<<<<<<<<<<<<< + * while pos < python.PyList_GET_SIZE(new_items): + * add = item.addnext + */ + __pyx_t_4 = ((PyObject *)elementFactory(__pyx_v_parent->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L15:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":629 + * return + * item = cetree.elementFactory(parent._doc, c_node) + * while pos < python.PyList_GET_SIZE(new_items): # <<<<<<<<<<<<<< + * add = item.addnext + * item = new_items[pos] + */ + while (1) { + __pyx_t_1 = (__pyx_v_pos < PyList_GET_SIZE(((PyObject *)__pyx_v_new_items))); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":630 + * item = cetree.elementFactory(parent._doc, c_node) + * while pos < python.PyList_GET_SIZE(new_items): + * add = item.addnext # <<<<<<<<<<<<<< + * item = new_items[pos] + * add(item) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_item, __pyx_n_ui_addnext); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_add); + __pyx_v_add = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":631 + * while pos < python.PyList_GET_SIZE(new_items): + * add = item.addnext + * item = new_items[pos] # <<<<<<<<<<<<<< + * add(item) + * pos += 1 + */ + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_new_items), __pyx_v_pos, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.objectify.pyx":632 + * add = item.addnext + * item = new_items[pos] + * add(item) # <<<<<<<<<<<<<< + * pos += 1 + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_item); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_item); + __Pyx_GIVEREF(__pyx_v_item); + __pyx_t_3 = PyObject_Call(__pyx_v_add, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":633 + * item = new_items[pos] + * add(item) + * pos += 1 # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __pyx_v_pos += 1; + } + goto __pyx_L14; + } + __pyx_L14:; + + __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_6); + __Pyx_AddTraceback("lxml.objectify._setSlice"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_parent); + __Pyx_DECREF(__pyx_v_new_items); + __Pyx_DECREF(__pyx_v_del_items); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_item); + __Pyx_DECREF(__pyx_v_new_element); + __Pyx_DECREF(__pyx_v_replace); + __Pyx_DECREF(__pyx_v_remove); + __Pyx_DECREF(__pyx_v_add); + __Pyx_DECREF(__pyx_v_slice); + __Pyx_DECREF((PyObject *)__pyx_v_target); + __Pyx_DECREF(__pyx_v_items); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":643 + * """ + * property pyval: + * def __get__(self): # <<<<<<<<<<<<<< + * return textOf(self._c_node) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement_5pyval___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement_5pyval___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":644 + * property pyval: + * def __get__(self): + * return textOf(self._c_node) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __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.objectify.ObjectifiedDataElement.pyval.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":646 + * return textOf(self._c_node) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return textOf(self._c_node) or u'' + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__str__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":647 + * + * def __str__(self): + * return textOf(self._c_node) or u'' # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __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 = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_3 = __pyx_kp_u_4; + } else { + __pyx_t_3 = __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.objectify.ObjectifiedDataElement.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":649 + * return textOf(self._c_node) or u'' + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return textOf(self._c_node) or u'' + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":650 + * + * def __repr__(self): + * return textOf(self._c_node) or u'' # <<<<<<<<<<<<<< + * + * def _setText(self, s): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __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 = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_3 = __pyx_kp_u_4; + } else { + __pyx_t_3 = __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.objectify.ObjectifiedDataElement.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":652 + * return textOf(self._c_node) or u'' + * + * def _setText(self, s): # <<<<<<<<<<<<<< + * u"""For use in subclasses only. Don't use unless you know what you are + * doing. + */ + +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement__setText(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/ +static char __pyx_doc_4lxml_9objectify_22ObjectifiedDataElement__setText[] = "For use in subclasses only. Don't use unless you know what you are\n doing.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement__setText(PyObject *__pyx_v_self, PyObject *__pyx_v_s) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_setText"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":656 + * doing. + * """ + * cetree.setNodeText(self._c_node, s) # <<<<<<<<<<<<<< + * + * cdef class NumberElement(ObjectifiedDataElement): + */ + __pyx_t_1 = setNodeText(((struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base._c_node, __pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectifiedDataElement._setText"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":660 + * cdef class NumberElement(ObjectifiedDataElement): + * cdef object _parse_value + * def _setValueParser(self, function): # <<<<<<<<<<<<<< + * u"""Set the function that parses the Python value from a string. + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement__setValueParser(PyObject *__pyx_v_self, PyObject *__pyx_v_function); /*proto*/ +static char __pyx_doc_4lxml_9objectify_13NumberElement__setValueParser[] = "Set the function that parses the Python value from a string.\n\n Do not use this unless you know what you are doing.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement__setValueParser(PyObject *__pyx_v_self, PyObject *__pyx_v_function) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("_setValueParser"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":665 + * Do not use this unless you know what you are doing. + * """ + * self._parse_value = function # <<<<<<<<<<<<<< + * + * property pyval: + */ + __Pyx_INCREF(__pyx_v_function); + __Pyx_GIVEREF(__pyx_v_function); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)->_parse_value); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)->_parse_value); + ((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)->_parse_value = __pyx_v_function; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":668 + * + * property pyval: + * def __get__(self): # <<<<<<<<<<<<<< + * return _parseNumber(self) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement_5pyval___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement_5pyval___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":669 + * property pyval: + * def __get__(self): + * return _parseNumber(self) # <<<<<<<<<<<<<< + * + * def __int__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __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.objectify.NumberElement.pyval.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":671 + * return _parseNumber(self) + * + * def __int__(self): # <<<<<<<<<<<<<< + * return int(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___int__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___int__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__int__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":672 + * + * def __int__(self): + * return int(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __long__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); 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 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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*)&PyInt_Type)), ((PyObject *)__pyx_t_2), NULL); 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_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.objectify.NumberElement.__int__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":674 + * return int(_parseNumber(self)) + * + * def __long__(self): # <<<<<<<<<<<<<< + * return long(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___long__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___long__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__long__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":675 + * + * def __long__(self): + * return long(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __float__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __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 = 675; __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*)&PyLong_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __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.objectify.NumberElement.__long__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":677 + * return long(_parseNumber(self)) + * + * def __float__(self): # <<<<<<<<<<<<<< + * return float(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___float__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___float__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__float__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":678 + * + * def __float__(self): + * return float(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __complex__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __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 = 678; __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*)&PyFloat_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __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.objectify.NumberElement.__float__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":680 + * return float(_parseNumber(self)) + * + * def __complex__(self): # <<<<<<<<<<<<<< + * return complex(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___complex__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___complex__(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__complex__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":681 + * + * def __complex__(self): + * return complex(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __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 = 681; __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*)&PyComplex_Type), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __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.objectify.NumberElement.__complex__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":683 + * return complex(_parseNumber(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return unicode(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__str__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":684 + * + * def __str__(self): + * return unicode(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __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 = 684; __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*)&PyUnicode_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __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.objectify.NumberElement.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":686 + * return unicode(_parseNumber(self)) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return repr(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":687 + * + * def __repr__(self): + * return repr(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __oct__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __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.objectify.NumberElement.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":689 + * return repr(_parseNumber(self)) + * + * def __oct__(self): # <<<<<<<<<<<<<< + * return oct(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___oct__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___oct__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__oct__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":690 + * + * def __oct__(self): + * return oct(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __hex__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __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 = 690; __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(__pyx_builtin_oct, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __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.objectify.NumberElement.__oct__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":692 + * return oct(_parseNumber(self)) + * + * def __hex__(self): # <<<<<<<<<<<<<< + * return hex(_parseNumber(self)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___hex__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___hex__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__hex__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":693 + * + * def __hex__(self): + * return hex(_parseNumber(self)) # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, int op): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __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 = 693; __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(__pyx_builtin_hex, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __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.objectify.NumberElement.__hex__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":695 + * return hex(_parseNumber(self)) + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * return _richcmpPyvals(self, other, op) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__richcmp__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":696 + * + * def __richcmp__(self, other, int op): + * return _richcmpPyvals(self, other, op) # <<<<<<<<<<<<<< + * + * def __add__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__richcmpPyvals(__pyx_v_self, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __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.objectify.NumberElement.__richcmp__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":698 + * return _richcmpPyvals(self, other, op) + * + * def __add__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) + _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__add__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":699 + * + * def __add__(self, other): + * return _numericValueOf(self) + _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __sub__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __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.objectify.NumberElement.__add__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":701 + * return _numericValueOf(self) + _numericValueOf(other) + * + * def __sub__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) - _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__sub__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":702 + * + * def __sub__(self, other): + * return _numericValueOf(self) - _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __mul__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __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.objectify.NumberElement.__sub__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":704 + * return _numericValueOf(self) - _numericValueOf(other) + * + * def __mul__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) * _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__mul__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":705 + * + * def __mul__(self, other): + * return _numericValueOf(self) * _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __div__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __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.objectify.NumberElement.__mul__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":707 + * return _numericValueOf(self) * _numericValueOf(other) + * + * def __div__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) / _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__div__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":708 + * + * def __div__(self, other): + * return _numericValueOf(self) / _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __truediv__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __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.objectify.NumberElement.__div__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":710 + * return _numericValueOf(self) / _numericValueOf(other) + * + * def __truediv__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) / _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___truediv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__truediv__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":711 + * + * def __truediv__(self, other): + * return _numericValueOf(self) / _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __mod__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __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.objectify.NumberElement.__truediv__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":713 + * return _numericValueOf(self) / _numericValueOf(other) + * + * def __mod__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) % _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__mod__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":714 + * + * def __mod__(self, other): + * return _numericValueOf(self) % _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __pow__(self, other, modulo): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __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.objectify.NumberElement.__mod__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":716 + * return _numericValueOf(self) % _numericValueOf(other) + * + * def __pow__(self, other, modulo): # <<<<<<<<<<<<<< + * if modulo is None: + * return _numericValueOf(self) ** _numericValueOf(other) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__pow__"); + __Pyx_INCREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_other); + __Pyx_INCREF(__pyx_v_modulo); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":717 + * + * def __pow__(self, other, modulo): + * if modulo is None: # <<<<<<<<<<<<<< + * return _numericValueOf(self) ** _numericValueOf(other) + * else: + */ + __pyx_t_1 = (__pyx_v_modulo == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":718 + * def __pow__(self, other, modulo): + * if modulo is None: + * return _numericValueOf(self) ** _numericValueOf(other) # <<<<<<<<<<<<<< + * else: + * return pow(_numericValueOf(self), _numericValueOf(other), modulo) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Power(__pyx_t_2, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":720 + * return _numericValueOf(self) ** _numericValueOf(other) + * else: + * return pow(_numericValueOf(self), _numericValueOf(other), modulo) # <<<<<<<<<<<<<< + * + * def __neg__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Power(__pyx_t_4, __pyx_t_3, __pyx_v_modulo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify.NumberElement.__pow__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_self); + __Pyx_DECREF(__pyx_v_other); + __Pyx_DECREF(__pyx_v_modulo); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":722 + * return pow(_numericValueOf(self), _numericValueOf(other), modulo) + * + * def __neg__(self): # <<<<<<<<<<<<<< + * return - _numericValueOf(self) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___neg__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___neg__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__neg__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":723 + * + * def __neg__(self): + * return - _numericValueOf(self) # <<<<<<<<<<<<<< + * + * def __pos__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __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.objectify.NumberElement.__neg__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":725 + * return - _numericValueOf(self) + * + * def __pos__(self): # <<<<<<<<<<<<<< + * return + _numericValueOf(self) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___pos__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___pos__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__pos__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":726 + * + * def __pos__(self): + * return + _numericValueOf(self) # <<<<<<<<<<<<<< + * + * def __abs__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Positive(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __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.objectify.NumberElement.__pos__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":728 + * return + _numericValueOf(self) + * + * def __abs__(self): # <<<<<<<<<<<<<< + * return abs( _numericValueOf(self) ) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___abs__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___abs__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__abs__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":729 + * + * def __abs__(self): + * return abs( _numericValueOf(self) ) # <<<<<<<<<<<<<< + * + * def __nonzero__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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.objectify.NumberElement.__abs__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":731 + * return abs( _numericValueOf(self) ) + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * return _numericValueOf(self) != 0 + * + */ + +static int __pyx_pf_4lxml_9objectify_13NumberElement___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_9objectify_13NumberElement___nonzero__(PyObject *__pyx_v_self) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__nonzero__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":732 + * + * def __nonzero__(self): + * return _numericValueOf(self) != 0 # <<<<<<<<<<<<<< + * + * def __invert__(self): + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __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_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __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.objectify.NumberElement.__nonzero__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":734 + * return _numericValueOf(self) != 0 + * + * def __invert__(self): # <<<<<<<<<<<<<< + * return ~ _numericValueOf(self) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___invert__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___invert__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__invert__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":735 + * + * def __invert__(self): + * return ~ _numericValueOf(self) # <<<<<<<<<<<<<< + * + * def __lshift__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Invert(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __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.objectify.NumberElement.__invert__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":737 + * return ~ _numericValueOf(self) + * + * def __lshift__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) << _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___lshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___lshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__lshift__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":738 + * + * def __lshift__(self, other): + * return _numericValueOf(self) << _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __rshift__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Lshift(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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.objectify.NumberElement.__lshift__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":740 + * return _numericValueOf(self) << _numericValueOf(other) + * + * def __rshift__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) >> _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___rshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___rshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__rshift__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":741 + * + * def __rshift__(self, other): + * return _numericValueOf(self) >> _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __and__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Rshift(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __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.objectify.NumberElement.__rshift__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":743 + * return _numericValueOf(self) >> _numericValueOf(other) + * + * def __and__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) & _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__and__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":744 + * + * def __and__(self, other): + * return _numericValueOf(self) & _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __or__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_And(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __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.objectify.NumberElement.__and__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":746 + * return _numericValueOf(self) & _numericValueOf(other) + * + * def __or__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) | _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__or__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":747 + * + * def __or__(self, other): + * return _numericValueOf(self) | _numericValueOf(other) # <<<<<<<<<<<<<< + * + * def __xor__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Or(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __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.objectify.NumberElement.__or__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":749 + * return _numericValueOf(self) | _numericValueOf(other) + * + * def __xor__(self, other): # <<<<<<<<<<<<<< + * return _numericValueOf(self) ^ _numericValueOf(other) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13NumberElement___xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__xor__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":750 + * + * def __xor__(self, other): + * return _numericValueOf(self) ^ _numericValueOf(other) # <<<<<<<<<<<<<< + * + * cdef class IntElement(NumberElement): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Xor(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __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.objectify.NumberElement.__xor__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":753 + * + * cdef class IntElement(NumberElement): + * def _init(self): # <<<<<<<<<<<<<< + * self._parse_value = int + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_10IntElement__init(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_10IntElement__init(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("_init"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":754 + * cdef class IntElement(NumberElement): + * def _init(self): + * self._parse_value = int # <<<<<<<<<<<<<< + * + * cdef class LongElement(NumberElement): + */ + __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type))); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_IntElement *)__pyx_v_self)->__pyx_base._parse_value); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_IntElement *)__pyx_v_self)->__pyx_base._parse_value); + ((struct __pyx_obj_4lxml_9objectify_IntElement *)__pyx_v_self)->__pyx_base._parse_value = ((PyObject *)((PyObject*)&PyInt_Type)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":757 + * + * cdef class LongElement(NumberElement): + * def _init(self): # <<<<<<<<<<<<<< + * self._parse_value = long + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11LongElement__init(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11LongElement__init(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("_init"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":758 + * cdef class LongElement(NumberElement): + * def _init(self): + * self._parse_value = long # <<<<<<<<<<<<<< + * + * cdef class FloatElement(NumberElement): + */ + __Pyx_INCREF(((PyObject *)((PyObject*)&PyLong_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyLong_Type))); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_LongElement *)__pyx_v_self)->__pyx_base._parse_value); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_LongElement *)__pyx_v_self)->__pyx_base._parse_value); + ((struct __pyx_obj_4lxml_9objectify_LongElement *)__pyx_v_self)->__pyx_base._parse_value = ((PyObject *)((PyObject*)&PyLong_Type)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":761 + * + * cdef class FloatElement(NumberElement): + * def _init(self): # <<<<<<<<<<<<<< + * self._parse_value = float + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_12FloatElement__init(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_12FloatElement__init(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("_init"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":762 + * cdef class FloatElement(NumberElement): + * def _init(self): + * self._parse_value = float # <<<<<<<<<<<<<< + * + * cdef class StringElement(ObjectifiedDataElement): + */ + __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type))); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_FloatElement *)__pyx_v_self)->__pyx_base._parse_value); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_FloatElement *)__pyx_v_self)->__pyx_base._parse_value); + ((struct __pyx_obj_4lxml_9objectify_FloatElement *)__pyx_v_self)->__pyx_base._parse_value = ((PyObject *)((PyObject*)&PyFloat_Type)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":772 + * """ + * property pyval: + * def __get__(self): # <<<<<<<<<<<<<< + * return textOf(self._c_node) or u'' + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement_5pyval___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement_5pyval___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":773 + * property pyval: + * def __get__(self): + * return textOf(self._c_node) or u'' # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __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 = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_3 = __pyx_kp_u_4; + } else { + __pyx_t_3 = __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.objectify.StringElement.pyval.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":775 + * return textOf(self._c_node) or u'' + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return repr(textOf(self._c_node) or u'') + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":776 + * + * def __repr__(self): + * return repr(textOf(self._c_node) or u'') # <<<<<<<<<<<<<< + * + * def strlen(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __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 = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_3 = __pyx_kp_u_4; + } else { + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_1 = PyObject_Repr(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__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_3); + __Pyx_AddTraceback("lxml.objectify.StringElement.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":778 + * return repr(textOf(self._c_node) or u'') + * + * def strlen(self): # <<<<<<<<<<<<<< + * text = textOf(self._c_node) + * if text is None: + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement_strlen(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement_strlen(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_v_text; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + __Pyx_SetupRefcountContext("strlen"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":779 + * + * def strlen(self): + * text = textOf(self._c_node) # <<<<<<<<<<<<<< + * if text is None: + * return 0 + */ + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":780 + * def strlen(self): + * text = textOf(self._c_node) + * if text is None: # <<<<<<<<<<<<<< + * return 0 + * else: + */ + __pyx_t_2 = (__pyx_v_text == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":781 + * text = textOf(self._c_node) + * if text is None: + * return 0 # <<<<<<<<<<<<<< + * else: + * return len(text) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":783 + * return 0 + * else: + * return len(text) # <<<<<<<<<<<<<< + * + * def __nonzero__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __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_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.objectify.StringElement.strlen"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_text); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":785 + * return len(text) + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * text = textOf(self._c_node) + * if text is None: + */ + +static int __pyx_pf_4lxml_9objectify_13StringElement___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_9objectify_13StringElement___nonzero__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_text; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + __Pyx_SetupRefcountContext("__nonzero__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":786 + * + * def __nonzero__(self): + * text = textOf(self._c_node) # <<<<<<<<<<<<<< + * if text is None: + * return False + */ + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":787 + * def __nonzero__(self): + * text = textOf(self._c_node) + * if text is None: # <<<<<<<<<<<<<< + * return False + * return len(text) > 0 + */ + __pyx_t_2 = (__pyx_v_text == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":788 + * text = textOf(self._c_node) + * if text is None: + * return False # <<<<<<<<<<<<<< + * return len(text) > 0 + * + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":789 + * if text is None: + * return False + * return len(text) > 0 # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, int op): + */ + __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = (__pyx_t_3 > 0); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lxml.objectify.StringElement.__nonzero__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_text); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":791 + * return len(text) > 0 + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * return _richcmpPyvals(self, other, op) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__richcmp__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":792 + * + * def __richcmp__(self, other, int op): + * return _richcmpPyvals(self, other, op) # <<<<<<<<<<<<<< + * + * def __add__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__richcmpPyvals(__pyx_v_self, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __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.objectify.StringElement.__richcmp__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":794 + * return _richcmpPyvals(self, other, op) + * + * def __add__(self, other): # <<<<<<<<<<<<<< + * text = _strValueOf(self) + * other = _strValueOf(other) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_v_text; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__add__"); + __Pyx_INCREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_other); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":795 + * + * def __add__(self, other): + * text = _strValueOf(self) # <<<<<<<<<<<<<< + * other = _strValueOf(other) + * if text is None: + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__strValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":796 + * def __add__(self, other): + * text = _strValueOf(self) + * other = _strValueOf(other) # <<<<<<<<<<<<<< + * if text is None: + * return other + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__strValueOf(__pyx_v_other); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_other); + __pyx_v_other = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":797 + * text = _strValueOf(self) + * other = _strValueOf(other) + * if text is None: # <<<<<<<<<<<<<< + * return other + * if other is None: + */ + __pyx_t_2 = (__pyx_v_text == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":798 + * other = _strValueOf(other) + * if text is None: + * return other # <<<<<<<<<<<<<< + * if other is None: + * return text + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_other); + __pyx_r = __pyx_v_other; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":799 + * if text is None: + * return other + * if other is None: # <<<<<<<<<<<<<< + * return text + * return text + other + */ + __pyx_t_2 = (__pyx_v_other == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":800 + * return other + * if other is None: + * return text # <<<<<<<<<<<<<< + * return text + other + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_text); + __pyx_r = __pyx_v_text; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":801 + * if other is None: + * return text + * return text + other # <<<<<<<<<<<<<< + * + * def __mul__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyNumber_Add(__pyx_v_text, __pyx_v_other); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __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.objectify.StringElement.__add__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_text); + __Pyx_DECREF(__pyx_v_self); + __Pyx_DECREF(__pyx_v_other); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":803 + * return text + other + * + * def __mul__(self, other): # <<<<<<<<<<<<<< + * if isinstance(self, StringElement): + * return textOf((self)._c_node) * _numericValueOf(other) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__mul__"); + __Pyx_INCREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_other); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":804 + * + * def __mul__(self, other): + * if isinstance(self, StringElement): # <<<<<<<<<<<<<< + * return textOf((self)._c_node) * _numericValueOf(other) + * elif isinstance(other, StringElement): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_self, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":805 + * def __mul__(self, other): + * if isinstance(self, StringElement): + * return textOf((self)._c_node) * _numericValueOf(other) # <<<<<<<<<<<<<< + * elif isinstance(other, StringElement): + * return _numericValueOf(self) * textOf((other)._c_node) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_other); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":806 + * if isinstance(self, StringElement): + * return textOf((self)._c_node) * _numericValueOf(other) + * elif isinstance(other, StringElement): # <<<<<<<<<<<<<< + * return _numericValueOf(self) * textOf((other)._c_node) + * else: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_other, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":807 + * return textOf((self)._c_node) * _numericValueOf(other) + * elif isinstance(other, StringElement): + * return _numericValueOf(self) * textOf((other)._c_node) # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"invalid types for * operator" + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_f_4lxml_9objectify__numericValueOf(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_other)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":809 + * return _numericValueOf(self) * textOf((other)._c_node) + * else: + * raise TypeError, u"invalid types for * operator" # <<<<<<<<<<<<<< + * + * def __mod__(self, other): + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_13), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __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_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify.StringElement.__mul__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_self); + __Pyx_DECREF(__pyx_v_other); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":811 + * raise TypeError, u"invalid types for * operator" + * + * def __mod__(self, other): # <<<<<<<<<<<<<< + * return _strValueOf(self) % other + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__mod__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":812 + * + * def __mod__(self, other): + * return _strValueOf(self) % other # <<<<<<<<<<<<<< + * + * def __int__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__strValueOf(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __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.objectify.StringElement.__mod__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":814 + * return _strValueOf(self) % other + * + * def __int__(self): # <<<<<<<<<<<<<< + * return int(textOf(self._c_node)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___int__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___int__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__int__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":815 + * + * def __int__(self): + * return int(textOf(self._c_node)) # <<<<<<<<<<<<<< + * + * def __long__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __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 = 815; __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*)&PyInt_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __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.objectify.StringElement.__int__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":817 + * return int(textOf(self._c_node)) + * + * def __long__(self): # <<<<<<<<<<<<<< + * return long(textOf(self._c_node)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___long__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___long__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__long__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":818 + * + * def __long__(self): + * return long(textOf(self._c_node)) # <<<<<<<<<<<<<< + * + * def __float__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __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 = 818; __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*)&PyLong_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __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.objectify.StringElement.__long__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":820 + * return long(textOf(self._c_node)) + * + * def __float__(self): # <<<<<<<<<<<<<< + * return float(textOf(self._c_node)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___float__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___float__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__float__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":821 + * + * def __float__(self): + * return float(textOf(self._c_node)) # <<<<<<<<<<<<<< + * + * def __complex__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __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 = 821; __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*)&PyFloat_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __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.objectify.StringElement.__float__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":823 + * return float(textOf(self._c_node)) + * + * def __complex__(self): # <<<<<<<<<<<<<< + * return complex(textOf(self._c_node)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___complex__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_13StringElement___complex__(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__complex__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":824 + * + * def __complex__(self): + * return complex(textOf(self._c_node)) # <<<<<<<<<<<<<< + * + * cdef class NoneElement(ObjectifiedDataElement): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_StringElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __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 = 824; __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*)&PyComplex_Type), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __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.objectify.StringElement.__complex__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":827 + * + * cdef class NoneElement(ObjectifiedDataElement): + * def __str__(self): # <<<<<<<<<<<<<< + * return u"None" + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__str__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":828 + * cdef class NoneElement(ObjectifiedDataElement): + * def __str__(self): + * return u"None" # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_n_u_None)); + __pyx_r = ((PyObject *)__pyx_n_u_None); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":830 + * return u"None" + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return u"None" + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":831 + * + * def __repr__(self): + * return u"None" # <<<<<<<<<<<<<< + * + * def __nonzero__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_n_u_None)); + __pyx_r = ((PyObject *)__pyx_n_u_None); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":833 + * return u"None" + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * return False + * + */ + +static int __pyx_pf_4lxml_9objectify_11NoneElement___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_9objectify_11NoneElement___nonzero__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_SetupRefcountContext("__nonzero__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":834 + * + * def __nonzero__(self): + * return False # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, int op): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":836 + * return False + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * if other is None or self is None: + * return python.PyObject_RichCompare(None, None, op) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("__richcmp__"); + __Pyx_INCREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_other); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":837 + * + * def __richcmp__(self, other, int op): + * if other is None or self is None: # <<<<<<<<<<<<<< + * return python.PyObject_RichCompare(None, None, op) + * if isinstance(self, NoneElement): + */ + __pyx_t_1 = (__pyx_v_other == Py_None); + if (!__pyx_t_1) { + __pyx_t_2 = (__pyx_v_self == 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-2.2/src/lxml/lxml.objectify.pyx":838 + * def __richcmp__(self, other, int op): + * if other is None or self is None: + * return python.PyObject_RichCompare(None, None, op) # <<<<<<<<<<<<<< + * if isinstance(self, NoneElement): + * return python.PyObject_RichCompare(None, other, op) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyObject_RichCompare(Py_None, Py_None, __pyx_v_op); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __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_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":839 + * if other is None or self is None: + * return python.PyObject_RichCompare(None, None, op) + * if isinstance(self, NoneElement): # <<<<<<<<<<<<<< + * return python.PyObject_RichCompare(None, other, op) + * else: + */ + __pyx_t_3 = PyObject_TypeCheck(__pyx_v_self, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":840 + * return python.PyObject_RichCompare(None, None, op) + * if isinstance(self, NoneElement): + * return python.PyObject_RichCompare(None, other, op) # <<<<<<<<<<<<<< + * else: + * return python.PyObject_RichCompare(self, None, op) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyObject_RichCompare(Py_None, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __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-2.2/src/lxml/lxml.objectify.pyx":842 + * return python.PyObject_RichCompare(None, other, op) + * else: + * return python.PyObject_RichCompare(self, None, op) # <<<<<<<<<<<<<< + * + * property pyval: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_self, Py_None, __pyx_v_op); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __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_4); + __Pyx_AddTraceback("lxml.objectify.NoneElement.__richcmp__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_self); + __Pyx_DECREF(__pyx_v_other); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":845 + * + * property pyval: + * def __get__(self): # <<<<<<<<<<<<<< + * return None + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement_5pyval___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11NoneElement_5pyval___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":846 + * property pyval: + * def __get__(self): + * return None # <<<<<<<<<<<<<< + * + * cdef class BoolElement(IntElement): + */ + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":854 + * Python's bool type. + * """ + * def _init(self): # <<<<<<<<<<<<<< + * self._parse_value = __parseBool + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement__init(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement__init(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_init"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":855 + * """ + * def _init(self): + * self._parse_value = __parseBool # <<<<<<<<<<<<<< + * + * def __nonzero__(self): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_ui___parseBool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base._parse_value); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base._parse_value); + ((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base._parse_value = __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.objectify.BoolElement._init"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":857 + * self._parse_value = __parseBool + * + * def __nonzero__(self): # <<<<<<<<<<<<<< + * return __parseBool(textOf(self._c_node)) + * + */ + +static int __pyx_pf_4lxml_9objectify_11BoolElement___nonzero__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_4lxml_9objectify_11BoolElement___nonzero__(PyObject *__pyx_v_self) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("__nonzero__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":858 + * + * def __nonzero__(self): + * return __parseBool(textOf(self._c_node)) # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, int op): + */ + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify___parseBool(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __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_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __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.objectify.BoolElement.__nonzero__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":860 + * return __parseBool(textOf(self._c_node)) + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * return _richcmpPyvals(self, other, op) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__richcmp__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":861 + * + * def __richcmp__(self, other, int op): + * return _richcmpPyvals(self, other, op) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__richcmpPyvals(__pyx_v_self, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __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.objectify.BoolElement.__richcmp__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":863 + * return _richcmpPyvals(self, other, op) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return unicode(__parseBool(textOf(self._c_node))) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__str__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":864 + * + * def __str__(self): + * return unicode(__parseBool(textOf(self._c_node))) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify___parseBool(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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 = 864; __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*)&PyUnicode_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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.objectify.BoolElement.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":866 + * return unicode(__parseBool(textOf(self._c_node))) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return repr(__parseBool(textOf(self._c_node))) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":867 + * + * def __repr__(self): + * return repr(__parseBool(textOf(self._c_node))) # <<<<<<<<<<<<<< + * + * property pyval: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify___parseBool(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __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_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __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.objectify.BoolElement.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":870 + * + * property pyval: + * def __get__(self): # <<<<<<<<<<<<<< + * return __parseBool(textOf(self._c_node)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement_5pyval___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_11BoolElement_5pyval___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":871 + * property pyval: + * def __get__(self): + * return __parseBool(textOf(self._c_node)) # <<<<<<<<<<<<<< + * + * def __checkBool(s): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(((struct __pyx_obj_4lxml_9objectify_BoolElement *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify___parseBool(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __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.objectify.BoolElement.pyval.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":873 + * return __parseBool(textOf(self._c_node)) + * + * def __checkBool(s): # <<<<<<<<<<<<<< + * cdef int value = -1 + * if s is not None: + */ + +static PyObject *__pyx_pf_4lxml_9objectify___checkBool(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify___checkBool(PyObject *__pyx_self, PyObject *__pyx_v_s) { + int __pyx_v_value; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("__checkBool"); + __pyx_self = __pyx_self; + __Pyx_INCREF(__pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":874 + * + * def __checkBool(s): + * cdef int value = -1 # <<<<<<<<<<<<<< + * if s is not None: + * value = __parseBoolAsInt(s) + */ + __pyx_v_value = -1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":875 + * def __checkBool(s): + * cdef int value = -1 + * if s is not None: # <<<<<<<<<<<<<< + * value = __parseBoolAsInt(s) + * if value == -1: + */ + __pyx_t_1 = (__pyx_v_s != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":876 + * cdef int value = -1 + * if s is not None: + * value = __parseBoolAsInt(s) # <<<<<<<<<<<<<< + * if value == -1: + * raise ValueError + */ + __pyx_v_value = __pyx_f_4lxml_9objectify___parseBoolAsInt(__pyx_v_s); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":877 + * if s is not None: + * value = __parseBoolAsInt(s) + * if value == -1: # <<<<<<<<<<<<<< + * raise ValueError + * + */ + __pyx_t_1 = (__pyx_v_value == -1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":878 + * value = __parseBoolAsInt(s) + * if value == -1: + * raise ValueError # <<<<<<<<<<<<<< + * + * cpdef __parseBool(s): + */ + __Pyx_Raise(__pyx_builtin_ValueError, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.objectify.__checkBool"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":880 + * raise ValueError + * + * cpdef __parseBool(s): # <<<<<<<<<<<<<< + * cdef int value + * if s is None: + */ + +static PyObject *__pyx_pf_4lxml_9objectify___parseBool(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyObject *__pyx_f_4lxml_9objectify___parseBool(PyObject *__pyx_v_s, int __pyx_skip_dispatch) { + int __pyx_v_value; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__parseBool"); + __Pyx_INCREF(__pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":882 + * cpdef __parseBool(s): + * cdef int value + * if s is None: # <<<<<<<<<<<<<< + * return False + * value = __parseBoolAsInt(s) + */ + __pyx_t_1 = (__pyx_v_s == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":883 + * cdef int value + * if s is None: + * return False # <<<<<<<<<<<<<< + * value = __parseBoolAsInt(s) + * if value == -1: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __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-2.2/src/lxml/lxml.objectify.pyx":884 + * if s is None: + * return False + * value = __parseBoolAsInt(s) # <<<<<<<<<<<<<< + * if value == -1: + * raise ValueError, u"Invalid boolean value: '%s'" % s + */ + __pyx_v_value = __pyx_f_4lxml_9objectify___parseBoolAsInt(__pyx_v_s); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":885 + * return False + * value = __parseBoolAsInt(s) + * if value == -1: # <<<<<<<<<<<<<< + * raise ValueError, u"Invalid boolean value: '%s'" % s + * return value + */ + __pyx_t_1 = (__pyx_v_value == -1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":886 + * value = __parseBoolAsInt(s) + * if value == -1: + * raise ValueError, u"Invalid boolean value: '%s'" % s # <<<<<<<<<<<<<< + * return value + * + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_2, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":887 + * if value == -1: + * raise ValueError, u"Invalid boolean value: '%s'" % s + * return value # <<<<<<<<<<<<<< + * + * cdef inline int __parseBoolAsInt(text): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(((int)__pyx_v_value)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __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.objectify.__parseBool"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":880 + * raise ValueError + * + * cpdef __parseBool(s): # <<<<<<<<<<<<<< + * cdef int value + * if s is None: + */ + +static PyObject *__pyx_pf_4lxml_9objectify___parseBool(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify___parseBool(PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__parseBool"); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify___parseBool(__pyx_v_s, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __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.objectify.__parseBool"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":889 + * return value + * + * cdef inline int __parseBoolAsInt(text): # <<<<<<<<<<<<<< + * if text == u'false': + * return 0 + */ + +static INLINE int __pyx_f_4lxml_9objectify___parseBoolAsInt(PyObject *__pyx_v_text) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__parseBoolAsInt"); + __Pyx_INCREF(__pyx_v_text); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":890 + * + * cdef inline int __parseBoolAsInt(text): + * if text == u'false': # <<<<<<<<<<<<<< + * return 0 + * elif text == u'true': + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_text, ((PyObject *)__pyx_n_u_false), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __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 = 890; __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-2.2/src/lxml/lxml.objectify.pyx":891 + * cdef inline int __parseBoolAsInt(text): + * if text == u'false': + * return 0 # <<<<<<<<<<<<<< + * elif text == u'true': + * return 1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":892 + * if text == u'false': + * return 0 + * elif text == u'true': # <<<<<<<<<<<<<< + * return 1 + * elif text == u'0': + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_text, ((PyObject *)__pyx_n_u_true), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __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 = 892; __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-2.2/src/lxml/lxml.objectify.pyx":893 + * return 0 + * elif text == u'true': + * return 1 # <<<<<<<<<<<<<< + * elif text == u'0': + * return 0 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":894 + * elif text == u'true': + * return 1 + * elif text == u'0': # <<<<<<<<<<<<<< + * return 0 + * elif text == u'1': + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_text, ((PyObject *)__pyx_kp_u_0), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __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 = 894; __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-2.2/src/lxml/lxml.objectify.pyx":895 + * return 1 + * elif text == u'0': + * return 0 # <<<<<<<<<<<<<< + * elif text == u'1': + * return 1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":896 + * elif text == u'0': + * return 0 + * elif text == u'1': # <<<<<<<<<<<<<< + * return 1 + * return -1 + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_text, ((PyObject *)__pyx_kp_u_15), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __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 = 896; __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-2.2/src/lxml/lxml.objectify.pyx":897 + * return 0 + * elif text == u'1': + * return 1 # <<<<<<<<<<<<<< + * return -1 + * + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":898 + * elif text == u'1': + * return 1 + * return -1 # <<<<<<<<<<<<<< + * + * cdef inline object _parseNumber(NumberElement element): + */ + __pyx_r = -1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_WriteUnraisable("lxml.objectify.__parseBoolAsInt"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_text); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":900 + * return -1 + * + * cdef inline object _parseNumber(NumberElement element): # <<<<<<<<<<<<<< + * return element._parse_value(textOf(element._c_node)) + * + */ + +static INLINE PyObject *__pyx_f_4lxml_9objectify__parseNumber(struct __pyx_obj_4lxml_9objectify_NumberElement *__pyx_v_element) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_parseNumber"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":901 + * + * cdef inline object _parseNumber(NumberElement element): + * return element._parse_value(textOf(element._c_node)) # <<<<<<<<<<<<<< + * + * cdef inline object _strValueOf(obj): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = textOf(__pyx_v_element->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __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 = 901; __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(__pyx_v_element->_parse_value, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __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.objectify._parseNumber"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":903 + * return element._parse_value(textOf(element._c_node)) + * + * cdef inline object _strValueOf(obj): # <<<<<<<<<<<<<< + * if python._isString(obj): + * return obj + */ + +static INLINE PyObject *__pyx_f_4lxml_9objectify__strValueOf(PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_strValueOf"); + __Pyx_INCREF(__pyx_v_obj); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":904 + * + * cdef inline object _strValueOf(obj): + * if python._isString(obj): # <<<<<<<<<<<<<< + * return obj + * if isinstance(obj, _Element): + */ + __pyx_t_1 = _isString(__pyx_v_obj); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":905 + * cdef inline object _strValueOf(obj): + * if python._isString(obj): + * return obj # <<<<<<<<<<<<<< + * if isinstance(obj, _Element): + * return textOf((<_Element>obj)._c_node) or u'' + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":906 + * if python._isString(obj): + * return obj + * if isinstance(obj, _Element): # <<<<<<<<<<<<<< + * return textOf((<_Element>obj)._c_node) or u'' + * if obj is None: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_obj, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":907 + * return obj + * if isinstance(obj, _Element): + * return textOf((<_Element>obj)._c_node) or u'' # <<<<<<<<<<<<<< + * if obj is None: + * return u'' + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = textOf(((struct LxmlElement *)__pyx_v_obj)->_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_3 = __pyx_kp_u_4; + } else { + __pyx_t_3 = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":908 + * if isinstance(obj, _Element): + * return textOf((<_Element>obj)._c_node) or u'' + * if obj is None: # <<<<<<<<<<<<<< + * return u'' + * return unicode(obj) + */ + __pyx_t_1 = (__pyx_v_obj == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":909 + * return textOf((<_Element>obj)._c_node) or u'' + * if obj is None: + * return u'' # <<<<<<<<<<<<<< + * return unicode(obj) + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + __pyx_r = ((PyObject *)__pyx_kp_u_4); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":910 + * if obj is None: + * return u'' + * return unicode(obj) # <<<<<<<<<<<<<< + * + * cdef inline object _numericValueOf(obj): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_obj); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __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 = 910; __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.objectify._strValueOf"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":912 + * return unicode(obj) + * + * cdef inline object _numericValueOf(obj): # <<<<<<<<<<<<<< + * if isinstance(obj, NumberElement): + * return _parseNumber(obj) + */ + +static INLINE PyObject *__pyx_f_4lxml_9objectify__numericValueOf(PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_numericValueOf"); + __Pyx_INCREF(__pyx_v_obj); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":913 + * + * cdef inline object _numericValueOf(obj): + * if isinstance(obj, NumberElement): # <<<<<<<<<<<<<< + * return _parseNumber(obj) + * elif hasattr(obj, u'pyval'): + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_obj, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NumberElement))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":914 + * cdef inline object _numericValueOf(obj): + * if isinstance(obj, NumberElement): + * return _parseNumber(obj) # <<<<<<<<<<<<<< + * elif hasattr(obj, u'pyval'): + * # not always numeric, but Python will raise the right exception + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_9objectify__parseNumber(((struct __pyx_obj_4lxml_9objectify_NumberElement *)__pyx_v_obj)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __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-2.2/src/lxml/lxml.objectify.pyx":915 + * if isinstance(obj, NumberElement): + * return _parseNumber(obj) + * elif hasattr(obj, u'pyval'): # <<<<<<<<<<<<<< + * # not always numeric, but Python will raise the right exception + * return obj.pyval + */ + __pyx_t_1 = PyObject_HasAttr(__pyx_v_obj, ((PyObject *)__pyx_n_u_pyval)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":917 + * elif hasattr(obj, u'pyval'): + * # not always numeric, but Python will raise the right exception + * return obj.pyval # <<<<<<<<<<<<<< + * return obj + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_obj, __pyx_n_ui_pyval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __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-2.2/src/lxml/lxml.objectify.pyx":918 + * # not always numeric, but Python will raise the right exception + * return obj.pyval + * return obj # <<<<<<<<<<<<<< + * + * cdef inline _richcmpPyvals(left, right, int op): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + 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.objectify._numericValueOf"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":920 + * return obj + * + * cdef inline _richcmpPyvals(left, right, int op): # <<<<<<<<<<<<<< + * left = getattr3(left, u'pyval', left) + * right = getattr3(right, u'pyval', right) + */ + +static INLINE PyObject *__pyx_f_4lxml_9objectify__richcmpPyvals(PyObject *__pyx_v_left, PyObject *__pyx_v_right, int __pyx_v_op) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_richcmpPyvals"); + __Pyx_INCREF(__pyx_v_left); + __Pyx_INCREF(__pyx_v_right); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":921 + * + * cdef inline _richcmpPyvals(left, right, int op): + * left = getattr3(left, u'pyval', left) # <<<<<<<<<<<<<< + * right = getattr3(right, u'pyval', right) + * return python.PyObject_RichCompare(left, right, op) + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_left, ((PyObject *)__pyx_n_u_pyval), __pyx_v_left); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_left); + __pyx_v_left = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":922 + * cdef inline _richcmpPyvals(left, right, int op): + * left = getattr3(left, u'pyval', left) + * right = getattr3(right, u'pyval', right) # <<<<<<<<<<<<<< + * return python.PyObject_RichCompare(left, right, op) + * + */ + __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_right, ((PyObject *)__pyx_n_u_pyval), __pyx_v_right); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_right); + __pyx_v_right = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":923 + * left = getattr3(left, u'pyval', left) + * right = getattr3(right, u'pyval', right) + * return python.PyObject_RichCompare(left, right, op) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_left, __pyx_v_right, __pyx_v_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __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.objectify._richcmpPyvals"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_left); + __Pyx_DECREF(__pyx_v_right); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":951 + * cdef object _type + * cdef list _schema_types + * def __init__(self, name, type_check, type_class, stringify=None): # <<<<<<<<<<<<<< + * if python.PyString_Check(name): + * name = python.PyUnicode_FromEncodedObject(name, 'ASCII', NULL) + */ + +static int __pyx_pf_4lxml_9objectify_6PyType___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_9objectify_6PyType___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_type_check = 0; + PyObject *__pyx_v_type_class = 0; + PyObject *__pyx_v_stringify = 0; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_name,&__pyx_n_ui_type_check,&__pyx_n_ui_type_class,&__pyx_n_ui_stringify,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + 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_ui_name); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_type_check); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_type_class); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_stringify); + if (unlikely(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[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_name = values[0]; + __pyx_v_type_check = values[1]; + __pyx_v_type_class = values[2]; + __pyx_v_stringify = values[3]; + } else { + __pyx_v_stringify = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: + __pyx_v_stringify = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: + __pyx_v_type_class = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_type_check = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_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, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.PyType.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_name); + __Pyx_INCREF(__pyx_v_type_check); + __Pyx_INCREF(__pyx_v_type_class); + __Pyx_INCREF(__pyx_v_stringify); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":952 + * cdef list _schema_types + * def __init__(self, name, type_check, type_class, stringify=None): + * if python.PyString_Check(name): # <<<<<<<<<<<<<< + * name = python.PyUnicode_FromEncodedObject(name, 'ASCII', NULL) + * elif not python.PyUnicode_Check(name): + */ + __pyx_t_1 = PyString_Check(__pyx_v_name); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":953 + * def __init__(self, name, type_check, type_class, stringify=None): + * if python.PyString_Check(name): + * name = python.PyUnicode_FromEncodedObject(name, 'ASCII', NULL) # <<<<<<<<<<<<<< + * elif not python.PyUnicode_Check(name): + * raise TypeError, u"Type name must be a string" + */ + __pyx_t_2 = PyUnicode_FromEncodedObject(__pyx_v_name, __pyx_k_ASCII, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __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_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":954 + * if python.PyString_Check(name): + * name = python.PyUnicode_FromEncodedObject(name, 'ASCII', NULL) + * elif not python.PyUnicode_Check(name): # <<<<<<<<<<<<<< + * raise TypeError, u"Type name must be a string" + * if type_check is not None and not callable(type_check): + */ + __pyx_t_1 = (!PyUnicode_Check(__pyx_v_name)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":955 + * name = python.PyUnicode_FromEncodedObject(name, 'ASCII', NULL) + * elif not python.PyUnicode_Check(name): + * raise TypeError, u"Type name must be a string" # <<<<<<<<<<<<<< + * if type_check is not None and not callable(type_check): + * raise TypeError, u"Type check function must be callable (or None)" + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_16), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":956 + * elif not python.PyUnicode_Check(name): + * raise TypeError, u"Type name must be a string" + * if type_check is not None and not callable(type_check): # <<<<<<<<<<<<<< + * raise TypeError, u"Type check function must be callable (or None)" + * if name != TREE_PYTYPE_NAME and \ + */ + __pyx_t_1 = (__pyx_v_type_check != Py_None); + if (__pyx_t_1) { + __pyx_t_3 = (!PyCallable_Check(__pyx_v_type_check)); + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":957 + * raise TypeError, u"Type name must be a string" + * if type_check is not None and not callable(type_check): + * raise TypeError, u"Type check function must be callable (or None)" # <<<<<<<<<<<<<< + * if name != TREE_PYTYPE_NAME and \ + * not issubclass(type_class, ObjectifiedDataElement): + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_17), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":958 + * if type_check is not None and not callable(type_check): + * raise TypeError, u"Type check function must be callable (or None)" + * if name != TREE_PYTYPE_NAME and \ # <<<<<<<<<<<<<< + * not issubclass(type_class, ObjectifiedDataElement): + * raise TypeError, \ + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_name, __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __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 = 958; __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-2.2/src/lxml/lxml.objectify.pyx":959 + * raise TypeError, u"Type check function must be callable (or None)" + * if name != TREE_PYTYPE_NAME and \ + * not issubclass(type_class, ObjectifiedDataElement): # <<<<<<<<<<<<<< + * raise TypeError, \ + * u"Data classes must inherit from ObjectifiedDataElement" + */ + __pyx_t_1 = PyObject_IsSubclass(__pyx_v_type_class, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedDataElement))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/lxml.objectify.pyx":960 + * if name != TREE_PYTYPE_NAME and \ + * not issubclass(type_class, ObjectifiedDataElement): + * raise TypeError, \ # <<<<<<<<<<<<<< + * u"Data classes must inherit from ObjectifiedDataElement" + * self.name = name + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_18), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":962 + * raise TypeError, \ + * u"Data classes must inherit from ObjectifiedDataElement" + * self.name = name # <<<<<<<<<<<<<< + * self._type = type_class + * self.type_check = type_check + */ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name = __pyx_v_name; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":963 + * u"Data classes must inherit from ObjectifiedDataElement" + * self.name = name + * self._type = type_class # <<<<<<<<<<<<<< + * self.type_check = type_check + * if stringify is None: + */ + __Pyx_INCREF(__pyx_v_type_class); + __Pyx_GIVEREF(__pyx_v_type_class); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_type); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_type); + ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_type = __pyx_v_type_class; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":964 + * self.name = name + * self._type = type_class + * self.type_check = type_check # <<<<<<<<<<<<<< + * if stringify is None: + * stringify = unicode + */ + __Pyx_INCREF(__pyx_v_type_check); + __Pyx_GIVEREF(__pyx_v_type_check); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check = __pyx_v_type_check; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":965 + * self._type = type_class + * self.type_check = type_check + * if stringify is None: # <<<<<<<<<<<<<< + * stringify = unicode + * self.stringify = stringify + */ + __pyx_t_1 = (__pyx_v_stringify == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":966 + * self.type_check = type_check + * if stringify is None: + * stringify = unicode # <<<<<<<<<<<<<< + * self.stringify = stringify + * self._schema_types = [] + */ + __Pyx_INCREF(((PyObject *)((PyObject*)&PyUnicode_Type))); + __Pyx_DECREF(__pyx_v_stringify); + __pyx_v_stringify = ((PyObject *)((PyObject*)&PyUnicode_Type)); + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":967 + * if stringify is None: + * stringify = unicode + * self.stringify = stringify # <<<<<<<<<<<<<< + * self._schema_types = [] + * + */ + __Pyx_INCREF(__pyx_v_stringify); + __Pyx_GIVEREF(__pyx_v_stringify); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->stringify); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->stringify); + ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->stringify = __pyx_v_stringify; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":968 + * stringify = unicode + * self.stringify = stringify + * self._schema_types = [] # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __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_9objectify_PyType *)__pyx_v_self)->_schema_types); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types)); + ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types = __pyx_t_2; + __pyx_t_2 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.objectify.PyType.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_type_check); + __Pyx_DECREF(__pyx_v_type_class); + __Pyx_DECREF(__pyx_v_stringify); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":970 + * self._schema_types = [] + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return u"PyType(%s, %s)" % (self.name, self._type.__name__) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_6PyType___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_6PyType___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__repr__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":971 + * + * def __repr__(self): + * return u"PyType(%s, %s)" % (self.name, self._type.__name__) # <<<<<<<<<<<<<< + * + * def register(self, before=None, after=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_type, __pyx_n_ui___name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __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[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_19), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __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.objectify.PyType.__repr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":973 + * return u"PyType(%s, %s)" % (self.name, self._type.__name__) + * + * def register(self, before=None, after=None): # <<<<<<<<<<<<<< + * u"""register(self, before=None, after=None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_6PyType_register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_6PyType_register[] = "register(self, before=None, after=None)\n\n Register the type.\n\n The additional keyword arguments 'before' and 'after' accept a\n sequence of type names that must appear before/after the new type in\n the type list. If any of them is not currently known, it is simply\n ignored. Raises ValueError if the dependencies cannot be fulfilled.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_6PyType_register(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_before = 0; + PyObject *__pyx_v_after = 0; + PyObject *__pyx_v_item; + PyObject *__pyx_v_entry; + PyObject *__pyx_v_first_pos; + PyObject *__pyx_v_last_pos; + PyObject *__pyx_v_i; + PyObject *__pyx_v_check; + PyObject *__pyx_v_pytype; + PyObject *__pyx_v_xs_type; + 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; + int __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_before,&__pyx_n_ui_after,0}; + __Pyx_SetupRefcountContext("register"); + 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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_before); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_after); + if (unlikely(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), "register") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_before = values[0]; + __pyx_v_after = values[1]; + } else { + __pyx_v_before = ((PyObject *)Py_None); + __pyx_v_after = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_after = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_before = 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("register", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.PyType.register"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_before); + __Pyx_INCREF(__pyx_v_after); + __pyx_v_item = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_entry = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_first_pos = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_last_pos = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_check = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_xs_type = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":983 + * ignored. Raises ValueError if the dependencies cannot be fulfilled. + * """ + * if self.name == TREE_PYTYPE_NAME: # <<<<<<<<<<<<<< + * raise ValueError, u"Cannot register tree type" + * if self.type_check is not None: + */ + __pyx_t_1 = PyObject_RichCompare(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name, __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __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 = 983; __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-2.2/src/lxml/lxml.objectify.pyx":984 + * """ + * if self.name == TREE_PYTYPE_NAME: + * raise ValueError, u"Cannot register tree type" # <<<<<<<<<<<<<< + * if self.type_check is not None: + * for item in _TYPE_CHECKS: + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_20), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":985 + * if self.name == TREE_PYTYPE_NAME: + * raise ValueError, u"Cannot register tree type" + * if self.type_check is not None: # <<<<<<<<<<<<<< + * for item in _TYPE_CHECKS: + * if item[0] is self.type_check: + */ + __pyx_t_2 = (((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check != Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":986 + * raise ValueError, u"Cannot register tree type" + * if self.type_check is not None: + * for item in _TYPE_CHECKS: # <<<<<<<<<<<<<< + * if item[0] is self.type_check: + * _TYPE_CHECKS.remove(item) + */ + if (likely(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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_item); + __pyx_v_item = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":987 + * if self.type_check is not None: + * for item in _TYPE_CHECKS: + * if item[0] is self.type_check: # <<<<<<<<<<<<<< + * _TYPE_CHECKS.remove(item) + * break + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_item, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__pyx_t_4 == ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":988 + * for item in _TYPE_CHECKS: + * if item[0] is self.type_check: + * _TYPE_CHECKS.remove(item) # <<<<<<<<<<<<<< + * break + * entry = (self.type_check, self) + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS), __pyx_n_ui_remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __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[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_item); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_item); + __Pyx_GIVEREF(__pyx_v_item); + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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-2.2/src/lxml/lxml.objectify.pyx":989 + * if item[0] is self.type_check: + * _TYPE_CHECKS.remove(item) + * break # <<<<<<<<<<<<<< + * entry = (self.type_check, self) + * first_pos = 0 + */ + goto __pyx_L9_break; + goto __pyx_L10; + } + __pyx_L10:; + } + __pyx_L9_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":990 + * _TYPE_CHECKS.remove(item) + * break + * entry = (self.type_check, self) # <<<<<<<<<<<<<< + * first_pos = 0 + * last_pos = -1 + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_DECREF(__pyx_v_entry); + __pyx_v_entry = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":991 + * break + * entry = (self.type_check, self) + * first_pos = 0 # <<<<<<<<<<<<<< + * last_pos = -1 + * if before or after: + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_first_pos); + __pyx_v_first_pos = __pyx_int_0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":992 + * entry = (self.type_check, self) + * first_pos = 0 + * last_pos = -1 # <<<<<<<<<<<<<< + * if before or after: + * if before is None: + */ + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_DECREF(__pyx_v_last_pos); + __pyx_v_last_pos = __pyx_int_neg_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":993 + * first_pos = 0 + * last_pos = -1 + * if before or after: # <<<<<<<<<<<<<< + * if before is None: + * before = () + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_before); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_after); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_2; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":994 + * last_pos = -1 + * if before or after: + * if before is None: # <<<<<<<<<<<<<< + * before = () + * elif after is None: + */ + __pyx_t_8 = (__pyx_v_before == Py_None); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":995 + * if before or after: + * if before is None: + * before = () # <<<<<<<<<<<<<< + * elif after is None: + * after = () + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_DECREF(__pyx_v_before); + __pyx_v_before = ((PyObject *)__pyx_empty_tuple); + goto __pyx_L12; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":996 + * if before is None: + * before = () + * elif after is None: # <<<<<<<<<<<<<< + * after = () + * for i, (check, pytype) in enumerate(_TYPE_CHECKS): + */ + __pyx_t_8 = (__pyx_v_after == Py_None); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":997 + * before = () + * elif after is None: + * after = () # <<<<<<<<<<<<<< + * for i, (check, pytype) in enumerate(_TYPE_CHECKS): + * if last_pos == -1 and pytype.name in before: + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_DECREF(__pyx_v_after); + __pyx_v_after = ((PyObject *)__pyx_empty_tuple); + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":998 + * elif after is None: + * after = () + * for i, (check, pytype) in enumerate(_TYPE_CHECKS): # <<<<<<<<<<<<<< + * if last_pos == -1 and pytype.name in before: + * last_pos = i + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + if (likely(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS); __Pyx_INCREF(__pyx_t_6); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; + 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_check); + __pyx_v_check = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __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[0]; __pyx_lineno = 998; __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[0]; __pyx_lineno = 998; __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[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_EndUnpack(__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_check); + __pyx_v_check = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_9; + __pyx_t_9 = 0; + } + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":999 + * after = () + * for i, (check, pytype) in enumerate(_TYPE_CHECKS): + * if last_pos == -1 and pytype.name in before: # <<<<<<<<<<<<<< + * last_pos = i + * if pytype.name in after: + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_last_pos, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __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[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = (PySequence_Contains(__pyx_v_before, __pyx_t_5)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __pyx_t_2; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1000 + * for i, (check, pytype) in enumerate(_TYPE_CHECKS): + * if last_pos == -1 and pytype.name in before: + * last_pos = i # <<<<<<<<<<<<<< + * if pytype.name in after: + * first_pos = i+1 + */ + __Pyx_INCREF(__pyx_v_i); + __Pyx_DECREF(__pyx_v_last_pos); + __pyx_v_last_pos = __pyx_v_i; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1001 + * if last_pos == -1 and pytype.name in before: + * last_pos = i + * if pytype.name in after: # <<<<<<<<<<<<<< + * first_pos = i+1 + * if last_pos == -1: + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (PySequence_Contains(__pyx_v_after, __pyx_t_5)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1002 + * last_pos = i + * if pytype.name in after: + * first_pos = i+1 # <<<<<<<<<<<<<< + * if last_pos == -1: + * _TYPE_CHECKS.append(entry) + */ + __pyx_t_5 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_first_pos); + __pyx_v_first_pos = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L16; + } + __pyx_L16:; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1003 + * if pytype.name in after: + * first_pos = i+1 + * if last_pos == -1: # <<<<<<<<<<<<<< + * _TYPE_CHECKS.append(entry) + * elif first_pos > last_pos: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_last_pos, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1004 + * first_pos = i+1 + * if last_pos == -1: + * _TYPE_CHECKS.append(entry) # <<<<<<<<<<<<<< + * elif first_pos > last_pos: + * raise ValueError, u"inconsistent before/after dependencies" + */ + if (unlikely(__pyx_v_4lxml_9objectify__TYPE_CHECKS == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = PyList_Append(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS), __pyx_v_entry); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L17; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1005 + * if last_pos == -1: + * _TYPE_CHECKS.append(entry) + * elif first_pos > last_pos: # <<<<<<<<<<<<<< + * raise ValueError, u"inconsistent before/after dependencies" + * else: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_first_pos, __pyx_v_last_pos, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1006 + * _TYPE_CHECKS.append(entry) + * elif first_pos > last_pos: + * raise ValueError, u"inconsistent before/after dependencies" # <<<<<<<<<<<<<< + * else: + * _TYPE_CHECKS.insert(last_pos, entry) + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_21), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L17; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1008 + * raise ValueError, u"inconsistent before/after dependencies" + * else: + * _TYPE_CHECKS.insert(last_pos, entry) # <<<<<<<<<<<<<< + * + * _PYTYPE_DICT[self.name] = self + */ + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_last_pos); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyList_Insert(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS), __pyx_t_3, __pyx_v_entry); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L17:; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1010 + * _TYPE_CHECKS.insert(last_pos, entry) + * + * _PYTYPE_DICT[self.name] = self # <<<<<<<<<<<<<< + * for xs_type in self._schema_types: + * _SCHEMA_TYPE_DICT[xs_type] = self + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name, __pyx_v_self) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1011 + * + * _PYTYPE_DICT[self.name] = self + * for xs_type in self._schema_types: # <<<<<<<<<<<<<< + * _SCHEMA_TYPE_DICT[xs_type] = self + * + */ + if (likely(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + 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++; + __Pyx_DECREF(__pyx_v_xs_type); + __pyx_v_xs_type = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1012 + * _PYTYPE_DICT[self.name] = self + * for xs_type in self._schema_types: + * _SCHEMA_TYPE_DICT[xs_type] = self # <<<<<<<<<<<<<< + * + * def unregister(self): + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_xs_type, __pyx_v_self) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("lxml.objectify.PyType.register"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_item); + __Pyx_DECREF(__pyx_v_entry); + __Pyx_DECREF(__pyx_v_first_pos); + __Pyx_DECREF(__pyx_v_last_pos); + __Pyx_DECREF(__pyx_v_i); + __Pyx_DECREF(__pyx_v_check); + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_DECREF(__pyx_v_xs_type); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_before); + __Pyx_DECREF(__pyx_v_after); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1014 + * _SCHEMA_TYPE_DICT[xs_type] = self + * + * def unregister(self): # <<<<<<<<<<<<<< + * u"unregister(self)" + * if _PYTYPE_DICT.get(self.name) is self: + */ + +static PyObject *__pyx_pf_4lxml_9objectify_6PyType_unregister(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_9objectify_6PyType_unregister[] = "unregister(self)"; +static PyObject *__pyx_pf_4lxml_9objectify_6PyType_unregister(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_v_xs_type; + PyObject *__pyx_v_pytype; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + __Pyx_SetupRefcountContext("unregister"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_xs_type = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1016 + * def unregister(self): + * u"unregister(self)" + * if _PYTYPE_DICT.get(self.name) is self: # <<<<<<<<<<<<<< + * del _PYTYPE_DICT[self.name] + * for xs_type, pytype in list(_SCHEMA_TYPE_DICT.items()): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_n_ui_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __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 = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name); + __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 = 1016; __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_t_4 = (__pyx_t_3 == __pyx_v_self); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1017 + * u"unregister(self)" + * if _PYTYPE_DICT.get(self.name) is self: + * del _PYTYPE_DICT[self.name] # <<<<<<<<<<<<<< + * for xs_type, pytype in list(_SCHEMA_TYPE_DICT.items()): + * if pytype is self: + */ + if (PyDict_DelItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->name) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1018 + * if _PYTYPE_DICT.get(self.name) is self: + * del _PYTYPE_DICT[self.name] + * for xs_type, pytype in list(_SCHEMA_TYPE_DICT.items()): # <<<<<<<<<<<<<< + * if pytype is self: + * del _SCHEMA_TYPE_DICT[xs_type] + */ + __pyx_t_3 = PyDict_Items(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __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[0]; __pyx_lineno = 1018; __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(((PyObject *)((PyObject*)&PyList_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __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_5 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __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_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __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_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_xs_type); + __pyx_v_xs_type = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_6; + __pyx_t_6 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_xs_type); + __pyx_v_xs_type = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1019 + * del _PYTYPE_DICT[self.name] + * for xs_type, pytype in list(_SCHEMA_TYPE_DICT.items()): + * if pytype is self: # <<<<<<<<<<<<<< + * del _SCHEMA_TYPE_DICT[xs_type] + * if self.type_check is None: + */ + __pyx_t_4 = (__pyx_v_pytype == __pyx_v_self); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1020 + * for xs_type, pytype in list(_SCHEMA_TYPE_DICT.items()): + * if pytype is self: + * del _SCHEMA_TYPE_DICT[xs_type] # <<<<<<<<<<<<<< + * if self.type_check is None: + * return + */ + if (PyDict_DelItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_xs_type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1021 + * if pytype is self: + * del _SCHEMA_TYPE_DICT[xs_type] + * if self.type_check is None: # <<<<<<<<<<<<<< + * return + * try: + */ + __pyx_t_4 = (((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check == Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1022 + * del _SCHEMA_TYPE_DICT[xs_type] + * if self.type_check is None: + * return # <<<<<<<<<<<<<< + * try: + * _TYPE_CHECKS.remove( (self.type_check, self) ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1023 + * if self.type_check is None: + * return + * try: # <<<<<<<<<<<<<< + * _TYPE_CHECKS.remove( (self.type_check, self) ) + * 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:*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1024 + * return + * try: + * _TYPE_CHECKS.remove( (self.type_check, self) ) # <<<<<<<<<<<<<< + * except ValueError: + * pass + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS), __pyx_n_ui_remove); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->type_check); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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_L17_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1025 + * try: + * _TYPE_CHECKS.remove( (self.type_check, self) ) + * except ValueError: # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_8) { + PyErr_Restore(0,0,0); + goto __pyx_L11_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__pyx_save_exc_tb); + goto __pyx_L1_error; + __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_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_AddTraceback("lxml.objectify.PyType.unregister"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_xs_type); + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1033 + * Note that this must be set before registering the type! + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * return self._schema_types + * def __set__(self, types): + */ + +static PyObject *__pyx_pf_4lxml_9objectify_6PyType_14xmlSchemaTypes___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_6PyType_14xmlSchemaTypes___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1034 + * """ + * def __get__(self): + * return self._schema_types # <<<<<<<<<<<<<< + * def __set__(self, types): + * self._schema_types = list(map(unicode, types)) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types)); + __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1035 + * def __get__(self): + * return self._schema_types + * def __set__(self, types): # <<<<<<<<<<<<<< + * self._schema_types = list(map(unicode, types)) + * + */ + +static int __pyx_pf_4lxml_9objectify_6PyType_14xmlSchemaTypes___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/ +static int __pyx_pf_4lxml_9objectify_6PyType_14xmlSchemaTypes___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_types) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("__set__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1036 + * return self._schema_types + * def __set__(self, types): + * self._schema_types = list(map(unicode, types)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)((PyObject*)&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyUnicode_Type))); + __Pyx_INCREF(__pyx_v_types); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_types); + __Pyx_GIVEREF(__pyx_v_types); + __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __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 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __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*)&PyList_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(PyList_CheckExact(__pyx_t_2)) || (__pyx_t_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types)); + ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_self)->_schema_types = ((PyObject *)__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.objectify.PyType.xmlSchemaTypes.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1048 + * _TYPE_CHECKS = [] + * + * cdef _lower_bool(b): # <<<<<<<<<<<<<< + * if b: + * return u"true" + */ + +static PyObject *__pyx_f_4lxml_9objectify__lower_bool(PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_lower_bool"); + __Pyx_INCREF(__pyx_v_b); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1049 + * + * cdef _lower_bool(b): + * if b: # <<<<<<<<<<<<<< + * return u"true" + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_b); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1050 + * cdef _lower_bool(b): + * if b: + * return u"true" # <<<<<<<<<<<<<< + * else: + * return u"false" + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_n_u_true)); + __pyx_r = ((PyObject *)__pyx_n_u_true); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1052 + * return u"true" + * else: + * return u"false" # <<<<<<<<<<<<<< + * + * def __lower_bool(b): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_n_u_false)); + __pyx_r = ((PyObject *)__pyx_n_u_false); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.objectify._lower_bool"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_b); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1054 + * return u"false" + * + * def __lower_bool(b): # <<<<<<<<<<<<<< + * return _lower_bool(b) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify___lower_bool(PyObject *__pyx_self, PyObject *__pyx_v_b); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify___lower_bool(PyObject *__pyx_self, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__lower_bool"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1055 + * + * def __lower_bool(b): + * return _lower_bool(b) # <<<<<<<<<<<<<< + * + * cdef _pytypename(obj): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__lower_bool(__pyx_v_b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __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.objectify.__lower_bool"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1057 + * return _lower_bool(b) + * + * cdef _pytypename(obj): # <<<<<<<<<<<<<< + * if python._isString(obj): + * return u"str" + */ + +static PyObject *__pyx_f_4lxml_9objectify__pytypename(PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("_pytypename"); + __Pyx_INCREF(__pyx_v_obj); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1058 + * + * cdef _pytypename(obj): + * if python._isString(obj): # <<<<<<<<<<<<<< + * return u"str" + * else: + */ + __pyx_t_1 = _isString(__pyx_v_obj); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1059 + * cdef _pytypename(obj): + * if python._isString(obj): + * return u"str" # <<<<<<<<<<<<<< + * else: + * return _typename(obj) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_n_u_str)); + __pyx_r = ((PyObject *)__pyx_n_u_str); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1061 + * return u"str" + * else: + * return _typename(obj) # <<<<<<<<<<<<<< + * + * def pytypename(obj): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_4lxml_9objectify__typename(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __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.objectify._pytypename"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1063 + * return _typename(obj) + * + * def pytypename(obj): # <<<<<<<<<<<<<< + * u"""pytypename(obj) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_pytypename(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ +static char __pyx_doc_4lxml_9objectify_pytypename[] = "pytypename(obj)\n\n Find the name of the corresponding PyType for a Python object.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_pytypename(PyObject *__pyx_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("pytypename"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1068 + * Find the name of the corresponding PyType for a Python object. + * """ + * return _pytypename(obj) # <<<<<<<<<<<<<< + * + * cdef _registerPyTypes(): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__pytypename(__pyx_v_obj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __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.objectify.pytypename"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1070 + * return _pytypename(obj) + * + * cdef _registerPyTypes(): # <<<<<<<<<<<<<< + * pytype = PyType(u'int', int, IntElement) + * pytype.xmlSchemaTypes = (u"integer", u"int", u"short", u"byte", u"unsignedShort", + */ + +static PyObject *__pyx_f_4lxml_9objectify__registerPyTypes(void) { + PyObject *__pyx_v_pytype; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("_registerPyTypes"); + __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1071 + * + * cdef _registerPyTypes(): + * pytype = PyType(u'int', int, IntElement) # <<<<<<<<<<<<<< + * pytype.xmlSchemaTypes = (u"integer", u"int", u"short", u"byte", u"unsignedShort", + * u"unsignedByte", u"nonPositiveInteger", + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_int)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_u_int)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_int)); + __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((PyObject*)&PyInt_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_IntElement))); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_IntElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_IntElement))); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1072 + * cdef _registerPyTypes(): + * pytype = PyType(u'int', int, IntElement) + * pytype.xmlSchemaTypes = (u"integer", u"int", u"short", u"byte", u"unsignedShort", # <<<<<<<<<<<<<< + * u"unsignedByte", u"nonPositiveInteger", + * u"negativeInteger", u"long", u"nonNegativeInteger", + */ + __pyx_t_2 = PyTuple_New(13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_integer)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_u_integer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_integer)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_int)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_u_int)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_int)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_short)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_u_short)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_short)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_byte)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_u_byte)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_byte)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_unsignedShort)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_u_unsignedShort)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_unsignedShort)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_unsignedByte)); + PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_n_u_unsignedByte)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_unsignedByte)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_nonPositiveInteger)); + PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_n_u_nonPositiveInteger)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_nonPositiveInteger)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_negativeInteger)); + PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_n_u_negativeInteger)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_negativeInteger)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_long)); + PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_n_u_long)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_long)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_nonNegativeInteger)); + PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_n_u_nonNegativeInteger)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_nonNegativeInteger)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_unsignedLong)); + PyTuple_SET_ITEM(__pyx_t_2, 10, ((PyObject *)__pyx_n_u_unsignedLong)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_unsignedLong)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_unsignedInt)); + PyTuple_SET_ITEM(__pyx_t_2, 11, ((PyObject *)__pyx_n_u_unsignedInt)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_unsignedInt)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_positiveInteger)); + PyTuple_SET_ITEM(__pyx_t_2, 12, ((PyObject *)__pyx_n_u_positiveInteger)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_positiveInteger)); + if (PyObject_SetAttr(__pyx_v_pytype, __pyx_n_ui_xmlSchemaTypes, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1076 + * u"negativeInteger", u"long", u"nonNegativeInteger", + * u"unsignedLong", u"unsignedInt", u"positiveInteger",) + * pytype.register() # <<<<<<<<<<<<<< + * + * # 'long' type just for backwards compatibility + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __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[0]; __pyx_lineno = 1076; __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-2.2/src/lxml/lxml.objectify.pyx":1079 + * + * # 'long' type just for backwards compatibility + * pytype = PyType(u'long', None, IntElement) # <<<<<<<<<<<<<< + * pytype.register() + * + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_long)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_u_long)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_long)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_IntElement))); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_IntElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_IntElement))); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1080 + * # 'long' type just for backwards compatibility + * pytype = PyType(u'long', None, IntElement) + * pytype.register() # <<<<<<<<<<<<<< + * + * pytype = PyType(u'float', float, FloatElement) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __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[0]; __pyx_lineno = 1080; __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-2.2/src/lxml/lxml.objectify.pyx":1082 + * pytype.register() + * + * pytype = PyType(u'float', float, FloatElement) # <<<<<<<<<<<<<< + * pytype.xmlSchemaTypes = (u"double", u"float") + * pytype.register() + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_float)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_u_float)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_float)); + __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((PyObject*)&PyFloat_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_FloatElement))); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_FloatElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_FloatElement))); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1083 + * + * pytype = PyType(u'float', float, FloatElement) + * pytype.xmlSchemaTypes = (u"double", u"float") # <<<<<<<<<<<<<< + * pytype.register() + * + */ + __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_n_u_double)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_u_double)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_double)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_float)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_u_float)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_float)); + if (PyObject_SetAttr(__pyx_v_pytype, __pyx_n_ui_xmlSchemaTypes, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1084 + * pytype = PyType(u'float', float, FloatElement) + * pytype.xmlSchemaTypes = (u"double", u"float") + * pytype.register() # <<<<<<<<<<<<<< + * + * pytype = PyType(u'bool', __checkBool, BoolElement, __lower_bool) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __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[0]; __pyx_lineno = 1084; __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-2.2/src/lxml/lxml.objectify.pyx":1086 + * pytype.register() + * + * pytype = PyType(u'bool', __checkBool, BoolElement, __lower_bool) # <<<<<<<<<<<<<< + * pytype.xmlSchemaTypes = (u"boolean",) + * pytype.register() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_ui___checkBool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_ui___lower_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __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 = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_bool)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_u_bool)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_bool)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_BoolElement))); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_BoolElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_BoolElement))); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1087 + * + * pytype = PyType(u'bool', __checkBool, BoolElement, __lower_bool) + * pytype.xmlSchemaTypes = (u"boolean",) # <<<<<<<<<<<<<< + * pytype.register() + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_boolean)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_u_boolean)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_boolean)); + if (PyObject_SetAttr(__pyx_v_pytype, __pyx_n_ui_xmlSchemaTypes, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1088 + * pytype = PyType(u'bool', __checkBool, BoolElement, __lower_bool) + * pytype.xmlSchemaTypes = (u"boolean",) + * pytype.register() # <<<<<<<<<<<<<< + * + * pytype = PyType(u'str', None, StringElement) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __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 = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1090 + * pytype.register() + * + * pytype = PyType(u'str', None, StringElement) # <<<<<<<<<<<<<< + * pytype.xmlSchemaTypes = (u"string", u"normalizedString", u"token", u"language", + * u"Name", u"NCName", u"ID", u"IDREF", u"ENTITY", + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_str)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_u_str)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_str)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1091 + * + * pytype = PyType(u'str', None, StringElement) + * pytype.xmlSchemaTypes = (u"string", u"normalizedString", u"token", u"language", # <<<<<<<<<<<<<< + * u"Name", u"NCName", u"ID", u"IDREF", u"ENTITY", + * u"NMTOKEN", ) + */ + __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_string)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_u_string)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_string)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_normalizedString)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_u_normalizedString)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_normalizedString)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_token)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_u_token)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_token)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_language)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_u_language)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_language)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_Name)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_u_Name)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_Name)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_NCName)); + PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_n_u_NCName)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_NCName)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_ID)); + PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_n_u_ID)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_ID)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_IDREF)); + PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_n_u_IDREF)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_IDREF)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_ENTITY)); + PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_n_u_ENTITY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_ENTITY)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_NMTOKEN)); + PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_n_u_NMTOKEN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_NMTOKEN)); + if (PyObject_SetAttr(__pyx_v_pytype, __pyx_n_ui_xmlSchemaTypes, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1094 + * u"Name", u"NCName", u"ID", u"IDREF", u"ENTITY", + * u"NMTOKEN", ) + * pytype.register() # <<<<<<<<<<<<<< + * + * # since lxml 2.0 + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __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 = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1097 + * + * # since lxml 2.0 + * pytype = PyType(u'NoneType', None, NoneElement) # <<<<<<<<<<<<<< + * pytype.register() + * + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_NoneType)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_u_NoneType)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_NoneType)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1098 + * # since lxml 2.0 + * pytype = PyType(u'NoneType', None, NoneElement) + * pytype.register() # <<<<<<<<<<<<<< + * + * # backwards compatibility + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __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 = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1101 + * + * # backwards compatibility + * pytype = PyType(u'none', None, NoneElement) # <<<<<<<<<<<<<< + * pytype.register() + * + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_none)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_u_none)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_none)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __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_pytype); + __pyx_v_pytype = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1102 + * # backwards compatibility + * pytype = PyType(u'none', None, NoneElement) + * pytype.register() # <<<<<<<<<<<<<< + * + * # non-registered PyType for inner tree elements + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_register); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __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 = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_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_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.objectify._registerPyTypes"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1110 + * _registerPyTypes() + * + * def getRegisteredTypes(): # <<<<<<<<<<<<<< + * u"""getRegisteredTypes() + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_getRegisteredTypes(PyObject *__pyx_self, PyObject *unused); /*proto*/ +static char __pyx_doc_4lxml_9objectify_getRegisteredTypes[] = "getRegisteredTypes()\n\n Returns a list of the currently registered PyType objects.\n\n To add a new type, retrieve this list and call unregister() for all\n entries. Then add the new type at a suitable position (possibly replacing\n an existing one) and call register() for all entries.\n\n This is necessary if the new type interferes with the type check functions\n of existing ones (normally only int/float/bool) and must the tried before\n other types. To add a type that is not yet parsable by the current type\n check functions, you can simply register() it, which will append it to the\n end of the type list.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_getRegisteredTypes(PyObject *__pyx_self, PyObject *unused) { + PyObject *__pyx_v_types = 0; + PyObject *__pyx_v_known = 0; + PyObject *__pyx_v_check; + PyObject *__pyx_v_pytype; + PyObject *__pyx_v_name; + 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; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + __Pyx_SetupRefcountContext("getRegisteredTypes"); + __pyx_self = __pyx_self; + __pyx_v_check = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1125 + * end of the type list. + * """ + * cdef list types = [] # <<<<<<<<<<<<<< + * cdef set known = set() + * for check, pytype in _TYPE_CHECKS: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_types = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1126 + * """ + * cdef list types = [] + * cdef set known = set() # <<<<<<<<<<<<<< + * for check, pytype in _TYPE_CHECKS: + * name = pytype.name + */ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_known = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1127 + * cdef list types = [] + * cdef set known = set() + * for check, pytype in _TYPE_CHECKS: # <<<<<<<<<<<<<< + * name = pytype.name + * if name not in known: + */ + if (likely(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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 (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_check); + __pyx_v_check = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __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[0]; __pyx_lineno = 1127; __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[0]; __pyx_lineno = 1127; __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[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_check); + __pyx_v_check = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1128 + * cdef set known = set() + * for check, pytype in _TYPE_CHECKS: + * name = pytype.name # <<<<<<<<<<<<<< + * if name not in known: + * known.add(name) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1129 + * for check, pytype in _TYPE_CHECKS: + * name = pytype.name + * if name not in known: # <<<<<<<<<<<<<< + * known.add(name) + * types.append(pytype) + */ + __pyx_t_7 = (!PySequence_Contains(((PyObject *)__pyx_v_known), __pyx_v_name)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1130 + * name = pytype.name + * if name not in known: + * known.add(name) # <<<<<<<<<<<<<< + * types.append(pytype) + * for pytype in _PYTYPE_DICT.values(): + */ + __pyx_t_8 = PySet_Add(((PyObject *)__pyx_v_known), __pyx_v_name); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1131 + * if name not in known: + * known.add(name) + * types.append(pytype) # <<<<<<<<<<<<<< + * for pytype in _PYTYPE_DICT.values(): + * name = pytype.name + */ + if (unlikely(__pyx_v_types == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_types), __pyx_v_pytype); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __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-2.2/src/lxml/lxml.objectify.pyx":1132 + * known.add(name) + * types.append(pytype) + * for pytype in _PYTYPE_DICT.values(): # <<<<<<<<<<<<<< + * name = pytype.name + * if name not in known: + */ + __pyx_t_1 = PyDict_Values(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1133 + * types.append(pytype) + * for pytype in _PYTYPE_DICT.values(): + * name = pytype.name # <<<<<<<<<<<<<< + * if name not in known: + * known.add(name) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_ui_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1134 + * for pytype in _PYTYPE_DICT.values(): + * name = pytype.name + * if name not in known: # <<<<<<<<<<<<<< + * known.add(name) + * types.append(pytype) + */ + __pyx_t_7 = (!PySequence_Contains(((PyObject *)__pyx_v_known), __pyx_v_name)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1135 + * name = pytype.name + * if name not in known: + * known.add(name) # <<<<<<<<<<<<<< + * types.append(pytype) + * return types + */ + __pyx_t_8 = PySet_Add(((PyObject *)__pyx_v_known), __pyx_v_name); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1136 + * if name not in known: + * known.add(name) + * types.append(pytype) # <<<<<<<<<<<<<< + * return types + * + */ + if (unlikely(__pyx_v_types == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_types), __pyx_v_pytype); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1137 + * known.add(name) + * types.append(pytype) + * return types # <<<<<<<<<<<<<< + * + * cdef PyType _guessPyType(value, PyType defaulttype): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_types)); + __pyx_r = ((PyObject *)__pyx_v_types); + 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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("lxml.objectify.getRegisteredTypes"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_types); + __Pyx_XDECREF(__pyx_v_known); + __Pyx_DECREF(__pyx_v_check); + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_DECREF(__pyx_v_name); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1139 + * return types + * + * cdef PyType _guessPyType(value, PyType defaulttype): # <<<<<<<<<<<<<< + * if value is None: + * return None + */ + +static struct __pyx_obj_4lxml_9objectify_PyType *__pyx_f_4lxml_9objectify__guessPyType(PyObject *__pyx_v_value, struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_defaulttype) { + PyObject *__pyx_v_type_check; + PyObject *__pyx_v_tested_pytype; + struct __pyx_obj_4lxml_9objectify_PyType *__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; + int __pyx_t_8; + __Pyx_SetupRefcountContext("_guessPyType"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_INCREF((PyObject *)__pyx_v_defaulttype); + __pyx_v_type_check = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_tested_pytype = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1140 + * + * cdef PyType _guessPyType(value, PyType defaulttype): + * if value is None: # <<<<<<<<<<<<<< + * return None + * for type_check, tested_pytype in _TYPE_CHECKS: + */ + __pyx_t_1 = (__pyx_v_value == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1141 + * cdef PyType _guessPyType(value, PyType defaulttype): + * if value is None: + * return None # <<<<<<<<<<<<<< + * for type_check, tested_pytype in _TYPE_CHECKS: + * try: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1142 + * if value is None: + * return None + * for type_check, tested_pytype in _TYPE_CHECKS: # <<<<<<<<<<<<<< + * try: + * type_check(value) + */ + if (likely(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS) != Py_None)) { + __pyx_t_2 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS); __Pyx_INCREF(__pyx_t_3); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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_type_check); + __pyx_v_type_check = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_tested_pytype); + __pyx_v_tested_pytype = __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[0]; __pyx_lineno = 1142; __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[0]; __pyx_lineno = 1142; __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 = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_type_check); + __pyx_v_type_check = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_tested_pytype); + __pyx_v_tested_pytype = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1143 + * return None + * for type_check, tested_pytype in _TYPE_CHECKS: + * try: # <<<<<<<<<<<<<< + * type_check(value) + * return tested_pytype + */ + { + 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-2.2/src/lxml/lxml.objectify.pyx":1144 + * for type_check, tested_pytype in _TYPE_CHECKS: + * try: + * type_check(value) # <<<<<<<<<<<<<< + * return tested_pytype + * except IGNORABLE_ERRORS: + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L6_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_6 = PyObject_Call(__pyx_v_type_check, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1145 + * try: + * type_check(value) + * return tested_pytype # <<<<<<<<<<<<<< + * except IGNORABLE_ERRORS: + * # could not be parsed as the specififed type => ignore + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_tested_pytype))); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_tested_pytype); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_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_L0; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1146 + * type_check(value) + * return tested_pytype + * except IGNORABLE_ERRORS: # <<<<<<<<<<<<<< + * # could not be parsed as the specififed type => ignore + * pass + */ + __pyx_t_8 = PyErr_ExceptionMatches(((PyObject *)__pyx_v_4lxml_9objectify_IGNORABLE_ERRORS)); + if (__pyx_t_8) { + PyErr_Restore(0,0,0); + goto __pyx_L7_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1149 + * # could not be parsed as the specififed type => ignore + * pass + * return defaulttype # <<<<<<<<<<<<<< + * + * cdef object _guessElementClass(tree.xmlNode* c_node): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_defaulttype)); + __pyx_r = __pyx_v_defaulttype; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)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.objectify._guessPyType"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_type_check); + __Pyx_DECREF(__pyx_v_tested_pytype); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF((PyObject *)__pyx_v_defaulttype); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1151 + * return defaulttype + * + * cdef object _guessElementClass(tree.xmlNode* c_node): # <<<<<<<<<<<<<< + * value = textOf(c_node) + * if value is None: + */ + +static PyObject *__pyx_f_4lxml_9objectify__guessElementClass(xmlNode *__pyx_v_c_node) { + PyObject *__pyx_v_value; + PyObject *__pyx_v_type_check; + PyObject *__pyx_v_pytype; + 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_SetupRefcountContext("_guessElementClass"); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_type_check = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1152 + * + * cdef object _guessElementClass(tree.xmlNode* c_node): + * value = textOf(c_node) # <<<<<<<<<<<<<< + * if value is None: + * return None + */ + __pyx_t_1 = textOf(__pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __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-2.2/src/lxml/lxml.objectify.pyx":1153 + * cdef object _guessElementClass(tree.xmlNode* c_node): + * value = textOf(c_node) + * if value is None: # <<<<<<<<<<<<<< + * return None + * if value == u'': + */ + __pyx_t_2 = (__pyx_v_value == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1154 + * value = textOf(c_node) + * if value is None: + * return None # <<<<<<<<<<<<<< + * if value == u'': + * return StringElement + */ + __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-2.2/src/lxml/lxml.objectify.pyx":1155 + * if value is None: + * return None + * if value == u'': # <<<<<<<<<<<<<< + * return StringElement + * + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_u_4), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __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 = 1155; __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-2.2/src/lxml/lxml.objectify.pyx":1156 + * return None + * if value == u'': + * return StringElement # <<<<<<<<<<<<<< + * + * for type_check, pytype in _TYPE_CHECKS: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement)); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1158 + * return StringElement + * + * for type_check, pytype in _TYPE_CHECKS: # <<<<<<<<<<<<<< + * try: + * type_check(value) + */ + if (likely(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS) != Py_None)) { + __pyx_t_3 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS); __Pyx_INCREF(__pyx_t_1); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + 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_type_check); + __pyx_v_type_check = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __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[0]; __pyx_lineno = 1158; __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[0]; __pyx_lineno = 1158; __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 = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_type_check); + __pyx_v_type_check = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1159 + * + * for type_check, pytype in _TYPE_CHECKS: + * try: # <<<<<<<<<<<<<< + * type_check(value) + * return (pytype)._type + */ + { + 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-2.2/src/lxml/lxml.objectify.pyx":1160 + * for type_check, pytype in _TYPE_CHECKS: + * try: + * type_check(value) # <<<<<<<<<<<<<< + * return (pytype)._type + * except IGNORABLE_ERRORS: + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L7_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_6 = PyObject_Call(__pyx_v_type_check, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1161 + * try: + * type_check(value) + * return (pytype)._type # <<<<<<<<<<<<<< + * except IGNORABLE_ERRORS: + * pass + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_pytype)->_type); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_pytype)->_type; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L11_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_L14_try_end; + __pyx_L11_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_L0; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1162 + * type_check(value) + * return (pytype)._type + * except IGNORABLE_ERRORS: # <<<<<<<<<<<<<< + * pass + * return None + */ + __pyx_t_8 = PyErr_ExceptionMatches(((PyObject *)__pyx_v_4lxml_9objectify_IGNORABLE_ERRORS)); + if (__pyx_t_8) { + PyErr_Restore(0,0,0); + goto __pyx_L8_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__pyx_save_exc_tb); + goto __pyx_L1_error; + __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:; + } + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1164 + * except IGNORABLE_ERRORS: + * pass + * 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_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("lxml.objectify._guessElementClass"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_type_check); + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1175 + * cdef bint _annotate + * + * def __call__(self, *children, **attrib): # <<<<<<<<<<<<<< + * u"__call__(self, *children, **attrib)" + * cdef _ObjectifyElementMakerCaller elementMaker + */ + +static PyObject *__pyx_pf_4lxml_9objectify_28_ObjectifyElementMakerCaller___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_28_ObjectifyElementMakerCaller___call__[] = "__call__(self, *children, **attrib)"; +static PyObject *__pyx_pf_4lxml_9objectify_28_ObjectifyElementMakerCaller___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_children = 0; + PyObject *__pyx_v_attrib = 0; + struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *__pyx_v_elementMaker; + PyObject *__pyx_v_pytype; + struct LxmlElement *__pyx_v_element; + struct LxmlElement *__pyx_v_childElement; + int __pyx_v_has_children; + int __pyx_v_has_string_value; + PyObject *__pyx_v_pytype_name; + PyObject *__pyx_v_child; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + 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; + __Pyx_SetupRefcountContext("__call__"); + if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL; + __pyx_v_attrib = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); + if (unlikely(!__pyx_v_attrib)) return NULL; + __Pyx_GOTREF(__pyx_v_attrib); + __Pyx_INCREF(__pyx_args); + __pyx_v_children = __pyx_args; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_elementMaker = ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childElement = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_pytype_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_child = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1183 + * cdef bint has_children + * cdef bint has_string_value + * if self._element_factory is None: # <<<<<<<<<<<<<< + * element = _makeElement(self._tag, None, attrib, self._nsmap) + * else: + */ + __pyx_t_1 = (((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_element_factory == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1184 + * cdef bint has_string_value + * if self._element_factory is None: + * element = _makeElement(self._tag, None, attrib, self._nsmap) # <<<<<<<<<<<<<< + * else: + * element = self._element_factory(self._tag, attrib, self._nsmap) + */ + __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_9objectify__makeElement(((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_tag, Py_None, __pyx_v_attrib, ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_nsmap)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1186 + * element = _makeElement(self._tag, None, attrib, self._nsmap) + * else: + * element = self._element_factory(self._tag, attrib, self._nsmap) # <<<<<<<<<<<<<< + * + * pytype_name = None + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_tag); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_tag); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_tag); + __Pyx_INCREF(__pyx_v_attrib); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_attrib); + __Pyx_GIVEREF(__pyx_v_attrib); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_nsmap); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_nsmap); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_nsmap); + __pyx_t_3 = PyObject_Call(((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_element_factory, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_element)); + __pyx_v_element = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1188 + * element = self._element_factory(self._tag, attrib, self._nsmap) + * + * pytype_name = None # <<<<<<<<<<<<<< + * has_children = 0 + * has_string_value = 0 + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_pytype_name); + __pyx_v_pytype_name = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1189 + * + * pytype_name = None + * has_children = 0 # <<<<<<<<<<<<<< + * has_string_value = 0 + * for child in children: + */ + __pyx_v_has_children = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1190 + * pytype_name = None + * has_children = 0 + * has_string_value = 0 # <<<<<<<<<<<<<< + * for child in children: + * if child is None: + */ + __pyx_v_has_string_value = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1191 + * has_children = 0 + * has_string_value = 0 + * for child in children: # <<<<<<<<<<<<<< + * if child is None: + * if python.PyTuple_GET_SIZE(children) == 1: + */ + if (PyList_CheckExact(__pyx_v_children) || PyTuple_CheckExact(__pyx_v_children)) { + __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_children; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __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 = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1192 + * has_string_value = 0 + * for child in children: + * if child is None: # <<<<<<<<<<<<<< + * if python.PyTuple_GET_SIZE(children) == 1: + * cetree.setAttributeValue( + */ + __pyx_t_1 = (__pyx_v_child == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1193 + * for child in children: + * if child is None: + * if python.PyTuple_GET_SIZE(children) == 1: # <<<<<<<<<<<<<< + * cetree.setAttributeValue( + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + */ + __pyx_t_1 = (PyTuple_GET_SIZE(__pyx_v_children) == 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1195 + * if python.PyTuple_GET_SIZE(children) == 1: + * cetree.setAttributeValue( + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") # <<<<<<<<<<<<<< + * elif python._isString(child): + * _add_text(element, child) + */ + __pyx_t_5 = setAttributeValue(__pyx_v_element, __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR, ((PyObject *)__pyx_n_u_true)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L8; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1196 + * cetree.setAttributeValue( + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + * elif python._isString(child): # <<<<<<<<<<<<<< + * _add_text(element, child) + * has_string_value = 1 + */ + __pyx_t_1 = _isString(__pyx_v_child); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1197 + * element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + * elif python._isString(child): + * _add_text(element, child) # <<<<<<<<<<<<<< + * has_string_value = 1 + * elif isinstance(child, _Element): + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__add_text(__pyx_v_element, __pyx_v_child); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1197; __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-2.2/src/lxml/lxml.objectify.pyx":1198 + * elif python._isString(child): + * _add_text(element, child) + * has_string_value = 1 # <<<<<<<<<<<<<< + * elif isinstance(child, _Element): + * cetree.appendChild(element, <_Element>child) + */ + __pyx_v_has_string_value = 1; + goto __pyx_L8; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1199 + * _add_text(element, child) + * has_string_value = 1 + * elif isinstance(child, _Element): # <<<<<<<<<<<<<< + * cetree.appendChild(element, <_Element>child) + * has_children = 1 + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_child, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_11etreepublic__Element))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1200 + * has_string_value = 1 + * elif isinstance(child, _Element): + * cetree.appendChild(element, <_Element>child) # <<<<<<<<<<<<<< + * has_children = 1 + * elif isinstance(child, _ObjectifyElementMakerCaller): + */ + appendChild(__pyx_v_element, ((struct LxmlElement *)__pyx_v_child)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1201 + * elif isinstance(child, _Element): + * cetree.appendChild(element, <_Element>child) + * has_children = 1 # <<<<<<<<<<<<<< + * elif isinstance(child, _ObjectifyElementMakerCaller): + * elementMaker = <_ObjectifyElementMakerCaller>child + */ + __pyx_v_has_children = 1; + goto __pyx_L8; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1202 + * cetree.appendChild(element, <_Element>child) + * has_children = 1 + * elif isinstance(child, _ObjectifyElementMakerCaller): # <<<<<<<<<<<<<< + * elementMaker = <_ObjectifyElementMakerCaller>child + * if elementMaker._element_factory is None: + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v_child, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify__ObjectifyElementMakerCaller))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1203 + * has_children = 1 + * elif isinstance(child, _ObjectifyElementMakerCaller): + * elementMaker = <_ObjectifyElementMakerCaller>child # <<<<<<<<<<<<<< + * if elementMaker._element_factory is None: + * cetree.makeSubElement(element, elementMaker._tag, + */ + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_child))); + __Pyx_DECREF(((PyObject *)__pyx_v_elementMaker)); + __pyx_v_elementMaker = ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_child); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1204 + * elif isinstance(child, _ObjectifyElementMakerCaller): + * elementMaker = <_ObjectifyElementMakerCaller>child + * if elementMaker._element_factory is None: # <<<<<<<<<<<<<< + * cetree.makeSubElement(element, elementMaker._tag, + * None, None, None, None) + */ + __pyx_t_1 = (__pyx_v_elementMaker->_element_factory == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1206 + * if elementMaker._element_factory is None: + * cetree.makeSubElement(element, elementMaker._tag, + * None, None, None, None) # <<<<<<<<<<<<<< + * else: + * childElement = elementMaker._element_factory( + */ + __pyx_t_2 = ((PyObject *)makeSubElement(__pyx_v_element, __pyx_v_elementMaker->_tag, Py_None, Py_None, Py_None, Py_None)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1209 + * else: + * childElement = elementMaker._element_factory( + * elementMaker._tag) # <<<<<<<<<<<<<< + * cetree.appendChild(element, childElement) + * has_children = 1 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_elementMaker->_tag); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_elementMaker->_tag); + __Pyx_GIVEREF(__pyx_v_elementMaker->_tag); + __pyx_t_6 = PyObject_Call(__pyx_v_elementMaker->_element_factory, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_childElement)); + __pyx_v_childElement = ((struct LxmlElement *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1210 + * childElement = elementMaker._element_factory( + * elementMaker._tag) + * cetree.appendChild(element, childElement) # <<<<<<<<<<<<<< + * has_children = 1 + * else: + */ + appendChild(__pyx_v_element, __pyx_v_childElement); + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1211 + * elementMaker._tag) + * cetree.appendChild(element, childElement) + * has_children = 1 # <<<<<<<<<<<<<< + * else: + * if pytype_name is not None: + */ + __pyx_v_has_children = 1; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1213 + * has_children = 1 + * else: + * if pytype_name is not None: # <<<<<<<<<<<<<< + * # concatenation always makes the result a string + * has_string_value = 1 + */ + __pyx_t_1 = (__pyx_v_pytype_name != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1215 + * if pytype_name is not None: + * # concatenation always makes the result a string + * has_string_value = 1 # <<<<<<<<<<<<<< + * pytype_name = _typename(child) + * pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + */ + __pyx_v_has_string_value = 1; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1216 + * # concatenation always makes the result a string + * has_string_value = 1 + * pytype_name = _typename(child) # <<<<<<<<<<<<<< + * pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * if pytype is not NULL: + */ + __pyx_t_6 = __pyx_f_4lxml_9objectify__typename(__pyx_v_child); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_pytype_name); + __pyx_v_pytype_name = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1217 + * has_string_value = 1 + * pytype_name = _typename(child) + * pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) # <<<<<<<<<<<<<< + * if pytype is not NULL: + * _add_text(element, (pytype).stringify(child)) + */ + __pyx_v_pytype = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v_pytype_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1218 + * pytype_name = _typename(child) + * pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * if pytype is not NULL: # <<<<<<<<<<<<<< + * _add_text(element, (pytype).stringify(child)) + * else: + */ + __pyx_t_1 = (__pyx_v_pytype != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1219 + * pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + * if pytype is not NULL: + * _add_text(element, (pytype).stringify(child)) # <<<<<<<<<<<<<< + * else: + * has_string_value = 1 + */ + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_child); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_child); + __Pyx_GIVEREF(__pyx_v_child); + __pyx_t_2 = PyObject_Call(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_pytype)->stringify, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_f_4lxml_9objectify__add_text(__pyx_v_element, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __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_6); __pyx_t_6 = 0; + goto __pyx_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1221 + * _add_text(element, (pytype).stringify(child)) + * else: + * has_string_value = 1 # <<<<<<<<<<<<<< + * child = unicode(child) + * _add_text(element, child) + */ + __pyx_v_has_string_value = 1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1222 + * else: + * has_string_value = 1 + * child = unicode(child) # <<<<<<<<<<<<<< + * _add_text(element, child) + * + */ + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_child); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_child); + __Pyx_GIVEREF(__pyx_v_child); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1223 + * has_string_value = 1 + * child = unicode(child) + * _add_text(element, child) # <<<<<<<<<<<<<< + * + * if self._annotate and not has_children: + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__add_text(__pyx_v_element, __pyx_v_child); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L12:; + } + __pyx_L8:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1225 + * _add_text(element, child) + * + * if self._annotate and not has_children: # <<<<<<<<<<<<<< + * if has_string_value: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, u"str") + */ + if (((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_annotate) { + __pyx_t_1 = (!__pyx_v_has_children); + } else { + __pyx_t_1 = ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_v_self)->_annotate; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1226 + * + * if self._annotate and not has_children: + * if has_string_value: # <<<<<<<<<<<<<< + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, u"str") + * elif pytype_name is not None: + */ + __pyx_t_1 = __pyx_v_has_string_value; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1227 + * if self._annotate and not has_children: + * if has_string_value: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, u"str") # <<<<<<<<<<<<<< + * elif pytype_name is not None: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = setAttributeValue(__pyx_v_element, __pyx_t_3, ((PyObject *)__pyx_n_u_str)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L14; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1228 + * if has_string_value: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, u"str") + * elif pytype_name is not None: # <<<<<<<<<<<<<< + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + * + */ + __pyx_t_1 = (__pyx_v_pytype_name != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1229 + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, u"str") + * elif pytype_name is not None: + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) # <<<<<<<<<<<<<< + * + * return element + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = setAttributeValue(__pyx_v_element, __pyx_t_3, __pyx_v_pytype_name); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L14; + } + __pyx_L14:; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1231 + * cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + * + * return element # <<<<<<<<<<<<<< + * + * cdef _add_text(_Element elem, text): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_element)); + __pyx_r = ((PyObject *)__pyx_v_element); + 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_6); + __Pyx_AddTraceback("lxml.objectify._ObjectifyElementMakerCaller.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_children); + __Pyx_DECREF(__pyx_v_attrib); + __Pyx_DECREF((PyObject *)__pyx_v_elementMaker); + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF((PyObject *)__pyx_v_childElement); + __Pyx_DECREF(__pyx_v_pytype_name); + __Pyx_DECREF(__pyx_v_child); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1233 + * return element + * + * cdef _add_text(_Element elem, text): # <<<<<<<<<<<<<< + * # add text to the tree in construction, either as element text or + * # tail text, depending on the current tree state + */ + +static PyObject *__pyx_f_4lxml_9objectify__add_text(struct LxmlElement *__pyx_v_elem, PyObject *__pyx_v_text) { + xmlNode *__pyx_v_c_child; + PyObject *__pyx_v_old; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("_add_text"); + __Pyx_INCREF((PyObject *)__pyx_v_elem); + __Pyx_INCREF(__pyx_v_text); + __pyx_v_old = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1237 + * # tail text, depending on the current tree state + * cdef tree.xmlNode* c_child + * c_child = cetree.findChildBackwards(elem._c_node, 0) # <<<<<<<<<<<<<< + * if c_child is not NULL: + * old = cetree.tailOf(c_child) + */ + __pyx_v_c_child = findChildBackwards(__pyx_v_elem->_c_node, 0); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1238 + * cdef tree.xmlNode* c_child + * c_child = cetree.findChildBackwards(elem._c_node, 0) + * if c_child is not NULL: # <<<<<<<<<<<<<< + * old = cetree.tailOf(c_child) + * if old is not None: + */ + __pyx_t_1 = (__pyx_v_c_child != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1239 + * c_child = cetree.findChildBackwards(elem._c_node, 0) + * if c_child is not NULL: + * old = cetree.tailOf(c_child) # <<<<<<<<<<<<<< + * if old is not None: + * text = old + text + */ + __pyx_t_2 = tailOf(__pyx_v_c_child); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_old); + __pyx_v_old = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1240 + * if c_child is not NULL: + * old = cetree.tailOf(c_child) + * if old is not None: # <<<<<<<<<<<<<< + * text = old + text + * cetree.setTailText(c_child, text) + */ + __pyx_t_1 = (__pyx_v_old != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1241 + * old = cetree.tailOf(c_child) + * if old is not None: + * text = old + text # <<<<<<<<<<<<<< + * cetree.setTailText(c_child, text) + * else: + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_old, __pyx_v_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __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_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1242 + * if old is not None: + * text = old + text + * cetree.setTailText(c_child, text) # <<<<<<<<<<<<<< + * else: + * old = cetree.textOf(elem._c_node) + */ + __pyx_t_3 = setTailText(__pyx_v_c_child, __pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1244 + * cetree.setTailText(c_child, text) + * else: + * old = cetree.textOf(elem._c_node) # <<<<<<<<<<<<<< + * if old is not None: + * text = old + text + */ + __pyx_t_2 = textOf(__pyx_v_elem->_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_old); + __pyx_v_old = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1245 + * else: + * old = cetree.textOf(elem._c_node) + * if old is not None: # <<<<<<<<<<<<<< + * text = old + text + * cetree.setNodeText(elem._c_node, text) + */ + __pyx_t_1 = (__pyx_v_old != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1246 + * old = cetree.textOf(elem._c_node) + * if old is not None: + * text = old + text # <<<<<<<<<<<<<< + * cetree.setNodeText(elem._c_node, text) + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_old, __pyx_v_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __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:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1247 + * if old is not None: + * text = old + text + * cetree.setNodeText(elem._c_node, text) # <<<<<<<<<<<<<< + * + * cdef extern from "etree_defs.h": + */ + __pyx_t_3 = setNodeText(__pyx_v_elem->_c_node, __pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __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.objectify._add_text"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_old); + __Pyx_DECREF((PyObject *)__pyx_v_elem); + __Pyx_DECREF(__pyx_v_text); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1273 + * cdef object _nsmap + * cdef bint _annotate + * def __init__(self, *, namespace=None, nsmap=None, annotate=True, # <<<<<<<<<<<<<< + * makeelement=None): + * if nsmap is None: + */ + +static int __pyx_pf_4lxml_9objectify_12ElementMaker___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_9objectify_12ElementMaker___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_namespace = 0; + PyObject *__pyx_v_nsmap = 0; + PyObject *__pyx_v_annotate = 0; + PyObject *__pyx_v_makeelement = 0; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_namespace,&__pyx_n_ui_nsmap,&__pyx_n_ui_annotate,&__pyx_n_ui_makeelement,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1274 + * cdef bint _annotate + * def __init__(self, *, namespace=None, nsmap=None, annotate=True, + * makeelement=None): # <<<<<<<<<<<<<< + * if nsmap is None: + * if annotate: + */ + 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] = __pyx_k_22; + values[3] = ((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_ui_namespace); + if (value) { values[0] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_nsmap); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_annotate); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_makeelement); + 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, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_namespace = values[0]; + __pyx_v_nsmap = values[1]; + __pyx_v_annotate = values[2]; + __pyx_v_makeelement = values[3]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 0) { + goto __pyx_L5_argtuple_error; + } else { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1273 + * cdef object _nsmap + * cdef bint _annotate + * def __init__(self, *, namespace=None, nsmap=None, annotate=True, # <<<<<<<<<<<<<< + * makeelement=None): + * if nsmap is None: + */ + __pyx_v_namespace = ((PyObject *)Py_None); + __pyx_v_nsmap = ((PyObject *)Py_None); + __pyx_v_annotate = __pyx_k_22; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1274 + * cdef bint _annotate + * def __init__(self, *, namespace=None, nsmap=None, annotate=True, + * makeelement=None): # <<<<<<<<<<<<<< + * if nsmap is None: + * if annotate: + */ + __pyx_v_makeelement = ((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[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ElementMaker.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_namespace); + __Pyx_INCREF(__pyx_v_nsmap); + __Pyx_INCREF(__pyx_v_annotate); + __Pyx_INCREF(__pyx_v_makeelement); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1275 + * def __init__(self, *, namespace=None, nsmap=None, annotate=True, + * makeelement=None): + * if nsmap is None: # <<<<<<<<<<<<<< + * if annotate: + * nsmap = _DEFAULT_NSMAP + */ + __pyx_t_1 = (__pyx_v_nsmap == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1276 + * makeelement=None): + * if nsmap is None: + * if annotate: # <<<<<<<<<<<<<< + * nsmap = _DEFAULT_NSMAP + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_annotate); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1277 + * if nsmap is None: + * if annotate: + * nsmap = _DEFAULT_NSMAP # <<<<<<<<<<<<<< + * else: + * nsmap = {} + */ + __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + __Pyx_DECREF(__pyx_v_nsmap); + __pyx_v_nsmap = ((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1279 + * nsmap = _DEFAULT_NSMAP + * else: + * nsmap = {} # <<<<<<<<<<<<<< + * self._nsmap = nsmap + * if namespace is None: + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_v_nsmap); + __pyx_v_nsmap = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1280 + * else: + * nsmap = {} + * self._nsmap = nsmap # <<<<<<<<<<<<<< + * if namespace is None: + * self._namespace = None + */ + __Pyx_INCREF(__pyx_v_nsmap); + __Pyx_GIVEREF(__pyx_v_nsmap); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_nsmap); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_nsmap); + ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_nsmap = __pyx_v_nsmap; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1281 + * nsmap = {} + * self._nsmap = nsmap + * if namespace is None: # <<<<<<<<<<<<<< + * self._namespace = None + * else: + */ + __pyx_t_1 = (__pyx_v_namespace == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1282 + * self._nsmap = nsmap + * if namespace is None: + * self._namespace = None # <<<<<<<<<<<<<< + * else: + * self._namespace = u"{%s}" % namespace + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace); + ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace = Py_None; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1284 + * self._namespace = None + * else: + * self._namespace = u"{%s}" % namespace # <<<<<<<<<<<<<< + * self._annotate = annotate + * if makeelement is not None: + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_23), __pyx_v_namespace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace); + ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1285 + * else: + * self._namespace = u"{%s}" % namespace + * self._annotate = annotate # <<<<<<<<<<<<<< + * if makeelement is not None: + * assert callable(makeelement) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_annotate); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_annotate = __pyx_t_1; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1286 + * self._namespace = u"{%s}" % namespace + * self._annotate = annotate + * if makeelement is not None: # <<<<<<<<<<<<<< + * assert callable(makeelement) + * self._makeelement = makeelement + */ + __pyx_t_1 = (__pyx_v_makeelement != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1287 + * self._annotate = annotate + * if makeelement is not None: + * assert callable(makeelement) # <<<<<<<<<<<<<< + * self._makeelement = makeelement + * else: + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + if (unlikely(!PyCallable_Check(__pyx_v_makeelement))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1288 + * if makeelement is not None: + * assert callable(makeelement) + * self._makeelement = makeelement # <<<<<<<<<<<<<< + * else: + * self._makeelement = None + */ + __Pyx_INCREF(__pyx_v_makeelement); + __Pyx_GIVEREF(__pyx_v_makeelement); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement); + ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement = __pyx_v_makeelement; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1290 + * self._makeelement = makeelement + * else: + * self._makeelement = None # <<<<<<<<<<<<<< + * + * def __getattr__(self, tag): + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement); + ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement = Py_None; + } + __pyx_L9:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("lxml.objectify.ElementMaker.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_namespace); + __Pyx_DECREF(__pyx_v_nsmap); + __Pyx_DECREF(__pyx_v_annotate); + __Pyx_DECREF(__pyx_v_makeelement); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1292 + * self._makeelement = None + * + * def __getattr__(self, tag): # <<<<<<<<<<<<<< + * cdef _ObjectifyElementMakerCaller element_maker + * if is_special_method(tag): + */ + +static PyObject *__pyx_pf_4lxml_9objectify_12ElementMaker___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_12ElementMaker___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) { + struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *__pyx_v_element_maker; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + __Pyx_SetupRefcountContext("__getattr__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_tag); + __pyx_v_element_maker = ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1294 + * def __getattr__(self, tag): + * cdef _ObjectifyElementMakerCaller element_maker + * if is_special_method(tag): # <<<<<<<<<<<<<< + * return object.__getattr__(self, tag) + * if self._namespace is not None and tag[0] != u"{": + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __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_4lxml_9objectify_is_special_method, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __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 = 1294; __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-2.2/src/lxml/lxml.objectify.pyx":1295 + * cdef _ObjectifyElementMakerCaller element_maker + * if is_special_method(tag): + * return object.__getattr__(self, tag) # <<<<<<<<<<<<<< + * if self._namespace is not None and tag[0] != u"{": + * tag = self._namespace + tag + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_builtin_object, __pyx_n_ui___getattr__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __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 = 1295; __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_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __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; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1296 + * if is_special_method(tag): + * return object.__getattr__(self, tag) + * if self._namespace is not None and tag[0] != u"{": # <<<<<<<<<<<<<< + * tag = self._namespace + tag + * element_maker = NEW_ELEMENT_MAKER(_ObjectifyElementMakerCaller) + */ + __pyx_t_3 = (((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace != Py_None); + if (__pyx_t_3) { + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_tag, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_u_24), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __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 = 1296; __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; + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1297 + * return object.__getattr__(self, tag) + * if self._namespace is not None and tag[0] != u"{": + * tag = self._namespace + tag # <<<<<<<<<<<<<< + * element_maker = NEW_ELEMENT_MAKER(_ObjectifyElementMakerCaller) + * element_maker._tag = tag + */ + __pyx_t_1 = PyNumber_Add(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_namespace, __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1298 + * if self._namespace is not None and tag[0] != u"{": + * tag = self._namespace + tag + * element_maker = NEW_ELEMENT_MAKER(_ObjectifyElementMakerCaller) # <<<<<<<<<<<<<< + * element_maker._tag = tag + * element_maker._nsmap = self._nsmap + */ + __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify__ObjectifyElementMakerCaller)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_element_maker)); + __pyx_v_element_maker = ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1299 + * tag = self._namespace + tag + * element_maker = NEW_ELEMENT_MAKER(_ObjectifyElementMakerCaller) + * element_maker._tag = tag # <<<<<<<<<<<<<< + * element_maker._nsmap = self._nsmap + * element_maker._annotate = self._annotate + */ + __Pyx_INCREF(__pyx_v_tag); + __Pyx_GIVEREF(__pyx_v_tag); + __Pyx_GOTREF(__pyx_v_element_maker->_tag); + __Pyx_DECREF(__pyx_v_element_maker->_tag); + __pyx_v_element_maker->_tag = __pyx_v_tag; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1300 + * element_maker = NEW_ELEMENT_MAKER(_ObjectifyElementMakerCaller) + * element_maker._tag = tag + * element_maker._nsmap = self._nsmap # <<<<<<<<<<<<<< + * element_maker._annotate = self._annotate + * element_maker._element_factory = self._makeelement + */ + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_nsmap); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_nsmap); + __Pyx_GOTREF(__pyx_v_element_maker->_nsmap); + __Pyx_DECREF(__pyx_v_element_maker->_nsmap); + __pyx_v_element_maker->_nsmap = ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_nsmap; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1301 + * element_maker._tag = tag + * element_maker._nsmap = self._nsmap + * element_maker._annotate = self._annotate # <<<<<<<<<<<<<< + * element_maker._element_factory = self._makeelement + * return element_maker + */ + __pyx_v_element_maker->_annotate = ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_annotate; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1302 + * element_maker._nsmap = self._nsmap + * element_maker._annotate = self._annotate + * element_maker._element_factory = self._makeelement # <<<<<<<<<<<<<< + * return element_maker + * + */ + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement); + __Pyx_GIVEREF(((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement); + __Pyx_GOTREF(__pyx_v_element_maker->_element_factory); + __Pyx_DECREF(__pyx_v_element_maker->_element_factory); + __pyx_v_element_maker->_element_factory = ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)__pyx_v_self)->_makeelement; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1303 + * element_maker._annotate = self._annotate + * element_maker._element_factory = self._makeelement + * return element_maker # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_element_maker)); + __pyx_r = ((PyObject *)__pyx_v_element_maker); + 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.objectify.ElementMaker.__getattr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element_maker); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1311 + * __RECURSIVE_STR = 0 # default: off + * + * def enable_recursive_str(on=True): # <<<<<<<<<<<<<< + * u"""enable_recursive_str(on=True) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_enable_recursive_str(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_enable_recursive_str[] = "enable_recursive_str(on=True)\n\n Enable a recursively generated tree representation for str(element),\n based on objectify.dump(element).\n "; +static PyObject *__pyx_pf_4lxml_9objectify_enable_recursive_str(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_on = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_on,0}; + __Pyx_SetupRefcountContext("enable_recursive_str"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = __pyx_k_25; + 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_ui_on); + if (unlikely(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), "enable_recursive_str") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_on = values[0]; + } else { + __pyx_v_on = __pyx_k_25; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: __pyx_v_on = 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("enable_recursive_str", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.enable_recursive_str"); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1318 + * """ + * global __RECURSIVE_STR + * __RECURSIVE_STR = on # <<<<<<<<<<<<<< + * + * def dump(_Element element not None): + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_on); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_4lxml_9objectify___RECURSIVE_STR = __pyx_t_1; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("lxml.objectify.enable_recursive_str"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1320 + * __RECURSIVE_STR = on + * + * def dump(_Element element not None): # <<<<<<<<<<<<<< + * u"""dump(_Element element not None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_dump(PyObject *__pyx_self, PyObject *__pyx_v_element); /*proto*/ +static char __pyx_doc_4lxml_9objectify_dump[] = "dump(_Element element not None)\n\n Return a recursively generated string representation of an element.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_dump(PyObject *__pyx_self, PyObject *__pyx_v_element) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("dump"); + __pyx_self = __pyx_self; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_11etreepublic__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1325 + * Return a recursively generated string representation of an element. + * """ + * return _dump(element, 0) # <<<<<<<<<<<<<< + * + * cdef object _dump(_Element element, int indent): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_4lxml_9objectify__dump(((struct LxmlElement *)__pyx_v_element), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __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.objectify.dump"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1327 + * return _dump(element, 0) + * + * cdef object _dump(_Element element, int indent): # <<<<<<<<<<<<<< + * indentstr = u" " * indent + * if isinstance(element, ObjectifiedDataElement): + */ + +static PyObject *__pyx_f_4lxml_9objectify__dump(struct LxmlElement *__pyx_v_element, int __pyx_v_indent) { + PyObject *__pyx_v_indentstr; + PyObject *__pyx_v_value; + PyObject *__pyx_v_result; + PyObject *__pyx_v_xsi_ns; + PyObject *__pyx_v_pytype_ns; + PyObject *__pyx_v_name; + PyObject *__pyx_v_child; + 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; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_SetupRefcountContext("_dump"); + __Pyx_INCREF((PyObject *)__pyx_v_element); + __pyx_v_indentstr = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_xsi_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_child = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1328 + * + * cdef object _dump(_Element element, int indent): + * indentstr = u" " * indent # <<<<<<<<<<<<<< + * if isinstance(element, ObjectifiedDataElement): + * value = repr(element) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_indent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_u_26), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __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_indentstr); + __pyx_v_indentstr = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1329 + * cdef object _dump(_Element element, int indent): + * indentstr = u" " * indent + * if isinstance(element, ObjectifiedDataElement): # <<<<<<<<<<<<<< + * value = repr(element) + * else: + */ + __pyx_t_3 = PyObject_TypeCheck(((PyObject *)__pyx_v_element), ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedDataElement))); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1330 + * indentstr = u" " * indent + * if isinstance(element, ObjectifiedDataElement): + * value = repr(element) # <<<<<<<<<<<<<< + * else: + * value = textOf(element._c_node) + */ + __pyx_t_2 = PyObject_Repr(((PyObject *)__pyx_v_element)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __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; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1332 + * value = repr(element) + * else: + * value = textOf(element._c_node) # <<<<<<<<<<<<<< + * if value is not None: + * if not value.strip(): + */ + __pyx_t_2 = textOf(__pyx_v_element->_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __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-2.2/src/lxml/lxml.objectify.pyx":1333 + * else: + * value = textOf(element._c_node) + * if value is not None: # <<<<<<<<<<<<<< + * if not value.strip(): + * value = None + */ + __pyx_t_3 = (__pyx_v_value != Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1334 + * value = textOf(element._c_node) + * if value is not None: + * if not value.strip(): # <<<<<<<<<<<<<< + * value = None + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_value, __pyx_n_ui_strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __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[0]; __pyx_lineno = 1334; __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[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1335 + * if value is not None: + * if not value.strip(): + * value = None # <<<<<<<<<<<<<< + * else: + * value = repr(value) + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = Py_None; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1337 + * value = None + * else: + * value = repr(value) # <<<<<<<<<<<<<< + * result = u"%s%s = %s [%s]\n" % (indentstr, element.tag, + * value, _typename(element)) + */ + __pyx_t_1 = PyObject_Repr(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __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_L5:; + goto __pyx_L4; + } + __pyx_L4:; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1338 + * else: + * value = repr(value) + * result = u"%s%s = %s [%s]\n" % (indentstr, element.tag, # <<<<<<<<<<<<<< + * value, _typename(element)) + * xsi_ns = u"{%s}" % XML_SCHEMA_INSTANCE_NS + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_ui_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1339 + * value = repr(value) + * result = u"%s%s = %s [%s]\n" % (indentstr, element.tag, + * value, _typename(element)) # <<<<<<<<<<<<<< + * xsi_ns = u"{%s}" % XML_SCHEMA_INSTANCE_NS + * pytype_ns = u"{%s}" % PYTYPE_NAMESPACE + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__typename(((PyObject *)__pyx_v_element)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_indentstr); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_indentstr); + __Pyx_GIVEREF(__pyx_v_indentstr); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_27), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1340 + * result = u"%s%s = %s [%s]\n" % (indentstr, element.tag, + * value, _typename(element)) + * xsi_ns = u"{%s}" % XML_SCHEMA_INSTANCE_NS # <<<<<<<<<<<<<< + * pytype_ns = u"{%s}" % PYTYPE_NAMESPACE + * for name, value in cetree.iterattributes(element, 3): + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_23), __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_xsi_ns); + __pyx_v_xsi_ns = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1341 + * value, _typename(element)) + * xsi_ns = u"{%s}" % XML_SCHEMA_INSTANCE_NS + * pytype_ns = u"{%s}" % PYTYPE_NAMESPACE # <<<<<<<<<<<<<< + * for name, value in cetree.iterattributes(element, 3): + * if u'{' in name: + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_23), __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_pytype_ns); + __pyx_v_pytype_ns = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1342 + * xsi_ns = u"{%s}" % XML_SCHEMA_INSTANCE_NS + * pytype_ns = u"{%s}" % PYTYPE_NAMESPACE + * for name, value in cetree.iterattributes(element, 3): # <<<<<<<<<<<<<< + * if u'{' in name: + * if name == PYTYPE_ATTRIBUTE: + */ + __pyx_t_2 = iterattributes(__pyx_v_element, 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __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_6 = 0; __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __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_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __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_name); + __pyx_v_name = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __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 = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_7; + __pyx_t_7 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1343 + * pytype_ns = u"{%s}" % PYTYPE_NAMESPACE + * for name, value in cetree.iterattributes(element, 3): + * if u'{' in name: # <<<<<<<<<<<<<< + * if name == PYTYPE_ATTRIBUTE: + * if value == TREE_PYTYPE_NAME: + */ + __pyx_t_4 = (PySequence_Contains(__pyx_v_name, ((PyObject *)__pyx_kp_u_24))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1344 + * for name, value in cetree.iterattributes(element, 3): + * if u'{' in name: + * if name == PYTYPE_ATTRIBUTE: # <<<<<<<<<<<<<< + * if value == TREE_PYTYPE_NAME: + * continue + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_name, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1345 + * if u'{' in name: + * if name == PYTYPE_ATTRIBUTE: + * if value == TREE_PYTYPE_NAME: # <<<<<<<<<<<<<< + * continue + * else: + */ + __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1346 + * if name == PYTYPE_ATTRIBUTE: + * if value == TREE_PYTYPE_NAME: + * continue # <<<<<<<<<<<<<< + * else: + * name = name.replace(pytype_ns, u'py:') + */ + goto __pyx_L6_continue; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1348 + * continue + * else: + * name = name.replace(pytype_ns, u'py:') # <<<<<<<<<<<<<< + * name = name.replace(xsi_ns, u'xsi:') + * result = result + u"%s * %s = %r\n" % (indentstr, name, value) + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_name, __pyx_n_ui_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_pytype_ns); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pytype_ns); + __Pyx_GIVEREF(__pyx_v_pytype_ns); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_28)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_u_28)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_28)); + __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L10:; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1349 + * else: + * name = name.replace(pytype_ns, u'py:') + * name = name.replace(xsi_ns, u'xsi:') # <<<<<<<<<<<<<< + * result = result + u"%s * %s = %r\n" % (indentstr, name, value) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_name, __pyx_n_ui_replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __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[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_xsi_ns); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xsi_ns); + __Pyx_GIVEREF(__pyx_v_xsi_ns); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_29)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_u_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_29)); + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __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_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1350 + * name = name.replace(pytype_ns, u'py:') + * name = name.replace(xsi_ns, u'xsi:') + * result = result + u"%s * %s = %r\n" % (indentstr, name, value) # <<<<<<<<<<<<<< + * + * indent = indent + 1 + */ + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_indentstr); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_indentstr); + __Pyx_GIVEREF(__pyx_v_indentstr); + __Pyx_INCREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_30), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L6_continue:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1352 + * result = result + u"%s * %s = %r\n" % (indentstr, name, value) + * + * indent = indent + 1 # <<<<<<<<<<<<<< + * for child in element.iterchildren(): + * result = result + _dump(child, indent) + */ + __pyx_v_indent = (__pyx_v_indent + 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1353 + * + * indent = indent + 1 + * for child in element.iterchildren(): # <<<<<<<<<<<<<< + * result = result + _dump(child, indent) + * if indent == 1: + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_element), __pyx_n_ui_iterchildren); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_7; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; + } else { + __pyx_t_7 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_7) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1354 + * indent = indent + 1 + * for child in element.iterchildren(): + * result = result + _dump(child, indent) # <<<<<<<<<<<<<< + * if indent == 1: + * return result[:-1] # strip last '\n' + */ + if (!(__Pyx_TypeTest(__pyx_v_child, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_f_4lxml_9objectify__dump(((struct LxmlElement *)__pyx_v_child), __pyx_v_indent); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyNumber_Add(__pyx_v_result, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1355 + * for child in element.iterchildren(): + * result = result + _dump(child, indent) + * if indent == 1: # <<<<<<<<<<<<<< + * return result[:-1] # strip last '\n' + * else: + */ + __pyx_t_4 = (__pyx_v_indent == 1); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1356 + * result = result + _dump(child, indent) + * if indent == 1: + * return result[:-1] # strip last '\n' # <<<<<<<<<<<<<< + * else: + * return result + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PySequence_GetSlice(__pyx_v_result, 0, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __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_L13; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1358 + * return result[:-1] # strip last '\n' + * else: + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + 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_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("lxml.objectify._dump"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_indentstr); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_xsi_ns); + __Pyx_DECREF(__pyx_v_pytype_ns); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_child); + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1364 + * # Pickle support + * + * def __unpickleElementTree(data): # <<<<<<<<<<<<<< + * return etree.ElementTree(fromstring(data)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify___unpickleElementTree(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify___unpickleElementTree(PyObject *__pyx_self, PyObject *__pyx_v_data) { + 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_SetupRefcountContext("__unpickleElementTree"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1365 + * + * def __unpickleElementTree(data): + * return etree.ElementTree(fromstring(data)) # <<<<<<<<<<<<<< + * + * cdef _setupPickle(elementReduceFunction, elementTreeReduceFunction): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_ElementTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_ui_fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __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[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_3, 0, __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[0]; __pyx_lineno = 1365; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __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_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __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_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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("lxml.objectify.__unpickleElementTree"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1367 + * return etree.ElementTree(fromstring(data)) + * + * cdef _setupPickle(elementReduceFunction, elementTreeReduceFunction): # <<<<<<<<<<<<<< + * if python.IS_PYTHON3: + * import copyreg + */ + +static PyObject *__pyx_f_4lxml_9objectify__setupPickle(PyObject *__pyx_v_elementReduceFunction, PyObject *__pyx_v_elementTreeReduceFunction) { + PyObject *__pyx_v_copyreg; + 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_SetupRefcountContext("_setupPickle"); + __Pyx_INCREF(__pyx_v_elementReduceFunction); + __Pyx_INCREF(__pyx_v_elementTreeReduceFunction); + __pyx_v_copyreg = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1368 + * + * cdef _setupPickle(elementReduceFunction, elementTreeReduceFunction): + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * import copyreg + * else: + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1369 + * cdef _setupPickle(elementReduceFunction, elementTreeReduceFunction): + * if python.IS_PYTHON3: + * import copyreg # <<<<<<<<<<<<<< + * else: + * import copy_reg as copyreg + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_ui_copyreg, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_copyreg); + __pyx_v_copyreg = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1371 + * import copyreg + * else: + * import copy_reg as copyreg # <<<<<<<<<<<<<< + * copyreg.constructor(fromstring) + * copyreg.constructor(__unpickleElementTree) + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_ui_copy_reg, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_copyreg); + __pyx_v_copyreg = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1372 + * else: + * import copy_reg as copyreg + * copyreg.constructor(fromstring) # <<<<<<<<<<<<<< + * copyreg.constructor(__unpickleElementTree) + * copyreg.pickle(ObjectifiedElement, + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_copyreg, __pyx_n_ui_constructor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_ui_fromstring); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __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[0]; __pyx_lineno = 1372; __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(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1373 + * import copy_reg as copyreg + * copyreg.constructor(fromstring) + * copyreg.constructor(__unpickleElementTree) # <<<<<<<<<<<<<< + * copyreg.pickle(ObjectifiedElement, + * elementReduceFunction, fromstring) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_copyreg, __pyx_n_ui_constructor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_ui_31); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __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_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1374 + * copyreg.constructor(fromstring) + * copyreg.constructor(__unpickleElementTree) + * copyreg.pickle(ObjectifiedElement, # <<<<<<<<<<<<<< + * elementReduceFunction, fromstring) + * copyreg.pickle(etree._ElementTree, + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_copyreg, __pyx_n_ui_pickle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1375 + * copyreg.constructor(__unpickleElementTree) + * copyreg.pickle(ObjectifiedElement, + * elementReduceFunction, fromstring) # <<<<<<<<<<<<<< + * copyreg.pickle(etree._ElementTree, + * elementTreeReduceFunction, __unpickleElementTree) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_ui_fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __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 = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + __Pyx_INCREF(__pyx_v_elementReduceFunction); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_elementReduceFunction); + __Pyx_GIVEREF(__pyx_v_elementReduceFunction); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), 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(__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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1376 + * copyreg.pickle(ObjectifiedElement, + * elementReduceFunction, fromstring) + * copyreg.pickle(etree._ElementTree, # <<<<<<<<<<<<<< + * elementTreeReduceFunction, __unpickleElementTree) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_copyreg, __pyx_n_ui_pickle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui__ElementTree); 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); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1377 + * elementReduceFunction, fromstring) + * copyreg.pickle(etree._ElementTree, + * elementTreeReduceFunction, __unpickleElementTree) # <<<<<<<<<<<<<< + * + * def pickleReduceElement(obj): + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_ui_31); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_elementTreeReduceFunction); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_elementTreeReduceFunction); + __Pyx_GIVEREF(__pyx_v_elementTreeReduceFunction); + PyTuple_SET_ITEM(__pyx_t_5, 2, __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[0]; __pyx_lineno = 1376; __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_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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.objectify._setupPickle"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_copyreg); + __Pyx_DECREF(__pyx_v_elementReduceFunction); + __Pyx_DECREF(__pyx_v_elementTreeReduceFunction); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1379 + * elementTreeReduceFunction, __unpickleElementTree) + * + * def pickleReduceElement(obj): # <<<<<<<<<<<<<< + * return (fromstring, (etree.tostring(obj),)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_pickleReduceElement(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_pickleReduceElement(PyObject *__pyx_self, PyObject *__pyx_v_obj) { + 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_SetupRefcountContext("pickleReduceElement"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1380 + * + * def pickleReduceElement(obj): + * return (fromstring, (etree.tostring(obj),)) # <<<<<<<<<<<<<< + * + * def pickleReduceElementTree(obj): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_ui_fromstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_tostring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __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[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_obj); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __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 = 1380; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __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, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = 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.objectify.pickleReduceElement"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1382 + * return (fromstring, (etree.tostring(obj),)) + * + * def pickleReduceElementTree(obj): # <<<<<<<<<<<<<< + * return (__unpickleElementTree, (etree.tostring(obj),)) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_pickleReduceElementTree(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_pickleReduceElementTree(PyObject *__pyx_self, PyObject *__pyx_v_obj) { + 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_SetupRefcountContext("pickleReduceElementTree"); + __pyx_self = __pyx_self; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1383 + * + * def pickleReduceElementTree(obj): + * return (__unpickleElementTree, (etree.tostring(obj),)) # <<<<<<<<<<<<<< + * + * _setupPickle(pickleReduceElement, pickleReduceElementTree) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_ui_31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_tostring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __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[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_obj); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __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 = 1383; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __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, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = 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.objectify.pickleReduceElementTree"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1397 + * cdef object empty_data_class + * cdef object tree_class + * def __init__(self, tree_class=None, empty_data_class=None): # <<<<<<<<<<<<<< + * u"""Lookup mechanism for objectify. + * + */ + +static int __pyx_pf_4lxml_9objectify_27ObjectifyElementClassLookup___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_27ObjectifyElementClassLookup___init__[] = "Lookup mechanism for objectify.\n\n The default Element classes can be replaced by passing subclasses of\n ObjectifiedElement and ObjectifiedDataElement as keyword arguments.\n 'tree_class' defines inner tree classes (defaults to\n ObjectifiedElement), 'empty_data_class' defines the default class for\n empty data elements (defauls to StringElement).\n "; +static int __pyx_pf_4lxml_9objectify_27ObjectifyElementClassLookup___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_tree_class = 0; + PyObject *__pyx_v_empty_data_class = 0; + int __pyx_r; + int __pyx_t_1; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_tree_class,&__pyx_n_ui_empty_data_class,0}; + __Pyx_SetupRefcountContext("__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 > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_tree_class); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_empty_data_class); + if (unlikely(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 = 1397; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tree_class = values[0]; + __pyx_v_empty_data_class = values[1]; + } else { + __pyx_v_tree_class = ((PyObject *)Py_None); + __pyx_v_empty_data_class = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_empty_data_class = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_tree_class = 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[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectifyElementClassLookup.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_tree_class); + __Pyx_INCREF(__pyx_v_empty_data_class); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1406 + * empty data elements (defauls to StringElement). + * """ + * self._lookup_function = _lookupElementClass # <<<<<<<<<<<<<< + * if tree_class is None: + * tree_class = ObjectifiedElement + */ + ((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->__pyx_base._lookup_function = __pyx_f_4lxml_9objectify__lookupElementClass; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1407 + * """ + * self._lookup_function = _lookupElementClass + * if tree_class is None: # <<<<<<<<<<<<<< + * tree_class = ObjectifiedElement + * self.tree_class = tree_class + */ + __pyx_t_1 = (__pyx_v_tree_class == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1408 + * self._lookup_function = _lookupElementClass + * if tree_class is None: + * tree_class = ObjectifiedElement # <<<<<<<<<<<<<< + * self.tree_class = tree_class + * if empty_data_class is None: + */ + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + __Pyx_DECREF(__pyx_v_tree_class); + __pyx_v_tree_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement)); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1409 + * if tree_class is None: + * tree_class = ObjectifiedElement + * self.tree_class = tree_class # <<<<<<<<<<<<<< + * if empty_data_class is None: + * empty_data_class = StringElement + */ + __Pyx_INCREF(__pyx_v_tree_class); + __Pyx_GIVEREF(__pyx_v_tree_class); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->tree_class); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->tree_class); + ((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->tree_class = __pyx_v_tree_class; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1410 + * tree_class = ObjectifiedElement + * self.tree_class = tree_class + * if empty_data_class is None: # <<<<<<<<<<<<<< + * empty_data_class = StringElement + * self.empty_data_class = empty_data_class + */ + __pyx_t_1 = (__pyx_v_empty_data_class == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1411 + * self.tree_class = tree_class + * if empty_data_class is None: + * empty_data_class = StringElement # <<<<<<<<<<<<<< + * self.empty_data_class = empty_data_class + * + */ + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement))); + __Pyx_DECREF(__pyx_v_empty_data_class); + __pyx_v_empty_data_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_StringElement)); + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1412 + * if empty_data_class is None: + * empty_data_class = StringElement + * self.empty_data_class = empty_data_class # <<<<<<<<<<<<<< + * + * cdef object _lookupElementClass(state, _Document doc, tree.xmlNode* c_node): + */ + __Pyx_INCREF(__pyx_v_empty_data_class); + __Pyx_GIVEREF(__pyx_v_empty_data_class); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->empty_data_class); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->empty_data_class); + ((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_self)->empty_data_class = __pyx_v_empty_data_class; + + __pyx_r = 0; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_tree_class); + __Pyx_DECREF(__pyx_v_empty_data_class); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1414 + * self.empty_data_class = empty_data_class + * + * cdef object _lookupElementClass(state, _Document doc, tree.xmlNode* c_node): # <<<<<<<<<<<<<< + * cdef ObjectifyElementClassLookup lookup + * cdef python.PyObject* dict_result + */ + +static PyObject *__pyx_f_4lxml_9objectify__lookupElementClass(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) { + struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *__pyx_v_lookup; + PyObject *__pyx_v_dict_result; + PyObject *__pyx_v_value; + PyObject *__pyx_v_prefix; + PyObject *__pyx_v_el_class; + 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_SetupRefcountContext("_lookupElementClass"); + __Pyx_INCREF(__pyx_v_state); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __pyx_v_lookup = ((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_el_class = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1417 + * cdef ObjectifyElementClassLookup lookup + * cdef python.PyObject* dict_result + * lookup = state # <<<<<<<<<<<<<< + * # if element has children => no data class + * if cetree.hasChild(c_node): + */ + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_state))); + __Pyx_DECREF(((PyObject *)__pyx_v_lookup)); + __pyx_v_lookup = ((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)__pyx_v_state); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1419 + * lookup = state + * # if element has children => no data class + * if cetree.hasChild(c_node): # <<<<<<<<<<<<<< + * return lookup.tree_class + * + */ + __pyx_t_1 = hasChild(__pyx_v_c_node); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1420 + * # if element has children => no data class + * if cetree.hasChild(c_node): + * return lookup.tree_class # <<<<<<<<<<<<<< + * + * # if element is defined as xsi:nil, return NoneElement class + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_lookup->tree_class); + __pyx_r = __pyx_v_lookup->tree_class; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1424 + * # if element is defined as xsi:nil, return NoneElement class + * if u"true" == cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "nil"): # <<<<<<<<<<<<<< + * return NoneElement + * + */ + __pyx_t_2 = attributeValueFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_nil); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_n_u_true), __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1425 + * if u"true" == cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "nil"): + * return NoneElement # <<<<<<<<<<<<<< + * + * # check for Python type hint + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement))); + __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_NoneElement)); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1429 + * # check for Python type hint + * value = cetree.attributeValueFromNsName( + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) # <<<<<<<<<<<<<< + * if value is not None: + * if value == TREE_PYTYPE_NAME: + */ + __pyx_t_3 = attributeValueFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE, __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __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-2.2/src/lxml/lxml.objectify.pyx":1430 + * value = cetree.attributeValueFromNsName( + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + * if value is not None: # <<<<<<<<<<<<<< + * if value == TREE_PYTYPE_NAME: + * return lookup.tree_class + */ + __pyx_t_1 = (__pyx_v_value != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1431 + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + * if value is not None: + * if value == TREE_PYTYPE_NAME: # <<<<<<<<<<<<<< + * return lookup.tree_class + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, value) + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1432 + * if value is not None: + * if value == TREE_PYTYPE_NAME: + * return lookup.tree_class # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, value) + * if dict_result is not NULL: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_lookup->tree_class); + __pyx_r = __pyx_v_lookup->tree_class; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1433 + * if value == TREE_PYTYPE_NAME: + * return lookup.tree_class + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, value) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * return (dict_result)._type + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1434 + * return lookup.tree_class + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, value) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * return (dict_result)._type + * # unknown 'pyval' => try to figure it out ourself, just go on + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1435 + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, value) + * if dict_result is not NULL: + * return (dict_result)._type # <<<<<<<<<<<<<< + * # unknown 'pyval' => try to figure it out ourself, just go on + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->_type); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->_type; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1440 + * # check for XML Schema type hint + * value = cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "type") # <<<<<<<<<<<<<< + * + * if value is not None: + */ + __pyx_t_3 = attributeValueFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __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-2.2/src/lxml/lxml.objectify.pyx":1442 + * c_node, _XML_SCHEMA_INSTANCE_NS, "type") + * + * if value is not None: # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + * if dict_result is NULL and u':' in value: + */ + __pyx_t_1 = (__pyx_v_value != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1443 + * + * if value is not None: + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) # <<<<<<<<<<<<<< + * if dict_result is NULL and u':' in value: + * prefix, value = value.split(u':', 1) + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_value); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1444 + * if value is not None: + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + * if dict_result is NULL and u':' in value: # <<<<<<<<<<<<<< + * prefix, value = value.split(u':', 1) + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + */ + if ((__pyx_v_dict_result == NULL)) { + __pyx_t_1 = (PySequence_Contains(__pyx_v_value, ((PyObject *)__pyx_kp_u_32))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_t_1; + } else { + __pyx_t_4 = (__pyx_v_dict_result == NULL); + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1445 + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + * if dict_result is NULL and u':' in value: + * prefix, value = value.split(u':', 1) # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + * if dict_result is not NULL: + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_value, __pyx_n_ui_split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __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[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_32)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_32)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_32)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __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_2)); __pyx_t_2 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { + PyObject* tuple = __pyx_t_5; + __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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __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_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1446 + * if dict_result is NULL and u':' in value: + * prefix, value = value.split(u':', 1) + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * return (dict_result)._type + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_value); + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1447 + * prefix, value = value.split(u':', 1) + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * return (dict_result)._type + * + */ + __pyx_t_4 = (__pyx_v_dict_result != NULL); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1448 + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + * if dict_result is not NULL: + * return (dict_result)._type # <<<<<<<<<<<<<< + * + * # otherwise determine class based on text content type + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->_type); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->_type; + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1451 + * + * # otherwise determine class based on text content type + * el_class = _guessElementClass(c_node) # <<<<<<<<<<<<<< + * if el_class is not None: + * return el_class + */ + __pyx_t_5 = __pyx_f_4lxml_9objectify__guessElementClass(__pyx_v_c_node); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_el_class); + __pyx_v_el_class = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1452 + * # otherwise determine class based on text content type + * el_class = _guessElementClass(c_node) + * if el_class is not None: # <<<<<<<<<<<<<< + * return el_class + * + */ + __pyx_t_4 = (__pyx_v_el_class != Py_None); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1453 + * el_class = _guessElementClass(c_node) + * if el_class is not None: + * return el_class # <<<<<<<<<<<<<< + * + * # if element is a root node => default to tree node + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_el_class); + __pyx_r = __pyx_v_el_class; + goto __pyx_L0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1456 + * + * # if element is a root node => default to tree node + * if c_node.parent is NULL or not tree._isElement(c_node.parent): # <<<<<<<<<<<<<< + * return lookup.tree_class + * + */ + if (!(__pyx_v_c_node->parent == NULL)) { + __pyx_t_4 = (!_isElement(__pyx_v_c_node->parent)); + } else { + __pyx_t_4 = (__pyx_v_c_node->parent == NULL); + } + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1457 + * # if element is a root node => default to tree node + * if c_node.parent is NULL or not tree._isElement(c_node.parent): + * return lookup.tree_class # <<<<<<<<<<<<<< + * + * return lookup.empty_data_class + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_lookup->tree_class); + __pyx_r = __pyx_v_lookup->tree_class; + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1459 + * return lookup.tree_class + * + * return lookup.empty_data_class # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_lookup->empty_data_class); + __pyx_r = __pyx_v_lookup->empty_data_class; + 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.objectify._lookupElementClass"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_lookup); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_prefix); + __Pyx_DECREF(__pyx_v_el_class); + __Pyx_DECREF(__pyx_v_state); + __Pyx_DECREF((PyObject *)__pyx_v_doc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1465 + * # Type annotations + * + * cdef PyType _check_type(tree.xmlNode* c_node, PyType pytype): # <<<<<<<<<<<<<< + * if pytype is None: + * return None + */ + +static struct __pyx_obj_4lxml_9objectify_PyType *__pyx_f_4lxml_9objectify__check_type(xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_pytype) { + PyObject *__pyx_v_value; + struct __pyx_obj_4lxml_9objectify_PyType *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_check_type"); + __Pyx_INCREF((PyObject *)__pyx_v_pytype); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1466 + * + * cdef PyType _check_type(tree.xmlNode* c_node, PyType pytype): + * if pytype is None: # <<<<<<<<<<<<<< + * return None + * value = textOf(c_node) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1467 + * cdef PyType _check_type(tree.xmlNode* c_node, PyType pytype): + * if pytype is None: + * return None # <<<<<<<<<<<<<< + * value = textOf(c_node) + * try: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1468 + * if pytype is None: + * return None + * value = textOf(c_node) # <<<<<<<<<<<<<< + * try: + * pytype.type_check(value) + */ + __pyx_t_2 = textOf(__pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __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-2.2/src/lxml/lxml.objectify.pyx":1469 + * return None + * value = textOf(c_node) + * try: # <<<<<<<<<<<<<< + * pytype.type_check(value) + * return pytype + */ + { + 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-2.2/src/lxml/lxml.objectify.pyx":1470 + * value = textOf(c_node) + * try: + * pytype.type_check(value) # <<<<<<<<<<<<<< + * return pytype + * except IGNORABLE_ERRORS: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_3 = PyObject_Call(__pyx_v_pytype->type_check, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __Pyx_GOTREF(__pyx_t_3); + __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-2.2/src/lxml/lxml.objectify.pyx":1471 + * try: + * pytype.type_check(value) + * return pytype # <<<<<<<<<<<<<< + * except IGNORABLE_ERRORS: + * # could not be parsed as the specified type => ignore + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_pytype)); + __pyx_r = __pyx_v_pytype; + 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_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_L0; + __pyx_L4_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-2.2/src/lxml/lxml.objectify.pyx":1472 + * pytype.type_check(value) + * return pytype + * except IGNORABLE_ERRORS: # <<<<<<<<<<<<<< + * # could not be parsed as the specified type => ignore + * pass + */ + __pyx_t_4 = PyErr_ExceptionMatches(((PyObject *)__pyx_v_4lxml_9objectify_IGNORABLE_ERRORS)); + if (__pyx_t_4) { + PyErr_Restore(0,0,0); + goto __pyx_L5_exception_handled; + } + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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-2.2/src/lxml/lxml.objectify.pyx":1475 + * # could not be parsed as the specified type => ignore + * pass + * return None # <<<<<<<<<<<<<< + * + * def pyannotate(element_or_tree, *, ignore_old=False, ignore_xsi=False, + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_PyType *)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.objectify._check_type"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF((PyObject *)__pyx_v_pytype); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1477 + * return None + * + * def pyannotate(element_or_tree, *, ignore_old=False, ignore_xsi=False, # <<<<<<<<<<<<<< + * empty_pytype=None): + * u"""pyannotate(element_or_tree, ignore_old=False, ignore_xsi=False, empty_pytype=None) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_pyannotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_pyannotate[] = "pyannotate(element_or_tree, ignore_old=False, ignore_xsi=False, empty_pytype=None)\n\n Recursively annotates the elements of an XML tree with 'pytype'\n attributes.\n\n If the 'ignore_old' keyword argument is True (the default), current 'pytype'\n attributes will be ignored and replaced. Otherwise, they will be checked\n and only replaced if they no longer fit the current text value.\n\n Setting the keyword argument ``ignore_xsi`` to True makes the function\n additionally ignore existing ``xsi:type`` annotations. The default is to\n use them as a type hint.\n\n The default annotation of empty elements can be set with the\n ``empty_pytype`` keyword argument. The default is not to annotate empty\n elements. Pass 'str', for example, to make string values the default.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_pyannotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_element_or_tree = 0; + PyObject *__pyx_v_ignore_old = 0; + PyObject *__pyx_v_ignore_xsi = 0; + PyObject *__pyx_v_empty_pytype = 0; + struct LxmlElement *__pyx_v_element; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_element_or_tree,&__pyx_n_ui_ignore_old,&__pyx_n_ui_ignore_xsi,&__pyx_n_ui_empty_pytype,0}; + __Pyx_SetupRefcountContext("pyannotate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1478 + * + * def pyannotate(element_or_tree, *, ignore_old=False, ignore_xsi=False, + * empty_pytype=None): # <<<<<<<<<<<<<< + * u"""pyannotate(element_or_tree, ignore_old=False, ignore_xsi=False, empty_pytype=None) + * + */ + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = __pyx_k_33; + values[2] = __pyx_k_34; + 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_ui_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_ui_ignore_old); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_ignore_xsi); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_empty_pytype); + 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), "pyannotate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_element_or_tree = values[0]; + __pyx_v_ignore_old = values[1]; + __pyx_v_ignore_xsi = values[2]; + __pyx_v_empty_pytype = values[3]; + } 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_ignore_old = __pyx_k_33; + __pyx_v_ignore_xsi = __pyx_k_34; + __pyx_v_empty_pytype = ((PyObject *)Py_None); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pyannotate", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.pyannotate"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1497 + * """ + * cdef _Element element + * element = cetree.rootNodeOrRaise(element_or_tree) # <<<<<<<<<<<<<< + * _annotate(element, 0, 1, ignore_xsi, ignore_old, None, empty_pytype) + * + */ + __pyx_t_1 = ((PyObject *)rootNodeOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __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-2.2/src/lxml/lxml.objectify.pyx":1498 + * cdef _Element element + * element = cetree.rootNodeOrRaise(element_or_tree) + * _annotate(element, 0, 1, ignore_xsi, ignore_old, None, empty_pytype) # <<<<<<<<<<<<<< + * + * def xsiannotate(element_or_tree, *, ignore_old=False, ignore_pytype=False, + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_xsi); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_old); if (unlikely((__pyx_t_3 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_9objectify__annotate(__pyx_v_element, 0, 1, __pyx_t_2, __pyx_t_3, Py_None, __pyx_v_empty_pytype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __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.objectify.pyannotate"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1500 + * _annotate(element, 0, 1, ignore_xsi, ignore_old, None, empty_pytype) + * + * def xsiannotate(element_or_tree, *, ignore_old=False, ignore_pytype=False, # <<<<<<<<<<<<<< + * empty_type=None): + * u"""xsiannotate(element_or_tree, ignore_old=False, ignore_pytype=False, empty_type=None) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_xsiannotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_xsiannotate[] = "xsiannotate(element_or_tree, ignore_old=False, ignore_pytype=False, empty_type=None)\n\n Recursively annotates the elements of an XML tree with 'xsi:type'\n attributes.\n\n If the 'ignore_old' keyword argument is True (the default), current\n 'xsi:type' attributes will be ignored and replaced. Otherwise, they will be\n checked and only replaced if they no longer fit the current text value.\n\n Note that the mapping from Python types to XSI types is usually ambiguous.\n Currently, only the first XSI type name in the corresponding PyType\n definition will be used for annotation. Thus, you should consider naming\n the widest type first if you define additional types.\n\n Setting the keyword argument ``ignore_pytype`` to True makes the function\n additionally ignore existing ``pytype`` annotations. The default is to\n use them as a type hint.\n\n The default annotation of empty elements can be set with the\n ``empty_type`` keyword argument. The default is not to annotate empty\n elements. Pass 'string', for example, to make string values the default.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_xsiannotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_element_or_tree = 0; + PyObject *__pyx_v_ignore_old = 0; + PyObject *__pyx_v_ignore_pytype = 0; + PyObject *__pyx_v_empty_type = 0; + struct LxmlElement *__pyx_v_element; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_element_or_tree,&__pyx_n_ui_ignore_old,&__pyx_n_ui_ignore_pytype,&__pyx_n_ui_empty_type,0}; + __Pyx_SetupRefcountContext("xsiannotate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1501 + * + * def xsiannotate(element_or_tree, *, ignore_old=False, ignore_pytype=False, + * empty_type=None): # <<<<<<<<<<<<<< + * u"""xsiannotate(element_or_tree, ignore_old=False, ignore_pytype=False, empty_type=None) + * + */ + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = __pyx_k_35; + values[2] = __pyx_k_36; + 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_ui_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_ui_ignore_old); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_ignore_pytype); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_empty_type); + 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), "xsiannotate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_element_or_tree = values[0]; + __pyx_v_ignore_old = values[1]; + __pyx_v_ignore_pytype = values[2]; + __pyx_v_empty_type = values[3]; + } 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_ignore_old = __pyx_k_35; + __pyx_v_ignore_pytype = __pyx_k_36; + __pyx_v_empty_type = ((PyObject *)Py_None); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("xsiannotate", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.xsiannotate"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1525 + * """ + * cdef _Element element + * element = cetree.rootNodeOrRaise(element_or_tree) # <<<<<<<<<<<<<< + * _annotate(element, 1, 0, ignore_old, ignore_pytype, empty_type, None) + * + */ + __pyx_t_1 = ((PyObject *)rootNodeOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __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-2.2/src/lxml/lxml.objectify.pyx":1526 + * cdef _Element element + * element = cetree.rootNodeOrRaise(element_or_tree) + * _annotate(element, 1, 0, ignore_old, ignore_pytype, empty_type, None) # <<<<<<<<<<<<<< + * + * def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False, + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_old); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_pytype); if (unlikely((__pyx_t_3 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_9objectify__annotate(__pyx_v_element, 1, 0, __pyx_t_2, __pyx_t_3, __pyx_v_empty_type, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __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.objectify.xsiannotate"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1528 + * _annotate(element, 1, 0, ignore_old, ignore_pytype, empty_type, None) + * + * def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False, # <<<<<<<<<<<<<< + * empty_pytype=None, empty_type=None, annotate_xsi=0, + * annotate_pytype=1): + */ + +static PyObject *__pyx_pf_4lxml_9objectify_annotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_annotate[] = "annotate(element_or_tree, ignore_old=True, ignore_xsi=False, empty_pytype=None, empty_type=None, annotate_xsi=0, annotate_pytype=1)\n\n Recursively annotates the elements of an XML tree with 'xsi:type'\n and/or 'py:pytype' attributes.\n\n If the 'ignore_old' keyword argument is True (the default), current\n 'py:pytype' attributes will be ignored for the type annotation. Set to False\n if you want reuse existing 'py:pytype' information (iff appropriate for the\n element text value).\n\n If the 'ignore_xsi' keyword argument is False (the default), existing\n 'xsi:type' attributes will be used for the type annotation, if they fit the\n element text values. \n \n Note that the mapping from Python types to XSI types is usually ambiguous.\n Currently, only the first XSI type name in the corresponding PyType\n definition will be used for annotation. Thus, you should consider naming\n the widest type first if you define additional types.\n\n The default 'py:pytype' annotation of empty elements can be set with the\n ``empty_pytype`` keyword argument. Pass 'str', for example, to make\n string values the default.\n\n The default 'xsi:type' annotation of empty elements can be set with the\n ``empty_type`` keyword argument. The default is not to annotate empty\n elements. Pass 'string', for example, to make string values the default.\n\n The keyword arguments 'annotate_xsi' (default: 0) and 'annotate_pytype'\n (default: 1) control which kind(s) of annotation to use. \n "; +static PyObject *__pyx_pf_4lxml_9objectify_annotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_element_or_tree = 0; + PyObject *__pyx_v_ignore_old = 0; + PyObject *__pyx_v_ignore_xsi = 0; + PyObject *__pyx_v_empty_pytype = 0; + PyObject *__pyx_v_empty_type = 0; + PyObject *__pyx_v_annotate_xsi = 0; + PyObject *__pyx_v_annotate_pytype = 0; + struct LxmlElement *__pyx_v_element; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_element_or_tree,&__pyx_n_ui_ignore_old,&__pyx_n_ui_ignore_xsi,&__pyx_n_ui_empty_pytype,&__pyx_n_ui_empty_type,&__pyx_n_ui_annotate_xsi,&__pyx_n_ui_annotate_pytype,0}; + __Pyx_SetupRefcountContext("annotate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1529 + * + * def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False, + * empty_pytype=None, empty_type=None, annotate_xsi=0, # <<<<<<<<<<<<<< + * annotate_pytype=1): + * u"""annotate(element_or_tree, ignore_old=True, ignore_xsi=False, empty_pytype=None, empty_type=None, annotate_xsi=0, annotate_pytype=1) + */ + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[1] = __pyx_k_37; + values[2] = __pyx_k_38; + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + values[5] = ((PyObject *)__pyx_int_0); + values[6] = ((PyObject *)__pyx_int_1); + 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_ui_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_ui_ignore_old); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_ignore_xsi); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_empty_pytype); + if (value) { values[3] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_empty_type); + if (value) { values[4] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_annotate_xsi); + if (value) { values[5] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_annotate_pytype); + if (value) { values[6] = 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), "annotate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_element_or_tree = values[0]; + __pyx_v_ignore_old = values[1]; + __pyx_v_ignore_xsi = values[2]; + __pyx_v_empty_pytype = values[3]; + __pyx_v_empty_type = values[4]; + __pyx_v_annotate_xsi = values[5]; + __pyx_v_annotate_pytype = values[6]; + } 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_ignore_old = __pyx_k_37; + __pyx_v_ignore_xsi = __pyx_k_38; + __pyx_v_empty_pytype = ((PyObject *)Py_None); + __pyx_v_empty_type = ((PyObject *)Py_None); + __pyx_v_annotate_xsi = ((PyObject *)__pyx_int_0); + __pyx_v_annotate_pytype = ((PyObject *)__pyx_int_1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("annotate", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.annotate"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_element = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1562 + * """ + * cdef _Element element + * element = cetree.rootNodeOrRaise(element_or_tree) # <<<<<<<<<<<<<< + * _annotate(element, annotate_xsi, annotate_pytype, ignore_xsi, + * ignore_old, empty_type, empty_pytype) + */ + __pyx_t_1 = ((PyObject *)rootNodeOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __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-2.2/src/lxml/lxml.objectify.pyx":1563 + * cdef _Element element + * element = cetree.rootNodeOrRaise(element_or_tree) + * _annotate(element, annotate_xsi, annotate_pytype, ignore_xsi, # <<<<<<<<<<<<<< + * ignore_old, empty_type, empty_pytype) + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_annotate_xsi); if (unlikely((__pyx_t_2 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_annotate_pytype); if (unlikely((__pyx_t_3 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_xsi); if (unlikely((__pyx_t_4 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1564 + * element = cetree.rootNodeOrRaise(element_or_tree) + * _annotate(element, annotate_xsi, annotate_pytype, ignore_xsi, + * ignore_old, empty_type, empty_pytype) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_old); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4lxml_9objectify__annotate(__pyx_v_element, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_empty_type, __pyx_v_empty_pytype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __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.objectify.annotate"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1567 + * + * + * cdef _annotate(_Element element, bint annotate_xsi, bint annotate_pytype, # <<<<<<<<<<<<<< + * bint ignore_xsi, bint ignore_pytype, + * empty_type_name, empty_pytype_name): + */ + +static PyObject *__pyx_f_4lxml_9objectify__annotate(struct LxmlElement *__pyx_v_element, int __pyx_v_annotate_xsi, int __pyx_v_annotate_pytype, int __pyx_v_ignore_xsi, int __pyx_v_ignore_pytype, PyObject *__pyx_v_empty_type_name, PyObject *__pyx_v_empty_pytype_name) { + struct LxmlDocument *__pyx_v_doc; + xmlNode *__pyx_v_c_node; + xmlNs *__pyx_v_c_ns; + PyObject *__pyx_v_dict_result; + struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_pytype; + struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_empty_pytype; + struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_StrType; + struct __pyx_obj_4lxml_9objectify_PyType *__pyx_v_NoneType; + PyObject *__pyx_v_typename; + PyObject *__pyx_v_value; + PyObject *__pyx_v_istree; + PyObject *__pyx_v_prefix; + PyObject *__pyx_v_old_pytypename; + PyObject *__pyx_v_typename_utf8; + PyObject *__pyx_v_name; + PyObject *__pyx_v_pytype_name; + 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; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + __Pyx_SetupRefcountContext("_annotate"); + __Pyx_INCREF((PyObject *)__pyx_v_element); + __Pyx_INCREF(__pyx_v_empty_type_name); + __Pyx_INCREF(__pyx_v_empty_pytype_name); + __pyx_v_doc = ((struct LxmlDocument *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_empty_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_StrType = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_NoneType = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_typename = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_istree = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_old_pytypename = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_typename_utf8 = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype_name = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1576 + * cdef PyType pytype, empty_pytype, StrType, NoneType + * + * if not annotate_xsi and not annotate_pytype: # <<<<<<<<<<<<<< + * return + * + */ + if ((!__pyx_v_annotate_xsi)) { + __pyx_t_1 = (!__pyx_v_annotate_pytype); + } else { + __pyx_t_1 = (!__pyx_v_annotate_xsi); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1577 + * + * if not annotate_xsi and not annotate_pytype: + * return # <<<<<<<<<<<<<< + * + * doc = element._doc + */ + __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-2.2/src/lxml/lxml.objectify.pyx":1579 + * return + * + * doc = element._doc # <<<<<<<<<<<<<< + * + * if empty_type_name is not None: + */ + __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-2.2/src/lxml/lxml.objectify.pyx":1581 + * doc = element._doc + * + * if empty_type_name is not None: # <<<<<<<<<<<<<< + * if python.PyString_Check(empty_type_name): + * empty_type_name = python.PyUnicode_FromEncodedObject( + */ + __pyx_t_1 = (__pyx_v_empty_type_name != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1582 + * + * if empty_type_name is not None: + * if python.PyString_Check(empty_type_name): # <<<<<<<<<<<<<< + * empty_type_name = python.PyUnicode_FromEncodedObject( + * empty_type_name, "ASCII", NULL) + */ + __pyx_t_1 = PyString_Check(__pyx_v_empty_type_name); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1584 + * if python.PyString_Check(empty_type_name): + * empty_type_name = python.PyUnicode_FromEncodedObject( + * empty_type_name, "ASCII", NULL) # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, empty_type_name) + * elif empty_pytype_name is not None: + */ + __pyx_t_2 = PyUnicode_FromEncodedObject(__pyx_v_empty_type_name, __pyx_k_ASCII, NULL); 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_empty_type_name); + __pyx_v_empty_type_name = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1585 + * empty_type_name = python.PyUnicode_FromEncodedObject( + * empty_type_name, "ASCII", NULL) + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, empty_type_name) # <<<<<<<<<<<<<< + * elif empty_pytype_name is not None: + * if python.PyString_Check(empty_pytype_name): + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_empty_type_name); + goto __pyx_L4; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1586 + * empty_type_name, "ASCII", NULL) + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, empty_type_name) + * elif empty_pytype_name is not None: # <<<<<<<<<<<<<< + * if python.PyString_Check(empty_pytype_name): + * empty_pytype_name = python.PyUnicode_FromEncodedObject( + */ + __pyx_t_1 = (__pyx_v_empty_pytype_name != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1587 + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, empty_type_name) + * elif empty_pytype_name is not None: + * if python.PyString_Check(empty_pytype_name): # <<<<<<<<<<<<<< + * empty_pytype_name = python.PyUnicode_FromEncodedObject( + * empty_pytype_name, "ASCII", NULL) + */ + __pyx_t_1 = PyString_Check(__pyx_v_empty_pytype_name); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1589 + * if python.PyString_Check(empty_pytype_name): + * empty_pytype_name = python.PyUnicode_FromEncodedObject( + * empty_pytype_name, "ASCII", NULL) # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, empty_pytype_name) + * else: + */ + __pyx_t_2 = PyUnicode_FromEncodedObject(__pyx_v_empty_pytype_name, __pyx_k_ASCII, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_empty_pytype_name); + __pyx_v_empty_pytype_name = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1590 + * empty_pytype_name = python.PyUnicode_FromEncodedObject( + * empty_pytype_name, "ASCII", NULL) + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, empty_pytype_name) # <<<<<<<<<<<<<< + * else: + * dict_result = NULL + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v_empty_pytype_name); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1592 + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, empty_pytype_name) + * else: + * dict_result = NULL # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * empty_pytype = dict_result + */ + __pyx_v_dict_result = NULL; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1593 + * else: + * dict_result = NULL + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * empty_pytype = dict_result + * else: + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1594 + * dict_result = NULL + * if dict_result is not NULL: + * empty_pytype = dict_result # <<<<<<<<<<<<<< + * else: + * empty_pytype = None + */ + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result))); + __Pyx_DECREF(((PyObject *)__pyx_v_empty_pytype)); + __pyx_v_empty_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1596 + * empty_pytype = dict_result + * else: + * empty_pytype = None # <<<<<<<<<<<<<< + * + * StrType = _PYTYPE_DICT.get(u'str') + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(((PyObject *)__pyx_v_empty_pytype)); + __pyx_v_empty_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1598 + * empty_pytype = None + * + * StrType = _PYTYPE_DICT.get(u'str') # <<<<<<<<<<<<<< + * NoneType = _PYTYPE_DICT.get(u'NoneType') + * c_node = element._c_node + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_n_ui_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __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[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_str)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_u_str)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_str)); + __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 = 1598; __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 (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_9objectify_PyType))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_StrType)); + __pyx_v_StrType = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1599 + * + * StrType = _PYTYPE_DICT.get(u'str') + * NoneType = _PYTYPE_DICT.get(u'NoneType') # <<<<<<<<<<<<<< + * c_node = element._c_node + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_n_ui_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __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[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_NoneType)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_u_NoneType)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_NoneType)); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __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; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_9objectify_PyType))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_NoneType)); + __pyx_v_NoneType = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1600 + * StrType = _PYTYPE_DICT.get(u'str') + * NoneType = _PYTYPE_DICT.get(u'NoneType') + * c_node = element._c_node # <<<<<<<<<<<<<< + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + * if c_node.type == tree.XML_ELEMENT_NODE: + */ + __pyx_v_c_node = __pyx_v_element->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1601 + * NoneType = _PYTYPE_DICT.get(u'NoneType') + * c_node = element._c_node + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) # <<<<<<<<<<<<<< + * if c_node.type == tree.XML_ELEMENT_NODE: + * typename = None + */ + BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1602 + * c_node = element._c_node + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + * if c_node.type == tree.XML_ELEMENT_NODE: # <<<<<<<<<<<<<< + * typename = None + * pytype = None + */ + __pyx_t_1 = (__pyx_v_c_node->type == XML_ELEMENT_NODE); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1603 + * tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + * if c_node.type == tree.XML_ELEMENT_NODE: + * typename = None # <<<<<<<<<<<<<< + * pytype = None + * value = None + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1604 + * if c_node.type == tree.XML_ELEMENT_NODE: + * typename = None + * pytype = None # <<<<<<<<<<<<<< + * value = None + * istree = 0 + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1605 + * typename = None + * pytype = None + * value = None # <<<<<<<<<<<<<< + * istree = 0 + * # if element is defined as xsi:nil, represent it as None + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1606 + * pytype = None + * value = None + * istree = 0 # <<<<<<<<<<<<<< + * # if element is defined as xsi:nil, represent it as None + * if cetree.attributeValueFromNsName( + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_istree); + __pyx_v_istree = __pyx_int_0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1609 + * # if element is defined as xsi:nil, represent it as None + * if cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "nil") == u"true": # <<<<<<<<<<<<<< + * pytype = NoneType + * + */ + __pyx_t_2 = attributeValueFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_nil); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_u_true), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1610 + * if cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "nil") == u"true": + * pytype = NoneType # <<<<<<<<<<<<<< + * + * if pytype is None and not ignore_xsi: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_NoneType)); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = __pyx_v_NoneType; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1612 + * pytype = NoneType + * + * if pytype is None and not ignore_xsi: # <<<<<<<<<<<<<< + * # check that old xsi type value is valid + * typename = cetree.attributeValueFromNsName( + */ + __pyx_t_1 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_1) { + __pyx_t_5 = (!__pyx_v_ignore_xsi); + } else { + __pyx_t_5 = __pyx_t_1; + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1615 + * # check that old xsi type value is valid + * typename = cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "type") # <<<<<<<<<<<<<< + * if typename is not None: + * dict_result = python.PyDict_GetItem( + */ + __pyx_t_3 = attributeValueFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1616 + * typename = cetree.attributeValueFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "type") + * if typename is not None: # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem( + * _SCHEMA_TYPE_DICT, typename) + */ + __pyx_t_5 = (__pyx_v_typename != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1618 + * if typename is not None: + * dict_result = python.PyDict_GetItem( + * _SCHEMA_TYPE_DICT, typename) # <<<<<<<<<<<<<< + * if dict_result is NULL and u':' in typename: + * prefix, typename = typename.split(u':', 1) + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_typename); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1619 + * dict_result = python.PyDict_GetItem( + * _SCHEMA_TYPE_DICT, typename) + * if dict_result is NULL and u':' in typename: # <<<<<<<<<<<<<< + * prefix, typename = typename.split(u':', 1) + * dict_result = python.PyDict_GetItem( + */ + if ((__pyx_v_dict_result == NULL)) { + __pyx_t_5 = (PySequence_Contains(__pyx_v_typename, ((PyObject *)__pyx_kp_u_32))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_t_5; + } else { + __pyx_t_1 = (__pyx_v_dict_result == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1620 + * _SCHEMA_TYPE_DICT, typename) + * if dict_result is NULL and u':' in typename: + * prefix, typename = typename.split(u':', 1) # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem( + * _SCHEMA_TYPE_DICT, typename) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_typename, __pyx_n_ui_split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __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[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_32)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_32)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_32)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __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_2)); __pyx_t_2 = 0; + 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_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __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_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1622 + * prefix, typename = typename.split(u':', 1) + * dict_result = python.PyDict_GetItem( + * _SCHEMA_TYPE_DICT, typename) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * pytype = dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_typename); + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1623 + * dict_result = python.PyDict_GetItem( + * _SCHEMA_TYPE_DICT, typename) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * pytype = dict_result + * if pytype is not StrType: + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1624 + * _SCHEMA_TYPE_DICT, typename) + * if dict_result is not NULL: + * pytype = dict_result # <<<<<<<<<<<<<< + * if pytype is not StrType: + * # StrType does not have a typecheck but is the default + */ + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result))); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1625 + * if dict_result is not NULL: + * pytype = dict_result + * if pytype is not StrType: # <<<<<<<<<<<<<< + * # StrType does not have a typecheck but is the default + * # anyway, so just accept it if given as type + */ + __pyx_t_1 = (__pyx_v_pytype != __pyx_v_StrType); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1629 + * # anyway, so just accept it if given as type + * # information + * pytype = _check_type(c_node, pytype) # <<<<<<<<<<<<<< + * if pytype is None: + * typename = None + */ + __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_9objectify__check_type(__pyx_v_c_node, __pyx_v_pytype)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1630 + * # information + * pytype = _check_type(c_node, pytype) + * if pytype is None: # <<<<<<<<<<<<<< + * typename = None + * + */ + __pyx_t_1 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1631 + * pytype = _check_type(c_node, pytype) + * if pytype is None: + * typename = None # <<<<<<<<<<<<<< + * + * if pytype is None and not ignore_pytype: + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = Py_None; + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + goto __pyx_L13; + } + __pyx_L13:; + goto __pyx_L11; + } + __pyx_L11:; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1633 + * typename = None + * + * if pytype is None and not ignore_pytype: # <<<<<<<<<<<<<< + * # check that old pytype value is valid + * old_pytypename = cetree.attributeValueFromNsName( + */ + __pyx_t_1 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_1) { + __pyx_t_5 = (!__pyx_v_ignore_pytype); + } else { + __pyx_t_5 = __pyx_t_1; + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1636 + * # check that old pytype value is valid + * old_pytypename = cetree.attributeValueFromNsName( + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) # <<<<<<<<<<<<<< + * if old_pytypename is not None: + * if old_pytypename == TREE_PYTYPE_NAME: + */ + __pyx_t_4 = attributeValueFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE, __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_old_pytypename); + __pyx_v_old_pytypename = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1637 + * old_pytypename = cetree.attributeValueFromNsName( + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + * if old_pytypename is not None: # <<<<<<<<<<<<<< + * if old_pytypename == TREE_PYTYPE_NAME: + * if not cetree.hasChild(c_node): + */ + __pyx_t_5 = (__pyx_v_old_pytypename != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1638 + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + * if old_pytypename is not None: + * if old_pytypename == TREE_PYTYPE_NAME: # <<<<<<<<<<<<<< + * if not cetree.hasChild(c_node): + * # only case where we should keep it, + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_old_pytypename, __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1638; __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 = 1638; __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-2.2/src/lxml/lxml.objectify.pyx":1639 + * if old_pytypename is not None: + * if old_pytypename == TREE_PYTYPE_NAME: + * if not cetree.hasChild(c_node): # <<<<<<<<<<<<<< + * # only case where we should keep it, + * # everything else is clear enough + */ + __pyx_t_5 = (!hasChild(__pyx_v_c_node)); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1642 + * # only case where we should keep it, + * # everything else is clear enough + * pytype = TREE_PYTYPE # <<<<<<<<<<<<<< + * else: + * if old_pytypename == u'none': + */ + __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_9objectify_TREE_PYTYPE)); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = __pyx_v_4lxml_9objectify_TREE_PYTYPE; + goto __pyx_L19; + } + __pyx_L19:; + goto __pyx_L18; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1644 + * pytype = TREE_PYTYPE + * else: + * if old_pytypename == u'none': # <<<<<<<<<<<<<< + * # transition from lxml 1.x + * old_pytypename = u"NoneType" + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_old_pytypename, ((PyObject *)__pyx_n_u_none), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __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 = 1644; __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-2.2/src/lxml/lxml.objectify.pyx":1646 + * if old_pytypename == u'none': + * # transition from lxml 1.x + * old_pytypename = u"NoneType" # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem( + * _PYTYPE_DICT, old_pytypename) + */ + __Pyx_INCREF(((PyObject *)__pyx_n_u_NoneType)); + __Pyx_DECREF(__pyx_v_old_pytypename); + __pyx_v_old_pytypename = ((PyObject *)__pyx_n_u_NoneType); + goto __pyx_L20; + } + __pyx_L20:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1648 + * old_pytypename = u"NoneType" + * dict_result = python.PyDict_GetItem( + * _PYTYPE_DICT, old_pytypename) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * pytype = dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v_old_pytypename); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1649 + * dict_result = python.PyDict_GetItem( + * _PYTYPE_DICT, old_pytypename) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * pytype = dict_result + * if pytype is not StrType: + */ + __pyx_t_5 = (__pyx_v_dict_result != NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1650 + * _PYTYPE_DICT, old_pytypename) + * if dict_result is not NULL: + * pytype = dict_result # <<<<<<<<<<<<<< + * if pytype is not StrType: + * # StrType does not have a typecheck but is the + */ + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result))); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1651 + * if dict_result is not NULL: + * pytype = dict_result + * if pytype is not StrType: # <<<<<<<<<<<<<< + * # StrType does not have a typecheck but is the + * # default anyway, so just accept it if given as + */ + __pyx_t_5 = (__pyx_v_pytype != __pyx_v_StrType); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1655 + * # default anyway, so just accept it if given as + * # type information + * pytype = _check_type(c_node, pytype) # <<<<<<<<<<<<<< + * + * if pytype is None: + */ + __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_9objectify__check_type(__pyx_v_c_node, __pyx_v_pytype)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L22; + } + __pyx_L22:; + goto __pyx_L21; + } + __pyx_L21:; + } + __pyx_L18:; + goto __pyx_L17; + } + __pyx_L17:; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1657 + * pytype = _check_type(c_node, pytype) + * + * if pytype is None: # <<<<<<<<<<<<<< + * # try to guess type + * if not cetree.hasChild(c_node): + */ + __pyx_t_5 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1659 + * if pytype is None: + * # try to guess type + * if not cetree.hasChild(c_node): # <<<<<<<<<<<<<< + * # element has no children => data class + * pytype = _guessPyType(textOf(c_node), StrType) + */ + __pyx_t_5 = (!hasChild(__pyx_v_c_node)); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1661 + * if not cetree.hasChild(c_node): + * # element has no children => data class + * pytype = _guessPyType(textOf(c_node), StrType) # <<<<<<<<<<<<<< + * else: + * istree = 1 + */ + __pyx_t_4 = textOf(__pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_9objectify__guessPyType(__pyx_t_4, __pyx_v_StrType)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __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_v_pytype)); + __pyx_v_pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L24; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1663 + * pytype = _guessPyType(textOf(c_node), StrType) + * else: + * istree = 1 # <<<<<<<<<<<<<< + * + * if pytype is None: + */ + __Pyx_INCREF(__pyx_int_1); + __Pyx_DECREF(__pyx_v_istree); + __pyx_v_istree = __pyx_int_1; + } + __pyx_L24:; + goto __pyx_L23; + } + __pyx_L23:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1665 + * istree = 1 + * + * if pytype is None: # <<<<<<<<<<<<<< + * # use default type for empty elements + * if cetree.hasText(c_node): + */ + __pyx_t_5 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1667 + * if pytype is None: + * # use default type for empty elements + * if cetree.hasText(c_node): # <<<<<<<<<<<<<< + * pytype = StrType + * else: + */ + __pyx_t_5 = hasText(__pyx_v_c_node); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1668 + * # use default type for empty elements + * if cetree.hasText(c_node): + * pytype = StrType # <<<<<<<<<<<<<< + * else: + * pytype = empty_pytype + */ + __Pyx_INCREF(((PyObject *)__pyx_v_StrType)); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = __pyx_v_StrType; + goto __pyx_L26; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1670 + * pytype = StrType + * else: + * pytype = empty_pytype # <<<<<<<<<<<<<< + * if typename is None: + * typename = empty_type_name + */ + __Pyx_INCREF(((PyObject *)__pyx_v_empty_pytype)); + __Pyx_DECREF(((PyObject *)__pyx_v_pytype)); + __pyx_v_pytype = __pyx_v_empty_pytype; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1671 + * else: + * pytype = empty_pytype + * if typename is None: # <<<<<<<<<<<<<< + * typename = empty_type_name + * + */ + __pyx_t_5 = (__pyx_v_typename == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1672 + * pytype = empty_pytype + * if typename is None: + * typename = empty_type_name # <<<<<<<<<<<<<< + * + * if pytype is not None: + */ + __Pyx_INCREF(__pyx_v_empty_type_name); + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = __pyx_v_empty_type_name; + goto __pyx_L27; + } + __pyx_L27:; + } + __pyx_L26:; + goto __pyx_L25; + } + __pyx_L25:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1674 + * typename = empty_type_name + * + * if pytype is not None: # <<<<<<<<<<<<<< + * if typename is None: + * if not istree: + */ + __pyx_t_5 = (((PyObject *)__pyx_v_pytype) != Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1675 + * + * if pytype is not None: + * if typename is None: # <<<<<<<<<<<<<< + * if not istree: + * if python.PyList_GET_SIZE(pytype._schema_types) > 0: + */ + __pyx_t_5 = (__pyx_v_typename == Py_None); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1676 + * if pytype is not None: + * if typename is None: + * if not istree: # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(pytype._schema_types) > 0: + * # pytype->xsi:type is a 1:n mapping + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_istree); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (!__pyx_t_5); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1677 + * if typename is None: + * if not istree: + * if python.PyList_GET_SIZE(pytype._schema_types) > 0: # <<<<<<<<<<<<<< + * # pytype->xsi:type is a 1:n mapping + * # simply take the first + */ + __pyx_t_1 = (PyList_GET_SIZE(((PyObject *)__pyx_v_pytype->_schema_types)) > 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1680 + * # pytype->xsi:type is a 1:n mapping + * # simply take the first + * typename = pytype._schema_types[0] # <<<<<<<<<<<<<< + * elif typename not in pytype._schema_types: + * typename = pytype._schema_types[0] + */ + __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_pytype->_schema_types), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L31; + } + __pyx_L31:; + goto __pyx_L30; + } + __pyx_L30:; + goto __pyx_L29; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1681 + * # simply take the first + * typename = pytype._schema_types[0] + * elif typename not in pytype._schema_types: # <<<<<<<<<<<<<< + * typename = pytype._schema_types[0] + * + */ + __pyx_t_1 = (!PySequence_Contains(((PyObject *)__pyx_v_pytype->_schema_types), __pyx_v_typename)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1682 + * typename = pytype._schema_types[0] + * elif typename not in pytype._schema_types: + * typename = pytype._schema_types[0] # <<<<<<<<<<<<<< + * + * if annotate_xsi: + */ + __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_pytype->_schema_types), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_typename); + __pyx_v_typename = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L29; + } + __pyx_L29:; + goto __pyx_L28; + } + __pyx_L28:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1684 + * typename = pytype._schema_types[0] + * + * if annotate_xsi: # <<<<<<<<<<<<<< + * if typename is None or istree: + * cetree.delAttributeFromNsName( + */ + __pyx_t_1 = __pyx_v_annotate_xsi; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1685 + * + * if annotate_xsi: + * if typename is None or istree: # <<<<<<<<<<<<<< + * cetree.delAttributeFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "type") + */ + __pyx_t_1 = (__pyx_v_typename == Py_None); + if (!__pyx_t_1) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_istree); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_t_5; + } else { + __pyx_t_7 = __pyx_t_1; + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1687 + * if typename is None or istree: + * cetree.delAttributeFromNsName( + * c_node, _XML_SCHEMA_INSTANCE_NS, "type") # <<<<<<<<<<<<<< + * else: + * # update or create attribute + */ + delAttributeFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_type); + goto __pyx_L33; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1690 + * else: + * # update or create attribute + * typename_utf8 = cetree.utf8(typename) # <<<<<<<<<<<<<< + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_NS, 'xsd') + */ + __pyx_t_3 = utf8(__pyx_v_typename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_typename_utf8); + __pyx_v_typename_utf8 = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1692 + * typename_utf8 = cetree.utf8(typename) + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_NS, 'xsd') # <<<<<<<<<<<<<< + * if c_ns is not NULL: + * if ':' in typename_utf8: + */ + __pyx_v_c_ns = findOrBuildNodeNsPrefix(__pyx_v_doc, __pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_NS, __pyx_k_xsd); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1693 + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_NS, 'xsd') + * if c_ns is not NULL: # <<<<<<<<<<<<<< + * if ':' in typename_utf8: + * prefix, name = typename_utf8.split(':', 1) + */ + __pyx_t_7 = (__pyx_v_c_ns != NULL); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1694 + * doc, c_node, _XML_SCHEMA_NS, 'xsd') + * if c_ns is not NULL: + * if ':' in typename_utf8: # <<<<<<<<<<<<<< + * prefix, name = typename_utf8.split(':', 1) + * if c_ns.prefix is NULL or c_ns.prefix[0] == c'\0': + */ + __pyx_t_7 = (PySequence_Contains(__pyx_v_typename_utf8, ((PyObject *)__pyx_kp_b_32))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1695 + * if c_ns is not NULL: + * if ':' in typename_utf8: + * prefix, name = typename_utf8.split(':', 1) # <<<<<<<<<<<<<< + * if c_ns.prefix is NULL or c_ns.prefix[0] == c'\0': + * typename_utf8 = name + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_typename_utf8, __pyx_n_ui_split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __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 = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_b_32)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_b_32)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_32)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __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; + 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_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __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[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __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_name); + __pyx_v_name = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1696 + * if ':' in typename_utf8: + * prefix, name = typename_utf8.split(':', 1) + * if c_ns.prefix is NULL or c_ns.prefix[0] == c'\0': # <<<<<<<<<<<<<< + * typename_utf8 = name + * elif cstd.strcmp(_cstr(prefix), c_ns.prefix) != 0: + */ + if (!(__pyx_v_c_ns->prefix == NULL)) { + __pyx_t_7 = ((__pyx_v_c_ns->prefix[0]) == '\x00'); + } else { + __pyx_t_7 = (__pyx_v_c_ns->prefix == NULL); + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1697 + * prefix, name = typename_utf8.split(':', 1) + * if c_ns.prefix is NULL or c_ns.prefix[0] == c'\0': + * typename_utf8 = name # <<<<<<<<<<<<<< + * elif cstd.strcmp(_cstr(prefix), c_ns.prefix) != 0: + * prefix = c_ns.prefix + */ + __Pyx_INCREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_typename_utf8); + __pyx_v_typename_utf8 = __pyx_v_name; + goto __pyx_L36; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1698 + * if c_ns.prefix is NULL or c_ns.prefix[0] == c'\0': + * typename_utf8 = name + * elif cstd.strcmp(_cstr(prefix), c_ns.prefix) != 0: # <<<<<<<<<<<<<< + * prefix = c_ns.prefix + * typename_utf8 = prefix + ':' + name + */ + __pyx_t_7 = (strcmp(PyString_AS_STRING(__pyx_v_prefix), __pyx_v_c_ns->prefix) != 0); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1699 + * typename_utf8 = name + * elif cstd.strcmp(_cstr(prefix), c_ns.prefix) != 0: + * prefix = c_ns.prefix # <<<<<<<<<<<<<< + * typename_utf8 = prefix + ':' + name + * elif c_ns.prefix is not NULL or c_ns.prefix[0] != c'\0': + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1700 + * elif cstd.strcmp(_cstr(prefix), c_ns.prefix) != 0: + * prefix = c_ns.prefix + * typename_utf8 = prefix + ':' + name # <<<<<<<<<<<<<< + * elif c_ns.prefix is not NULL or c_ns.prefix[0] != c'\0': + * prefix = c_ns.prefix + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_kp_b_32)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __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_typename_utf8); + __pyx_v_typename_utf8 = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L36; + } + __pyx_L36:; + goto __pyx_L35; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1701 + * prefix = c_ns.prefix + * typename_utf8 = prefix + ':' + name + * elif c_ns.prefix is not NULL or c_ns.prefix[0] != c'\0': # <<<<<<<<<<<<<< + * prefix = c_ns.prefix + * typename_utf8 = prefix + ':' + typename_utf8 + */ + if (!(__pyx_v_c_ns->prefix != NULL)) { + __pyx_t_7 = ((__pyx_v_c_ns->prefix[0]) != '\x00'); + } else { + __pyx_t_7 = (__pyx_v_c_ns->prefix != NULL); + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1702 + * typename_utf8 = prefix + ':' + name + * elif c_ns.prefix is not NULL or c_ns.prefix[0] != c'\0': + * prefix = c_ns.prefix # <<<<<<<<<<<<<< + * typename_utf8 = prefix + ':' + typename_utf8 + * c_ns = cetree.findOrBuildNodeNsPrefix( + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1703 + * elif c_ns.prefix is not NULL or c_ns.prefix[0] != c'\0': + * prefix = c_ns.prefix + * typename_utf8 = prefix + ':' + typename_utf8 # <<<<<<<<<<<<<< + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + */ + __pyx_t_3 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_kp_b_32)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_typename_utf8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __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_typename_utf8); + __pyx_v_typename_utf8 = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L35; + } + __pyx_L35:; + goto __pyx_L34; + } + __pyx_L34:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1705 + * typename_utf8 = prefix + ':' + typename_utf8 + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') # <<<<<<<<<<<<<< + * tree.xmlSetNsProp(c_node, c_ns, "type", _cstr(typename_utf8)) + * + */ + __pyx_v_c_ns = findOrBuildNodeNsPrefix(__pyx_v_doc, __pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_xsi); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1706 + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + * tree.xmlSetNsProp(c_node, c_ns, "type", _cstr(typename_utf8)) # <<<<<<<<<<<<<< + * + * if annotate_pytype: + */ + xmlSetNsProp(__pyx_v_c_node, __pyx_v_c_ns, __pyx_k_type, PyString_AS_STRING(__pyx_v_typename_utf8)); + } + __pyx_L33:; + goto __pyx_L32; + } + __pyx_L32:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1708 + * tree.xmlSetNsProp(c_node, c_ns, "type", _cstr(typename_utf8)) + * + * if annotate_pytype: # <<<<<<<<<<<<<< + * if pytype is None: + * # delete attribute if it exists + */ + __pyx_t_7 = __pyx_v_annotate_pytype; + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1709 + * + * if annotate_pytype: + * if pytype is None: # <<<<<<<<<<<<<< + * # delete attribute if it exists + * cetree.delAttributeFromNsName( + */ + __pyx_t_7 = (((PyObject *)__pyx_v_pytype) == Py_None); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1712 + * # delete attribute if it exists + * cetree.delAttributeFromNsName( + * c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) # <<<<<<<<<<<<<< + * else: + * # update or create attribute + */ + delAttributeFromNsName(__pyx_v_c_node, __pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE, __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME); + goto __pyx_L38; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1716 + * # update or create attribute + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _PYTYPE_NAMESPACE, 'py') # <<<<<<<<<<<<<< + * pytype_name = cetree.utf8(pytype.name) + * tree.xmlSetNsProp(c_node, c_ns, _PYTYPE_ATTRIBUTE_NAME, + */ + __pyx_v_c_ns = findOrBuildNodeNsPrefix(__pyx_v_doc, __pyx_v_c_node, __pyx_v_4lxml_9objectify__PYTYPE_NAMESPACE, __pyx_k_py); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1717 + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _PYTYPE_NAMESPACE, 'py') + * pytype_name = cetree.utf8(pytype.name) # <<<<<<<<<<<<<< + * tree.xmlSetNsProp(c_node, c_ns, _PYTYPE_ATTRIBUTE_NAME, + * _cstr(pytype_name)) + */ + __pyx_t_2 = utf8(__pyx_v_pytype->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_pytype_name); + __pyx_v_pytype_name = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1719 + * pytype_name = cetree.utf8(pytype.name) + * tree.xmlSetNsProp(c_node, c_ns, _PYTYPE_ATTRIBUTE_NAME, + * _cstr(pytype_name)) # <<<<<<<<<<<<<< + * if pytype is NoneType: + * c_ns = cetree.findOrBuildNodeNsPrefix( + */ + xmlSetNsProp(__pyx_v_c_node, __pyx_v_c_ns, __pyx_v_4lxml_9objectify__PYTYPE_ATTRIBUTE_NAME, PyString_AS_STRING(__pyx_v_pytype_name)); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1720 + * tree.xmlSetNsProp(c_node, c_ns, _PYTYPE_ATTRIBUTE_NAME, + * _cstr(pytype_name)) + * if pytype is NoneType: # <<<<<<<<<<<<<< + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + */ + __pyx_t_7 = (__pyx_v_pytype == __pyx_v_NoneType); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1722 + * if pytype is NoneType: + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') # <<<<<<<<<<<<<< + * tree.xmlSetNsProp(c_node, c_ns, "nil", "true") + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + */ + __pyx_v_c_ns = findOrBuildNodeNsPrefix(__pyx_v_doc, __pyx_v_c_node, __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS, __pyx_k_xsi); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1723 + * c_ns = cetree.findOrBuildNodeNsPrefix( + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + * tree.xmlSetNsProp(c_node, c_ns, "nil", "true") # <<<<<<<<<<<<<< + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + * + */ + xmlSetNsProp(__pyx_v_c_node, __pyx_v_c_ns, __pyx_k_nil, __pyx_k_true); + goto __pyx_L39; + } + __pyx_L39:; + } + __pyx_L38:; + goto __pyx_L37; + } + __pyx_L37:; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1724 + * doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + * tree.xmlSetNsProp(c_node, c_ns, "nil", "true") + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) # <<<<<<<<<<<<<< + * + * cdef object _strip_attributes = etree.strip_attributes + */ + END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node); + + __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_6); + __Pyx_AddTraceback("lxml.objectify._annotate"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_doc); + __Pyx_DECREF((PyObject *)__pyx_v_pytype); + __Pyx_DECREF((PyObject *)__pyx_v_empty_pytype); + __Pyx_DECREF((PyObject *)__pyx_v_StrType); + __Pyx_DECREF((PyObject *)__pyx_v_NoneType); + __Pyx_DECREF(__pyx_v_typename); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_istree); + __Pyx_DECREF(__pyx_v_prefix); + __Pyx_DECREF(__pyx_v_old_pytypename); + __Pyx_DECREF(__pyx_v_typename_utf8); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_pytype_name); + __Pyx_DECREF((PyObject *)__pyx_v_element); + __Pyx_DECREF(__pyx_v_empty_type_name); + __Pyx_DECREF(__pyx_v_empty_pytype_name); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1728 + * cdef object _strip_attributes = etree.strip_attributes + * + * def deannotate(element_or_tree, *, pytype=True, xsi=True, xsi_nil=False): # <<<<<<<<<<<<<< + * u"""deannotate(element_or_tree, pytype=True, xsi=True, xsi_nil=False) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_deannotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_deannotate[] = "deannotate(element_or_tree, pytype=True, xsi=True, xsi_nil=False)\n\n Recursively de-annotate the elements of an XML tree by removing 'py:pytype'\n and/or 'xsi:type' attributes and/or 'xsi:nil' attributes.\n\n If the 'pytype' keyword argument is True (the default), 'py:pytype'\n attributes will be removed. If the 'xsi' keyword argument is True (the \n default), 'xsi:type' attributes will be removed.\n If the 'xsi_nil' keyword argument is True (default: False), 'xsi:nil'\n attributes will be removed.\n\n Note that this does not touch the namespace declarations. If you\n want to remove unused namespace declarations from the tree, use\n ``lxml.etree.cleanup_namespaces()``.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_deannotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_element_or_tree = 0; + PyObject *__pyx_v_pytype = 0; + PyObject *__pyx_v_xsi = 0; + PyObject *__pyx_v_xsi_nil = 0; + PyObject *__pyx_v_attribute_names = 0; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_element_or_tree,&__pyx_n_ui_pytype,&__pyx_n_ui_xsi,&__pyx_n_ui_xsi_nil,0}; + __Pyx_SetupRefcountContext("deannotate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = __pyx_k_39; + values[2] = __pyx_k_40; + values[3] = __pyx_k_41; + 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_ui_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_ui_pytype); + if (value) { values[1] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_xsi); + if (value) { values[2] = value; if (!(--kw_args)) break; } + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_xsi_nil); + 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), "deannotate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_element_or_tree = values[0]; + __pyx_v_pytype = values[1]; + __pyx_v_xsi = values[2]; + __pyx_v_xsi_nil = values[3]; + } 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_pytype = __pyx_k_39; + __pyx_v_xsi = __pyx_k_40; + __pyx_v_xsi_nil = __pyx_k_41; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("deannotate", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.deannotate"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_element_or_tree); + __Pyx_INCREF(__pyx_v_pytype); + __Pyx_INCREF(__pyx_v_xsi); + __Pyx_INCREF(__pyx_v_xsi_nil); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1744 + * ``lxml.etree.cleanup_namespaces()``. + * """ + * cdef list attribute_names = [] # <<<<<<<<<<<<<< + * + * if pytype: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_attribute_names = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1746 + * cdef list attribute_names = [] + * + * if pytype: # <<<<<<<<<<<<<< + * attribute_names.append(PYTYPE_ATTRIBUTE) + * if xsi: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pytype); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1747 + * + * if pytype: + * attribute_names.append(PYTYPE_ATTRIBUTE) # <<<<<<<<<<<<<< + * if xsi: + * attribute_names.append(XML_SCHEMA_INSTANCE_TYPE_ATTR) + */ + if (unlikely(__pyx_v_attribute_names == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_attribute_names), __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1748 + * if pytype: + * attribute_names.append(PYTYPE_ATTRIBUTE) + * if xsi: # <<<<<<<<<<<<<< + * attribute_names.append(XML_SCHEMA_INSTANCE_TYPE_ATTR) + * if xsi_nil: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_xsi); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1749 + * attribute_names.append(PYTYPE_ATTRIBUTE) + * if xsi: + * attribute_names.append(XML_SCHEMA_INSTANCE_TYPE_ATTR) # <<<<<<<<<<<<<< + * if xsi_nil: + * attribute_names.append(XML_SCHEMA_INSTANCE_NIL_ATTR) + */ + if (unlikely(__pyx_v_attribute_names == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_attribute_names), __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1750 + * if xsi: + * attribute_names.append(XML_SCHEMA_INSTANCE_TYPE_ATTR) + * if xsi_nil: # <<<<<<<<<<<<<< + * attribute_names.append(XML_SCHEMA_INSTANCE_NIL_ATTR) + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_xsi_nil); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1751 + * attribute_names.append(XML_SCHEMA_INSTANCE_TYPE_ATTR) + * if xsi_nil: + * attribute_names.append(XML_SCHEMA_INSTANCE_NIL_ATTR) # <<<<<<<<<<<<<< + * + * _strip_attributes(element_or_tree, *attribute_names) + */ + if (unlikely(__pyx_v_attribute_names == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_attribute_names), __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1753 + * attribute_names.append(XML_SCHEMA_INSTANCE_NIL_ATTR) + * + * _strip_attributes(element_or_tree, *attribute_names) # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_element_or_tree); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_element_or_tree); + __Pyx_GIVEREF(__pyx_v_element_or_tree); + __pyx_t_4 = PySequence_Tuple(((PyObject *)__pyx_v_attribute_names)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __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_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_v_4lxml_9objectify__strip_attributes, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __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_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.objectify.deannotate"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_attribute_names); + __Pyx_DECREF(__pyx_v_element_or_tree); + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_DECREF(__pyx_v_xsi); + __Pyx_DECREF(__pyx_v_xsi_nil); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1765 + * objectify_parser = __DEFAULT_PARSER + * + * def set_default_parser(new_parser = None): # <<<<<<<<<<<<<< + * u"""set_default_parser(new_parser = None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_set_default_parser[] = "set_default_parser(new_parser = None)\n\n Replace the default parser used by objectify's Element() and\n fromstring() functions.\n\n The new parser must be an etree.XMLParser.\n\n Call without arguments to reset to the original parser.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_new_parser = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_new_parser,0}; + __Pyx_SetupRefcountContext("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 *)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_ui_new_parser); + if (unlikely(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[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_new_parser = values[0]; + } else { + __pyx_v_new_parser = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: __pyx_v_new_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("set_default_parser", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.set_default_parser"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_new_parser); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1776 + * """ + * global objectify_parser + * if new_parser is None: # <<<<<<<<<<<<<< + * objectify_parser = __DEFAULT_PARSER + * elif isinstance(new_parser, etree.XMLParser): + */ + __pyx_t_1 = (__pyx_v_new_parser == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1777 + * global objectify_parser + * if new_parser is None: + * objectify_parser = __DEFAULT_PARSER # <<<<<<<<<<<<<< + * elif isinstance(new_parser, etree.XMLParser): + * objectify_parser = new_parser + */ + __Pyx_INCREF(__pyx_v_4lxml_9objectify___DEFAULT_PARSER); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_GIVEREF(__pyx_v_4lxml_9objectify___DEFAULT_PARSER); + __pyx_v_4lxml_9objectify_objectify_parser = __pyx_v_4lxml_9objectify___DEFAULT_PARSER; + goto __pyx_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1778 + * if new_parser is None: + * objectify_parser = __DEFAULT_PARSER + * elif isinstance(new_parser, etree.XMLParser): # <<<<<<<<<<<<<< + * objectify_parser = new_parser + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_XMLParser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_IsInstance(__pyx_v_new_parser, __pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1779 + * objectify_parser = __DEFAULT_PARSER + * elif isinstance(new_parser, etree.XMLParser): + * objectify_parser = new_parser # <<<<<<<<<<<<<< + * else: + * raise TypeError, u"parser must inherit from lxml.etree.XMLParser" + */ + __Pyx_INCREF(__pyx_v_new_parser); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_GIVEREF(__pyx_v_new_parser); + __pyx_v_4lxml_9objectify_objectify_parser = __pyx_v_new_parser; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1781 + * objectify_parser = new_parser + * else: + * raise TypeError, u"parser must inherit from lxml.etree.XMLParser" # <<<<<<<<<<<<<< + * + * def makeparser(**kw): + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_42), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __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_2); + __Pyx_AddTraceback("lxml.objectify.set_default_parser"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_new_parser); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1783 + * raise TypeError, u"parser must inherit from lxml.etree.XMLParser" + * + * def makeparser(**kw): # <<<<<<<<<<<<<< + * u"""makeparser(remove_blank_text=True, **kw) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_makeparser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_makeparser[] = "makeparser(remove_blank_text=True, **kw)\n\n Create a new XML parser for objectify trees.\n\n You can pass all keyword arguments that are supported by\n ``etree.XMLParser()``. Note that this parser defaults to removing\n blank text. You can disable this by passing the\n ``remove_blank_text`` boolean keyword option yourself.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_makeparser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kw = 0; + PyObject *__pyx_v_remove_blank_text; + PyObject *__pyx_v_parser; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_SetupRefcountContext("makeparser"); + __pyx_self = __pyx_self; + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("makeparser", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "makeparser", 1))) return NULL; + __pyx_v_kw = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); + if (unlikely(!__pyx_v_kw)) return NULL; + __Pyx_GOTREF(__pyx_v_kw); + __pyx_v_remove_blank_text = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_parser = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1793 + * ``remove_blank_text`` boolean keyword option yourself. + * """ + * if python.IS_PYTHON3: # <<<<<<<<<<<<<< + * remove_blank_text = u'remove_blank_text' + * else: + */ + __pyx_t_1 = IS_PYTHON3; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1794 + * """ + * if python.IS_PYTHON3: + * remove_blank_text = u'remove_blank_text' # <<<<<<<<<<<<<< + * else: + * remove_blank_text = 'remove_blank_text' + */ + __Pyx_INCREF(((PyObject *)__pyx_n_u_remove_blank_text)); + __Pyx_DECREF(__pyx_v_remove_blank_text); + __pyx_v_remove_blank_text = ((PyObject *)__pyx_n_u_remove_blank_text); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1796 + * remove_blank_text = u'remove_blank_text' + * else: + * remove_blank_text = 'remove_blank_text' # <<<<<<<<<<<<<< + * if remove_blank_text not in kw: + * kw[remove_blank_text] = True + */ + __Pyx_INCREF(((PyObject *)__pyx_n_b_remove_blank_text)); + __Pyx_DECREF(__pyx_v_remove_blank_text); + __pyx_v_remove_blank_text = ((PyObject *)__pyx_n_b_remove_blank_text); + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1797 + * else: + * remove_blank_text = 'remove_blank_text' + * if remove_blank_text not in kw: # <<<<<<<<<<<<<< + * kw[remove_blank_text] = True + * parser = etree.XMLParser(**kw) + */ + __pyx_t_1 = (!PySequence_Contains(__pyx_v_kw, __pyx_v_remove_blank_text)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1798 + * remove_blank_text = 'remove_blank_text' + * if remove_blank_text not in kw: + * kw[remove_blank_text] = True # <<<<<<<<<<<<<< + * parser = etree.XMLParser(**kw) + * parser.set_element_class_lookup( ObjectifyElementClassLookup() ) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_v_kw, __pyx_v_remove_blank_text, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1799 + * if remove_blank_text not in kw: + * kw[remove_blank_text] = True + * parser = etree.XMLParser(**kw) # <<<<<<<<<<<<<< + * parser.set_element_class_lookup( ObjectifyElementClassLookup() ) + * return parser + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_XMLParser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), __pyx_v_kw); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __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_parser); + __pyx_v_parser = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1800 + * kw[remove_blank_text] = True + * parser = etree.XMLParser(**kw) + * parser.set_element_class_lookup( ObjectifyElementClassLookup() ) # <<<<<<<<<<<<<< + * return parser + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_parser, __pyx_n_ui_43); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifyElementClassLookup)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __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[0]; __pyx_lineno = 1800; __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[0]; __pyx_lineno = 1800; __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_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1801 + * parser = etree.XMLParser(**kw) + * parser.set_element_class_lookup( ObjectifyElementClassLookup() ) + * return parser # <<<<<<<<<<<<<< + * + * cdef _Element _makeElement(tag, text, attrib, nsmap): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_parser); + __pyx_r = __pyx_v_parser; + 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.objectify.makeparser"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_kw); + __Pyx_DECREF(__pyx_v_remove_blank_text); + __Pyx_DECREF(__pyx_v_parser); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1803 + * return parser + * + * cdef _Element _makeElement(tag, text, attrib, nsmap): # <<<<<<<<<<<<<< + * return cetree.makeElement(tag, None, objectify_parser, text, None, attrib, nsmap) + * + */ + +static struct LxmlElement *__pyx_f_4lxml_9objectify__makeElement(PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) { + struct LxmlElement *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("_makeElement"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1804 + * + * cdef _Element _makeElement(tag, text, attrib, nsmap): + * return cetree.makeElement(tag, None, objectify_parser, text, None, attrib, nsmap) # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = ((PyObject *)makeElement(__pyx_v_tag, ((struct LxmlDocument *)Py_None), __pyx_v_4lxml_9objectify_objectify_parser, __pyx_v_text, Py_None, __pyx_v_attrib, __pyx_v_nsmap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __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.objectify._makeElement"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1812 + * _fromstring = etree.fromstring + * + * def fromstring(xml, parser=None, *, base_url=None): # <<<<<<<<<<<<<< + * u"""fromstring(xml, parser=None, base_url=None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_fromstring[] = "fromstring(xml, parser=None, base_url=None)\n\n Objectify specific version of the lxml.etree fromstring() function\n that uses the objectify parser.\n\n You can pass a different parser as second 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 PyObject *__pyx_pf_4lxml_9objectify_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_xml = 0; + PyObject *__pyx_v_parser = 0; + PyObject *__pyx_v_base_url = 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_ui_xml,&__pyx_n_ui_parser,&__pyx_n_ui_base_url,0}; + __Pyx_SetupRefcountContext("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 *)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_ui_xml); + 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_ui_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_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 = 1812; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_xml = 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_xml = 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 = 1812; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.fromstring"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_xml); + __Pyx_INCREF(__pyx_v_parser); + __Pyx_INCREF(__pyx_v_base_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1824 + * (DTD, XInclude, ...). + * """ + * if parser is None: # <<<<<<<<<<<<<< + * parser = objectify_parser + * return _fromstring(xml, parser, base_url=base_url) + */ + __pyx_t_1 = (__pyx_v_parser == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1825 + * """ + * if parser is None: + * parser = objectify_parser # <<<<<<<<<<<<<< + * return _fromstring(xml, parser, base_url=base_url) + * + */ + __Pyx_INCREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_DECREF(__pyx_v_parser); + __pyx_v_parser = __pyx_v_4lxml_9objectify_objectify_parser; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1826 + * if parser is None: + * parser = objectify_parser + * return _fromstring(xml, parser, base_url=base_url) # <<<<<<<<<<<<<< + * + * def XML(xml, parser=None, *, base_url=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_xml); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xml); + __Pyx_GIVEREF(__pyx_v_xml); + __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[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_ui_base_url, __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_v_4lxml_9objectify__fromstring, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __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; + + __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.objectify.fromstring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_xml); + __Pyx_DECREF(__pyx_v_parser); + __Pyx_DECREF(__pyx_v_base_url); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1828 + * return _fromstring(xml, parser, base_url=base_url) + * + * def XML(xml, parser=None, *, base_url=None): # <<<<<<<<<<<<<< + * u"""XML(xml, parser=None, base_url=None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_XML[] = "XML(xml, parser=None, base_url=None)\n\n Objectify specific version of the lxml.etree XML() literal factory\n that uses the objectify parser.\n\n You can pass a different parser as second 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 PyObject *__pyx_pf_4lxml_9objectify_XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_xml = 0; + PyObject *__pyx_v_parser = 0; + PyObject *__pyx_v_base_url = 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_ui_xml,&__pyx_n_ui_parser,&__pyx_n_ui_base_url,0}; + __Pyx_SetupRefcountContext("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 *)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_ui_xml); + 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_ui_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_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 = 1828; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_xml = 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_xml = 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 = 1828; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.XML"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_xml); + __Pyx_INCREF(__pyx_v_parser); + __Pyx_INCREF(__pyx_v_base_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1840 + * (DTD, XInclude, ...). + * """ + * if parser is None: # <<<<<<<<<<<<<< + * parser = objectify_parser + * return _fromstring(xml, parser, base_url=base_url) + */ + __pyx_t_1 = (__pyx_v_parser == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1841 + * """ + * if parser is None: + * parser = objectify_parser # <<<<<<<<<<<<<< + * return _fromstring(xml, parser, base_url=base_url) + * + */ + __Pyx_INCREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_DECREF(__pyx_v_parser); + __pyx_v_parser = __pyx_v_4lxml_9objectify_objectify_parser; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1842 + * if parser is None: + * parser = objectify_parser + * return _fromstring(xml, parser, base_url=base_url) # <<<<<<<<<<<<<< + * + * cdef object _parse + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_xml); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xml); + __Pyx_GIVEREF(__pyx_v_xml); + __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[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_ui_base_url, __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_v_4lxml_9objectify__fromstring, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __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; + + __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.objectify.XML"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_xml); + __Pyx_DECREF(__pyx_v_parser); + __Pyx_DECREF(__pyx_v_base_url); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1847 + * _parse = etree.parse + * + * def parse(f, parser=None, *, base_url=None): # <<<<<<<<<<<<<< + * u"""parse(f, parser=None, base_url=None) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_parse[] = "parse(f, parser=None, base_url=None)\n\n Parse a file or file-like object with the objectify parser.\n\n You can pass a different parser as second argument.\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 PyObject *__pyx_pf_4lxml_9objectify_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + PyObject *__pyx_v_parser = 0; + PyObject *__pyx_v_base_url = 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_ui_f,&__pyx_n_ui_parser,&__pyx_n_ui_base_url,0}; + __Pyx_SetupRefcountContext("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 *)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_ui_f); + 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_ui_parser); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + while (kw_args > 0) { + PyObject* value; + value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_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 = 1847; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_f = 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_f = 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 = 1847; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.parse"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_f); + __Pyx_INCREF(__pyx_v_parser); + __Pyx_INCREF(__pyx_v_base_url); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1858 + * up external entities (DTD, XInclude, ...) with relative paths. + * """ + * if parser is None: # <<<<<<<<<<<<<< + * parser = objectify_parser + * return _parse(f, parser, base_url=base_url) + */ + __pyx_t_1 = (__pyx_v_parser == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1859 + * """ + * if parser is None: + * parser = objectify_parser # <<<<<<<<<<<<<< + * return _parse(f, parser, base_url=base_url) + * + */ + __Pyx_INCREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_DECREF(__pyx_v_parser); + __pyx_v_parser = __pyx_v_4lxml_9objectify_objectify_parser; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1860 + * if parser is None: + * parser = objectify_parser + * return _parse(f, parser, base_url=base_url) # <<<<<<<<<<<<<< + * + * cdef dict _DEFAULT_NSMAP + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __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[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_ui_base_url, __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_v_4lxml_9objectify__parse, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __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; + + __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.objectify.parse"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_DECREF(__pyx_v_parser); + __Pyx_DECREF(__pyx_v_base_url); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1869 + * E = ElementMaker() + * + * def Element(_tag, attrib=None, nsmap=None, *, _pytype=None, **_attributes): # <<<<<<<<<<<<<< + * u"""Element(_tag, attrib=None, nsmap=None, _pytype=None, **_attributes) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_Element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_Element[] = "Element(_tag, attrib=None, nsmap=None, _pytype=None, **_attributes)\n\n Objectify specific version of the lxml.etree Element() factory that\n always creates a structural (tree) element.\n\n NOTE: requires parser based element class lookup activated in lxml.etree!\n "; +static PyObject *__pyx_pf_4lxml_9objectify_Element(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__pytype = 0; + PyObject *__pyx_v__attributes = 0; + 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; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui__tag,&__pyx_n_ui_attrib,&__pyx_n_ui_nsmap,&__pyx_n_ui__pytype,0}; + __Pyx_SetupRefcountContext("Element"); + __pyx_self = __pyx_self; + __pyx_v__attributes = PyDict_New(); if (unlikely(!__pyx_v__attributes)) return NULL; + __Pyx_GOTREF(__pyx_v__attributes); + 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] = ((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_ui__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_ui_attrib); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_nsmap); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__attributes, values, PyTuple_GET_SIZE(__pyx_args), "Element") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v__tag = values[0]; + __pyx_v_attrib = values[1]; + __pyx_v_nsmap = values[2]; + __pyx_v__pytype = values[3]; + } else { + __pyx_v_attrib = ((PyObject *)Py_None); + __pyx_v_nsmap = ((PyObject *)Py_None); + __pyx_v__pytype = ((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 = 1869; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__attributes); + __Pyx_AddTraceback("lxml.objectify.Element"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v__tag); + __Pyx_INCREF(__pyx_v_attrib); + __Pyx_INCREF(__pyx_v_nsmap); + __Pyx_INCREF(__pyx_v__pytype); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1877 + * NOTE: requires parser based element class lookup activated in lxml.etree! + * """ + * if attrib is not None: # <<<<<<<<<<<<<< + * if python.PyDict_Size(_attributes): + * attrib.update(_attributes) + */ + __pyx_t_1 = (__pyx_v_attrib != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1878 + * """ + * if attrib is not None: + * if python.PyDict_Size(_attributes): # <<<<<<<<<<<<<< + * attrib.update(_attributes) + * _attributes = attrib + */ + __pyx_t_2 = PyDict_Size(__pyx_v__attributes); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1879 + * if attrib is not None: + * if python.PyDict_Size(_attributes): + * attrib.update(_attributes) # <<<<<<<<<<<<<< + * _attributes = attrib + * if _pytype is None: + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_attrib, __pyx_n_ui_update); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __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[0]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v__attributes); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__attributes); + __Pyx_GIVEREF(__pyx_v__attributes); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __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_t_5); __pyx_t_5 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1880 + * if python.PyDict_Size(_attributes): + * attrib.update(_attributes) + * _attributes = attrib # <<<<<<<<<<<<<< + * if _pytype is None: + * _pytype = TREE_PYTYPE_NAME + */ + __Pyx_INCREF(__pyx_v_attrib); + __Pyx_DECREF(__pyx_v__attributes); + __pyx_v__attributes = __pyx_v_attrib; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1881 + * attrib.update(_attributes) + * _attributes = attrib + * if _pytype is None: # <<<<<<<<<<<<<< + * _pytype = TREE_PYTYPE_NAME + * if nsmap is None: + */ + __pyx_t_1 = (__pyx_v__pytype == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1882 + * _attributes = attrib + * if _pytype is None: + * _pytype = TREE_PYTYPE_NAME # <<<<<<<<<<<<<< + * if nsmap is None: + * nsmap = _DEFAULT_NSMAP + */ + __Pyx_INCREF(__pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME); + __Pyx_DECREF(__pyx_v__pytype); + __pyx_v__pytype = __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1883 + * if _pytype is None: + * _pytype = TREE_PYTYPE_NAME + * if nsmap is None: # <<<<<<<<<<<<<< + * nsmap = _DEFAULT_NSMAP + * _attributes[PYTYPE_ATTRIBUTE] = _pytype + */ + __pyx_t_1 = (__pyx_v_nsmap == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1884 + * _pytype = TREE_PYTYPE_NAME + * if nsmap is None: + * nsmap = _DEFAULT_NSMAP # <<<<<<<<<<<<<< + * _attributes[PYTYPE_ATTRIBUTE] = _pytype + * return _makeElement(_tag, None, _attributes, nsmap) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + __Pyx_DECREF(__pyx_v_nsmap); + __pyx_v_nsmap = ((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP); + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1885 + * if nsmap is None: + * nsmap = _DEFAULT_NSMAP + * _attributes[PYTYPE_ATTRIBUTE] = _pytype # <<<<<<<<<<<<<< + * return _makeElement(_tag, None, _attributes, nsmap) + * + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyObject_SetItem(__pyx_v__attributes, __pyx_t_5, __pyx_v__pytype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1886 + * nsmap = _DEFAULT_NSMAP + * _attributes[PYTYPE_ATTRIBUTE] = _pytype + * return _makeElement(_tag, None, _attributes, nsmap) # <<<<<<<<<<<<<< + * + * def DataElement(_value, attrib=None, nsmap=None, *, _pytype=None, _xsi=None, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_9objectify__makeElement(__pyx_v__tag, Py_None, __pyx_v__attributes, __pyx_v_nsmap)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; __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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.objectify.Element"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v__attributes); + __Pyx_DECREF(__pyx_v__tag); + __Pyx_DECREF(__pyx_v_attrib); + __Pyx_DECREF(__pyx_v_nsmap); + __Pyx_DECREF(__pyx_v__pytype); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1888 + * return _makeElement(_tag, None, _attributes, nsmap) + * + * def DataElement(_value, attrib=None, nsmap=None, *, _pytype=None, _xsi=None, # <<<<<<<<<<<<<< + * **_attributes): + * u"""DataElement(_value, attrib=None, nsmap=None, _pytype=None, _xsi=None, **_attributes) + */ + +static PyObject *__pyx_pf_4lxml_9objectify_DataElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_DataElement[] = "DataElement(_value, attrib=None, nsmap=None, _pytype=None, _xsi=None, **_attributes)\n\n Create a new element from a Python value and XML attributes taken from\n keyword arguments or a dictionary passed as second argument.\n\n Automatically adds a 'pytype' attribute for the Python type of the value,\n if the type can be identified. If '_pytype' or '_xsi' are among the\n keyword arguments, they will be used instead.\n\n If the _value argument is an ObjectifiedDataElement instance, its py:pytype,\n xsi:type and other attributes and nsmap are reused unless they are redefined\n in attrib and/or keyword arguments.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_DataElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v__value = 0; + PyObject *__pyx_v_attrib = 0; + PyObject *__pyx_v_nsmap = 0; + PyObject *__pyx_v__pytype = 0; + PyObject *__pyx_v__xsi = 0; + PyObject *__pyx_v__attributes = 0; + PyObject *__pyx_v_dict_result; + PyObject *__pyx_v_temp; + PyObject *__pyx_v_prefix; + PyObject *__pyx_v_name; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_strval; + PyObject *__pyx_v_type_check; + PyObject *__pyx_r = NULL; + 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; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui__value,&__pyx_n_ui_attrib,&__pyx_n_ui_nsmap,&__pyx_n_ui__pytype,&__pyx_n_ui__xsi,0}; + __Pyx_SetupRefcountContext("DataElement"); + __pyx_self = __pyx_self; + __pyx_v__attributes = PyDict_New(); if (unlikely(!__pyx_v__attributes)) return NULL; + __Pyx_GOTREF(__pyx_v__attributes); + 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] = ((PyObject *)Py_None); + values[4] = ((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_ui__value); + 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_ui_attrib); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_nsmap); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__attributes, values, PyTuple_GET_SIZE(__pyx_args), "DataElement") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v__value = values[0]; + __pyx_v_attrib = values[1]; + __pyx_v_nsmap = values[2]; + __pyx_v__pytype = values[3]; + __pyx_v__xsi = values[4]; + } else { + __pyx_v_attrib = ((PyObject *)Py_None); + __pyx_v_nsmap = ((PyObject *)Py_None); + __pyx_v__pytype = ((PyObject *)Py_None); + __pyx_v__xsi = ((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__value = 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("DataElement", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v__attributes); + __Pyx_AddTraceback("lxml.objectify.DataElement"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v__value); + __Pyx_INCREF(__pyx_v_attrib); + __Pyx_INCREF(__pyx_v_nsmap); + __Pyx_INCREF(__pyx_v__pytype); + __Pyx_INCREF(__pyx_v__xsi); + __pyx_v_temp = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_prefix = 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_strval = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_type_check = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1904 + * """ + * cdef python.PyObject* dict_result + * if nsmap is None: # <<<<<<<<<<<<<< + * nsmap = _DEFAULT_NSMAP + * if attrib is not None and attrib: + */ + __pyx_t_1 = (__pyx_v_nsmap == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1905 + * cdef python.PyObject* dict_result + * if nsmap is None: + * nsmap = _DEFAULT_NSMAP # <<<<<<<<<<<<<< + * if attrib is not None and attrib: + * if python.PyDict_Size(_attributes): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + __Pyx_DECREF(__pyx_v_nsmap); + __pyx_v_nsmap = ((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1906 + * if nsmap is None: + * nsmap = _DEFAULT_NSMAP + * if attrib is not None and attrib: # <<<<<<<<<<<<<< + * if python.PyDict_Size(_attributes): + * attrib = dict(attrib) + */ + __pyx_t_1 = (__pyx_v_attrib != Py_None); + if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1906; __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-2.2/src/lxml/lxml.objectify.pyx":1907 + * nsmap = _DEFAULT_NSMAP + * if attrib is not None and attrib: + * if python.PyDict_Size(_attributes): # <<<<<<<<<<<<<< + * attrib = dict(attrib) + * attrib.update(_attributes) + */ + __pyx_t_4 = PyDict_Size(__pyx_v__attributes); + if (__pyx_t_4) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1908 + * if attrib is not None and attrib: + * if python.PyDict_Size(_attributes): + * attrib = dict(attrib) # <<<<<<<<<<<<<< + * attrib.update(_attributes) + * _attributes = attrib + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_attrib); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_attrib); + __Pyx_GIVEREF(__pyx_v_attrib); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_attrib); + __pyx_v_attrib = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1909 + * if python.PyDict_Size(_attributes): + * attrib = dict(attrib) + * attrib.update(_attributes) # <<<<<<<<<<<<<< + * _attributes = attrib + * if isinstance(_value, ObjectifiedElement): + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_attrib, __pyx_n_ui_update); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1909; __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[0]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v__attributes); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__attributes); + __Pyx_GIVEREF(__pyx_v__attributes); + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1910 + * attrib = dict(attrib) + * attrib.update(_attributes) + * _attributes = attrib # <<<<<<<<<<<<<< + * if isinstance(_value, ObjectifiedElement): + * if _pytype is None: + */ + __Pyx_INCREF(__pyx_v_attrib); + __Pyx_DECREF(__pyx_v__attributes); + __pyx_v__attributes = __pyx_v_attrib; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1911 + * attrib.update(_attributes) + * _attributes = attrib + * if isinstance(_value, ObjectifiedElement): # <<<<<<<<<<<<<< + * if _pytype is None: + * if _xsi is None and not _attributes and nsmap is _DEFAULT_NSMAP: + */ + __pyx_t_3 = PyObject_TypeCheck(__pyx_v__value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1912 + * _attributes = attrib + * if isinstance(_value, ObjectifiedElement): + * if _pytype is None: # <<<<<<<<<<<<<< + * if _xsi is None and not _attributes and nsmap is _DEFAULT_NSMAP: + * # special case: no change! + */ + __pyx_t_3 = (__pyx_v__pytype == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1913 + * if isinstance(_value, ObjectifiedElement): + * if _pytype is None: + * if _xsi is None and not _attributes and nsmap is _DEFAULT_NSMAP: # <<<<<<<<<<<<<< + * # special case: no change! + * return _value.__copy__() + */ + __pyx_t_3 = (__pyx_v__xsi == Py_None); + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v__attributes); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ((!__pyx_t_1)) { + __pyx_t_2 = (__pyx_v_nsmap == ((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + __pyx_t_8 = __pyx_t_2; + } else { + __pyx_t_8 = (!__pyx_t_1); + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1915 + * if _xsi is None and not _attributes and nsmap is _DEFAULT_NSMAP: + * # special case: no change! + * return _value.__copy__() # <<<<<<<<<<<<<< + * if isinstance(_value, ObjectifiedDataElement): + * # reuse existing nsmap unless redefined in nsmap parameter + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyObject_GetAttr(__pyx_v__value, __pyx_n_ui___copy__); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L11; + } + __pyx_L11:; + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1916 + * # special case: no change! + * return _value.__copy__() + * if isinstance(_value, ObjectifiedDataElement): # <<<<<<<<<<<<<< + * # reuse existing nsmap unless redefined in nsmap parameter + * temp = _value.nsmap + */ + __pyx_t_1 = PyObject_TypeCheck(__pyx_v__value, ((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedDataElement))); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1918 + * if isinstance(_value, ObjectifiedDataElement): + * # reuse existing nsmap unless redefined in nsmap parameter + * temp = _value.nsmap # <<<<<<<<<<<<<< + * if temp is not None and temp: + * temp = dict(temp) + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v__value, __pyx_n_ui_nsmap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_temp); + __pyx_v_temp = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1919 + * # reuse existing nsmap unless redefined in nsmap parameter + * temp = _value.nsmap + * if temp is not None and temp: # <<<<<<<<<<<<<< + * temp = dict(temp) + * temp.update(nsmap) + */ + __pyx_t_1 = (__pyx_v_temp != Py_None); + if (__pyx_t_1) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_temp); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1920 + * temp = _value.nsmap + * if temp is not None and temp: + * temp = dict(temp) # <<<<<<<<<<<<<< + * temp.update(nsmap) + * nsmap = temp + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_temp); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_temp); + __Pyx_GIVEREF(__pyx_v_temp); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_temp); + __pyx_v_temp = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1921 + * if temp is not None and temp: + * temp = dict(temp) + * temp.update(nsmap) # <<<<<<<<<<<<<< + * nsmap = temp + * # reuse existing attributes unless redefined in attrib/_attributes + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_temp, __pyx_n_ui_update); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_nsmap); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_nsmap); + __Pyx_GIVEREF(__pyx_v_nsmap); + __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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-2.2/src/lxml/lxml.objectify.pyx":1922 + * temp = dict(temp) + * temp.update(nsmap) + * nsmap = temp # <<<<<<<<<<<<<< + * # reuse existing attributes unless redefined in attrib/_attributes + * temp = _value.attrib + */ + __Pyx_INCREF(__pyx_v_temp); + __Pyx_DECREF(__pyx_v_nsmap); + __pyx_v_nsmap = __pyx_v_temp; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1924 + * nsmap = temp + * # reuse existing attributes unless redefined in attrib/_attributes + * temp = _value.attrib # <<<<<<<<<<<<<< + * if temp is not None and temp: + * temp = dict(temp) + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v__value, __pyx_n_ui_attrib); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_temp); + __pyx_v_temp = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1925 + * # reuse existing attributes unless redefined in attrib/_attributes + * temp = _value.attrib + * if temp is not None and temp: # <<<<<<<<<<<<<< + * temp = dict(temp) + * temp.update(_attributes) + */ + __pyx_t_8 = (__pyx_v_temp != Py_None); + if (__pyx_t_8) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_temp); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_8; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1926 + * temp = _value.attrib + * if temp is not None and temp: + * temp = dict(temp) # <<<<<<<<<<<<<< + * temp.update(_attributes) + * _attributes = temp + */ + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_temp); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_temp); + __Pyx_GIVEREF(__pyx_v_temp); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_temp); + __pyx_v_temp = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1927 + * if temp is not None and temp: + * temp = dict(temp) + * temp.update(_attributes) # <<<<<<<<<<<<<< + * _attributes = temp + * # reuse existing xsi:type or py:pytype attributes, unless provided as + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_temp, __pyx_n_ui_update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1927; __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[0]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v__attributes); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v__attributes); + __Pyx_GIVEREF(__pyx_v__attributes); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1927; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1928 + * temp = dict(temp) + * temp.update(_attributes) + * _attributes = temp # <<<<<<<<<<<<<< + * # reuse existing xsi:type or py:pytype attributes, unless provided as + * # arguments + */ + __Pyx_INCREF(__pyx_v_temp); + __Pyx_DECREF(__pyx_v__attributes); + __pyx_v__attributes = __pyx_v_temp; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1931 + * # reuse existing xsi:type or py:pytype attributes, unless provided as + * # arguments + * if _xsi is None and _pytype is None: # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_attributes, + * XML_SCHEMA_INSTANCE_TYPE_ATTR) + */ + __pyx_t_3 = (__pyx_v__xsi == Py_None); + if (__pyx_t_3) { + __pyx_t_8 = (__pyx_v__pytype == Py_None); + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1933 + * if _xsi is None and _pytype is None: + * dict_result = python.PyDict_GetItem(_attributes, + * XML_SCHEMA_INSTANCE_TYPE_ATTR) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * _xsi = dict_result + */ + __pyx_v_dict_result = PyDict_GetItem(__pyx_v__attributes, __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1934 + * dict_result = python.PyDict_GetItem(_attributes, + * XML_SCHEMA_INSTANCE_TYPE_ATTR) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * _xsi = dict_result + * dict_result = python.PyDict_GetItem(_attributes, PYTYPE_ATTRIBUTE) + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1935 + * XML_SCHEMA_INSTANCE_TYPE_ATTR) + * if dict_result is not NULL: + * _xsi = dict_result # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_attributes, PYTYPE_ATTRIBUTE) + * if dict_result is not NULL: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_dict_result)); + __Pyx_DECREF(__pyx_v__xsi); + __pyx_v__xsi = ((PyObject *)__pyx_v_dict_result); + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1936 + * if dict_result is not NULL: + * _xsi = dict_result + * dict_result = python.PyDict_GetItem(_attributes, PYTYPE_ATTRIBUTE) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * _pytype = dict_result + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_dict_result = PyDict_GetItem(__pyx_v__attributes, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1937 + * _xsi = dict_result + * dict_result = python.PyDict_GetItem(_attributes, PYTYPE_ATTRIBUTE) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * _pytype = dict_result + * + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1938 + * dict_result = python.PyDict_GetItem(_attributes, PYTYPE_ATTRIBUTE) + * if dict_result is not NULL: + * _pytype = dict_result # <<<<<<<<<<<<<< + * + * if _xsi is not None: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_dict_result)); + __Pyx_DECREF(__pyx_v__pytype); + __pyx_v__pytype = ((PyObject *)__pyx_v_dict_result); + goto __pyx_L17; + } + __pyx_L17:; + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1940 + * _pytype = dict_result + * + * if _xsi is not None: # <<<<<<<<<<<<<< + * if u':' in _xsi: + * prefix, name = _xsi.split(u':', 1) + */ + __pyx_t_1 = (__pyx_v__xsi != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1941 + * + * if _xsi is not None: + * if u':' in _xsi: # <<<<<<<<<<<<<< + * prefix, name = _xsi.split(u':', 1) + * ns = nsmap.get(prefix) + */ + __pyx_t_1 = (PySequence_Contains(__pyx_v__xsi, ((PyObject *)__pyx_kp_u_32))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1942 + * if _xsi is not None: + * if u':' in _xsi: + * prefix, name = _xsi.split(u':', 1) # <<<<<<<<<<<<<< + * ns = nsmap.get(prefix) + * if ns != XML_SCHEMA_NS: + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v__xsi, __pyx_n_ui_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_32)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_u_32)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_32)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && 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_prefix); + __pyx_v_prefix = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_7; + __pyx_t_7 = 0; + } else { + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_prefix); + __pyx_v_prefix = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_7; + __pyx_t_7 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1943 + * if u':' in _xsi: + * prefix, name = _xsi.split(u':', 1) + * ns = nsmap.get(prefix) # <<<<<<<<<<<<<< + * if ns != XML_SCHEMA_NS: + * raise ValueError, u"XSD types require the XSD namespace" + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_nsmap, __pyx_n_ui_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_prefix); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_prefix); + __Pyx_GIVEREF(__pyx_v_prefix); + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __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_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1944 + * prefix, name = _xsi.split(u':', 1) + * ns = nsmap.get(prefix) + * if ns != XML_SCHEMA_NS: # <<<<<<<<<<<<<< + * raise ValueError, u"XSD types require the XSD namespace" + * elif nsmap is _DEFAULT_NSMAP: + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_ns, __pyx_v_4lxml_9objectify_XML_SCHEMA_NS, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1945 + * ns = nsmap.get(prefix) + * if ns != XML_SCHEMA_NS: + * raise ValueError, u"XSD types require the XSD namespace" # <<<<<<<<<<<<<< + * elif nsmap is _DEFAULT_NSMAP: + * name = _xsi + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_44), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L20; + } + __pyx_L20:; + goto __pyx_L19; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1946 + * if ns != XML_SCHEMA_NS: + * raise ValueError, u"XSD types require the XSD namespace" + * elif nsmap is _DEFAULT_NSMAP: # <<<<<<<<<<<<<< + * name = _xsi + * _xsi = u'xsd:' + _xsi + */ + __pyx_t_1 = (__pyx_v_nsmap == ((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1947 + * raise ValueError, u"XSD types require the XSD namespace" + * elif nsmap is _DEFAULT_NSMAP: + * name = _xsi # <<<<<<<<<<<<<< + * _xsi = u'xsd:' + _xsi + * else: + */ + __Pyx_INCREF(__pyx_v__xsi); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_v__xsi; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1948 + * elif nsmap is _DEFAULT_NSMAP: + * name = _xsi + * _xsi = u'xsd:' + _xsi # <<<<<<<<<<<<<< + * else: + * name = _xsi + */ + __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_u_45), __pyx_v__xsi); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v__xsi); + __pyx_v__xsi = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L19; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1950 + * _xsi = u'xsd:' + _xsi + * else: + * name = _xsi # <<<<<<<<<<<<<< + * for prefix, ns in nsmap.items(): + * if ns == XML_SCHEMA_NS: + */ + __Pyx_INCREF(__pyx_v__xsi); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_v__xsi; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1951 + * else: + * name = _xsi + * for prefix, ns in nsmap.items(): # <<<<<<<<<<<<<< + * if ns == XML_SCHEMA_NS: + * if prefix is not None and prefix: + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_nsmap, __pyx_n_ui_items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __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[0]; __pyx_lineno = 1951; __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_4 = 0; __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __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_4 >= PyList_GET_SIZE(__pyx_t_6)) break; + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_6))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; + } else { + __pyx_t_7 = PyIter_Next(__pyx_t_6); + if (!__pyx_t_7) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) { + PyObject* tuple = __pyx_t_7; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5); + __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_prefix); + __pyx_v_prefix = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_t_9; + __pyx_t_9 = 0; + } else { + __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_EndUnpack(__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __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_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_t_9; + __pyx_t_9 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1952 + * name = _xsi + * for prefix, ns in nsmap.items(): + * if ns == XML_SCHEMA_NS: # <<<<<<<<<<<<<< + * if prefix is not None and prefix: + * _xsi = prefix + u':' + _xsi + */ + __pyx_t_7 = PyObject_RichCompare(__pyx_v_ns, __pyx_v_4lxml_9objectify_XML_SCHEMA_NS, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1953 + * for prefix, ns in nsmap.items(): + * if ns == XML_SCHEMA_NS: + * if prefix is not None and prefix: # <<<<<<<<<<<<<< + * _xsi = prefix + u':' + _xsi + * break + */ + __pyx_t_1 = (__pyx_v_prefix != Py_None); + if (__pyx_t_1) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1954 + * if ns == XML_SCHEMA_NS: + * if prefix is not None and prefix: + * _xsi = prefix + u':' + _xsi # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_7 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_kp_u_32)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_v__xsi); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v__xsi); + __pyx_v__xsi = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1955 + * if prefix is not None and prefix: + * _xsi = prefix + u':' + _xsi + * break # <<<<<<<<<<<<<< + * else: + * raise ValueError, u"XSD types require the XSD namespace" + */ + goto __pyx_L22_break; + goto __pyx_L23; + } + __pyx_L23:; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1957 + * break + * else: + * raise ValueError, u"XSD types require the XSD namespace" # <<<<<<<<<<<<<< + * _attributes[XML_SCHEMA_INSTANCE_TYPE_ATTR] = _xsi + * if _pytype is None: + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_44), 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L22_break:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_L19:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1958 + * else: + * raise ValueError, u"XSD types require the XSD namespace" + * _attributes[XML_SCHEMA_INSTANCE_TYPE_ATTR] = _xsi # <<<<<<<<<<<<<< + * if _pytype is None: + * # allow using unregistered or even wrong xsi:type names + */ + if (PyObject_SetItem(__pyx_v__attributes, __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR, __pyx_v__xsi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1959 + * raise ValueError, u"XSD types require the XSD namespace" + * _attributes[XML_SCHEMA_INSTANCE_TYPE_ATTR] = _xsi + * if _pytype is None: # <<<<<<<<<<<<<< + * # allow using unregistered or even wrong xsi:type names + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, _xsi) + */ + __pyx_t_8 = (__pyx_v__pytype == Py_None); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1961 + * if _pytype is None: + * # allow using unregistered or even wrong xsi:type names + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, _xsi) # <<<<<<<<<<<<<< + * if dict_result is NULL: + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, name) + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v__xsi); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1962 + * # allow using unregistered or even wrong xsi:type names + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, _xsi) + * if dict_result is NULL: # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, name) + * if dict_result is not NULL: + */ + __pyx_t_8 = (__pyx_v_dict_result == NULL); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1963 + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, _xsi) + * if dict_result is NULL: + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, name) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * _pytype = (dict_result).name + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT), __pyx_v_name); + goto __pyx_L26; + } + __pyx_L26:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1964 + * if dict_result is NULL: + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, name) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * _pytype = (dict_result).name + * + */ + __pyx_t_8 = (__pyx_v_dict_result != NULL); + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1965 + * dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, name) + * if dict_result is not NULL: + * _pytype = (dict_result).name # <<<<<<<<<<<<<< + * + * if _value is None and _pytype != u"str": + */ + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->name); + __Pyx_DECREF(__pyx_v__pytype); + __pyx_v__pytype = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->name; + goto __pyx_L27; + } + __pyx_L27:; + goto __pyx_L25; + } + __pyx_L25:; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1967 + * _pytype = (dict_result).name + * + * if _value is None and _pytype != u"str": # <<<<<<<<<<<<<< + * _pytype = _pytype or u"NoneType" + * strval = None + */ + __pyx_t_8 = (__pyx_v__value == Py_None); + if (__pyx_t_8) { + __pyx_t_6 = PyObject_RichCompare(__pyx_v__pytype, ((PyObject *)__pyx_n_u_str), Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_8; + } + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1968 + * + * if _value is None and _pytype != u"str": + * _pytype = _pytype or u"NoneType" # <<<<<<<<<<<<<< + * strval = None + * elif python._isString(_value): + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__pytype); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_3) { + __Pyx_INCREF(((PyObject *)__pyx_n_u_NoneType)); + __pyx_t_6 = __pyx_n_u_NoneType; + } else { + __Pyx_INCREF(__pyx_v__pytype); + __pyx_t_6 = __pyx_v__pytype; + } + __Pyx_DECREF(__pyx_v__pytype); + __pyx_v__pytype = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1969 + * if _value is None and _pytype != u"str": + * _pytype = _pytype or u"NoneType" + * strval = None # <<<<<<<<<<<<<< + * elif python._isString(_value): + * strval = _value + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_strval); + __pyx_v_strval = Py_None; + goto __pyx_L28; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1970 + * _pytype = _pytype or u"NoneType" + * strval = None + * elif python._isString(_value): # <<<<<<<<<<<<<< + * strval = _value + * elif python.PyBool_Check(_value): + */ + __pyx_t_3 = _isString(__pyx_v__value); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1971 + * strval = None + * elif python._isString(_value): + * strval = _value # <<<<<<<<<<<<<< + * elif python.PyBool_Check(_value): + * if _value: + */ + __Pyx_INCREF(__pyx_v__value); + __Pyx_DECREF(__pyx_v_strval); + __pyx_v_strval = __pyx_v__value; + goto __pyx_L28; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1972 + * elif python._isString(_value): + * strval = _value + * elif python.PyBool_Check(_value): # <<<<<<<<<<<<<< + * if _value: + * strval = u"true" + */ + __pyx_t_3 = PyBool_Check(__pyx_v__value); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1973 + * strval = _value + * elif python.PyBool_Check(_value): + * if _value: # <<<<<<<<<<<<<< + * strval = u"true" + * else: + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__value); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1974 + * elif python.PyBool_Check(_value): + * if _value: + * strval = u"true" # <<<<<<<<<<<<<< + * else: + * strval = u"false" + */ + __Pyx_INCREF(((PyObject *)__pyx_n_u_true)); + __Pyx_DECREF(__pyx_v_strval); + __pyx_v_strval = ((PyObject *)__pyx_n_u_true); + goto __pyx_L29; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1976 + * strval = u"true" + * else: + * strval = u"false" # <<<<<<<<<<<<<< + * else: + * strval = unicode(_value) + */ + __Pyx_INCREF(((PyObject *)__pyx_n_u_false)); + __Pyx_DECREF(__pyx_v_strval); + __pyx_v_strval = ((PyObject *)__pyx_n_u_false); + } + __pyx_L29:; + goto __pyx_L28; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1978 + * strval = u"false" + * else: + * strval = unicode(_value) # <<<<<<<<<<<<<< + * + * if _pytype is None: + */ + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v__value); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v__value); + __Pyx_GIVEREF(__pyx_v__value); + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_strval); + __pyx_v_strval = __pyx_t_9; + __pyx_t_9 = 0; + } + __pyx_L28:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1980 + * strval = unicode(_value) + * + * if _pytype is None: # <<<<<<<<<<<<<< + * _pytype = _pytypename(_value) + * + */ + __pyx_t_3 = (__pyx_v__pytype == Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1981 + * + * if _pytype is None: + * _pytype = _pytypename(_value) # <<<<<<<<<<<<<< + * + * if _pytype is not None: + */ + __pyx_t_9 = __pyx_f_4lxml_9objectify__pytypename(__pyx_v__value); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_v__pytype); + __pyx_v__pytype = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L30; + } + __pyx_L30:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1983 + * _pytype = _pytypename(_value) + * + * if _pytype is not None: # <<<<<<<<<<<<<< + * if _pytype == u"NoneType" or _pytype == u"none": + * strval = None + */ + __pyx_t_3 = (__pyx_v__pytype != Py_None); + if (__pyx_t_3) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1984 + * + * if _pytype is not None: + * if _pytype == u"NoneType" or _pytype == u"none": # <<<<<<<<<<<<<< + * strval = None + * _attributes[XML_SCHEMA_INSTANCE_NIL_ATTR] = u"true" + */ + __pyx_t_9 = PyObject_RichCompare(__pyx_v__pytype, ((PyObject *)__pyx_n_u_NoneType), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (!__pyx_t_3) { + __pyx_t_9 = PyObject_RichCompare(__pyx_v__pytype, ((PyObject *)__pyx_n_u_none), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1985 + * if _pytype is not None: + * if _pytype == u"NoneType" or _pytype == u"none": + * strval = None # <<<<<<<<<<<<<< + * _attributes[XML_SCHEMA_INSTANCE_NIL_ATTR] = u"true" + * else: + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_strval); + __pyx_v_strval = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1986 + * if _pytype == u"NoneType" or _pytype == u"none": + * strval = None + * _attributes[XML_SCHEMA_INSTANCE_NIL_ATTR] = u"true" # <<<<<<<<<<<<<< + * else: + * # check if type information from arguments is valid + */ + if (PyObject_SetItem(__pyx_v__attributes, __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR, ((PyObject *)__pyx_n_u_true)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L32; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1989 + * else: + * # check if type information from arguments is valid + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, _pytype) # <<<<<<<<<<<<<< + * if dict_result is not NULL: + * type_check = (dict_result).type_check + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT), __pyx_v__pytype); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1990 + * # check if type information from arguments is valid + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, _pytype) + * if dict_result is not NULL: # <<<<<<<<<<<<<< + * type_check = (dict_result).type_check + * if type_check is not None: + */ + __pyx_t_1 = (__pyx_v_dict_result != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1991 + * dict_result = python.PyDict_GetItem(_PYTYPE_DICT, _pytype) + * if dict_result is not NULL: + * type_check = (dict_result).type_check # <<<<<<<<<<<<<< + * if type_check is not None: + * type_check(strval) + */ + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->type_check); + __Pyx_DECREF(__pyx_v_type_check); + __pyx_v_type_check = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_v_dict_result)->type_check; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1992 + * if dict_result is not NULL: + * type_check = (dict_result).type_check + * if type_check is not None: # <<<<<<<<<<<<<< + * type_check(strval) + * + */ + __pyx_t_1 = (__pyx_v_type_check != Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1993 + * type_check = (dict_result).type_check + * if type_check is not None: + * type_check(strval) # <<<<<<<<<<<<<< + * + * _attributes[PYTYPE_ATTRIBUTE] = _pytype + */ + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_strval); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_strval); + __Pyx_GIVEREF(__pyx_v_strval); + __pyx_t_6 = PyObject_Call(__pyx_v_type_check, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L34; + } + __pyx_L34:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1995 + * type_check(strval) + * + * _attributes[PYTYPE_ATTRIBUTE] = _pytype # <<<<<<<<<<<<<< + * + * return _makeElement(u"value", strval, _attributes, nsmap) + */ + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyObject_SetItem(__pyx_v__attributes, __pyx_t_6, __pyx_v__pytype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L33; + } + __pyx_L33:; + } + __pyx_L32:; + goto __pyx_L31; + } + __pyx_L31:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1997 + * _attributes[PYTYPE_ATTRIBUTE] = _pytype + * + * return _makeElement(u"value", strval, _attributes, nsmap) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_9objectify__makeElement(((PyObject *)__pyx_n_u_value), __pyx_v_strval, __pyx_v__attributes, __pyx_v_nsmap)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("lxml.objectify.DataElement"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v__attributes); + __Pyx_DECREF(__pyx_v_temp); + __Pyx_DECREF(__pyx_v_prefix); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_strval); + __Pyx_DECREF(__pyx_v_type_check); + __Pyx_DECREF(__pyx_v__value); + __Pyx_DECREF(__pyx_v_attrib); + __Pyx_DECREF(__pyx_v_nsmap); + __Pyx_DECREF(__pyx_v__pytype); + __Pyx_DECREF(__pyx_v__xsi); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":21 + * cdef _ObjectPath* _c_path + * cdef Py_ssize_t _path_len + * def __init__(self, path): # <<<<<<<<<<<<<< + * if python._isString(path): + * self._path = _parseObjectPathString(path) + */ + +static int __pyx_pf_4lxml_9objectify_10ObjectPath___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4lxml_9objectify_10ObjectPath___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_path = 0; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_4lxml_9objectify__ObjectPath *__pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_path,0}; + __Pyx_SetupRefcountContext("__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_ui_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, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __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("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectPath.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":22 + * cdef Py_ssize_t _path_len + * def __init__(self, path): + * if python._isString(path): # <<<<<<<<<<<<<< + * self._path = _parseObjectPathString(path) + * self._path_str = path + */ + __pyx_t_1 = _isString(__pyx_v_path); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":23 + * def __init__(self, path): + * if python._isString(path): + * self._path = _parseObjectPathString(path) # <<<<<<<<<<<<<< + * self._path_str = path + * else: + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__parseObjectPathString(__pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path); + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":24 + * if python._isString(path): + * self._path = _parseObjectPathString(path) + * self._path_str = path # <<<<<<<<<<<<<< + * else: + * self._path = _parseObjectPathList(path) + */ + __Pyx_INCREF(__pyx_v_path); + __Pyx_GIVEREF(__pyx_v_path); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str); + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str = __pyx_v_path; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":26 + * self._path_str = path + * else: + * self._path = _parseObjectPathList(path) # <<<<<<<<<<<<<< + * self._path_str = u'.'.join(path) + * self._path_len = python.PyList_GET_SIZE(self._path) + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__parseObjectPathList(__pyx_v_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __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_9objectify_ObjectPath *)__pyx_v_self)->_path); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path); + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":27 + * else: + * self._path = _parseObjectPathList(path) + * self._path_str = u'.'.join(path) # <<<<<<<<<<<<<< + * self._path_len = python.PyList_GET_SIZE(self._path) + * self._c_path = _buildObjectPathSegments(self._path) + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_u_9), __pyx_n_ui_join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __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[1]; __pyx_lineno = 27; __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_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __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_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str); + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":28 + * self._path = _parseObjectPathList(path) + * self._path_str = u'.'.join(path) + * self._path_len = python.PyList_GET_SIZE(self._path) # <<<<<<<<<<<<<< + * self._c_path = _buildObjectPathSegments(self._path) + * self.find = self.__call__ + */ + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_len = PyList_GET_SIZE(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":29 + * self._path_str = u'.'.join(path) + * self._path_len = python.PyList_GET_SIZE(self._path) + * self._c_path = _buildObjectPathSegments(self._path) # <<<<<<<<<<<<<< + * self.find = self.__call__ + * + */ + __pyx_t_5 = __pyx_f_4lxml_9objectify__buildObjectPathSegments(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path = __pyx_t_5; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":30 + * self._path_len = python.PyList_GET_SIZE(self._path) + * self._c_path = _buildObjectPathSegments(self._path) + * self.find = self.__call__ # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ui___call__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->find); + __Pyx_DECREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->find); + ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->find = __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.objectify.ObjectPath.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_path); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":32 + * self.find = self.__call__ + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self._c_path is not NULL: + * python.PyMem_Free(self._c_path) + */ + +static void __pyx_pf_4lxml_9objectify_10ObjectPath___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_4lxml_9objectify_10ObjectPath___dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__dealloc__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":33 + * + * def __dealloc__(self): + * if self._c_path is not NULL: # <<<<<<<<<<<<<< + * python.PyMem_Free(self._c_path) + * + */ + __pyx_t_1 = (((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":34 + * def __dealloc__(self): + * if self._c_path is not NULL: + * python.PyMem_Free(self._c_path) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + PyMem_Free(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_FinishRefcountContext(); +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":36 + * python.PyMem_Free(self._c_path) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self._path_str + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__str__"); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":37 + * + * def __str__(self): + * return self._path_str # <<<<<<<<<<<<<< + * + * def __call__(self, _Element root not None, *default): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str); + __pyx_r = ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_str; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":39 + * return self._path_str + * + * def __call__(self, _Element root not None, *default): # <<<<<<<<<<<<<< + * u"""Follow the attribute path in the object structure and return the + * target attribute value. + */ + +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_10ObjectPath___call__[] = "Follow the attribute path in the object structure and return the\n target attribute value.\n\n If it it not found, either returns a default value (if one was passed\n as second argument) or raises AttributeError.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct LxmlElement *__pyx_v_root = 0; + PyObject *__pyx_v_default = 0; + Py_ssize_t __pyx_v_use_default; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_root,0}; + __Pyx_SetupRefcountContext("__call__"); + 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_ui_root); + 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, "__call__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_root = ((struct LxmlElement *)values[0]); + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_root = ((struct LxmlElement *)PyTuple_GET_ITEM(__pyx_args, 0)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_default); + __Pyx_AddTraceback("lxml.objectify.ObjectPath.__call__"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_root); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_11etreepublic__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":47 + * """ + * cdef Py_ssize_t use_default + * use_default = python.PyTuple_GET_SIZE(default) # <<<<<<<<<<<<<< + * if use_default == 1: + * default = python.PyTuple_GET_ITEM(default, 0) + */ + __pyx_v_use_default = PyTuple_GET_SIZE(__pyx_v_default); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":48 + * cdef Py_ssize_t use_default + * use_default = python.PyTuple_GET_SIZE(default) + * if use_default == 1: # <<<<<<<<<<<<<< + * default = python.PyTuple_GET_ITEM(default, 0) + * python.Py_INCREF(default) + */ + __pyx_t_1 = (__pyx_v_use_default == 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":49 + * use_default = python.PyTuple_GET_SIZE(default) + * if use_default == 1: + * default = python.PyTuple_GET_ITEM(default, 0) # <<<<<<<<<<<<<< + * python.Py_INCREF(default) + * use_default = 1 + */ + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_default, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_default); + __pyx_v_default = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":50 + * if use_default == 1: + * default = python.PyTuple_GET_ITEM(default, 0) + * python.Py_INCREF(default) # <<<<<<<<<<<<<< + * use_default = 1 + * elif use_default > 1: + */ + Py_INCREF(__pyx_v_default); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":51 + * default = python.PyTuple_GET_ITEM(default, 0) + * python.Py_INCREF(default) + * use_default = 1 # <<<<<<<<<<<<<< + * elif use_default > 1: + * raise TypeError, u"invalid number of arguments: needs one or two" + */ + __pyx_v_use_default = 1; + goto __pyx_L6; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":52 + * python.Py_INCREF(default) + * use_default = 1 + * elif use_default > 1: # <<<<<<<<<<<<<< + * raise TypeError, u"invalid number of arguments: needs one or two" + * return _findObjectPath(root, self._c_path, self._path_len, + */ + __pyx_t_1 = (__pyx_v_use_default > 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":53 + * use_default = 1 + * elif use_default > 1: + * raise TypeError, u"invalid number of arguments: needs one or two" # <<<<<<<<<<<<<< + * return _findObjectPath(root, self._c_path, self._path_len, + * default, use_default) + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_46), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":54 + * elif use_default > 1: + * raise TypeError, u"invalid number of arguments: needs one or two" + * return _findObjectPath(root, self._c_path, self._path_len, # <<<<<<<<<<<<<< + * default, use_default) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":55 + * raise TypeError, u"invalid number of arguments: needs one or two" + * return _findObjectPath(root, self._c_path, self._path_len, + * default, use_default) # <<<<<<<<<<<<<< + * + * def hasattr(self, _Element root not None): + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__findObjectPath(__pyx_v_root, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_len, __pyx_v_default, __pyx_v_use_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __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.objectify.ObjectPath.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_default); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_root); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":57 + * default, use_default) + * + * def hasattr(self, _Element root not None): # <<<<<<<<<<<<<< + * u"hasattr(self, root)" + * try: + */ + +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath_hasattr(PyObject *__pyx_v_self, PyObject *__pyx_v_root); /*proto*/ +static char __pyx_doc_4lxml_9objectify_10ObjectPath_hasattr[] = "hasattr(self, root)"; +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath_hasattr(PyObject *__pyx_v_self, PyObject *__pyx_v_root) { + 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; + __Pyx_SetupRefcountContext("hasattr"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_root); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_11etreepublic__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":59 + * def hasattr(self, _Element root not None): + * u"hasattr(self, root)" + * try: # <<<<<<<<<<<<<< + * _findObjectPath(root, self._c_path, self._path_len, None, 0) + * 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-2.2/src/lxml/objectpath.pxi":60 + * u"hasattr(self, root)" + * try: + * _findObjectPath(root, self._c_path, self._path_len, None, 0) # <<<<<<<<<<<<<< + * except AttributeError: + * return False + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__findObjectPath(((struct LxmlElement *)__pyx_v_root), ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_len, Py_None, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5_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_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":61 + * try: + * _findObjectPath(root, self._c_path, self._path_len, None, 0) + * except AttributeError: # <<<<<<<<<<<<<< + * return False + * return True + */ + __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_2) { + __Pyx_AddTraceback("lxml.objectify.hasattr"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":62 + * _findObjectPath(root, self._c_path, self._path_len, None, 0) + * except AttributeError: + * return False # <<<<<<<<<<<<<< + * return True + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_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_L8_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_L6_exception_handled; + } + __pyx_L7_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__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:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":63 + * except AttributeError: + * return False + * return True # <<<<<<<<<<<<<< + * + * def setattr(self, _Element root not None, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __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_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("lxml.objectify.ObjectPath.hasattr"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_root); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":65 + * return True + * + * def setattr(self, _Element root not None, value): # <<<<<<<<<<<<<< + * u"""setattr(self, root, value) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath_setattr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_10ObjectPath_setattr[] = "setattr(self, root, value)\n\n Set the value of the target element in a subtree.\n\n If any of the children on the path does not exist, it is created.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath_setattr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct LxmlElement *__pyx_v_root = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_root,&__pyx_n_ui_value,0}; + __Pyx_SetupRefcountContext("setattr"); + 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_ui_root); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setattr", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __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), "setattr") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_root = ((struct LxmlElement *)values[0]); + __pyx_v_value = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_root = ((struct LxmlElement *)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("setattr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectPath.setattr"); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_11etreepublic__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":72 + * If any of the children on the path does not exist, it is created. + * """ + * _createObjectPath(root, self._c_path, self._path_len, 1, value) # <<<<<<<<<<<<<< + * + * def addattr(self, _Element root not None, value): + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__createObjectPath(__pyx_v_root, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_len, 1, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __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.objectify.ObjectPath.setattr"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":74 + * _createObjectPath(root, self._c_path, self._path_len, 1, value) + * + * def addattr(self, _Element root not None, value): # <<<<<<<<<<<<<< + * u"""addattr(self, root, value) + * + */ + +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath_addattr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4lxml_9objectify_10ObjectPath_addattr[] = "addattr(self, root, value)\n\n Append a value to the target element in a subtree.\n\n If any of the children on the path does not exist, it is created.\n "; +static PyObject *__pyx_pf_4lxml_9objectify_10ObjectPath_addattr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct LxmlElement *__pyx_v_root = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_ui_root,&__pyx_n_ui_value,0}; + __Pyx_SetupRefcountContext("addattr"); + 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_ui_root); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_ui_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("addattr", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __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), "addattr") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_root = ((struct LxmlElement *)values[0]); + __pyx_v_value = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_root = ((struct LxmlElement *)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("addattr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("lxml.objectify.ObjectPath.addattr"); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_11etreepublic__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":81 + * If any of the children on the path does not exist, it is created. + * """ + * _createObjectPath(root, self._c_path, self._path_len, 0, value) # <<<<<<<<<<<<<< + * + * cdef object __MATCH_PATH_SEGMENT + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__createObjectPath(__pyx_v_root, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_c_path, ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)__pyx_v_self)->_path_len, 0, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __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.objectify.ObjectPath.addattr"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":91 + * _RELATIVE_PATH_SEGMENT = (None, None, 0) + * + * cdef _parseObjectPathString(path): # <<<<<<<<<<<<<< + * u"""Parse object path string into a (ns, name, index) list. + * """ + */ + +static PyObject *__pyx_f_4lxml_9objectify__parseObjectPathString(PyObject *__pyx_v_path) { + int __pyx_v_has_dot; + PyObject *__pyx_v_new_path = 0; + PyObject *__pyx_v_path_pos; + PyObject *__pyx_v_match; + PyObject *__pyx_v_dot; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_name; + PyObject *__pyx_v_index; + 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; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + __Pyx_SetupRefcountContext("_parseObjectPathString"); + __Pyx_INCREF(__pyx_v_path); + __pyx_v_path_pos = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_match = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_dot = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_index = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":95 + * """ + * cdef bint has_dot + * cdef list new_path = [] # <<<<<<<<<<<<<< + * if python.PyString_Check(path): + * path = python.PyUnicode_FromEncodedObject(path, 'ASCII', NULL) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_new_path = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":96 + * cdef bint has_dot + * cdef list new_path = [] + * if python.PyString_Check(path): # <<<<<<<<<<<<<< + * path = python.PyUnicode_FromEncodedObject(path, 'ASCII', NULL) + * path = path.strip() + */ + __pyx_t_2 = PyString_Check(__pyx_v_path); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":97 + * cdef list new_path = [] + * if python.PyString_Check(path): + * path = python.PyUnicode_FromEncodedObject(path, 'ASCII', NULL) # <<<<<<<<<<<<<< + * path = path.strip() + * if path == u'.': + */ + __pyx_t_1 = PyUnicode_FromEncodedObject(__pyx_v_path, __pyx_k_ASCII, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_path); + __pyx_v_path = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":98 + * if python.PyString_Check(path): + * path = python.PyUnicode_FromEncodedObject(path, 'ASCII', NULL) + * path = path.strip() # <<<<<<<<<<<<<< + * if path == u'.': + * return [_RELATIVE_PATH_SEGMENT] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_path, __pyx_n_ui_strip); 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_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_path); + __pyx_v_path = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":99 + * path = python.PyUnicode_FromEncodedObject(path, 'ASCII', NULL) + * path = path.strip() + * if path == u'.': # <<<<<<<<<<<<<< + * return [_RELATIVE_PATH_SEGMENT] + * path_pos = 0 + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_path, ((PyObject *)__pyx_kp_u_9), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":100 + * path = path.strip() + * if path == u'.': + * return [_RELATIVE_PATH_SEGMENT] # <<<<<<<<<<<<<< + * path_pos = 0 + * while python.PyUnicode_GET_SIZE(path) > 0: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT); + __Pyx_GIVEREF(__pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT); + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":101 + * if path == u'.': + * return [_RELATIVE_PATH_SEGMENT] + * path_pos = 0 # <<<<<<<<<<<<<< + * while python.PyUnicode_GET_SIZE(path) > 0: + * match = __MATCH_PATH_SEGMENT(path, path_pos) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_path_pos); + __pyx_v_path_pos = __pyx_int_0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":102 + * return [_RELATIVE_PATH_SEGMENT] + * path_pos = 0 + * while python.PyUnicode_GET_SIZE(path) > 0: # <<<<<<<<<<<<<< + * match = __MATCH_PATH_SEGMENT(path, path_pos) + * if match is None: + */ + while (1) { + __pyx_t_2 = (PyUnicode_GET_SIZE(__pyx_v_path) > 0); + if (!__pyx_t_2) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":103 + * path_pos = 0 + * while python.PyUnicode_GET_SIZE(path) > 0: + * match = __MATCH_PATH_SEGMENT(path, path_pos) # <<<<<<<<<<<<<< + * if match is None: + * break + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __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_INCREF(__pyx_v_path_pos); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path_pos); + __Pyx_GIVEREF(__pyx_v_path_pos); + __pyx_t_1 = PyObject_Call(__pyx_v_4lxml_9objectify___MATCH_PATH_SEGMENT, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __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_v_match); + __pyx_v_match = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":104 + * while python.PyUnicode_GET_SIZE(path) > 0: + * match = __MATCH_PATH_SEGMENT(path, path_pos) + * if match is None: # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_2 = (__pyx_v_match == Py_None); + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":105 + * match = __MATCH_PATH_SEGMENT(path, path_pos) + * if match is None: + * break # <<<<<<<<<<<<<< + * + * dot, ns, name, index = match.groups() + */ + goto __pyx_L6_break; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":107 + * break + * + * dot, ns, name, index = match.groups() # <<<<<<<<<<<<<< + * if index is None or not index: + * index = 0 + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_match, __pyx_n_ui_groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 4)) { + PyObject* tuple = __pyx_t_3; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_dot); + __pyx_v_dot = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __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_index); + __pyx_v_index = __pyx_t_6; + __pyx_t_6 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_dot); + __pyx_v_dot = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __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_index); + __pyx_v_index = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":108 + * + * dot, ns, name, index = match.groups() + * if index is None or not index: # <<<<<<<<<<<<<< + * index = 0 + * else: + */ + __pyx_t_2 = (__pyx_v_index == Py_None); + if (!__pyx_t_2) { + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_index); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (!__pyx_t_8); + } else { + __pyx_t_9 = __pyx_t_2; + } + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":109 + * dot, ns, name, index = match.groups() + * if index is None or not index: + * index = 0 # <<<<<<<<<<<<<< + * else: + * index = int(index) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_int_0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":111 + * index = 0 + * else: + * index = int(index) # <<<<<<<<<<<<<< + * has_dot = dot == u'.' + * if python.PyList_GET_SIZE(new_path) == 0: + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_t_6; + __pyx_t_6 = 0; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":112 + * else: + * index = int(index) + * has_dot = dot == u'.' # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(new_path) == 0: + * if has_dot: + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_dot, ((PyObject *)__pyx_kp_u_9), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_has_dot = __pyx_t_9; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":113 + * index = int(index) + * has_dot = dot == u'.' + * if python.PyList_GET_SIZE(new_path) == 0: # <<<<<<<<<<<<<< + * if has_dot: + * # path '.child' => ignore root + */ + __pyx_t_9 = (PyList_GET_SIZE(((PyObject *)__pyx_v_new_path)) == 0); + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":114 + * has_dot = dot == u'.' + * if python.PyList_GET_SIZE(new_path) == 0: + * if has_dot: # <<<<<<<<<<<<<< + * # path '.child' => ignore root + * new_path.append(_RELATIVE_PATH_SEGMENT) + */ + __pyx_t_9 = __pyx_v_has_dot; + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":116 + * if has_dot: + * # path '.child' => ignore root + * new_path.append(_RELATIVE_PATH_SEGMENT) # <<<<<<<<<<<<<< + * elif index != 0: + * raise ValueError, u"index not allowed on root node" + */ + if (unlikely(__pyx_v_new_path == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_new_path), __pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":117 + * # path '.child' => ignore root + * new_path.append(_RELATIVE_PATH_SEGMENT) + * elif index != 0: # <<<<<<<<<<<<<< + * raise ValueError, u"index not allowed on root node" + * elif not has_dot: + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":118 + * new_path.append(_RELATIVE_PATH_SEGMENT) + * elif index != 0: + * raise ValueError, u"index not allowed on root node" # <<<<<<<<<<<<<< + * elif not has_dot: + * raise ValueError, u"invalid path" + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_47), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L9; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":119 + * elif index != 0: + * raise ValueError, u"index not allowed on root node" + * elif not has_dot: # <<<<<<<<<<<<<< + * raise ValueError, u"invalid path" + * if ns is not None: + */ + __pyx_t_9 = (!__pyx_v_has_dot); + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":120 + * raise ValueError, u"index not allowed on root node" + * elif not has_dot: + * raise ValueError, u"invalid path" # <<<<<<<<<<<<<< + * if ns is not None: + * ns = python.PyUnicode_AsUTF8String(ns) + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_48), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":121 + * elif not has_dot: + * raise ValueError, u"invalid path" + * if ns is not None: # <<<<<<<<<<<<<< + * ns = python.PyUnicode_AsUTF8String(ns) + * name = python.PyUnicode_AsUTF8String(name) + */ + __pyx_t_9 = (__pyx_v_ns != Py_None); + if (__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":122 + * raise ValueError, u"invalid path" + * if ns is not None: + * ns = python.PyUnicode_AsUTF8String(ns) # <<<<<<<<<<<<<< + * name = python.PyUnicode_AsUTF8String(name) + * new_path.append( (ns, name, index) ) + */ + __pyx_t_6 = PyUnicode_AsUTF8String(__pyx_v_ns); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":123 + * if ns is not None: + * ns = python.PyUnicode_AsUTF8String(ns) + * name = python.PyUnicode_AsUTF8String(name) # <<<<<<<<<<<<<< + * new_path.append( (ns, name, index) ) + * + */ + __pyx_t_6 = PyUnicode_AsUTF8String(__pyx_v_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":124 + * ns = python.PyUnicode_AsUTF8String(ns) + * name = python.PyUnicode_AsUTF8String(name) + * new_path.append( (ns, name, index) ) # <<<<<<<<<<<<<< + * + * path_pos = match.end() + */ + if (unlikely(__pyx_v_new_path == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __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_name); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_new_path), ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":126 + * new_path.append( (ns, name, index) ) + * + * path_pos = match.end() # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(new_path) == 0 or \ + * python.PyUnicode_GET_SIZE(path) > path_pos: + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_match, __pyx_n_ui_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __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_DECREF(__pyx_v_path_pos); + __pyx_v_path_pos = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L6_break:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":127 + * + * path_pos = match.end() + * if python.PyList_GET_SIZE(new_path) == 0 or \ # <<<<<<<<<<<<<< + * python.PyUnicode_GET_SIZE(path) > path_pos: + * raise ValueError, u"invalid path" + */ + __pyx_t_9 = (PyList_GET_SIZE(((PyObject *)__pyx_v_new_path)) == 0); + if (!__pyx_t_9) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":128 + * path_pos = match.end() + * if python.PyList_GET_SIZE(new_path) == 0 or \ + * python.PyUnicode_GET_SIZE(path) > path_pos: # <<<<<<<<<<<<<< + * raise ValueError, u"invalid path" + * return new_path + */ + __pyx_t_3 = PyInt_FromSsize_t(PyUnicode_GET_SIZE(__pyx_v_path)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_v_path_pos, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = __pyx_t_2; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":129 + * if python.PyList_GET_SIZE(new_path) == 0 or \ + * python.PyUnicode_GET_SIZE(path) > path_pos: + * raise ValueError, u"invalid path" # <<<<<<<<<<<<<< + * return new_path + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_48), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":130 + * python.PyUnicode_GET_SIZE(path) > path_pos: + * raise ValueError, u"invalid path" + * return new_path # <<<<<<<<<<<<<< + * + * cdef _parseObjectPathList(path): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_new_path)); + __pyx_r = ((PyObject *)__pyx_v_new_path); + 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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("lxml.objectify._parseObjectPathString"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_new_path); + __Pyx_DECREF(__pyx_v_path_pos); + __Pyx_DECREF(__pyx_v_match); + __Pyx_DECREF(__pyx_v_dot); + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_index); + __Pyx_DECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":132 + * return new_path + * + * cdef _parseObjectPathList(path): # <<<<<<<<<<<<<< + * u"""Parse object path sequence into a (ns, name, index) list. + * """ + */ + +static PyObject *__pyx_f_4lxml_9objectify__parseObjectPathList(PyObject *__pyx_v_path) { + char *__pyx_v_index_pos; + char *__pyx_v_index_end; + char *__pyx_v_c_name; + PyObject *__pyx_v_new_path = 0; + PyObject *__pyx_v_item; + PyObject *__pyx_v_ns; + PyObject *__pyx_v_name; + PyObject *__pyx_v_index; + 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; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + __Pyx_SetupRefcountContext("_parseObjectPathList"); + __Pyx_INCREF(__pyx_v_path); + __pyx_v_item = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_index = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":138 + * cdef char* index_end + * cdef char* c_name + * cdef list new_path = [] # <<<<<<<<<<<<<< + * for item in path: + * item = item.strip() + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_new_path = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":139 + * cdef char* c_name + * cdef list new_path = [] + * for item in path: # <<<<<<<<<<<<<< + * item = item.strip() + * if python.PyList_GET_SIZE(new_path) == 0 and item == u'': + */ + if (PyList_CheckExact(__pyx_v_path) || PyTuple_CheckExact(__pyx_v_path)) { + __pyx_t_2 = 0; __pyx_t_1 = __pyx_v_path; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __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[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":140 + * cdef list new_path = [] + * for item in path: + * item = item.strip() # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(new_path) == 0 and item == u'': + * # path '.child' => ignore root + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_item, __pyx_n_ui_strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __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[1]; __pyx_lineno = 140; __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_item); + __pyx_v_item = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":141 + * for item in path: + * item = item.strip() + * if python.PyList_GET_SIZE(new_path) == 0 and item == u'': # <<<<<<<<<<<<<< + * # path '.child' => ignore root + * ns = name = None + */ + __pyx_t_5 = (PyList_GET_SIZE(((PyObject *)__pyx_v_new_path)) == 0); + if (__pyx_t_5) { + __pyx_t_4 = PyObject_RichCompare(__pyx_v_item, ((PyObject *)__pyx_kp_u_4), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":143 + * if python.PyList_GET_SIZE(new_path) == 0 and item == u'': + * # path '.child' => ignore root + * ns = name = None # <<<<<<<<<<<<<< + * index = 0 + * else: + */ + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_ns); + __pyx_v_ns = Py_None; + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = Py_None; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":144 + * # path '.child' => ignore root + * ns = name = None + * index = 0 # <<<<<<<<<<<<<< + * else: + * ns, name = cetree.getNsTag(item) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_int_0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":146 + * index = 0 + * else: + * ns, name = cetree.getNsTag(item) # <<<<<<<<<<<<<< + * c_name = _cstr(name) + * index_pos = cstd.strchr(c_name, c'[') + */ + __pyx_t_4 = getNsTag(__pyx_v_item); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __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_ns); + __pyx_v_ns = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __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[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_EndUnpack(__pyx_t_9) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __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_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_8; + __pyx_t_8 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":147 + * else: + * ns, name = cetree.getNsTag(item) + * c_name = _cstr(name) # <<<<<<<<<<<<<< + * index_pos = cstd.strchr(c_name, c'[') + * if index_pos is NULL: + */ + __pyx_v_c_name = PyString_AS_STRING(__pyx_v_name); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":148 + * ns, name = cetree.getNsTag(item) + * c_name = _cstr(name) + * index_pos = cstd.strchr(c_name, c'[') # <<<<<<<<<<<<<< + * if index_pos is NULL: + * index = 0 + */ + __pyx_v_index_pos = strchr(__pyx_v_c_name, '['); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":149 + * c_name = _cstr(name) + * index_pos = cstd.strchr(c_name, c'[') + * if index_pos is NULL: # <<<<<<<<<<<<<< + * index = 0 + * else: + */ + __pyx_t_7 = (__pyx_v_index_pos == NULL); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":150 + * index_pos = cstd.strchr(c_name, c'[') + * if index_pos is NULL: + * index = 0 # <<<<<<<<<<<<<< + * else: + * index_end = cstd.strchr(index_pos + 1, c']') + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_int_0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":152 + * index = 0 + * else: + * index_end = cstd.strchr(index_pos + 1, c']') # <<<<<<<<<<<<<< + * if index_end is NULL: + * raise ValueError, u"index must be enclosed in []" + */ + __pyx_v_index_end = strchr((__pyx_v_index_pos + 1), ']'); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":153 + * else: + * index_end = cstd.strchr(index_pos + 1, c']') + * if index_end is NULL: # <<<<<<<<<<<<<< + * raise ValueError, u"index must be enclosed in []" + * index = int( + */ + __pyx_t_7 = (__pyx_v_index_end == NULL); + if (__pyx_t_7) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":154 + * index_end = cstd.strchr(index_pos + 1, c']') + * if index_end is NULL: + * raise ValueError, u"index must be enclosed in []" # <<<<<<<<<<<<<< + * index = int( + * python.PyString_FromStringAndSize( + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_49), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":157 + * index = int( + * python.PyString_FromStringAndSize( + * index_pos + 1, (index_end - index_pos - 1))) # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(new_path) == 0 and index != 0: + * raise ValueError, u"index not allowed on root node" + */ + __pyx_t_4 = PyString_FromStringAndSize((__pyx_v_index_pos + 1), ((Py_ssize_t)((__pyx_v_index_end - __pyx_v_index_pos) - 1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 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_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":158 + * python.PyString_FromStringAndSize( + * index_pos + 1, (index_end - index_pos - 1))) + * if python.PyList_GET_SIZE(new_path) == 0 and index != 0: # <<<<<<<<<<<<<< + * raise ValueError, u"index not allowed on root node" + * name = python.PyString_FromStringAndSize( + */ + __pyx_t_7 = (PyList_GET_SIZE(((PyObject *)__pyx_v_new_path)) == 0); + if (__pyx_t_7) { + __pyx_t_4 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __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[1]; __pyx_lineno = 158; __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_7; + } + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":159 + * index_pos + 1, (index_end - index_pos - 1))) + * if python.PyList_GET_SIZE(new_path) == 0 and index != 0: + * raise ValueError, u"index not allowed on root node" # <<<<<<<<<<<<<< + * name = python.PyString_FromStringAndSize( + * c_name, (index_pos - c_name)) + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_47), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":161 + * raise ValueError, u"index not allowed on root node" + * name = python.PyString_FromStringAndSize( + * c_name, (index_pos - c_name)) # <<<<<<<<<<<<<< + * new_path.append( (ns, name, index) ) + * if python.PyList_GET_SIZE(new_path) == 0: + */ + __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_c_name, ((Py_ssize_t)(__pyx_v_index_pos - __pyx_v_c_name))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; __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; + } + __pyx_L6:; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":162 + * name = python.PyString_FromStringAndSize( + * c_name, (index_pos - c_name)) + * new_path.append( (ns, name, index) ) # <<<<<<<<<<<<<< + * if python.PyList_GET_SIZE(new_path) == 0: + * raise ValueError, u"invalid path" + */ + if (unlikely(__pyx_v_new_path == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_ns); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ns); + __Pyx_GIVEREF(__pyx_v_ns); + __Pyx_INCREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_new_path), ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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-2.2/src/lxml/objectpath.pxi":163 + * c_name, (index_pos - c_name)) + * new_path.append( (ns, name, index) ) + * if python.PyList_GET_SIZE(new_path) == 0: # <<<<<<<<<<<<<< + * raise ValueError, u"invalid path" + * return new_path + */ + __pyx_t_6 = (PyList_GET_SIZE(((PyObject *)__pyx_v_new_path)) == 0); + if (__pyx_t_6) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":164 + * new_path.append( (ns, name, index) ) + * if python.PyList_GET_SIZE(new_path) == 0: + * raise ValueError, u"invalid path" # <<<<<<<<<<<<<< + * return new_path + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_u_48), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":165 + * if python.PyList_GET_SIZE(new_path) == 0: + * raise ValueError, u"invalid path" + * return new_path # <<<<<<<<<<<<<< + * + * cdef _ObjectPath* _buildObjectPathSegments(path_list) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_new_path)); + __pyx_r = ((PyObject *)__pyx_v_new_path); + 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_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("lxml.objectify._parseObjectPathList"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_new_path); + __Pyx_DECREF(__pyx_v_item); + __Pyx_DECREF(__pyx_v_ns); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_index); + __Pyx_DECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":167 + * return new_path + * + * cdef _ObjectPath* _buildObjectPathSegments(path_list) except NULL: # <<<<<<<<<<<<<< + * cdef _ObjectPath* c_path + * cdef _ObjectPath* c_path_segments + */ + +static __pyx_t_4lxml_9objectify__ObjectPath *__pyx_f_4lxml_9objectify__buildObjectPathSegments(PyObject *__pyx_v_path_list) { + __pyx_t_4lxml_9objectify__ObjectPath *__pyx_v_c_path; + __pyx_t_4lxml_9objectify__ObjectPath *__pyx_v_c_path_segments; + PyObject *__pyx_v_href; + PyObject *__pyx_v_name; + PyObject *__pyx_v_index; + __pyx_t_4lxml_9objectify__ObjectPath *__pyx_r; + 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; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + __Pyx_SetupRefcountContext("_buildObjectPathSegments"); + __Pyx_INCREF(__pyx_v_path_list); + __pyx_v_href = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_index = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":171 + * cdef _ObjectPath* c_path_segments + * c_path_segments = <_ObjectPath*>python.PyMem_Malloc( + * sizeof(_ObjectPath) * python.PyList_GET_SIZE(path_list)) # <<<<<<<<<<<<<< + * if c_path_segments is NULL: + * python.PyErr_NoMemory() + */ + __pyx_v_c_path_segments = ((__pyx_t_4lxml_9objectify__ObjectPath *)PyMem_Malloc(((sizeof(__pyx_t_4lxml_9objectify__ObjectPath)) * PyList_GET_SIZE(__pyx_v_path_list)))); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":172 + * c_path_segments = <_ObjectPath*>python.PyMem_Malloc( + * sizeof(_ObjectPath) * python.PyList_GET_SIZE(path_list)) + * if c_path_segments is NULL: # <<<<<<<<<<<<<< + * python.PyErr_NoMemory() + * c_path = c_path_segments + */ + __pyx_t_1 = (__pyx_v_c_path_segments == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":173 + * sizeof(_ObjectPath) * python.PyList_GET_SIZE(path_list)) + * if c_path_segments is NULL: + * python.PyErr_NoMemory() # <<<<<<<<<<<<<< + * c_path = c_path_segments + * for href, name, index in path_list: + */ + __pyx_t_2 = PyErr_NoMemory(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 173; __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-2.2/src/lxml/objectpath.pxi":174 + * if c_path_segments is NULL: + * python.PyErr_NoMemory() + * c_path = c_path_segments # <<<<<<<<<<<<<< + * for href, name, index in path_list: + * if href is None: + */ + __pyx_v_c_path = __pyx_v_c_path_segments; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":175 + * python.PyErr_NoMemory() + * c_path = c_path_segments + * for href, name, index in path_list: # <<<<<<<<<<<<<< + * if href is None: + * c_path[0].href = NULL + */ + if (PyList_CheckExact(__pyx_v_path_list) || PyTuple_CheckExact(__pyx_v_path_list)) { + __pyx_t_3 = 0; __pyx_t_2 = __pyx_v_path_list; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_path_list); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __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[1]; __pyx_lineno = 175; __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) == 3)) { + 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_t_7 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __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; + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_t_7; + __pyx_t_7 = 0; + } else { + __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __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; + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_t_7; + __pyx_t_7 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":176 + * c_path = c_path_segments + * for href, name, index in path_list: + * if href is None: # <<<<<<<<<<<<<< + * c_path[0].href = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_href == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":177 + * for href, name, index in path_list: + * if href is None: + * c_path[0].href = NULL # <<<<<<<<<<<<<< + * else: + * c_path[0].href = _cstr(href) + */ + (__pyx_v_c_path[0]).href = NULL; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":179 + * c_path[0].href = NULL + * else: + * c_path[0].href = _cstr(href) # <<<<<<<<<<<<<< + * if name is None: + * c_path[0].name = NULL + */ + (__pyx_v_c_path[0]).href = PyString_AS_STRING(__pyx_v_href); + } + __pyx_L6:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":180 + * else: + * c_path[0].href = _cstr(href) + * if name is None: # <<<<<<<<<<<<<< + * c_path[0].name = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_name == Py_None); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":181 + * c_path[0].href = _cstr(href) + * if name is None: + * c_path[0].name = NULL # <<<<<<<<<<<<<< + * else: + * c_path[0].name = _cstr(name) + */ + (__pyx_v_c_path[0]).name = NULL; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":183 + * c_path[0].name = NULL + * else: + * c_path[0].name = _cstr(name) # <<<<<<<<<<<<<< + * c_path[0].index = index + * c_path = c_path + 1 + */ + (__pyx_v_c_path[0]).name = PyString_AS_STRING(__pyx_v_name); + } + __pyx_L7:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":184 + * else: + * c_path[0].name = _cstr(name) + * c_path[0].index = index # <<<<<<<<<<<<<< + * c_path = c_path + 1 + * return c_path_segments + */ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_c_path[0]).index = __pyx_t_9; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":185 + * c_path[0].name = _cstr(name) + * c_path[0].index = index + * c_path = c_path + 1 # <<<<<<<<<<<<<< + * return c_path_segments + * + */ + __pyx_v_c_path = (__pyx_v_c_path + 1); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":186 + * c_path[0].index = index + * c_path = c_path + 1 + * return c_path_segments # <<<<<<<<<<<<<< + * + * cdef _findObjectPath(_Element root, _ObjectPath* c_path, Py_ssize_t c_path_len, + */ + __pyx_r = __pyx_v_c_path_segments; + goto __pyx_L0; + + __pyx_r = 0; + 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_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("lxml.objectify._buildObjectPathSegments"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_href); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_index); + __Pyx_DECREF(__pyx_v_path_list); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":188 + * return c_path_segments + * + * cdef _findObjectPath(_Element root, _ObjectPath* c_path, Py_ssize_t c_path_len, # <<<<<<<<<<<<<< + * default_value, int use_default): + * u"""Follow the path to find the target element. + */ + +static PyObject *__pyx_f_4lxml_9objectify__findObjectPath(struct LxmlElement *__pyx_v_root, __pyx_t_4lxml_9objectify__ObjectPath *__pyx_v_c_path, Py_ssize_t __pyx_v_c_path_len, PyObject *__pyx_v_default_value, int __pyx_v_use_default) { + xmlNode *__pyx_v_c_node; + char *__pyx_v_c_href; + char *__pyx_v_c_name; + Py_ssize_t __pyx_v_c_index; + PyObject *__pyx_v_tag; + 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_SetupRefcountContext("_findObjectPath"); + __Pyx_INCREF((PyObject *)__pyx_v_root); + __Pyx_INCREF(__pyx_v_default_value); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":196 + * cdef char* c_name + * cdef Py_ssize_t c_index + * c_node = root._c_node # <<<<<<<<<<<<<< + * c_name = c_path[0].name + * c_href = c_path[0].href + */ + __pyx_v_c_node = __pyx_v_root->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":197 + * cdef Py_ssize_t c_index + * c_node = root._c_node + * c_name = c_path[0].name # <<<<<<<<<<<<<< + * c_href = c_path[0].href + * if c_href is NULL or c_href[0] == c'\0': + */ + __pyx_v_c_name = (__pyx_v_c_path[0]).name; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":198 + * c_node = root._c_node + * c_name = c_path[0].name + * c_href = c_path[0].href # <<<<<<<<<<<<<< + * if c_href is NULL or c_href[0] == c'\0': + * c_href = tree._getNs(c_node) + */ + __pyx_v_c_href = (__pyx_v_c_path[0]).href; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":199 + * c_name = c_path[0].name + * c_href = c_path[0].href + * if c_href is NULL or c_href[0] == c'\0': # <<<<<<<<<<<<<< + * c_href = tree._getNs(c_node) + * if not cetree.tagMatches(c_node, c_href, c_name): + */ + if (!(__pyx_v_c_href == NULL)) { + __pyx_t_1 = ((__pyx_v_c_href[0]) == '\x00'); + } else { + __pyx_t_1 = (__pyx_v_c_href == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":200 + * c_href = c_path[0].href + * if c_href is NULL or c_href[0] == c'\0': + * c_href = tree._getNs(c_node) # <<<<<<<<<<<<<< + * if not cetree.tagMatches(c_node, c_href, c_name): + * if use_default: + */ + __pyx_v_c_href = _getNs(__pyx_v_c_node); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":201 + * if c_href is NULL or c_href[0] == c'\0': + * c_href = tree._getNs(c_node) + * if not cetree.tagMatches(c_node, c_href, c_name): # <<<<<<<<<<<<<< + * if use_default: + * return default_value + */ + __pyx_t_1 = (!tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":202 + * c_href = tree._getNs(c_node) + * if not cetree.tagMatches(c_node, c_href, c_name): + * if use_default: # <<<<<<<<<<<<<< + * return default_value + * else: + */ + __pyx_t_2 = __pyx_v_use_default; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":203 + * if not cetree.tagMatches(c_node, c_href, c_name): + * if use_default: + * return default_value # <<<<<<<<<<<<<< + * else: + * raise ValueError, \ + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_default_value); + __pyx_r = __pyx_v_default_value; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":207 + * raise ValueError, \ + * u"root element does not match: need %s, got %s" % \ + * (cetree.namespacedNameFromNsName(c_href, c_name), root.tag) # <<<<<<<<<<<<<< + * + * while c_node is not NULL: + */ + __pyx_t_3 = namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_root), __pyx_n_ui_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_50), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":209 + * (cetree.namespacedNameFromNsName(c_href, c_name), root.tag) + * + * while c_node is not NULL: # <<<<<<<<<<<<<< + * c_path_len = c_path_len - 1 + * if c_path_len <= 0: + */ + while (1) { + __pyx_t_1 = (__pyx_v_c_node != NULL); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":210 + * + * while c_node is not NULL: + * c_path_len = c_path_len - 1 # <<<<<<<<<<<<<< + * if c_path_len <= 0: + * break + */ + __pyx_v_c_path_len = (__pyx_v_c_path_len - 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":211 + * while c_node is not NULL: + * c_path_len = c_path_len - 1 + * if c_path_len <= 0: # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_1 = (__pyx_v_c_path_len <= 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":212 + * c_path_len = c_path_len - 1 + * if c_path_len <= 0: + * break # <<<<<<<<<<<<<< + * + * c_path = c_path + 1 + */ + goto __pyx_L7_break; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":214 + * break + * + * c_path = c_path + 1 # <<<<<<<<<<<<<< + * if c_path[0].href is not NULL: + * c_href = c_path[0].href # otherwise: keep parent namespace + */ + __pyx_v_c_path = (__pyx_v_c_path + 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":215 + * + * c_path = c_path + 1 + * if c_path[0].href is not NULL: # <<<<<<<<<<<<<< + * c_href = c_path[0].href # otherwise: keep parent namespace + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + */ + __pyx_t_1 = ((__pyx_v_c_path[0]).href != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":216 + * c_path = c_path + 1 + * if c_path[0].href is not NULL: + * c_href = c_path[0].href # otherwise: keep parent namespace # <<<<<<<<<<<<<< + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + * if c_name is NULL: + */ + __pyx_v_c_href = (__pyx_v_c_path[0]).href; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":217 + * if c_path[0].href is not NULL: + * c_href = c_path[0].href # otherwise: keep parent namespace + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) # <<<<<<<<<<<<<< + * if c_name is NULL: + * c_name = c_path[0].name + */ + __pyx_v_c_name = xmlDictExists(__pyx_v_c_node->doc->dict, (__pyx_v_c_path[0]).name, -1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":218 + * c_href = c_path[0].href # otherwise: keep parent namespace + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + * if c_name is NULL: # <<<<<<<<<<<<<< + * c_name = c_path[0].name + * c_node = NULL + */ + __pyx_t_1 = (__pyx_v_c_name == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":219 + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + * if c_name is NULL: + * c_name = c_path[0].name # <<<<<<<<<<<<<< + * c_node = NULL + * break + */ + __pyx_v_c_name = (__pyx_v_c_path[0]).name; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":220 + * if c_name is NULL: + * c_name = c_path[0].name + * c_node = NULL # <<<<<<<<<<<<<< + * break + * c_index = c_path[0].index + */ + __pyx_v_c_node = NULL; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":221 + * c_name = c_path[0].name + * c_node = NULL + * break # <<<<<<<<<<<<<< + * c_index = c_path[0].index + * + */ + goto __pyx_L7_break; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":222 + * c_node = NULL + * break + * c_index = c_path[0].index # <<<<<<<<<<<<<< + * + * if c_index < 0: + */ + __pyx_v_c_index = (__pyx_v_c_path[0]).index; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":224 + * c_index = c_path[0].index + * + * if c_index < 0: # <<<<<<<<<<<<<< + * c_node = c_node.last + * else: + */ + __pyx_t_1 = (__pyx_v_c_index < 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":225 + * + * if c_index < 0: + * c_node = c_node.last # <<<<<<<<<<<<<< + * else: + * c_node = c_node.children + */ + __pyx_v_c_node = __pyx_v_c_node->last; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":227 + * c_node = c_node.last + * else: + * c_node = c_node.children # <<<<<<<<<<<<<< + * c_node = _findFollowingSibling(c_node, c_href, c_name, c_index) + * + */ + __pyx_v_c_node = __pyx_v_c_node->children; + } + __pyx_L11:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":228 + * else: + * c_node = c_node.children + * c_node = _findFollowingSibling(c_node, c_href, c_name, c_index) # <<<<<<<<<<<<<< + * + * if c_node is not NULL: + */ + __pyx_v_c_node = __pyx_f_4lxml_9objectify__findFollowingSibling(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name, __pyx_v_c_index); + } + __pyx_L7_break:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":230 + * c_node = _findFollowingSibling(c_node, c_href, c_name, c_index) + * + * if c_node is not NULL: # <<<<<<<<<<<<<< + * return cetree.elementFactory(root._doc, c_node) + * elif use_default: + */ + __pyx_t_1 = (__pyx_v_c_node != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":231 + * + * if c_node is not NULL: + * return cetree.elementFactory(root._doc, c_node) # <<<<<<<<<<<<<< + * elif use_default: + * return default_value + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = ((PyObject *)elementFactory(__pyx_v_root->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __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_L12; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":232 + * if c_node is not NULL: + * return cetree.elementFactory(root._doc, c_node) + * elif use_default: # <<<<<<<<<<<<<< + * return default_value + * else: + */ + __pyx_t_2 = __pyx_v_use_default; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":233 + * return cetree.elementFactory(root._doc, c_node) + * elif use_default: + * return default_value # <<<<<<<<<<<<<< + * else: + * tag = cetree.namespacedNameFromNsName(c_href, c_name) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_default_value); + __pyx_r = __pyx_v_default_value; + goto __pyx_L0; + goto __pyx_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":235 + * return default_value + * else: + * tag = cetree.namespacedNameFromNsName(c_href, c_name) # <<<<<<<<<<<<<< + * raise AttributeError, u"no such child: " + tag + * + */ + __pyx_t_4 = namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 235; __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-2.2/src/lxml/objectpath.pxi":236 + * else: + * tag = cetree.namespacedNameFromNsName(c_href, c_name) + * raise AttributeError, u"no such child: " + tag # <<<<<<<<<<<<<< + * + * cdef _createObjectPath(_Element root, _ObjectPath* c_path, + */ + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_u_10), __pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_4, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L12:; + + __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.objectify._findObjectPath"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF((PyObject *)__pyx_v_root); + __Pyx_DECREF(__pyx_v_default_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":238 + * raise AttributeError, u"no such child: " + tag + * + * cdef _createObjectPath(_Element root, _ObjectPath* c_path, # <<<<<<<<<<<<<< + * Py_ssize_t c_path_len, int replace, value): + * u"""Follow the path to find the target element, build the missing children + */ + +static PyObject *__pyx_f_4lxml_9objectify__createObjectPath(struct LxmlElement *__pyx_v_root, __pyx_t_4lxml_9objectify__ObjectPath *__pyx_v_c_path, Py_ssize_t __pyx_v_c_path_len, int __pyx_v_replace, PyObject *__pyx_v_value) { + struct LxmlElement *__pyx_v_child; + xmlNode *__pyx_v_c_node; + xmlNode *__pyx_v_c_child; + char *__pyx_v_c_href; + char *__pyx_v_c_name; + Py_ssize_t __pyx_v_c_index; + PyObject *__pyx_v_element; + 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_SetupRefcountContext("_createObjectPath"); + __Pyx_INCREF((PyObject *)__pyx_v_root); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_child = ((struct LxmlElement *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_element = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":250 + * cdef char* c_name + * cdef Py_ssize_t c_index + * if c_path_len == 1: # <<<<<<<<<<<<<< + * raise TypeError, u"cannot update root node" + * + */ + __pyx_t_1 = (__pyx_v_c_path_len == 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":251 + * cdef Py_ssize_t c_index + * if c_path_len == 1: + * raise TypeError, u"cannot update root node" # <<<<<<<<<<<<<< + * + * c_node = root._c_node + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_51), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":253 + * raise TypeError, u"cannot update root node" + * + * c_node = root._c_node # <<<<<<<<<<<<<< + * c_name = c_path[0].name + * c_href = c_path[0].href + */ + __pyx_v_c_node = __pyx_v_root->_c_node; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":254 + * + * c_node = root._c_node + * c_name = c_path[0].name # <<<<<<<<<<<<<< + * c_href = c_path[0].href + * if c_href is NULL or c_href[0] == c'\0': + */ + __pyx_v_c_name = (__pyx_v_c_path[0]).name; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":255 + * c_node = root._c_node + * c_name = c_path[0].name + * c_href = c_path[0].href # <<<<<<<<<<<<<< + * if c_href is NULL or c_href[0] == c'\0': + * c_href = tree._getNs(c_node) + */ + __pyx_v_c_href = (__pyx_v_c_path[0]).href; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":256 + * c_name = c_path[0].name + * c_href = c_path[0].href + * if c_href is NULL or c_href[0] == c'\0': # <<<<<<<<<<<<<< + * c_href = tree._getNs(c_node) + * if not cetree.tagMatches(c_node, c_href, c_name): + */ + if (!(__pyx_v_c_href == NULL)) { + __pyx_t_1 = ((__pyx_v_c_href[0]) == '\x00'); + } else { + __pyx_t_1 = (__pyx_v_c_href == NULL); + } + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":257 + * c_href = c_path[0].href + * if c_href is NULL or c_href[0] == c'\0': + * c_href = tree._getNs(c_node) # <<<<<<<<<<<<<< + * if not cetree.tagMatches(c_node, c_href, c_name): + * raise ValueError, \ + */ + __pyx_v_c_href = _getNs(__pyx_v_c_node); + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":258 + * if c_href is NULL or c_href[0] == c'\0': + * c_href = tree._getNs(c_node) + * if not cetree.tagMatches(c_node, c_href, c_name): # <<<<<<<<<<<<<< + * raise ValueError, \ + * u"root element does not match: need %s, got %s" % \ + */ + __pyx_t_1 = (!tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name)); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":261 + * raise ValueError, \ + * u"root element does not match: need %s, got %s" % \ + * (cetree.namespacedNameFromNsName(c_href, c_name), root.tag) # <<<<<<<<<<<<<< + * + * while c_path_len > 1: + */ + __pyx_t_2 = namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_root), __pyx_n_ui_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __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 = 261; __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_50), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":263 + * (cetree.namespacedNameFromNsName(c_href, c_name), root.tag) + * + * while c_path_len > 1: # <<<<<<<<<<<<<< + * c_path_len = c_path_len - 1 + * c_path = c_path + 1 + */ + while (1) { + __pyx_t_1 = (__pyx_v_c_path_len > 1); + if (!__pyx_t_1) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":264 + * + * while c_path_len > 1: + * c_path_len = c_path_len - 1 # <<<<<<<<<<<<<< + * c_path = c_path + 1 + * if c_path[0].href is not NULL: + */ + __pyx_v_c_path_len = (__pyx_v_c_path_len - 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":265 + * while c_path_len > 1: + * c_path_len = c_path_len - 1 + * c_path = c_path + 1 # <<<<<<<<<<<<<< + * if c_path[0].href is not NULL: + * c_href = c_path[0].href # otherwise: keep parent namespace + */ + __pyx_v_c_path = (__pyx_v_c_path + 1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":266 + * c_path_len = c_path_len - 1 + * c_path = c_path + 1 + * if c_path[0].href is not NULL: # <<<<<<<<<<<<<< + * c_href = c_path[0].href # otherwise: keep parent namespace + * c_index = c_path[0].index + */ + __pyx_t_1 = ((__pyx_v_c_path[0]).href != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":267 + * c_path = c_path + 1 + * if c_path[0].href is not NULL: + * c_href = c_path[0].href # otherwise: keep parent namespace # <<<<<<<<<<<<<< + * c_index = c_path[0].index + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + */ + __pyx_v_c_href = (__pyx_v_c_path[0]).href; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":268 + * if c_path[0].href is not NULL: + * c_href = c_path[0].href # otherwise: keep parent namespace + * c_index = c_path[0].index # <<<<<<<<<<<<<< + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + * if c_name is NULL: + */ + __pyx_v_c_index = (__pyx_v_c_path[0]).index; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":269 + * c_href = c_path[0].href # otherwise: keep parent namespace + * c_index = c_path[0].index + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) # <<<<<<<<<<<<<< + * if c_name is NULL: + * c_name = c_path[0].name + */ + __pyx_v_c_name = xmlDictExists(__pyx_v_c_node->doc->dict, (__pyx_v_c_path[0]).name, -1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":270 + * c_index = c_path[0].index + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + * if c_name is NULL: # <<<<<<<<<<<<<< + * c_name = c_path[0].name + * c_child = NULL + */ + __pyx_t_1 = (__pyx_v_c_name == NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":271 + * c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + * if c_name is NULL: + * c_name = c_path[0].name # <<<<<<<<<<<<<< + * c_child = NULL + * else: + */ + __pyx_v_c_name = (__pyx_v_c_path[0]).name; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":272 + * if c_name is NULL: + * c_name = c_path[0].name + * c_child = NULL # <<<<<<<<<<<<<< + * else: + * if c_index < 0: + */ + __pyx_v_c_child = NULL; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":274 + * c_child = NULL + * else: + * if c_index < 0: # <<<<<<<<<<<<<< + * c_child = c_node.last + * else: + */ + __pyx_t_1 = (__pyx_v_c_index < 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":275 + * else: + * if c_index < 0: + * c_child = c_node.last # <<<<<<<<<<<<<< + * else: + * c_child = c_node.children + */ + __pyx_v_c_child = __pyx_v_c_node->last; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":277 + * c_child = c_node.last + * else: + * c_child = c_node.children # <<<<<<<<<<<<<< + * c_child = _findFollowingSibling(c_child, c_href, c_name, c_index) + * + */ + __pyx_v_c_child = __pyx_v_c_node->children; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":278 + * else: + * c_child = c_node.children + * c_child = _findFollowingSibling(c_child, c_href, c_name, c_index) # <<<<<<<<<<<<<< + * + * if c_child is not NULL: + */ + __pyx_v_c_child = __pyx_f_4lxml_9objectify__findFollowingSibling(__pyx_v_c_child, __pyx_v_c_href, __pyx_v_c_name, __pyx_v_c_index); + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":280 + * c_child = _findFollowingSibling(c_child, c_href, c_name, c_index) + * + * if c_child is not NULL: # <<<<<<<<<<<<<< + * c_node = c_child + * elif c_index != 0: + */ + __pyx_t_1 = (__pyx_v_c_child != NULL); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":281 + * + * if c_child is not NULL: + * c_node = c_child # <<<<<<<<<<<<<< + * elif c_index != 0: + * raise TypeError, \ + */ + __pyx_v_c_node = __pyx_v_c_child; + goto __pyx_L11; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":282 + * if c_child is not NULL: + * c_node = c_child + * elif c_index != 0: # <<<<<<<<<<<<<< + * raise TypeError, \ + * u"creating indexed path attributes is not supported" + */ + __pyx_t_1 = (__pyx_v_c_index != 0); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":283 + * c_node = c_child + * elif c_index != 0: + * raise TypeError, \ # <<<<<<<<<<<<<< + * u"creating indexed path attributes is not supported" + * elif c_path_len == 1: + */ + __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_52), 0); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":285 + * raise TypeError, \ + * u"creating indexed path attributes is not supported" + * elif c_path_len == 1: # <<<<<<<<<<<<<< + * _appendValue(cetree.elementFactory(root._doc, c_node), + * cetree.namespacedNameFromNsName(c_href, c_name), + */ + __pyx_t_1 = (__pyx_v_c_path_len == 1); + if (__pyx_t_1) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":286 + * u"creating indexed path attributes is not supported" + * elif c_path_len == 1: + * _appendValue(cetree.elementFactory(root._doc, c_node), # <<<<<<<<<<<<<< + * cetree.namespacedNameFromNsName(c_href, c_name), + * value) + */ + __pyx_t_3 = ((PyObject *)elementFactory(__pyx_v_root->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":287 + * elif c_path_len == 1: + * _appendValue(cetree.elementFactory(root._doc, c_node), + * cetree.namespacedNameFromNsName(c_href, c_name), # <<<<<<<<<<<<<< + * value) + * return + */ + __pyx_t_4 = namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":288 + * _appendValue(cetree.elementFactory(root._doc, c_node), + * cetree.namespacedNameFromNsName(c_href, c_name), + * value) # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_t_2 = __pyx_f_4lxml_9objectify__appendValue(((struct LxmlElement *)__pyx_t_3), __pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":289 + * cetree.namespacedNameFromNsName(c_href, c_name), + * value) + * return # <<<<<<<<<<<<<< + * else: + * child = cetree.makeSubElement( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":292 + * else: + * child = cetree.makeSubElement( + * cetree.elementFactory(root._doc, c_node), # <<<<<<<<<<<<<< + * cetree.namespacedNameFromNsName(c_href, c_name), + * None, None, None, None) + */ + __pyx_t_2 = ((PyObject *)elementFactory(__pyx_v_root->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":293 + * child = cetree.makeSubElement( + * cetree.elementFactory(root._doc, c_node), + * cetree.namespacedNameFromNsName(c_href, c_name), # <<<<<<<<<<<<<< + * None, None, None, None) + * c_node = child._c_node + */ + __pyx_t_4 = namespacedNameFromNsName(__pyx_v_c_href, __pyx_v_c_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":294 + * cetree.elementFactory(root._doc, c_node), + * cetree.namespacedNameFromNsName(c_href, c_name), + * None, None, None, None) # <<<<<<<<<<<<<< + * c_node = child._c_node + * + */ + __pyx_t_3 = ((PyObject *)makeSubElement(((struct LxmlElement *)__pyx_t_2), __pyx_t_4, Py_None, Py_None, Py_None, Py_None)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((struct LxmlElement *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":295 + * cetree.namespacedNameFromNsName(c_href, c_name), + * None, None, None, None) + * c_node = child._c_node # <<<<<<<<<<<<<< + * + * # if we get here, the entire path was already there + */ + __pyx_v_c_node = __pyx_v_child->_c_node; + } + __pyx_L11:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":298 + * + * # if we get here, the entire path was already there + * if replace: # <<<<<<<<<<<<<< + * element = cetree.elementFactory(root._doc, c_node) + * _replaceElement(element, value) + */ + __pyx_t_5 = __pyx_v_replace; + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":299 + * # if we get here, the entire path was already there + * if replace: + * element = cetree.elementFactory(root._doc, c_node) # <<<<<<<<<<<<<< + * _replaceElement(element, value) + * else: + */ + __pyx_t_3 = ((PyObject *)elementFactory(__pyx_v_root->_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_element); + __pyx_v_element = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":300 + * if replace: + * element = cetree.elementFactory(root._doc, c_node) + * _replaceElement(element, value) # <<<<<<<<<<<<<< + * else: + * _appendValue(cetree.elementFactory(root._doc, c_node.parent), + */ + if (!(__Pyx_TypeTest(__pyx_v_element, __pyx_ptype_4lxml_11etreepublic__Element))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4lxml_9objectify__replaceElement(((struct LxmlElement *)__pyx_v_element), __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L12; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":302 + * _replaceElement(element, value) + * else: + * _appendValue(cetree.elementFactory(root._doc, c_node.parent), # <<<<<<<<<<<<<< + * cetree.namespacedName(c_node), value) + * + */ + __pyx_t_3 = ((PyObject *)elementFactory(__pyx_v_root->_doc, __pyx_v_c_node->parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":303 + * else: + * _appendValue(cetree.elementFactory(root._doc, c_node.parent), + * cetree.namespacedName(c_node), value) # <<<<<<<<<<<<<< + * + * cdef list _buildDescendantPaths(tree.xmlNode* c_node, prefix_string): + */ + __pyx_t_4 = namespacedName(__pyx_v_c_node); 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_t_2 = __pyx_f_4lxml_9objectify__appendValue(((struct LxmlElement *)__pyx_t_3), __pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __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.objectify._createObjectPath"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_element); + __Pyx_DECREF((PyObject *)__pyx_v_root); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":305 + * cetree.namespacedName(c_node), value) + * + * cdef list _buildDescendantPaths(tree.xmlNode* c_node, prefix_string): # <<<<<<<<<<<<<< + * u"""Returns a list of all descendant paths. + * """ + */ + +static PyObject *__pyx_f_4lxml_9objectify__buildDescendantPaths(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_prefix_string) { + PyObject *__pyx_v_path; + PyObject *__pyx_v_path_list; + PyObject *__pyx_v_tag; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("_buildDescendantPaths"); + __Pyx_INCREF(__pyx_v_prefix_string); + __pyx_v_path = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_path_list = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":309 + * """ + * cdef list path, path_list + * tag = cetree.namespacedName(c_node) # <<<<<<<<<<<<<< + * if prefix_string: + * if prefix_string[-1] != u'.': + */ + __pyx_t_1 = namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":310 + * cdef list path, path_list + * tag = cetree.namespacedName(c_node) + * if prefix_string: # <<<<<<<<<<<<<< + * if prefix_string[-1] != u'.': + * prefix_string = prefix_string + u'.' + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_prefix_string); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":311 + * tag = cetree.namespacedName(c_node) + * if prefix_string: + * if prefix_string[-1] != u'.': # <<<<<<<<<<<<<< + * prefix_string = prefix_string + u'.' + * prefix_string = prefix_string + tag + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_prefix_string, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_kp_u_9), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":312 + * if prefix_string: + * if prefix_string[-1] != u'.': + * prefix_string = prefix_string + u'.' # <<<<<<<<<<<<<< + * prefix_string = prefix_string + tag + * else: + */ + __pyx_t_3 = PyNumber_Add(__pyx_v_prefix_string, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_prefix_string); + __pyx_v_prefix_string = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":313 + * if prefix_string[-1] != u'.': + * prefix_string = prefix_string + u'.' + * prefix_string = prefix_string + tag # <<<<<<<<<<<<<< + * else: + * prefix_string = tag + */ + __pyx_t_3 = PyNumber_Add(__pyx_v_prefix_string, __pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_prefix_string); + __pyx_v_prefix_string = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":315 + * prefix_string = prefix_string + tag + * else: + * prefix_string = tag # <<<<<<<<<<<<<< + * path = [prefix_string] + * path_list = [] + */ + __Pyx_INCREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_prefix_string); + __pyx_v_prefix_string = __pyx_v_tag; + } + __pyx_L3:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":316 + * else: + * prefix_string = tag + * path = [prefix_string] # <<<<<<<<<<<<<< + * path_list = [] + * _recursiveBuildDescendantPaths(c_node, path, path_list) + */ + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_prefix_string); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_prefix_string); + __Pyx_GIVEREF(__pyx_v_prefix_string); + __Pyx_DECREF(((PyObject *)__pyx_v_path)); + __pyx_v_path = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":317 + * prefix_string = tag + * path = [prefix_string] + * path_list = [] # <<<<<<<<<<<<<< + * _recursiveBuildDescendantPaths(c_node, path, path_list) + * return path_list + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_v_path_list)); + __pyx_v_path_list = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":318 + * path = [prefix_string] + * path_list = [] + * _recursiveBuildDescendantPaths(c_node, path, path_list) # <<<<<<<<<<<<<< + * return path_list + * + */ + __pyx_t_4 = __pyx_f_4lxml_9objectify__recursiveBuildDescendantPaths(__pyx_v_c_node, __pyx_v_path, __pyx_v_path_list); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":319 + * path_list = [] + * _recursiveBuildDescendantPaths(c_node, path, path_list) + * return path_list # <<<<<<<<<<<<<< + * + * cdef int _recursiveBuildDescendantPaths(tree.xmlNode* c_node, + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_path_list)); + __pyx_r = __pyx_v_path_list; + 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.objectify._buildDescendantPaths"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_path); + __Pyx_DECREF(__pyx_v_path_list); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_prefix_string); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":321 + * return path_list + * + * cdef int _recursiveBuildDescendantPaths(tree.xmlNode* c_node, # <<<<<<<<<<<<<< + * list path, list path_list) except -1: + * u"""Fills the list 'path_list' with all descendant paths, initial prefix + */ + +static int __pyx_f_4lxml_9objectify__recursiveBuildDescendantPaths(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_path, PyObject *__pyx_v_path_list) { + PyObject *__pyx_v_dict_result; + xmlNode *__pyx_v_c_child; + char *__pyx_v_c_href; + PyObject *__pyx_v_tags = 0; + PyObject *__pyx_v_tag; + PyObject *__pyx_v_count; + 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; + __Pyx_SetupRefcountContext("_recursiveBuildDescendantPaths"); + __Pyx_INCREF(__pyx_v_path); + __Pyx_INCREF(__pyx_v_path_list); + __pyx_v_tag = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_count = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":329 + * cdef tree.xmlNode* c_child + * cdef char* c_href + * cdef dict tags = {} # <<<<<<<<<<<<<< + * path_list.append( u'.'.join(path) ) + * c_href = tree._getNs(c_node) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_tags = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":330 + * cdef char* c_href + * cdef dict tags = {} + * path_list.append( u'.'.join(path) ) # <<<<<<<<<<<<<< + * c_href = tree._getNs(c_node) + * c_child = c_node.children + */ + if (unlikely(__pyx_v_path_list == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_u_9), __pyx_n_ui_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __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 = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_path)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_path)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_path)); + __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 = 330; __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_t_4 = PyList_Append(((PyObject *)__pyx_v_path_list), __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":331 + * cdef dict tags = {} + * path_list.append( u'.'.join(path) ) + * c_href = tree._getNs(c_node) # <<<<<<<<<<<<<< + * c_child = c_node.children + * while c_child is not NULL: + */ + __pyx_v_c_href = _getNs(__pyx_v_c_node); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":332 + * path_list.append( u'.'.join(path) ) + * c_href = tree._getNs(c_node) + * c_child = c_node.children # <<<<<<<<<<<<<< + * while c_child is not NULL: + * while c_child.type != tree.XML_ELEMENT_NODE: + */ + __pyx_v_c_child = __pyx_v_c_node->children; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":333 + * c_href = tree._getNs(c_node) + * c_child = c_node.children + * while c_child is not NULL: # <<<<<<<<<<<<<< + * while c_child.type != tree.XML_ELEMENT_NODE: + * c_child = c_child.next + */ + while (1) { + __pyx_t_5 = (__pyx_v_c_child != NULL); + if (!__pyx_t_5) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":334 + * c_child = c_node.children + * while c_child is not NULL: + * while c_child.type != tree.XML_ELEMENT_NODE: # <<<<<<<<<<<<<< + * c_child = c_child.next + * if c_child is NULL: + */ + while (1) { + __pyx_t_5 = (__pyx_v_c_child->type != XML_ELEMENT_NODE); + if (!__pyx_t_5) break; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":335 + * while c_child is not NULL: + * while c_child.type != tree.XML_ELEMENT_NODE: + * c_child = c_child.next # <<<<<<<<<<<<<< + * if c_child is NULL: + * return 0 + */ + __pyx_v_c_child = __pyx_v_c_child->next; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":336 + * while c_child.type != tree.XML_ELEMENT_NODE: + * c_child = c_child.next + * if c_child is NULL: # <<<<<<<<<<<<<< + * return 0 + * if c_href is tree._getNs(c_child): + */ + __pyx_t_5 = (__pyx_v_c_child == NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":337 + * c_child = c_child.next + * if c_child is NULL: + * return 0 # <<<<<<<<<<<<<< + * if c_href is tree._getNs(c_child): + * tag = pyunicode(c_child.name) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":338 + * if c_child is NULL: + * return 0 + * if c_href is tree._getNs(c_child): # <<<<<<<<<<<<<< + * tag = pyunicode(c_child.name) + * elif c_href is not NULL and tree._getNs(c_child) is NULL: + */ + __pyx_t_5 = (__pyx_v_c_href == _getNs(__pyx_v_c_child)); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":339 + * return 0 + * if c_href is tree._getNs(c_child): + * tag = pyunicode(c_child.name) # <<<<<<<<<<<<<< + * elif c_href is not NULL and tree._getNs(c_child) is NULL: + * # special case: parent has namespace, child does not + */ + __pyx_t_3 = pyunicode(__pyx_v_c_child->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L8; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":340 + * if c_href is tree._getNs(c_child): + * tag = pyunicode(c_child.name) + * elif c_href is not NULL and tree._getNs(c_child) is NULL: # <<<<<<<<<<<<<< + * # special case: parent has namespace, child does not + * tag = u'{}' + pyunicode(c_child.name) + */ + if ((__pyx_v_c_href != NULL)) { + __pyx_t_5 = (_getNs(__pyx_v_c_child) == NULL); + } else { + __pyx_t_5 = (__pyx_v_c_href != NULL); + } + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":342 + * elif c_href is not NULL and tree._getNs(c_child) is NULL: + * # special case: parent has namespace, child does not + * tag = u'{}' + pyunicode(c_child.name) # <<<<<<<<<<<<<< + * else: + * tag = cetree.namespacedName(c_child) + */ + __pyx_t_3 = pyunicode(__pyx_v_c_child->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_u_53), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __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_tag); + __pyx_v_tag = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":344 + * tag = u'{}' + pyunicode(c_child.name) + * else: + * tag = cetree.namespacedName(c_child) # <<<<<<<<<<<<<< + * dict_result = python.PyDict_GetItem(tags, tag) + * if dict_result is NULL: + */ + __pyx_t_2 = namespacedName(__pyx_v_c_child); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_tag); + __pyx_v_tag = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L8:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":345 + * else: + * tag = cetree.namespacedName(c_child) + * dict_result = python.PyDict_GetItem(tags, tag) # <<<<<<<<<<<<<< + * if dict_result is NULL: + * count = 0 + */ + __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_tags), __pyx_v_tag); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":346 + * tag = cetree.namespacedName(c_child) + * dict_result = python.PyDict_GetItem(tags, tag) + * if dict_result is NULL: # <<<<<<<<<<<<<< + * count = 0 + * else: + */ + __pyx_t_5 = (__pyx_v_dict_result == NULL); + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":347 + * dict_result = python.PyDict_GetItem(tags, tag) + * if dict_result is NULL: + * count = 0 # <<<<<<<<<<<<<< + * else: + * count = (dict_result) + 1 + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_int_0; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":349 + * count = 0 + * else: + * count = (dict_result) + 1 # <<<<<<<<<<<<<< + * tags[tag] = count + * if count > 0: + */ + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_v_dict_result), __pyx_int_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(__pyx_v_count); + __pyx_v_count = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L9:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":350 + * else: + * count = (dict_result) + 1 + * tags[tag] = count # <<<<<<<<<<<<<< + * if count > 0: + * tag += u'[%d]' % count + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_tags), __pyx_v_tag, __pyx_v_count) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":351 + * count = (dict_result) + 1 + * tags[tag] = count + * if count > 0: # <<<<<<<<<<<<<< + * tag += u'[%d]' % count + * path.append(tag) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_count, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":352 + * tags[tag] = count + * if count > 0: + * tag += u'[%d]' % count # <<<<<<<<<<<<<< + * path.append(tag) + * _recursiveBuildDescendantPaths(c_child, path, path_list) + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_54), __pyx_v_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tag, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 352; __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_tag); + __pyx_v_tag = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":353 + * if count > 0: + * tag += u'[%d]' % count + * path.append(tag) # <<<<<<<<<<<<<< + * _recursiveBuildDescendantPaths(c_child, path, path_list) + * del path[-1] + */ + if (unlikely(__pyx_v_path == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_path), __pyx_v_tag); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":354 + * tag += u'[%d]' % count + * path.append(tag) + * _recursiveBuildDescendantPaths(c_child, path, path_list) # <<<<<<<<<<<<<< + * del path[-1] + * c_child = c_child.next + */ + __pyx_t_4 = __pyx_f_4lxml_9objectify__recursiveBuildDescendantPaths(__pyx_v_c_child, __pyx_v_path, __pyx_v_path_list); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":355 + * path.append(tag) + * _recursiveBuildDescendantPaths(c_child, path, path_list) + * del path[-1] # <<<<<<<<<<<<<< + * c_child = c_child.next + * return 0 + */ + if (__Pyx_DelItemInt(((PyObject *)__pyx_v_path), -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":356 + * _recursiveBuildDescendantPaths(c_child, path, path_list) + * del path[-1] + * c_child = c_child.next # <<<<<<<<<<<<<< + * return 0 + */ + __pyx_v_c_child = __pyx_v_c_child->next; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":357 + * del path[-1] + * c_child = c_child.next + * return 0 # <<<<<<<<<<<<<< + */ + __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.objectify._recursiveBuildDescendantPaths"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tags); + __Pyx_DECREF(__pyx_v_tag); + __Pyx_DECREF(__pyx_v_count); + __Pyx_DECREF(__pyx_v_path); + __Pyx_DECREF(__pyx_v_path_list); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_4lxml_9objectify_PyType(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_9objectify_PyType *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_9objectify_PyType *)o); + p->name = Py_None; Py_INCREF(Py_None); + p->type_check = Py_None; Py_INCREF(Py_None); + p->stringify = Py_None; Py_INCREF(Py_None); + p->_type = Py_None; Py_INCREF(Py_None); + p->_schema_types = ((PyObject *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify_PyType(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_PyType *p = (struct __pyx_obj_4lxml_9objectify_PyType *)o; + Py_XDECREF(p->name); + Py_XDECREF(p->type_check); + Py_XDECREF(p->stringify); + Py_XDECREF(p->_type); + Py_XDECREF(((PyObject *)p->_schema_types)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify_PyType(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_9objectify_PyType *p = (struct __pyx_obj_4lxml_9objectify_PyType *)o; + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + if (p->type_check) { + e = (*v)(p->type_check, a); if (e) return e; + } + if (p->stringify) { + e = (*v)(p->stringify, a); if (e) return e; + } + if (p->_type) { + e = (*v)(p->_type, a); if (e) return e; + } + if (p->_schema_types) { + e = (*v)(p->_schema_types, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify_PyType(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_PyType *p = (struct __pyx_obj_4lxml_9objectify_PyType *)o; + PyObject* tmp; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->type_check); + p->type_check = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->stringify); + p->stringify = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_type); + p->_type = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_schema_types); + p->_schema_types = ((PyObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4lxml_9objectify_6PyType_xmlSchemaTypes(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_6PyType_14xmlSchemaTypes___get__(o); +} + +static int __pyx_setprop_4lxml_9objectify_6PyType_xmlSchemaTypes(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_4lxml_9objectify_6PyType_14xmlSchemaTypes___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_PyType[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_6PyType___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("register"), (PyCFunction)__pyx_pf_4lxml_9objectify_6PyType_register, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_6PyType_register)}, + {__Pyx_NAMESTR("unregister"), (PyCFunction)__pyx_pf_4lxml_9objectify_6PyType_unregister, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_6PyType_unregister)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_9objectify_PyType[] = { + {(char *)"name", T_OBJECT, offsetof(struct __pyx_obj_4lxml_9objectify_PyType, name), READONLY, 0}, + {(char *)"type_check", T_OBJECT, offsetof(struct __pyx_obj_4lxml_9objectify_PyType, type_check), READONLY, 0}, + {(char *)"stringify", T_OBJECT, offsetof(struct __pyx_obj_4lxml_9objectify_PyType, stringify), READONLY, 0}, + {0, 0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_PyType[] = { + {(char *)"xmlSchemaTypes", __pyx_getprop_4lxml_9objectify_6PyType_xmlSchemaTypes, __pyx_setprop_4lxml_9objectify_6PyType_xmlSchemaTypes, __Pyx_DOCSTR(__pyx_k_55), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PyType = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PyType = { + 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_PyType = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PyType = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_PyType = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.PyType"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_PyType), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_PyType, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_9objectify_6PyType___repr__, /*tp_repr*/ + &__pyx_tp_as_number_PyType, /*tp_as_number*/ + &__pyx_tp_as_sequence_PyType, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PyType, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PyType, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("PyType(self, name, type_check, type_class, stringify=None)\n User defined type.\n\n Named type that contains a type check function and a type class that\n inherits from ObjectifiedDataElement. The type check must take a string\n as argument and raise ValueError or TypeError if it cannot handle the\n string value. It may be None in which case it is not considered for type\n guessing.\n\n Example::\n\n PyType('int', int, MyIntClass).register()\n\n Note that the order in which types are registered matters. The first\n matching type will be used.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_PyType, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_PyType, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_PyType, /*tp_methods*/ + __pyx_members_4lxml_9objectify_PyType, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_PyType, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_4lxml_9objectify_6PyType___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4lxml_9objectify_PyType, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_ObjectifiedElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_ptype_4lxml_11etreepublic_ElementBase->tp_new(t, a, k); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify_ObjectifiedElement(PyObject *o) { + __pyx_ptype_4lxml_11etreepublic_ElementBase->tp_dealloc(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify_ObjectifiedElement(PyObject *o, visitproc v, void *a) { + int e; + if (__pyx_ptype_4lxml_11etreepublic_ElementBase->tp_traverse) { + e = __pyx_ptype_4lxml_11etreepublic_ElementBase->tp_traverse(o, v, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify_ObjectifiedElement(PyObject *o) { + if (__pyx_ptype_4lxml_11etreepublic_ElementBase->tp_clear) { + __pyx_ptype_4lxml_11etreepublic_ElementBase->tp_clear(o); + } + return 0; +} +static PyObject *__pyx_sq_item_4lxml_9objectify_ObjectifiedElement(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_9objectify_ObjectifiedElement(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pf_4lxml_9objectify_18ObjectifiedElement___setitem__(o, i, v); + } + else { + return __pyx_pf_4lxml_9objectify_18ObjectifiedElement___delitem__(o, i); + } +} + +static PyObject *__pyx_tp_getattro_4lxml_9objectify_ObjectifiedElement(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_pf_4lxml_9objectify_18ObjectifiedElement___getattr__(o, n); + } + return v; +} + +static int __pyx_tp_setattro_4lxml_9objectify_ObjectifiedElement(PyObject *o, PyObject *n, PyObject *v) { + if (v) { + return __pyx_pf_4lxml_9objectify_18ObjectifiedElement___setattr__(o, n, v); + } + else { + return __pyx_pf_4lxml_9objectify_18ObjectifiedElement___delattr__(o, n); + } +} + +static PyObject *__pyx_getprop_4lxml_9objectify_18ObjectifiedElement_text(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_18ObjectifiedElement_4text___get__(o); +} + +static PyObject *__pyx_getprop_4lxml_9objectify_18ObjectifiedElement___dict__(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_18ObjectifiedElement_8__dict_____get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_ObjectifiedElement[] = { + {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement___iter__)}, + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("countchildren"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_countchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_countchildren)}, + {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_getchildren)}, + {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement___getattr__)}, + {__Pyx_NAMESTR("addattr"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_addattr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_addattr)}, + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement___getitem__)}, + {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_iterfind, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_iterfind)}, + {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_findall, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_findall)}, + {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_find, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_find)}, + {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_findtext)}, + {__Pyx_NAMESTR("descendantpaths"), (PyCFunction)__pyx_pf_4lxml_9objectify_18ObjectifiedElement_descendantpaths, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_18ObjectifiedElement_descendantpaths)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_ObjectifiedElement[] = { + {(char *)"text", __pyx_getprop_4lxml_9objectify_18ObjectifiedElement_text, 0, 0, 0}, + {(char *)"__dict__", __pyx_getprop_4lxml_9objectify_18ObjectifiedElement___dict__, 0, __Pyx_DOCSTR(__pyx_k_56), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ObjectifiedElement = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ObjectifiedElement = { + __pyx_pf_4lxml_9objectify_18ObjectifiedElement___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4lxml_9objectify_ObjectifiedElement, /*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_ObjectifiedElement = { + __pyx_pf_4lxml_9objectify_18ObjectifiedElement___len__, /*mp_length*/ + __pyx_pf_4lxml_9objectify_18ObjectifiedElement___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_4lxml_9objectify_ObjectifiedElement, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ObjectifiedElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_ObjectifiedElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.ObjectifiedElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_ObjectifiedElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ObjectifiedElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_ObjectifiedElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_ObjectifiedElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ObjectifiedElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_4lxml_9objectify_18ObjectifiedElement___str__, /*tp_str*/ + __pyx_tp_getattro_4lxml_9objectify_ObjectifiedElement, /*tp_getattro*/ + __pyx_tp_setattro_4lxml_9objectify_ObjectifiedElement, /*tp_setattro*/ + &__pyx_tp_as_buffer_ObjectifiedElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Main XML Element class.\n\n Element children are accessed as object attributes. Multiple children\n with the same name are available through a list index. Example::\n\n >>> root = XML(\"01\")\n >>> second_c2 = root.c1.c2[1]\n >>> print(second_c2.text)\n 1\n\n Note that you cannot (and must not) instantiate this class or its\n subclasses.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ObjectifiedElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ObjectifiedElement, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_4lxml_9objectify_18ObjectifiedElement___iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_ObjectifiedElement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_ObjectifiedElement, /*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_9objectify_ObjectifiedElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_ObjectifiedDataElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_ObjectifiedElement(t, a, k); + if (!o) return 0; + return o; +} + +static PyObject *__pyx_getprop_4lxml_9objectify_22ObjectifiedDataElement_pyval(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_22ObjectifiedDataElement_5pyval___get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_ObjectifiedDataElement[] = { + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_setText"), (PyCFunction)__pyx_pf_4lxml_9objectify_22ObjectifiedDataElement__setText, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_22ObjectifiedDataElement__setText)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_ObjectifiedDataElement[] = { + {(char *)"pyval", __pyx_getprop_4lxml_9objectify_22ObjectifiedDataElement_pyval, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ObjectifiedDataElement = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ObjectifiedDataElement = { + 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_ObjectifiedDataElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ObjectifiedDataElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_ObjectifiedDataElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.ObjectifiedDataElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_ObjectifiedDataElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ObjectifiedElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___repr__, /*tp_repr*/ + &__pyx_tp_as_number_ObjectifiedDataElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_ObjectifiedDataElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ObjectifiedDataElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_4lxml_9objectify_22ObjectifiedDataElement___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ObjectifiedDataElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("This is the base class for all data type Elements. Subclasses should\n override the 'pyval' property and possibly the __str__ method.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ObjectifiedElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ObjectifiedElement, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_ObjectifiedDataElement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_ObjectifiedDataElement, /*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_9objectify_ObjectifiedDataElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_NumberElement(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_9objectify_NumberElement *p; + PyObject *o = __pyx_tp_new_4lxml_9objectify_ObjectifiedElement(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_9objectify_NumberElement *)o); + p->_parse_value = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify_NumberElement(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_NumberElement *p = (struct __pyx_obj_4lxml_9objectify_NumberElement *)o; + Py_XDECREF(p->_parse_value); + __pyx_tp_dealloc_4lxml_9objectify_ObjectifiedElement(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify_NumberElement(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_9objectify_NumberElement *p = (struct __pyx_obj_4lxml_9objectify_NumberElement *)o; + e = __pyx_tp_traverse_4lxml_9objectify_ObjectifiedElement(o, v, a); if (e) return e; + if (p->_parse_value) { + e = (*v)(p->_parse_value, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify_NumberElement(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_NumberElement *p = (struct __pyx_obj_4lxml_9objectify_NumberElement *)o; + PyObject* tmp; + __pyx_tp_clear_4lxml_9objectify_ObjectifiedElement(o); + tmp = ((PyObject*)p->_parse_value); + p->_parse_value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4lxml_9objectify_13NumberElement_pyval(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_13NumberElement_5pyval___get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_NumberElement[] = { + {__Pyx_NAMESTR("_setValueParser"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement__setValueParser, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_13NumberElement__setValueParser)}, + {__Pyx_NAMESTR("__int__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___int__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__long__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___long__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__float__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___float__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__complex__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___complex__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__oct__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___oct__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__hex__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___hex__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__add__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___add__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__sub__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___sub__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__mul__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___mul__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__div__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___div__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__truediv__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___truediv__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__mod__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___mod__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__neg__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___neg__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__pos__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___pos__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__abs__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___abs__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__invert__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___invert__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__lshift__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___lshift__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__rshift__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___rshift__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__and__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___and__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__or__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___or__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__xor__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13NumberElement___xor__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_NumberElement[] = { + {(char *)"pyval", __pyx_getprop_4lxml_9objectify_13NumberElement_pyval, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_NumberElement = { + __pyx_pf_4lxml_9objectify_13NumberElement___add__, /*nb_add*/ + __pyx_pf_4lxml_9objectify_13NumberElement___sub__, /*nb_subtract*/ + __pyx_pf_4lxml_9objectify_13NumberElement___mul__, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + __pyx_pf_4lxml_9objectify_13NumberElement___div__, /*nb_divide*/ + #endif + __pyx_pf_4lxml_9objectify_13NumberElement___mod__, /*nb_remainder*/ + 0, /*nb_divmod*/ + __pyx_pf_4lxml_9objectify_13NumberElement___pow__, /*nb_power*/ + __pyx_pf_4lxml_9objectify_13NumberElement___neg__, /*nb_negative*/ + __pyx_pf_4lxml_9objectify_13NumberElement___pos__, /*nb_positive*/ + __pyx_pf_4lxml_9objectify_13NumberElement___abs__, /*nb_absolute*/ + __pyx_pf_4lxml_9objectify_13NumberElement___nonzero__, /*nb_nonzero*/ + __pyx_pf_4lxml_9objectify_13NumberElement___invert__, /*nb_invert*/ + __pyx_pf_4lxml_9objectify_13NumberElement___lshift__, /*nb_lshift*/ + __pyx_pf_4lxml_9objectify_13NumberElement___rshift__, /*nb_rshift*/ + __pyx_pf_4lxml_9objectify_13NumberElement___and__, /*nb_and*/ + __pyx_pf_4lxml_9objectify_13NumberElement___xor__, /*nb_xor*/ + __pyx_pf_4lxml_9objectify_13NumberElement___or__, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + __pyx_pf_4lxml_9objectify_13NumberElement___int__, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + __pyx_pf_4lxml_9objectify_13NumberElement___long__, /*nb_long*/ + #endif + __pyx_pf_4lxml_9objectify_13NumberElement___float__, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + __pyx_pf_4lxml_9objectify_13NumberElement___oct__, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_pf_4lxml_9objectify_13NumberElement___hex__, /*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*/ + __pyx_pf_4lxml_9objectify_13NumberElement___truediv__, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_NumberElement = { + 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_NumberElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_NumberElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_NumberElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.NumberElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_NumberElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_NumberElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_9objectify_13NumberElement___repr__, /*tp_repr*/ + &__pyx_tp_as_number_NumberElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_NumberElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_NumberElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_4lxml_9objectify_13NumberElement___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_NumberElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_NumberElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_NumberElement, /*tp_clear*/ + __pyx_pf_4lxml_9objectify_13NumberElement___richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_NumberElement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_NumberElement, /*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_9objectify_NumberElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_IntElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_NumberElement(t, a, k); + if (!o) return 0; + return o; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_IntElement[] = { + {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pf_4lxml_9objectify_10IntElement__init, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IntElement = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntElement = { + 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_IntElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IntElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_IntElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.IntElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_IntElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_NumberElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_IntElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_IntElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IntElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_NumberElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_NumberElement, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_IntElement, /*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_9objectify_IntElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_LongElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_NumberElement(t, a, k); + if (!o) return 0; + return o; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_LongElement[] = { + {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pf_4lxml_9objectify_11LongElement__init, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_LongElement = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_LongElement = { + 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_LongElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_LongElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_LongElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.LongElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_LongElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_NumberElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_LongElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_LongElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_LongElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_LongElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_NumberElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_NumberElement, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_LongElement, /*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_9objectify_LongElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_FloatElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_NumberElement(t, a, k); + if (!o) return 0; + return o; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_FloatElement[] = { + {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pf_4lxml_9objectify_12FloatElement__init, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_FloatElement = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_FloatElement = { + 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_FloatElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_FloatElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_FloatElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.FloatElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_FloatElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_NumberElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_FloatElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_FloatElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FloatElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_FloatElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_NumberElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_NumberElement, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_FloatElement, /*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_9objectify_FloatElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_StringElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_ObjectifiedElement(t, a, k); + if (!o) return 0; + return o; +} + +static PyObject *__pyx_getprop_4lxml_9objectify_13StringElement_pyval(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_13StringElement_5pyval___get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_StringElement[] = { + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("strlen"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement_strlen, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__add__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___add__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__mul__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___mul__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__mod__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___mod__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__int__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___int__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__long__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___long__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__float__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___float__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__complex__"), (PyCFunction)__pyx_pf_4lxml_9objectify_13StringElement___complex__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_StringElement[] = { + {(char *)"pyval", __pyx_getprop_4lxml_9objectify_13StringElement_pyval, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_StringElement = { + __pyx_pf_4lxml_9objectify_13StringElement___add__, /*nb_add*/ + 0, /*nb_subtract*/ + __pyx_pf_4lxml_9objectify_13StringElement___mul__, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + __pyx_pf_4lxml_9objectify_13StringElement___mod__, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + __pyx_pf_4lxml_9objectify_13StringElement___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 + __pyx_pf_4lxml_9objectify_13StringElement___int__, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + __pyx_pf_4lxml_9objectify_13StringElement___long__, /*nb_long*/ + #endif + __pyx_pf_4lxml_9objectify_13StringElement___float__, /*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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_StringElement = { + 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_StringElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_StringElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_StringElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.StringElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_StringElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ObjectifiedElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_9objectify_13StringElement___repr__, /*tp_repr*/ + &__pyx_tp_as_number_StringElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_StringElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_StringElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_StringElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("String data class.\n\n Note that this class does *not* support the sequence protocol of strings:\n len(), iter(), str_attr[0], str_attr[0:1], etc. are *not* supported.\n Instead, use the .text attribute to get a 'real' string.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ObjectifiedElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ObjectifiedElement, /*tp_clear*/ + __pyx_pf_4lxml_9objectify_13StringElement___richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_StringElement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_StringElement, /*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_9objectify_StringElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_NoneElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_ObjectifiedElement(t, a, k); + if (!o) return 0; + return o; +} + +static PyObject *__pyx_getprop_4lxml_9objectify_11NoneElement_pyval(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_11NoneElement_5pyval___get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_NoneElement[] = { + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_9objectify_11NoneElement___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_11NoneElement___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_NoneElement[] = { + {(char *)"pyval", __pyx_getprop_4lxml_9objectify_11NoneElement_pyval, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_NoneElement = { + 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_9objectify_11NoneElement___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_NoneElement = { + 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_NoneElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_NoneElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_NoneElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.NoneElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_NoneElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ObjectifiedElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_9objectify_11NoneElement___repr__, /*tp_repr*/ + &__pyx_tp_as_number_NoneElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_NoneElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_NoneElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_4lxml_9objectify_11NoneElement___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_NoneElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ObjectifiedElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ObjectifiedElement, /*tp_clear*/ + __pyx_pf_4lxml_9objectify_11NoneElement___richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_NoneElement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_NoneElement, /*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_9objectify_NoneElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_BoolElement(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4lxml_9objectify_NumberElement(t, a, k); + if (!o) return 0; + return o; +} + +static PyObject *__pyx_getprop_4lxml_9objectify_11BoolElement_pyval(PyObject *o, void *x) { + return __pyx_pf_4lxml_9objectify_11BoolElement_5pyval___get__(o); +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_BoolElement[] = { + {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pf_4lxml_9objectify_11BoolElement__init, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_9objectify_11BoolElement___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_11BoolElement___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4lxml_9objectify_BoolElement[] = { + {(char *)"pyval", __pyx_getprop_4lxml_9objectify_11BoolElement_pyval, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BoolElement = { + 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_9objectify_11BoolElement___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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BoolElement = { + 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_BoolElement = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BoolElement = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_BoolElement = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.BoolElement"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_BoolElement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_NumberElement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + __pyx_pf_4lxml_9objectify_11BoolElement___repr__, /*tp_repr*/ + &__pyx_tp_as_number_BoolElement, /*tp_as_number*/ + &__pyx_tp_as_sequence_BoolElement, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BoolElement, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_4lxml_9objectify_11BoolElement___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BoolElement, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Boolean type base on string values: 'true' or 'false'.\n\n Note that this inherits from IntElement to mimic the behaviour of\n Python's bool type.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_NumberElement, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_NumberElement, /*tp_clear*/ + __pyx_pf_4lxml_9objectify_11BoolElement___richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_BoolElement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4lxml_9objectify_BoolElement, /*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_9objectify_BoolElement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify__ObjectifyElementMakerCaller(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)o); + p->_tag = Py_None; Py_INCREF(Py_None); + p->_nsmap = Py_None; Py_INCREF(Py_None); + p->_element_factory = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify__ObjectifyElementMakerCaller(PyObject *o) { + struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *p = (struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)o; + Py_XDECREF(p->_tag); + Py_XDECREF(p->_nsmap); + Py_XDECREF(p->_element_factory); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify__ObjectifyElementMakerCaller(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *p = (struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)o; + if (p->_tag) { + e = (*v)(p->_tag, a); if (e) return e; + } + if (p->_nsmap) { + e = (*v)(p->_nsmap, a); if (e) return e; + } + if (p->_element_factory) { + e = (*v)(p->_element_factory, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify__ObjectifyElementMakerCaller(PyObject *o) { + struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *p = (struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller *)o; + PyObject* tmp; + tmp = ((PyObject*)p->_tag); + p->_tag = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_nsmap); + p->_nsmap = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_element_factory); + p->_element_factory = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify__ObjectifyElementMakerCaller[] = { + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_9objectify_28_ObjectifyElementMakerCaller___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_28_ObjectifyElementMakerCaller___call__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number__ObjectifyElementMakerCaller = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence__ObjectifyElementMakerCaller = { + 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__ObjectifyElementMakerCaller = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer__ObjectifyElementMakerCaller = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify__ObjectifyElementMakerCaller = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify._ObjectifyElementMakerCaller"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify__ObjectifyElementMakerCaller), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify__ObjectifyElementMakerCaller, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number__ObjectifyElementMakerCaller, /*tp_as_number*/ + &__pyx_tp_as_sequence__ObjectifyElementMakerCaller, /*tp_as_sequence*/ + &__pyx_tp_as_mapping__ObjectifyElementMakerCaller, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_4lxml_9objectify_28_ObjectifyElementMakerCaller___call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer__ObjectifyElementMakerCaller, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify__ObjectifyElementMakerCaller, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify__ObjectifyElementMakerCaller, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify__ObjectifyElementMakerCaller, /*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_9objectify__ObjectifyElementMakerCaller, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_ElementMaker(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_9objectify_ElementMaker *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_9objectify_ElementMaker *)o); + p->_makeelement = Py_None; Py_INCREF(Py_None); + p->_namespace = Py_None; Py_INCREF(Py_None); + p->_nsmap = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify_ElementMaker(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_ElementMaker *p = (struct __pyx_obj_4lxml_9objectify_ElementMaker *)o; + Py_XDECREF(p->_makeelement); + Py_XDECREF(p->_namespace); + Py_XDECREF(p->_nsmap); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify_ElementMaker(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_9objectify_ElementMaker *p = (struct __pyx_obj_4lxml_9objectify_ElementMaker *)o; + if (p->_makeelement) { + e = (*v)(p->_makeelement, a); if (e) return e; + } + if (p->_namespace) { + e = (*v)(p->_namespace, a); if (e) return e; + } + if (p->_nsmap) { + e = (*v)(p->_nsmap, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify_ElementMaker(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_ElementMaker *p = (struct __pyx_obj_4lxml_9objectify_ElementMaker *)o; + PyObject* tmp; + tmp = ((PyObject*)p->_makeelement); + p->_makeelement = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_namespace); + p->_namespace = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_nsmap); + p->_nsmap = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_tp_getattro_4lxml_9objectify_ElementMaker(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_pf_4lxml_9objectify_12ElementMaker___getattr__(o, n); + } + return v; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_ElementMaker[] = { + {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_4lxml_9objectify_12ElementMaker___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ElementMaker = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ElementMaker = { + 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_ElementMaker = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ElementMaker = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_ElementMaker = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.ElementMaker"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_ElementMaker), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ElementMaker, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_ElementMaker, /*tp_as_number*/ + &__pyx_tp_as_sequence_ElementMaker, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ElementMaker, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_4lxml_9objectify_ElementMaker, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ElementMaker, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("ElementMaker(self, namespace=None, nsmap=None, annotate=True, makeelement=None)\n\n An ElementMaker that can be used for constructing trees.\n\n Example::\n\n >>> M = ElementMaker(annotate=False)\n >>> html = M.html( M.body( M.p('hello', M.br, 'objectify') ) )\n\n >>> from lxml.etree import tostring\n >>> print(tostring(html, method='html').decode('ASCII'))\n

hello
objectify

\n\n Note that this module has a predefined ElementMaker instance called ``E``.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ElementMaker, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ElementMaker, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_ElementMaker, /*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_9objectify_12ElementMaker___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4lxml_9objectify_ElementMaker, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_ObjectifyElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *p; + PyObject *o = __pyx_ptype_4lxml_11etreepublic_ElementClassLookup->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)o); + p->empty_data_class = Py_None; Py_INCREF(Py_None); + p->tree_class = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify_ObjectifyElementClassLookup(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *p = (struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)o; + Py_XDECREF(p->empty_data_class); + Py_XDECREF(p->tree_class); + __pyx_ptype_4lxml_11etreepublic_ElementClassLookup->tp_dealloc(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify_ObjectifyElementClassLookup(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *p = (struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)o; + if (__pyx_ptype_4lxml_11etreepublic_ElementClassLookup->tp_traverse) { + e = __pyx_ptype_4lxml_11etreepublic_ElementClassLookup->tp_traverse(o, v, a); if (e) return e; + } + if (p->empty_data_class) { + e = (*v)(p->empty_data_class, a); if (e) return e; + } + if (p->tree_class) { + e = (*v)(p->tree_class, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify_ObjectifyElementClassLookup(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *p = (struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup *)o; + PyObject* tmp; + if (__pyx_ptype_4lxml_11etreepublic_ElementClassLookup->tp_clear) { + __pyx_ptype_4lxml_11etreepublic_ElementClassLookup->tp_clear(o); + } + tmp = ((PyObject*)p->empty_data_class); + p->empty_data_class = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->tree_class); + p->tree_class = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_ObjectifyElementClassLookup[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ObjectifyElementClassLookup = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ObjectifyElementClassLookup = { + 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_ObjectifyElementClassLookup = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ObjectifyElementClassLookup = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_ObjectifyElementClassLookup = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.ObjectifyElementClassLookup"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_ObjectifyElementClassLookup), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ObjectifyElementClassLookup, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_ObjectifyElementClassLookup, /*tp_as_number*/ + &__pyx_tp_as_sequence_ObjectifyElementClassLookup, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ObjectifyElementClassLookup, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ObjectifyElementClassLookup, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("ObjectifyElementClassLookup(self, tree_class=None, empty_data_class=None)\n Element class lookup method that uses the objectify classes.\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ObjectifyElementClassLookup, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ObjectifyElementClassLookup, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_ObjectifyElementClassLookup, /*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_9objectify_27ObjectifyElementClassLookup___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4lxml_9objectify_ObjectifyElementClassLookup, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static PyObject *__pyx_tp_new_4lxml_9objectify_ObjectPath(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4lxml_9objectify_ObjectPath *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_4lxml_9objectify_ObjectPath *)o); + p->find = Py_None; Py_INCREF(Py_None); + p->_path = Py_None; Py_INCREF(Py_None); + p->_path_str = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4lxml_9objectify_ObjectPath(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_ObjectPath *p = (struct __pyx_obj_4lxml_9objectify_ObjectPath *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_4lxml_9objectify_10ObjectPath___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(p->find); + Py_XDECREF(p->_path); + Py_XDECREF(p->_path_str); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4lxml_9objectify_ObjectPath(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4lxml_9objectify_ObjectPath *p = (struct __pyx_obj_4lxml_9objectify_ObjectPath *)o; + if (p->find) { + e = (*v)(p->find, a); if (e) return e; + } + if (p->_path) { + e = (*v)(p->_path, a); if (e) return e; + } + if (p->_path_str) { + e = (*v)(p->_path_str, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4lxml_9objectify_ObjectPath(PyObject *o) { + struct __pyx_obj_4lxml_9objectify_ObjectPath *p = (struct __pyx_obj_4lxml_9objectify_ObjectPath *)o; + PyObject* tmp; + tmp = ((PyObject*)p->find); + p->find = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_path); + p->_path = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_path_str); + p->_path_str = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static struct PyMethodDef __pyx_methods_4lxml_9objectify_ObjectPath[] = { + {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_4lxml_9objectify_10ObjectPath___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_4lxml_9objectify_10ObjectPath___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_10ObjectPath___call__)}, + {__Pyx_NAMESTR("hasattr"), (PyCFunction)__pyx_pf_4lxml_9objectify_10ObjectPath_hasattr, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_10ObjectPath_hasattr)}, + {__Pyx_NAMESTR("setattr"), (PyCFunction)__pyx_pf_4lxml_9objectify_10ObjectPath_setattr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_10ObjectPath_setattr)}, + {__Pyx_NAMESTR("addattr"), (PyCFunction)__pyx_pf_4lxml_9objectify_10ObjectPath_addattr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_10ObjectPath_addattr)}, + {0, 0, 0, 0} +}; + +static struct PyMemberDef __pyx_members_4lxml_9objectify_ObjectPath[] = { + {(char *)"find", T_OBJECT, offsetof(struct __pyx_obj_4lxml_9objectify_ObjectPath, find), READONLY, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ObjectPath = { + 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, /*reserved*/ + #else + 0, /*nb_long*/ + #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ObjectPath = { + 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_ObjectPath = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ObjectPath = { + #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 +}; + +PyTypeObject __pyx_type_4lxml_9objectify_ObjectPath = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("lxml.objectify.ObjectPath"), /*tp_name*/ + sizeof(struct __pyx_obj_4lxml_9objectify_ObjectPath), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4lxml_9objectify_ObjectPath, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_ObjectPath, /*tp_as_number*/ + &__pyx_tp_as_sequence_ObjectPath, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ObjectPath, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_4lxml_9objectify_10ObjectPath___call__, /*tp_call*/ + __pyx_pf_4lxml_9objectify_10ObjectPath___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ObjectPath, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("ObjectPath(path)\n Immutable object that represents a compiled object path.\n\n Example for a path: 'root.child[1].{other}child[25]'\n "), /*tp_doc*/ + __pyx_tp_traverse_4lxml_9objectify_ObjectPath, /*tp_traverse*/ + __pyx_tp_clear_4lxml_9objectify_ObjectPath, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4lxml_9objectify_ObjectPath, /*tp_methods*/ + __pyx_members_4lxml_9objectify_ObjectPath, /*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_9objectify_10ObjectPath___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4lxml_9objectify_ObjectPath, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static struct PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("set_pytype_attribute_tag"), (PyCFunction)__pyx_pf_4lxml_9objectify_set_pytype_attribute_tag, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_set_pytype_attribute_tag)}, + {__Pyx_NAMESTR("__checkBool"), (PyCFunction)__pyx_pf_4lxml_9objectify___checkBool, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__parseBool"), (PyCFunction)__pyx_pf_4lxml_9objectify___parseBool, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__lower_bool"), (PyCFunction)__pyx_pf_4lxml_9objectify___lower_bool, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("pytypename"), (PyCFunction)__pyx_pf_4lxml_9objectify_pytypename, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_pytypename)}, + {__Pyx_NAMESTR("getRegisteredTypes"), (PyCFunction)__pyx_pf_4lxml_9objectify_getRegisteredTypes, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_getRegisteredTypes)}, + {__Pyx_NAMESTR("enable_recursive_str"), (PyCFunction)__pyx_pf_4lxml_9objectify_enable_recursive_str, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_enable_recursive_str)}, + {__Pyx_NAMESTR("dump"), (PyCFunction)__pyx_pf_4lxml_9objectify_dump, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_dump)}, + {__Pyx_NAMESTR("__unpickleElementTree"), (PyCFunction)__pyx_pf_4lxml_9objectify___unpickleElementTree, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("pickleReduceElement"), (PyCFunction)__pyx_pf_4lxml_9objectify_pickleReduceElement, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("pickleReduceElementTree"), (PyCFunction)__pyx_pf_4lxml_9objectify_pickleReduceElementTree, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("pyannotate"), (PyCFunction)__pyx_pf_4lxml_9objectify_pyannotate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_pyannotate)}, + {__Pyx_NAMESTR("xsiannotate"), (PyCFunction)__pyx_pf_4lxml_9objectify_xsiannotate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_xsiannotate)}, + {__Pyx_NAMESTR("annotate"), (PyCFunction)__pyx_pf_4lxml_9objectify_annotate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_annotate)}, + {__Pyx_NAMESTR("deannotate"), (PyCFunction)__pyx_pf_4lxml_9objectify_deannotate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_deannotate)}, + {__Pyx_NAMESTR("set_default_parser"), (PyCFunction)__pyx_pf_4lxml_9objectify_set_default_parser, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_set_default_parser)}, + {__Pyx_NAMESTR("makeparser"), (PyCFunction)__pyx_pf_4lxml_9objectify_makeparser, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_makeparser)}, + {__Pyx_NAMESTR("fromstring"), (PyCFunction)__pyx_pf_4lxml_9objectify_fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_fromstring)}, + {__Pyx_NAMESTR("XML"), (PyCFunction)__pyx_pf_4lxml_9objectify_XML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_XML)}, + {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4lxml_9objectify_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_parse)}, + {__Pyx_NAMESTR("Element"), (PyCFunction)__pyx_pf_4lxml_9objectify_Element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_Element)}, + {__Pyx_NAMESTR("DataElement"), (PyCFunction)__pyx_pf_4lxml_9objectify_DataElement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_9objectify_DataElement)}, + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("objectify"), + __Pyx_DOCSTR(__pyx_k_57), /* 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_u_0, __pyx_k_0, sizeof(__pyx_k_0), 1, 0, 0}, + {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 1, 0, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 1, 0, 0}, + {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 1, 0, 0}, + {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 1, 0, 0}, + {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 1, 0, 0}, + {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 1, 0, 0}, + {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 1, 0, 0}, + {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 1, 0, 0}, + {&__pyx_kp_u_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 0, 0}, + {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 1, 0, 0}, + {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 1, 0, 0}, + {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 1, 0, 0}, + {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 1, 0, 0}, + {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 1, 0, 0}, + {&__pyx_n_ui_3, __pyx_k_3, sizeof(__pyx_k_3), 1, 1, 1}, + {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 1, 0, 0}, + {&__pyx_n_ui_31, __pyx_k_31, sizeof(__pyx_k_31), 1, 1, 1}, + {&__pyx_kp_b_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 0}, + {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 1, 0, 0}, + {&__pyx_kp_u_42, __pyx_k_42, sizeof(__pyx_k_42), 1, 0, 0}, + {&__pyx_n_ui_43, __pyx_k_43, sizeof(__pyx_k_43), 1, 1, 1}, + {&__pyx_kp_u_44, __pyx_k_44, sizeof(__pyx_k_44), 1, 0, 0}, + {&__pyx_kp_u_45, __pyx_k_45, sizeof(__pyx_k_45), 1, 0, 0}, + {&__pyx_kp_u_46, __pyx_k_46, sizeof(__pyx_k_46), 1, 0, 0}, + {&__pyx_kp_u_47, __pyx_k_47, sizeof(__pyx_k_47), 1, 0, 0}, + {&__pyx_kp_u_48, __pyx_k_48, sizeof(__pyx_k_48), 1, 0, 0}, + {&__pyx_kp_u_49, __pyx_k_49, sizeof(__pyx_k_49), 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 1, 0, 0}, + {&__pyx_kp_u_50, __pyx_k_50, sizeof(__pyx_k_50), 1, 0, 0}, + {&__pyx_kp_u_51, __pyx_k_51, sizeof(__pyx_k_51), 1, 0, 0}, + {&__pyx_kp_u_52, __pyx_k_52, sizeof(__pyx_k_52), 1, 0, 0}, + {&__pyx_kp_u_53, __pyx_k_53, sizeof(__pyx_k_53), 1, 0, 0}, + {&__pyx_kp_u_54, __pyx_k_54, sizeof(__pyx_k_54), 1, 0, 0}, + {&__pyx_n_u_58, __pyx_k_58, sizeof(__pyx_k_58), 1, 1, 0}, + {&__pyx_n_u_59, __pyx_k_59, sizeof(__pyx_k_59), 1, 1, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 1, 0, 0}, + {&__pyx_n_u_60, __pyx_k_60, sizeof(__pyx_k_60), 1, 1, 0}, + {&__pyx_n_u_61, __pyx_k_61, sizeof(__pyx_k_61), 1, 1, 0}, + {&__pyx_n_ui_61, __pyx_k_61, sizeof(__pyx_k_61), 1, 1, 1}, + {&__pyx_kp_u_62, __pyx_k_62, sizeof(__pyx_k_62), 1, 0, 0}, + {&__pyx_kp_u_63, __pyx_k_63, sizeof(__pyx_k_63), 1, 0, 0}, + {&__pyx_kp_u_64, __pyx_k_64, sizeof(__pyx_k_64), 1, 0, 0}, + {&__pyx_kp_u_65, __pyx_k_65, sizeof(__pyx_k_65), 1, 0, 0}, + {&__pyx_kp_u_66, __pyx_k_66, sizeof(__pyx_k_66), 1, 0, 0}, + {&__pyx_n_ui_67, __pyx_k_67, sizeof(__pyx_k_67), 1, 1, 1}, + {&__pyx_kp_u_68, __pyx_k_68, sizeof(__pyx_k_68), 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 1, 0, 0}, + {&__pyx_n_ui_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 1, 1, 1}, + {&__pyx_n_u_BoolElement, __pyx_k_BoolElement, sizeof(__pyx_k_BoolElement), 1, 1, 0}, + {&__pyx_n_u_DataElement, __pyx_k_DataElement, sizeof(__pyx_k_DataElement), 1, 1, 0}, + {&__pyx_n_u_E, __pyx_k_E, sizeof(__pyx_k_E), 1, 1, 0}, + {&__pyx_n_ui_E, __pyx_k_E, sizeof(__pyx_k_E), 1, 1, 1}, + {&__pyx_n_u_ENTITY, __pyx_k_ENTITY, sizeof(__pyx_k_ENTITY), 1, 1, 0}, + {&__pyx_n_ui_ETXPath, __pyx_k_ETXPath, sizeof(__pyx_k_ETXPath), 1, 1, 1}, + {&__pyx_n_u_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 1, 1, 0}, + {&__pyx_n_u_ElementMaker, __pyx_k_ElementMaker, sizeof(__pyx_k_ElementMaker), 1, 1, 0}, + {&__pyx_n_ui_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 1, 1, 1}, + {&__pyx_n_u_FloatElement, __pyx_k_FloatElement, sizeof(__pyx_k_FloatElement), 1, 1, 0}, + {&__pyx_n_u_ID, __pyx_k_ID, sizeof(__pyx_k_ID), 1, 1, 0}, + {&__pyx_n_u_IDREF, __pyx_k_IDREF, sizeof(__pyx_k_IDREF), 1, 1, 0}, + {&__pyx_n_ui_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 1, 1, 1}, + {&__pyx_n_u_IntElement, __pyx_k_IntElement, sizeof(__pyx_k_IntElement), 1, 1, 0}, + {&__pyx_n_u_LongElement, __pyx_k_LongElement, sizeof(__pyx_k_LongElement), 1, 1, 0}, + {&__pyx_n_u_NCName, __pyx_k_NCName, sizeof(__pyx_k_NCName), 1, 1, 0}, + {&__pyx_n_u_NMTOKEN, __pyx_k_NMTOKEN, sizeof(__pyx_k_NMTOKEN), 1, 1, 0}, + {&__pyx_n_u_Name, __pyx_k_Name, sizeof(__pyx_k_Name), 1, 1, 0}, + {&__pyx_n_u_None, __pyx_k_None, sizeof(__pyx_k_None), 1, 1, 0}, + {&__pyx_n_u_NoneElement, __pyx_k_NoneElement, sizeof(__pyx_k_NoneElement), 1, 1, 0}, + {&__pyx_n_u_NoneType, __pyx_k_NoneType, sizeof(__pyx_k_NoneType), 1, 1, 0}, + {&__pyx_n_u_NumberElement, __pyx_k_NumberElement, sizeof(__pyx_k_NumberElement), 1, 1, 0}, + {&__pyx_n_u_ObjectPath, __pyx_k_ObjectPath, sizeof(__pyx_k_ObjectPath), 1, 1, 0}, + {&__pyx_n_u_ObjectifiedElement, __pyx_k_ObjectifiedElement, sizeof(__pyx_k_ObjectifiedElement), 1, 1, 0}, + {&__pyx_n_u_PYTYPE_ATTRIBUTE, __pyx_k_PYTYPE_ATTRIBUTE, sizeof(__pyx_k_PYTYPE_ATTRIBUTE), 1, 1, 0}, + {&__pyx_n_ui_PYTYPE_ATTRIBUTE, __pyx_k_PYTYPE_ATTRIBUTE, sizeof(__pyx_k_PYTYPE_ATTRIBUTE), 1, 1, 1}, + {&__pyx_n_u_PyType, __pyx_k_PyType, sizeof(__pyx_k_PyType), 1, 1, 0}, + {&__pyx_n_u_StringElement, __pyx_k_StringElement, sizeof(__pyx_k_StringElement), 1, 1, 0}, + {&__pyx_n_u_TREE, __pyx_k_TREE, sizeof(__pyx_k_TREE), 1, 1, 0}, + {&__pyx_n_ui_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 1, 1, 1}, + {&__pyx_n_ui_U, __pyx_k_U, sizeof(__pyx_k_U), 1, 1, 1}, + {&__pyx_n_ui_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, + {&__pyx_n_u_XML, __pyx_k_XML, sizeof(__pyx_k_XML), 1, 1, 0}, + {&__pyx_n_ui_XMLParser, __pyx_k_XMLParser, sizeof(__pyx_k_XMLParser), 1, 1, 1}, + {&__pyx_n_ui__ElementTree, __pyx_k__ElementTree, sizeof(__pyx_k__ElementTree), 1, 1, 1}, + {&__pyx_n_ui___all__, __pyx_k___all__, sizeof(__pyx_k___all__), 1, 1, 1}, + {&__pyx_n_ui___call__, __pyx_k___call__, sizeof(__pyx_k___call__), 1, 1, 1}, + {&__pyx_n_ui___checkBool, __pyx_k___checkBool, sizeof(__pyx_k___checkBool), 1, 1, 1}, + {&__pyx_n_ui___copy__, __pyx_k___copy__, sizeof(__pyx_k___copy__), 1, 1, 1}, + {&__pyx_n_ui___getattr__, __pyx_k___getattr__, sizeof(__pyx_k___getattr__), 1, 1, 1}, + {&__pyx_n_ui___getitem__, __pyx_k___getitem__, sizeof(__pyx_k___getitem__), 1, 1, 1}, + {&__pyx_n_ui___lower_bool, __pyx_k___lower_bool, sizeof(__pyx_k___lower_bool), 1, 1, 1}, + {&__pyx_n_ui___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_n_ui___name__, __pyx_k___name__, sizeof(__pyx_k___name__), 1, 1, 1}, + {&__pyx_n_ui___parseBool, __pyx_k___parseBool, sizeof(__pyx_k___parseBool), 1, 1, 1}, + {&__pyx_n_ui___set__, __pyx_k___set__, sizeof(__pyx_k___set__), 1, 1, 1}, + {&__pyx_n_ui___version__, __pyx_k___version__, sizeof(__pyx_k___version__), 1, 1, 1}, + {&__pyx_n_ui__annotate, __pyx_k__annotate, sizeof(__pyx_k__annotate), 1, 1, 1}, + {&__pyx_n_ui__c_node, __pyx_k__c_node, sizeof(__pyx_k__c_node), 1, 1, 1}, + {&__pyx_n_ui__c_path, __pyx_k__c_path, sizeof(__pyx_k__c_path), 1, 1, 1}, + {&__pyx_n_ui__doc, __pyx_k__doc, sizeof(__pyx_k__doc), 1, 1, 1}, + {&__pyx_n_ui__element_factory, __pyx_k__element_factory, sizeof(__pyx_k__element_factory), 1, 1, 1}, + {&__pyx_n_ui__lookup_function, __pyx_k__lookup_function, sizeof(__pyx_k__lookup_function), 1, 1, 1}, + {&__pyx_n_ui__makeelement, __pyx_k__makeelement, sizeof(__pyx_k__makeelement), 1, 1, 1}, + {&__pyx_n_ui__namespace, __pyx_k__namespace, sizeof(__pyx_k__namespace), 1, 1, 1}, + {&__pyx_n_ui__nsmap, __pyx_k__nsmap, sizeof(__pyx_k__nsmap), 1, 1, 1}, + {&__pyx_n_ui__parse_value, __pyx_k__parse_value, sizeof(__pyx_k__parse_value), 1, 1, 1}, + {&__pyx_n_ui__path, __pyx_k__path, sizeof(__pyx_k__path), 1, 1, 1}, + {&__pyx_n_ui__path_len, __pyx_k__path_len, sizeof(__pyx_k__path_len), 1, 1, 1}, + {&__pyx_n_ui__path_str, __pyx_k__path_str, sizeof(__pyx_k__path_str), 1, 1, 1}, + {&__pyx_n_ui__pytype, __pyx_k__pytype, sizeof(__pyx_k__pytype), 1, 1, 1}, + {&__pyx_n_ui__schema_types, __pyx_k__schema_types, sizeof(__pyx_k__schema_types), 1, 1, 1}, + {&__pyx_n_ui__tag, __pyx_k__tag, sizeof(__pyx_k__tag), 1, 1, 1}, + {&__pyx_n_ui__type, __pyx_k__type, sizeof(__pyx_k__type), 1, 1, 1}, + {&__pyx_n_ui__value, __pyx_k__value, sizeof(__pyx_k__value), 1, 1, 1}, + {&__pyx_n_ui__xsi, __pyx_k__xsi, sizeof(__pyx_k__xsi), 1, 1, 1}, + {&__pyx_n_ui_add, __pyx_k_add, sizeof(__pyx_k_add), 1, 1, 1}, + {&__pyx_n_ui_addnext, __pyx_k_addnext, sizeof(__pyx_k_addnext), 1, 1, 1}, + {&__pyx_n_ui_after, __pyx_k_after, sizeof(__pyx_k_after), 1, 1, 1}, + {&__pyx_n_u_annotate, __pyx_k_annotate, sizeof(__pyx_k_annotate), 1, 1, 0}, + {&__pyx_n_ui_annotate, __pyx_k_annotate, sizeof(__pyx_k_annotate), 1, 1, 1}, + {&__pyx_n_ui_annotate_pytype, __pyx_k_annotate_pytype, sizeof(__pyx_k_annotate_pytype), 1, 1, 1}, + {&__pyx_n_ui_annotate_xsi, __pyx_k_annotate_xsi, sizeof(__pyx_k_annotate_xsi), 1, 1, 1}, + {&__pyx_n_ui_attrib, __pyx_k_attrib, sizeof(__pyx_k_attrib), 1, 1, 1}, + {&__pyx_n_ui_attribute_tag, __pyx_k_attribute_tag, sizeof(__pyx_k_attribute_tag), 1, 1, 1}, + {&__pyx_n_u_base, __pyx_k_base, sizeof(__pyx_k_base), 1, 1, 0}, + {&__pyx_n_ui_base, __pyx_k_base, sizeof(__pyx_k_base), 1, 1, 1}, + {&__pyx_n_ui_base_url, __pyx_k_base_url, sizeof(__pyx_k_base_url), 1, 1, 1}, + {&__pyx_n_ui_before, __pyx_k_before, sizeof(__pyx_k_before), 1, 1, 1}, + {&__pyx_n_u_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 1, 1, 0}, + {&__pyx_n_u_boolean, __pyx_k_boolean, sizeof(__pyx_k_boolean), 1, 1, 0}, + {&__pyx_n_u_byte, __pyx_k_byte, sizeof(__pyx_k_byte), 1, 1, 0}, + {&__pyx_n_ui_children, __pyx_k_children, sizeof(__pyx_k_children), 1, 1, 1}, + {&__pyx_n_ui_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 1, 1, 1}, + {&__pyx_n_ui_constructor, __pyx_k_constructor, sizeof(__pyx_k_constructor), 1, 1, 1}, + {&__pyx_n_ui_copy_reg, __pyx_k_copy_reg, sizeof(__pyx_k_copy_reg), 1, 1, 1}, + {&__pyx_n_ui_copyreg, __pyx_k_copyreg, sizeof(__pyx_k_copyreg), 1, 1, 1}, + {&__pyx_n_u_deannotate, __pyx_k_deannotate, sizeof(__pyx_k_deannotate), 1, 1, 0}, + {&__pyx_n_ui_default, __pyx_k_default, sizeof(__pyx_k_default), 1, 1, 1}, + {&__pyx_n_ui_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 1, 1, 1}, + {&__pyx_n_ui_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 1, 1, 1}, + {&__pyx_n_u_double, __pyx_k_double, sizeof(__pyx_k_double), 1, 1, 0}, + {&__pyx_n_u_dump, __pyx_k_dump, sizeof(__pyx_k_dump), 1, 1, 0}, + {&__pyx_n_ui_element_or_tree, __pyx_k_element_or_tree, sizeof(__pyx_k_element_or_tree), 1, 1, 1}, + {&__pyx_n_ui_empty_data_class, __pyx_k_empty_data_class, sizeof(__pyx_k_empty_data_class), 1, 1, 1}, + {&__pyx_n_ui_empty_pytype, __pyx_k_empty_pytype, sizeof(__pyx_k_empty_pytype), 1, 1, 1}, + {&__pyx_n_ui_empty_type, __pyx_k_empty_type, sizeof(__pyx_k_empty_type), 1, 1, 1}, + {&__pyx_n_ui_end, __pyx_k_end, sizeof(__pyx_k_end), 1, 1, 1}, + {&__pyx_n_ui_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 1, 1, 1}, + {&__pyx_n_bi_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 1, 1}, + {&__pyx_n_ui_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 1, 1, 1}, + {&__pyx_n_ui_f, __pyx_k_f, sizeof(__pyx_k_f), 1, 1, 1}, + {&__pyx_n_u_false, __pyx_k_false, sizeof(__pyx_k_false), 1, 1, 0}, + {&__pyx_n_ui_find, __pyx_k_find, sizeof(__pyx_k_find), 1, 1, 1}, + {&__pyx_n_ui_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 1, 1, 1}, + {&__pyx_n_u_float, __pyx_k_float, sizeof(__pyx_k_float), 1, 1, 0}, + {&__pyx_n_u_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 1, 1, 0}, + {&__pyx_n_ui_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 1, 1, 1}, + {&__pyx_n_ui_get, __pyx_k_get, sizeof(__pyx_k_get), 1, 1, 1}, + {&__pyx_n_u_getRegisteredTypes, __pyx_k_getRegisteredTypes, sizeof(__pyx_k_getRegisteredTypes), 1, 1, 0}, + {&__pyx_n_ui_getparent, __pyx_k_getparent, sizeof(__pyx_k_getparent), 1, 1, 1}, + {&__pyx_n_ui_groups, __pyx_k_groups, sizeof(__pyx_k_groups), 1, 1, 1}, + {&__pyx_n_ui_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 1, 1, 1}, + {&__pyx_n_ui_href, __pyx_k_href, sizeof(__pyx_k_href), 1, 1, 1}, + {&__pyx_n_ui_ignore_old, __pyx_k_ignore_old, sizeof(__pyx_k_ignore_old), 1, 1, 1}, + {&__pyx_n_ui_ignore_pytype, __pyx_k_ignore_pytype, sizeof(__pyx_k_ignore_pytype), 1, 1, 1}, + {&__pyx_n_ui_ignore_xsi, __pyx_k_ignore_xsi, sizeof(__pyx_k_ignore_xsi), 1, 1, 1}, + {&__pyx_n_ui_index, __pyx_k_index, sizeof(__pyx_k_index), 1, 1, 1}, + {&__pyx_n_ui_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 1, 1, 1}, + {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 1, 1, 0}, + {&__pyx_n_u_integer, __pyx_k_integer, sizeof(__pyx_k_integer), 1, 1, 0}, + {&__pyx_n_bi_islice, __pyx_k_islice, sizeof(__pyx_k_islice), 0, 1, 1}, + {&__pyx_n_ui_islice, __pyx_k_islice, sizeof(__pyx_k_islice), 1, 1, 1}, + {&__pyx_n_ui_items, __pyx_k_items, sizeof(__pyx_k_items), 1, 1, 1}, + {&__pyx_n_ui_iterchildren, __pyx_k_iterchildren, sizeof(__pyx_k_iterchildren), 1, 1, 1}, + {&__pyx_n_ui_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 1, 1, 1}, + {&__pyx_n_ui_join, __pyx_k_join, sizeof(__pyx_k_join), 1, 1, 1}, + {&__pyx_n_u_language, __pyx_k_language, sizeof(__pyx_k_language), 1, 1, 0}, + {&__pyx_n_ui_last, __pyx_k_last, sizeof(__pyx_k_last), 1, 1, 1}, + {&__pyx_n_u_long, __pyx_k_long, sizeof(__pyx_k_long), 1, 1, 0}, + {&__pyx_n_ui_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 1, 1, 1}, + {&__pyx_n_ui_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 1, 1, 1}, + {&__pyx_n_u_makeparser, __pyx_k_makeparser, sizeof(__pyx_k_makeparser), 1, 1, 0}, + {&__pyx_n_ui_map, __pyx_k_map, sizeof(__pyx_k_map), 1, 1, 1}, + {&__pyx_n_ui_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, + {&__pyx_n_ui_name, __pyx_k_name, sizeof(__pyx_k_name), 1, 1, 1}, + {&__pyx_n_ui_namespace, __pyx_k_namespace, sizeof(__pyx_k_namespace), 1, 1, 1}, + {&__pyx_n_u_negativeInteger, __pyx_k_negativeInteger, sizeof(__pyx_k_negativeInteger), 1, 1, 0}, + {&__pyx_n_ui_new_parser, __pyx_k_new_parser, sizeof(__pyx_k_new_parser), 1, 1, 1}, + {&__pyx_n_ui_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, + {&__pyx_n_u_nonNegativeInteger, __pyx_k_nonNegativeInteger, sizeof(__pyx_k_nonNegativeInteger), 1, 1, 0}, + {&__pyx_n_u_nonPositiveInteger, __pyx_k_nonPositiveInteger, sizeof(__pyx_k_nonPositiveInteger), 1, 1, 0}, + {&__pyx_n_u_none, __pyx_k_none, sizeof(__pyx_k_none), 1, 1, 0}, + {&__pyx_n_u_normalizedString, __pyx_k_normalizedString, sizeof(__pyx_k_normalizedString), 1, 1, 0}, + {&__pyx_n_ui_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 1, 1, 1}, + {&__pyx_n_ui_object, __pyx_k_object, sizeof(__pyx_k_object), 1, 1, 1}, + {&__pyx_n_ui_oct, __pyx_k_oct, sizeof(__pyx_k_oct), 1, 1, 1}, + {&__pyx_n_ui_on, __pyx_k_on, sizeof(__pyx_k_on), 1, 1, 1}, + {&__pyx_n_ui_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 1, 1, 1}, + {&__pyx_n_u_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 1, 1, 0}, + {&__pyx_n_ui_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 1, 1, 1}, + {&__pyx_n_ui_parser, __pyx_k_parser, sizeof(__pyx_k_parser), 1, 1, 1}, + {&__pyx_n_ui_path, __pyx_k_path, sizeof(__pyx_k_path), 1, 1, 1}, + {&__pyx_n_ui_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 1, 1, 1}, + {&__pyx_n_ui_pickleReduceElement, __pyx_k_pickleReduceElement, sizeof(__pyx_k_pickleReduceElement), 1, 1, 1}, + {&__pyx_n_u_positiveInteger, __pyx_k_positiveInteger, sizeof(__pyx_k_positiveInteger), 1, 1, 0}, + {&__pyx_n_ui_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 1, 1, 1}, + {&__pyx_n_ui_prev, __pyx_k_prev, sizeof(__pyx_k_prev), 1, 1, 1}, + {&__pyx_n_u_py, __pyx_k_py, sizeof(__pyx_k_py), 1, 1, 0}, + {&__pyx_n_u_pyannotate, __pyx_k_pyannotate, sizeof(__pyx_k_pyannotate), 1, 1, 0}, + {&__pyx_n_u_pytype, __pyx_k_pytype, sizeof(__pyx_k_pytype), 1, 1, 0}, + {&__pyx_n_ui_pytype, __pyx_k_pytype, sizeof(__pyx_k_pytype), 1, 1, 1}, + {&__pyx_n_u_pytypename, __pyx_k_pytypename, sizeof(__pyx_k_pytypename), 1, 1, 0}, + {&__pyx_n_u_pyval, __pyx_k_pyval, sizeof(__pyx_k_pyval), 1, 1, 0}, + {&__pyx_n_ui_pyval, __pyx_k_pyval, sizeof(__pyx_k_pyval), 1, 1, 1}, + {&__pyx_n_ui_re, __pyx_k_re, sizeof(__pyx_k_re), 1, 1, 1}, + {&__pyx_n_ui_register, __pyx_k_register, sizeof(__pyx_k_register), 1, 1, 1}, + {&__pyx_n_ui_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 1, 1, 1}, + {&__pyx_n_b_remove_blank_text, __pyx_k_remove_blank_text, sizeof(__pyx_k_remove_blank_text), 0, 1, 0}, + {&__pyx_n_u_remove_blank_text, __pyx_k_remove_blank_text, sizeof(__pyx_k_remove_blank_text), 1, 1, 0}, + {&__pyx_n_ui_remove_blank_text, __pyx_k_remove_blank_text, sizeof(__pyx_k_remove_blank_text), 1, 1, 1}, + {&__pyx_n_ui_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 1, 1, 1}, + {&__pyx_n_ui_root, __pyx_k_root, sizeof(__pyx_k_root), 1, 1, 1}, + {&__pyx_n_u_set_default_parser, __pyx_k_set_default_parser, sizeof(__pyx_k_set_default_parser), 1, 1, 0}, + {&__pyx_n_u_short, __pyx_k_short, sizeof(__pyx_k_short), 1, 1, 0}, + {&__pyx_n_ui_split, __pyx_k_split, sizeof(__pyx_k_split), 1, 1, 1}, + {&__pyx_n_ui_start, __pyx_k_start, sizeof(__pyx_k_start), 1, 1, 1}, + {&__pyx_n_ui_step, __pyx_k_step, sizeof(__pyx_k_step), 1, 1, 1}, + {&__pyx_n_u_str, __pyx_k_str, sizeof(__pyx_k_str), 1, 1, 0}, + {&__pyx_n_u_string, __pyx_k_string, sizeof(__pyx_k_string), 1, 1, 0}, + {&__pyx_n_ui_stringify, __pyx_k_stringify, sizeof(__pyx_k_stringify), 1, 1, 1}, + {&__pyx_n_ui_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 1, 1, 1}, + {&__pyx_n_ui_strip_attributes, __pyx_k_strip_attributes, sizeof(__pyx_k_strip_attributes), 1, 1, 1}, + {&__pyx_n_u_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 1, 1, 0}, + {&__pyx_n_ui_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 1, 1, 1}, + {&__pyx_n_u_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 1, 1, 0}, + {&__pyx_n_u_text, __pyx_k_text, sizeof(__pyx_k_text), 1, 1, 0}, + {&__pyx_n_ui_text, __pyx_k_text, sizeof(__pyx_k_text), 1, 1, 1}, + {&__pyx_n_u_token, __pyx_k_token, sizeof(__pyx_k_token), 1, 1, 0}, + {&__pyx_n_ui_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 1, 1, 1}, + {&__pyx_n_ui_tree_class, __pyx_k_tree_class, sizeof(__pyx_k_tree_class), 1, 1, 1}, + {&__pyx_n_u_true, __pyx_k_true, sizeof(__pyx_k_true), 1, 1, 0}, + {&__pyx_n_ui_type, __pyx_k_type, sizeof(__pyx_k_type), 1, 1, 1}, + {&__pyx_n_ui_type_check, __pyx_k_type_check, sizeof(__pyx_k_type_check), 1, 1, 1}, + {&__pyx_n_ui_type_class, __pyx_k_type_class, sizeof(__pyx_k_type_class), 1, 1, 1}, + {&__pyx_n_u_unsignedByte, __pyx_k_unsignedByte, sizeof(__pyx_k_unsignedByte), 1, 1, 0}, + {&__pyx_n_u_unsignedInt, __pyx_k_unsignedInt, sizeof(__pyx_k_unsignedInt), 1, 1, 0}, + {&__pyx_n_u_unsignedLong, __pyx_k_unsignedLong, sizeof(__pyx_k_unsignedLong), 1, 1, 0}, + {&__pyx_n_u_unsignedShort, __pyx_k_unsignedShort, sizeof(__pyx_k_unsignedShort), 1, 1, 0}, + {&__pyx_n_ui_update, __pyx_k_update, sizeof(__pyx_k_update), 1, 1, 1}, + {&__pyx_n_u_value, __pyx_k_value, sizeof(__pyx_k_value), 1, 1, 0}, + {&__pyx_n_ui_value, __pyx_k_value, sizeof(__pyx_k_value), 1, 1, 1}, + {&__pyx_n_ui_values, __pyx_k_values, sizeof(__pyx_k_values), 1, 1, 1}, + {&__pyx_n_ui_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 1, 1, 1}, + {&__pyx_n_ui_xmlSchemaTypes, __pyx_k_xmlSchemaTypes, sizeof(__pyx_k_xmlSchemaTypes), 1, 1, 1}, + {&__pyx_n_u_xsd, __pyx_k_xsd, sizeof(__pyx_k_xsd), 1, 1, 0}, + {&__pyx_n_u_xsi, __pyx_k_xsi, sizeof(__pyx_k_xsi), 1, 1, 0}, + {&__pyx_n_ui_xsi, __pyx_k_xsi, sizeof(__pyx_k_xsi), 1, 1, 1}, + {&__pyx_n_ui_xsi_nil, __pyx_k_xsi_nil, sizeof(__pyx_k_xsi_nil), 1, 1, 1}, + {&__pyx_n_u_xsiannotate, __pyx_k_xsiannotate, sizeof(__pyx_k_xsiannotate), 1, 1, 0}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_ui_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_ui_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_ui_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_ui_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_ui_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_oct = __Pyx_GetName(__pyx_b, __pyx_n_ui_oct); if (!__pyx_builtin_oct) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_hex = __Pyx_GetName(__pyx_b, __pyx_n_ui_hex); if (!__pyx_builtin_hex) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_ui_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_ui_map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + 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_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;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initobjectify(void); /*proto*/ +PyMODINIT_FUNC initobjectify(void) +#else +PyMODINIT_FUNC PyInit_objectify(void); /*proto*/ +PyMODINIT_FUNC PyInit_objectify(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_objectify(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;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __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;} + #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("objectify"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_57), 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;}; + if (__pyx_module_is_main_lxml__objectify) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_ui___main__) < 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;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + __pyx_v_4lxml_9objectify_etree = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_re = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_IGNORABLE_ERRORS = ((PyObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_is_special_method = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_islice = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE_UTF8 = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_PYTYPE_ATTRIBUTE_NAME_UTF8 = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_XML_SCHEMA_NS = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8 = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8 = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__PYTYPE_DICT = ((PyObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT = ((PyObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__TYPE_CHECKS = ((PyObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_TREE_PYTYPE = ((struct __pyx_obj_4lxml_9objectify_PyType *)Py_None); Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__strip_attributes = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify___DEFAULT_PARSER = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify_objectify_parser = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__fromstring = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__parse = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__DEFAULT_NSMAP = ((PyObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify___MATCH_PATH_SEGMENT = Py_None; Py_INCREF(Py_None); + __pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT = Py_None; Py_INCREF(Py_None); + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_4lxml_9objectify_PyType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PyType", (PyObject *)&__pyx_type_4lxml_9objectify_PyType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_PyType = &__pyx_type_4lxml_9objectify_PyType; + __pyx_ptype_4lxml_11etreepublic_ElementBase = __Pyx_ImportType("lxml.etree", "ElementBase", sizeof(struct LxmlElementBase)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic_ElementBase)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_4lxml_9objectify_ObjectifiedElement.tp_base = __pyx_ptype_4lxml_11etreepublic_ElementBase; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_ObjectifiedElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ObjectifiedElement", (PyObject *)&__pyx_type_4lxml_9objectify_ObjectifiedElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_ObjectifiedElement = &__pyx_type_4lxml_9objectify_ObjectifiedElement; + __pyx_type_4lxml_9objectify_ObjectifiedDataElement.tp_base = __pyx_ptype_4lxml_9objectify_ObjectifiedElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_ObjectifiedDataElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ObjectifiedDataElement", (PyObject *)&__pyx_type_4lxml_9objectify_ObjectifiedDataElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_ObjectifiedDataElement = &__pyx_type_4lxml_9objectify_ObjectifiedDataElement; + __pyx_type_4lxml_9objectify_NumberElement.tp_base = __pyx_ptype_4lxml_9objectify_ObjectifiedDataElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_NumberElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "NumberElement", (PyObject *)&__pyx_type_4lxml_9objectify_NumberElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_NumberElement = &__pyx_type_4lxml_9objectify_NumberElement; + __pyx_type_4lxml_9objectify_IntElement.tp_base = __pyx_ptype_4lxml_9objectify_NumberElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_IntElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IntElement", (PyObject *)&__pyx_type_4lxml_9objectify_IntElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_IntElement = &__pyx_type_4lxml_9objectify_IntElement; + __pyx_type_4lxml_9objectify_LongElement.tp_base = __pyx_ptype_4lxml_9objectify_NumberElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_LongElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "LongElement", (PyObject *)&__pyx_type_4lxml_9objectify_LongElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_LongElement = &__pyx_type_4lxml_9objectify_LongElement; + __pyx_type_4lxml_9objectify_FloatElement.tp_base = __pyx_ptype_4lxml_9objectify_NumberElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_FloatElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FloatElement", (PyObject *)&__pyx_type_4lxml_9objectify_FloatElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_FloatElement = &__pyx_type_4lxml_9objectify_FloatElement; + __pyx_type_4lxml_9objectify_StringElement.tp_base = __pyx_ptype_4lxml_9objectify_ObjectifiedDataElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_StringElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "StringElement", (PyObject *)&__pyx_type_4lxml_9objectify_StringElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_StringElement = &__pyx_type_4lxml_9objectify_StringElement; + __pyx_type_4lxml_9objectify_NoneElement.tp_base = __pyx_ptype_4lxml_9objectify_ObjectifiedDataElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_NoneElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "NoneElement", (PyObject *)&__pyx_type_4lxml_9objectify_NoneElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_NoneElement = &__pyx_type_4lxml_9objectify_NoneElement; + __pyx_type_4lxml_9objectify_BoolElement.tp_base = __pyx_ptype_4lxml_9objectify_IntElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_BoolElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BoolElement", (PyObject *)&__pyx_type_4lxml_9objectify_BoolElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_BoolElement = &__pyx_type_4lxml_9objectify_BoolElement; + if (PyType_Ready(&__pyx_type_4lxml_9objectify__ObjectifyElementMakerCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "_ObjectifyElementMakerCaller", (PyObject *)&__pyx_type_4lxml_9objectify__ObjectifyElementMakerCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify__ObjectifyElementMakerCaller = &__pyx_type_4lxml_9objectify__ObjectifyElementMakerCaller; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_ElementMaker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ElementMaker", (PyObject *)&__pyx_type_4lxml_9objectify_ElementMaker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_ElementMaker = &__pyx_type_4lxml_9objectify_ElementMaker; + __pyx_ptype_4lxml_11etreepublic_ElementClassLookup = __Pyx_ImportType("lxml.etree", "ElementClassLookup", sizeof(struct LxmlElementClassLookup)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic_ElementClassLookup)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_4lxml_9objectify_ObjectifyElementClassLookup.tp_base = __pyx_ptype_4lxml_11etreepublic_ElementClassLookup; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_ObjectifyElementClassLookup) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ObjectifyElementClassLookup", (PyObject *)&__pyx_type_4lxml_9objectify_ObjectifyElementClassLookup) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_ObjectifyElementClassLookup = &__pyx_type_4lxml_9objectify_ObjectifyElementClassLookup; + if (PyType_Ready(&__pyx_type_4lxml_9objectify_ObjectPath) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ObjectPath", (PyObject *)&__pyx_type_4lxml_9objectify_ObjectPath) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_9objectify_ObjectPath = &__pyx_type_4lxml_9objectify_ObjectPath; + /*--- Type import code ---*/ + __pyx_ptype_4lxml_6python_slice = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "slice", sizeof(PySliceObject)); if (unlikely(!__pyx_ptype_4lxml_6python_slice)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + __pyx_ptype_4lxml_6python_unicode = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "str", sizeof(PyUnicodeObject)); if (unlikely(!__pyx_ptype_4lxml_6python_unicode)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_ptype_4lxml_6python_unicode = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "unicode", sizeof(PyUnicodeObject)); if (unlikely(!__pyx_ptype_4lxml_6python_unicode)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __pyx_ptype_4lxml_11etreepublic__Document = __Pyx_ImportType("lxml.etree", "_Document", sizeof(struct LxmlDocument)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic__Document)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_11etreepublic__Element = __Pyx_ImportType("lxml.etree", "_Element", sizeof(struct LxmlElement)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic__Element)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_11etreepublic__ElementTree = __Pyx_ImportType("lxml.etree", "_ElementTree", sizeof(struct LxmlElementTree)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic__ElementTree)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_11etreepublic_FallbackElementClassLookup = __Pyx_ImportType("lxml.etree", "FallbackElementClassLookup", sizeof(struct LxmlFallbackElementClassLookup)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic_FallbackElementClassLookup)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_11etreepublic__ElementTagMatcher = __Pyx_ImportType("lxml.etree", "_ElementTagMatcher", sizeof(struct LxmlElementTagMatcher)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic__ElementTagMatcher)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4lxml_11etreepublic__ElementIterator = __Pyx_ImportType("lxml.etree", "_ElementIterator", sizeof(struct LxmlElementIterator)); if (unlikely(!__pyx_ptype_4lxml_11etreepublic__ElementIterator)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":14 + * cimport cstd + * + * __all__ = [u'BoolElement', u'DataElement', u'E', u'Element', u'ElementMaker', # <<<<<<<<<<<<<< + * u'FloatElement', u'IntElement', u'LongElement', u'NoneElement', + * u'NumberElement', u'ObjectPath', u'ObjectifiedDataElement', + */ + __pyx_t_1 = PyList_New(31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_BoolElement)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_u_BoolElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_BoolElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_DataElement)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_u_DataElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_DataElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_E)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_u_E)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_E)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_Element)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_u_Element)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_Element)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_ElementMaker)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_u_ElementMaker)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_ElementMaker)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_FloatElement)); + PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_u_FloatElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_FloatElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_IntElement)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_u_IntElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_IntElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_LongElement)); + PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_u_LongElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_LongElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_NoneElement)); + PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_u_NoneElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_NoneElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_NumberElement)); + PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_u_NumberElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_NumberElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_ObjectPath)); + PyList_SET_ITEM(__pyx_t_1, 10, ((PyObject *)__pyx_n_u_ObjectPath)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_ObjectPath)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_58)); + PyList_SET_ITEM(__pyx_t_1, 11, ((PyObject *)__pyx_n_u_58)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_58)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_ObjectifiedElement)); + PyList_SET_ITEM(__pyx_t_1, 12, ((PyObject *)__pyx_n_u_ObjectifiedElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_ObjectifiedElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_59)); + PyList_SET_ITEM(__pyx_t_1, 13, ((PyObject *)__pyx_n_u_59)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_59)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_PYTYPE_ATTRIBUTE)); + PyList_SET_ITEM(__pyx_t_1, 14, ((PyObject *)__pyx_n_u_PYTYPE_ATTRIBUTE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_PYTYPE_ATTRIBUTE)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_PyType)); + PyList_SET_ITEM(__pyx_t_1, 15, ((PyObject *)__pyx_n_u_PyType)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_PyType)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_StringElement)); + PyList_SET_ITEM(__pyx_t_1, 16, ((PyObject *)__pyx_n_u_StringElement)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_StringElement)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_XML)); + PyList_SET_ITEM(__pyx_t_1, 17, ((PyObject *)__pyx_n_u_XML)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_XML)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_annotate)); + PyList_SET_ITEM(__pyx_t_1, 18, ((PyObject *)__pyx_n_u_annotate)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_annotate)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_deannotate)); + PyList_SET_ITEM(__pyx_t_1, 19, ((PyObject *)__pyx_n_u_deannotate)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_deannotate)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_dump)); + PyList_SET_ITEM(__pyx_t_1, 20, ((PyObject *)__pyx_n_u_dump)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_dump)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_60)); + PyList_SET_ITEM(__pyx_t_1, 21, ((PyObject *)__pyx_n_u_60)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_60)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_fromstring)); + PyList_SET_ITEM(__pyx_t_1, 22, ((PyObject *)__pyx_n_u_fromstring)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_fromstring)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_getRegisteredTypes)); + PyList_SET_ITEM(__pyx_t_1, 23, ((PyObject *)__pyx_n_u_getRegisteredTypes)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_getRegisteredTypes)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_makeparser)); + PyList_SET_ITEM(__pyx_t_1, 24, ((PyObject *)__pyx_n_u_makeparser)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_makeparser)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_parse)); + PyList_SET_ITEM(__pyx_t_1, 25, ((PyObject *)__pyx_n_u_parse)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_parse)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_pyannotate)); + PyList_SET_ITEM(__pyx_t_1, 26, ((PyObject *)__pyx_n_u_pyannotate)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_pyannotate)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_pytypename)); + PyList_SET_ITEM(__pyx_t_1, 27, ((PyObject *)__pyx_n_u_pytypename)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_pytypename)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_set_default_parser)); + PyList_SET_ITEM(__pyx_t_1, 28, ((PyObject *)__pyx_n_u_set_default_parser)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_set_default_parser)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_61)); + PyList_SET_ITEM(__pyx_t_1, 29, ((PyObject *)__pyx_n_u_61)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_61)); + __Pyx_INCREF(((PyObject *)__pyx_n_u_xsiannotate)); + PyList_SET_ITEM(__pyx_t_1, 30, ((PyObject *)__pyx_n_u_xsiannotate)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_xsiannotate)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_ui___all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":25 + * + * cdef object etree + * from lxml import etree # <<<<<<<<<<<<<< + * # initialize C-API of lxml.etree + * import_lxml__etree() + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_n_ui_etree); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_ui_etree); + __Pyx_GIVEREF(__pyx_n_ui_etree); + __pyx_t_2 = __Pyx_Import(__pyx_n_ui_lxml, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __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_GetAttr(__pyx_t_2, __pyx_n_bi_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_etree); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_etree); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify_etree = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":27 + * from lxml import etree + * # initialize C-API of lxml.etree + * import_lxml__etree() # <<<<<<<<<<<<<< + * + * __version__ = etree.__version__ + */ + __pyx_t_3 = import_lxml__etree(); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":29 + * import_lxml__etree() + * + * __version__ = etree.__version__ # <<<<<<<<<<<<<< + * + * cdef object re + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui___version__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_ui___version__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":32 + * + * cdef object re + * import re # <<<<<<<<<<<<<< + * + * cdef tuple IGNORABLE_ERRORS = (ValueError, TypeError) + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_ui_re, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_re); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_re); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_re = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":34 + * import re + * + * cdef tuple IGNORABLE_ERRORS = (ValueError, TypeError) # <<<<<<<<<<<<<< + * cdef object is_special_method = re.compile(u'__.*__$').match + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_builtin_ValueError); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_ValueError); + __Pyx_GIVEREF(__pyx_builtin_ValueError); + __Pyx_INCREF(__pyx_builtin_TypeError); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_TypeError); + __Pyx_GIVEREF(__pyx_builtin_TypeError); + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_9objectify_IGNORABLE_ERRORS)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_9objectify_IGNORABLE_ERRORS)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_v_4lxml_9objectify_IGNORABLE_ERRORS = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":35 + * + * cdef tuple IGNORABLE_ERRORS = (ValueError, TypeError) + * cdef object is_special_method = re.compile(u'__.*__$').match # <<<<<<<<<<<<<< + * + * cdef object islice + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_re, __pyx_n_ui_compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __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 = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_62)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_u_62)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_62)); + __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 = 35; __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_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_ui_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_is_special_method); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_is_special_method); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify_is_special_method = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":38 + * + * cdef object islice + * from itertools import islice # <<<<<<<<<<<<<< + * + * cdef object _typename(object t): + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_n_ui_islice); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_ui_islice); + __Pyx_GIVEREF(__pyx_n_ui_islice); + __pyx_t_4 = __Pyx_Import(__pyx_n_ui_itertools, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __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_bi_islice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_islice); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_islice); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify_islice = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":58 + * cdef char* _PYTYPE_ATTRIBUTE_NAME + * + * PYTYPE_ATTRIBUTE = None # <<<<<<<<<<<<<< + * + * cdef object TREE_PYTYPE_NAME + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_ui_PYTYPE_ATTRIBUTE, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":61 + * + * cdef object TREE_PYTYPE_NAME + * TREE_PYTYPE_NAME = u"TREE" # <<<<<<<<<<<<<< + * + * cdef _unicodeAndUtf8(s): + */ + __Pyx_INCREF(((PyObject *)__pyx_n_u_TREE)); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME); + __Pyx_GIVEREF(((PyObject *)__pyx_n_u_TREE)); + __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME = ((PyObject *)__pyx_n_u_TREE); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":98 + * _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + * + * set_pytype_attribute_tag() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_ui_61); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":104 + * cdef object XML_SCHEMA_NS, XML_SCHEMA_NS_UTF8 + * XML_SCHEMA_NS, XML_SCHEMA_NS_UTF8 = \ + * _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema") # <<<<<<<<<<<<<< + * cdef char* _XML_SCHEMA_NS + * _XML_SCHEMA_NS = _cstr(XML_SCHEMA_NS_UTF8) + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__unicodeAndUtf8(((PyObject *)__pyx_kp_u_63)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __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_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":103 + * # namespaces for XML Schema + * cdef object XML_SCHEMA_NS, XML_SCHEMA_NS_UTF8 + * XML_SCHEMA_NS, XML_SCHEMA_NS_UTF8 = \ # <<<<<<<<<<<<<< + * _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema") + * cdef char* _XML_SCHEMA_NS + */ + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_XML_SCHEMA_NS = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8 = __pyx_t_2; + __pyx_t_2 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_XML_SCHEMA_NS = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8 = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":106 + * _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema") + * cdef char* _XML_SCHEMA_NS + * _XML_SCHEMA_NS = _cstr(XML_SCHEMA_NS_UTF8) # <<<<<<<<<<<<<< + * + * cdef object XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 + */ + __pyx_v_4lxml_9objectify__XML_SCHEMA_NS = PyString_AS_STRING(__pyx_v_4lxml_9objectify_XML_SCHEMA_NS_UTF8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":110 + * cdef object XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 + * XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 = \ + * _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema-instance") # <<<<<<<<<<<<<< + * cdef char* _XML_SCHEMA_INSTANCE_NS + * _XML_SCHEMA_INSTANCE_NS = _cstr(XML_SCHEMA_INSTANCE_NS_UTF8) + */ + __pyx_t_1 = __pyx_f_4lxml_9objectify__unicodeAndUtf8(((PyObject *)__pyx_kp_u_64)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __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_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":109 + * + * cdef object XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 + * XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 = \ # <<<<<<<<<<<<<< + * _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema-instance") + * cdef char* _XML_SCHEMA_INSTANCE_NS + */ + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8 = __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 = 109; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8 = __pyx_t_4; + __pyx_t_4 = 0; + } + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":112 + * _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema-instance") + * cdef char* _XML_SCHEMA_INSTANCE_NS + * _XML_SCHEMA_INSTANCE_NS = _cstr(XML_SCHEMA_INSTANCE_NS_UTF8) # <<<<<<<<<<<<<< + * + * cdef object XML_SCHEMA_INSTANCE_NIL_ATTR + */ + __pyx_v_4lxml_9objectify__XML_SCHEMA_INSTANCE_NS = PyString_AS_STRING(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS_UTF8); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":115 + * + * cdef object XML_SCHEMA_INSTANCE_NIL_ATTR + * XML_SCHEMA_INSTANCE_NIL_ATTR = u"{%s}nil" % XML_SCHEMA_INSTANCE_NS # <<<<<<<<<<<<<< + * cdef object XML_SCHEMA_INSTANCE_TYPE_ATTR + * XML_SCHEMA_INSTANCE_TYPE_ATTR = u"{%s}type" % XML_SCHEMA_INSTANCE_NS + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_65), __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NIL_ATTR = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":117 + * XML_SCHEMA_INSTANCE_NIL_ATTR = u"{%s}nil" % XML_SCHEMA_INSTANCE_NS + * cdef object XML_SCHEMA_INSTANCE_TYPE_ATTR + * XML_SCHEMA_INSTANCE_TYPE_ATTR = u"{%s}type" % XML_SCHEMA_INSTANCE_NS # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_66), __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_TYPE_ATTR = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1040 + * + * cdef dict _PYTYPE_DICT + * _PYTYPE_DICT = {} # <<<<<<<<<<<<<< + * + * cdef dict _SCHEMA_TYPE_DICT + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_9objectify__PYTYPE_DICT)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_v_4lxml_9objectify__PYTYPE_DICT = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1043 + * + * cdef dict _SCHEMA_TYPE_DICT + * _SCHEMA_TYPE_DICT = {} # <<<<<<<<<<<<<< + * + * cdef list _TYPE_CHECKS + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_v_4lxml_9objectify__SCHEMA_TYPE_DICT = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1046 + * + * cdef list _TYPE_CHECKS + * _TYPE_CHECKS = [] # <<<<<<<<<<<<<< + * + * cdef _lower_bool(b): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_9objectify__TYPE_CHECKS)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_v_4lxml_9objectify__TYPE_CHECKS = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1106 + * # non-registered PyType for inner tree elements + * cdef PyType TREE_PYTYPE + * TREE_PYTYPE = PyType(TREE_PYTYPE_NAME, None, ObjectifiedElement) # <<<<<<<<<<<<<< + * + * _registerPyTypes() + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME); + __Pyx_GIVEREF(__pyx_v_4lxml_9objectify_TREE_PYTYPE_NAME); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifiedElement))); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_PyType)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_9objectify_TREE_PYTYPE)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_9objectify_TREE_PYTYPE)); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify_TREE_PYTYPE = ((struct __pyx_obj_4lxml_9objectify_PyType *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1108 + * TREE_PYTYPE = PyType(TREE_PYTYPE_NAME, None, ObjectifiedElement) + * + * _registerPyTypes() # <<<<<<<<<<<<<< + * + * def getRegisteredTypes(): + */ + __pyx_t_4 = __pyx_f_4lxml_9objectify__registerPyTypes(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __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-2.2/src/lxml/lxml.objectify.pyx":1273 + * cdef object _nsmap + * cdef bint _annotate + * def __init__(self, *, namespace=None, nsmap=None, annotate=True, # <<<<<<<<<<<<<< + * makeelement=None): + * if nsmap is None: + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_22 = __pyx_t_4; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1309 + * + * cdef bint __RECURSIVE_STR + * __RECURSIVE_STR = 0 # default: off # <<<<<<<<<<<<<< + * + * def enable_recursive_str(on=True): + */ + __pyx_v_4lxml_9objectify___RECURSIVE_STR = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1311 + * __RECURSIVE_STR = 0 # default: off + * + * def enable_recursive_str(on=True): # <<<<<<<<<<<<<< + * u"""enable_recursive_str(on=True) + * + */ + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_k_25 = __pyx_t_4; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1385 + * return (__unpickleElementTree, (etree.tostring(obj),)) + * + * _setupPickle(pickleReduceElement, pickleReduceElementTree) # <<<<<<<<<<<<<< + * del pickleReduceElement, pickleReduceElementTree + * + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_ui_pickleReduceElement); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_ui_67); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_4lxml_9objectify__setupPickle(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1386 + * + * _setupPickle(pickleReduceElement, pickleReduceElementTree) + * del pickleReduceElement, pickleReduceElementTree # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + if (__Pyx_DelAttrString(__pyx_m, "pickleReduceElement") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_DelAttrString(__pyx_m, "pickleReduceElementTree") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1477 + * return None + * + * def pyannotate(element_or_tree, *, ignore_old=False, ignore_xsi=False, # <<<<<<<<<<<<<< + * empty_pytype=None): + * u"""pyannotate(element_or_tree, ignore_old=False, ignore_xsi=False, empty_pytype=None) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_33 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_34 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1500 + * _annotate(element, 0, 1, ignore_xsi, ignore_old, None, empty_pytype) + * + * def xsiannotate(element_or_tree, *, ignore_old=False, ignore_pytype=False, # <<<<<<<<<<<<<< + * empty_type=None): + * u"""xsiannotate(element_or_tree, ignore_old=False, ignore_pytype=False, empty_type=None) + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_35 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_36 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1528 + * _annotate(element, 1, 0, ignore_old, ignore_pytype, empty_type, None) + * + * def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False, # <<<<<<<<<<<<<< + * empty_pytype=None, empty_type=None, annotate_xsi=0, + * annotate_pytype=1): + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_37 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_38 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1726 + * tree.END_FOR_EACH_ELEMENT_FROM(c_node) + * + * cdef object _strip_attributes = etree.strip_attributes # <<<<<<<<<<<<<< + * + * def deannotate(element_or_tree, *, pytype=True, xsi=True, xsi_nil=False): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_strip_attributes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify__strip_attributes); + __Pyx_DECREF(__pyx_v_4lxml_9objectify__strip_attributes); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_v_4lxml_9objectify__strip_attributes = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1728 + * cdef object _strip_attributes = etree.strip_attributes + * + * def deannotate(element_or_tree, *, pytype=True, xsi=True, xsi_nil=False): # <<<<<<<<<<<<<< + * u"""deannotate(element_or_tree, pytype=True, xsi=True, xsi_nil=False) + * + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_39 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_40 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_41 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1759 + * + * cdef object __DEFAULT_PARSER + * __DEFAULT_PARSER = etree.XMLParser(remove_blank_text=True) # <<<<<<<<<<<<<< + * __DEFAULT_PARSER.set_element_class_lookup( ObjectifyElementClassLookup() ) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_XMLParser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_ui_remove_blank_text, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __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_GOTREF(__pyx_v_4lxml_9objectify___DEFAULT_PARSER); + __Pyx_DECREF(__pyx_v_4lxml_9objectify___DEFAULT_PARSER); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify___DEFAULT_PARSER = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1760 + * cdef object __DEFAULT_PARSER + * __DEFAULT_PARSER = etree.XMLParser(remove_blank_text=True) + * __DEFAULT_PARSER.set_element_class_lookup( ObjectifyElementClassLookup() ) # <<<<<<<<<<<<<< + * + * cdef object objectify_parser + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_4lxml_9objectify___DEFAULT_PARSER, __pyx_n_ui_43); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ObjectifyElementClassLookup)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __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 = 1760; __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(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __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_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1763 + * + * cdef object objectify_parser + * objectify_parser = __DEFAULT_PARSER # <<<<<<<<<<<<<< + * + * def set_default_parser(new_parser = None): + */ + __Pyx_INCREF(__pyx_v_4lxml_9objectify___DEFAULT_PARSER); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_DECREF(__pyx_v_4lxml_9objectify_objectify_parser); + __Pyx_GIVEREF(__pyx_v_4lxml_9objectify___DEFAULT_PARSER); + __pyx_v_4lxml_9objectify_objectify_parser = __pyx_v_4lxml_9objectify___DEFAULT_PARSER; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1810 + * + * cdef object _fromstring + * _fromstring = etree.fromstring # <<<<<<<<<<<<<< + * + * def fromstring(xml, parser=None, *, base_url=None): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_fromstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify__fromstring); + __Pyx_DECREF(__pyx_v_4lxml_9objectify__fromstring); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify__fromstring = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1845 + * + * cdef object _parse + * _parse = etree.parse # <<<<<<<<<<<<<< + * + * def parse(f, parser=None, *, base_url=None): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_etree, __pyx_n_ui_parse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify__parse); + __Pyx_DECREF(__pyx_v_4lxml_9objectify__parse); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_4lxml_9objectify__parse = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1863 + * + * cdef dict _DEFAULT_NSMAP + * _DEFAULT_NSMAP = { u"py" : PYTYPE_NAMESPACE, # <<<<<<<<<<<<<< + * u"xsi" : XML_SCHEMA_INSTANCE_NS, + * u"xsd" : XML_SCHEMA_NS} + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u_py), __pyx_v_4lxml_9objectify_PYTYPE_NAMESPACE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1864 + * cdef dict _DEFAULT_NSMAP + * _DEFAULT_NSMAP = { u"py" : PYTYPE_NAMESPACE, + * u"xsi" : XML_SCHEMA_INSTANCE_NS, # <<<<<<<<<<<<<< + * u"xsd" : XML_SCHEMA_NS} + * + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u_xsi), __pyx_v_4lxml_9objectify_XML_SCHEMA_INSTANCE_NS) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1865 + * _DEFAULT_NSMAP = { u"py" : PYTYPE_NAMESPACE, + * u"xsi" : XML_SCHEMA_INSTANCE_NS, + * u"xsd" : XML_SCHEMA_NS} # <<<<<<<<<<<<<< + * + * E = ElementMaker() + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_u_xsd), __pyx_v_4lxml_9objectify_XML_SCHEMA_NS) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + __Pyx_DECREF(((PyObject *)__pyx_v_4lxml_9objectify__DEFAULT_NSMAP)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_v_4lxml_9objectify__DEFAULT_NSMAP = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/lxml.objectify.pyx":1867 + * u"xsd" : XML_SCHEMA_NS} + * + * E = ElementMaker() # <<<<<<<<<<<<<< + * + * def Element(_tag, attrib=None, nsmap=None, *, _pytype=None, **_attributes): + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_9objectify_ElementMaker)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_ui_E, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":84 + * + * cdef object __MATCH_PATH_SEGMENT + * __MATCH_PATH_SEGMENT = re.compile( # <<<<<<<<<<<<<< + * ur"(\.?)\s*(?:\{([^}]*)\})?\s*([^.{}\[\]\s]+)\s*(?:\[\s*([-0-9]+)\s*\])?", + * re.U).match + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_re, __pyx_n_ui_compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":86 + * __MATCH_PATH_SEGMENT = re.compile( + * ur"(\.?)\s*(?:\{([^}]*)\})?\s*([^.{}\[\]\s]+)\s*(?:\[\s*([-0-9]+)\s*\])?", + * re.U).match # <<<<<<<<<<<<<< + * + * cdef object _RELATIVE_PATH_SEGMENT + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_4lxml_9objectify_re, __pyx_n_ui_U); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_68)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_68)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_68)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __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_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_ui_match); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_4lxml_9objectify___MATCH_PATH_SEGMENT); + __Pyx_DECREF(__pyx_v_4lxml_9objectify___MATCH_PATH_SEGMENT); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_v_4lxml_9objectify___MATCH_PATH_SEGMENT = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/objectpath.pxi":89 + * + * cdef object _RELATIVE_PATH_SEGMENT + * _RELATIVE_PATH_SEGMENT = (None, None, 0) # <<<<<<<<<<<<<< + * + * cdef _parseObjectPathString(path): + */ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __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); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GOTREF(__pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT); + __Pyx_DECREF(__pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_v_4lxml_9objectify__RELATIVE_PATH_SEGMENT = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/sbehnel/source/Python/lxml/lxml-2.2/src/lxml/cstd.pxd":2 + * + * cdef extern from "string.h": # <<<<<<<<<<<<<< + * cdef int strlen(char* s) nogil + * cdef char* strstr(char* haystack, char* needle) nogil + */ + 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); + if (__pyx_m) { + __Pyx_AddTraceback("init lxml.objectify"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init lxml.objectify"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "lxml.objectify.pyx", + "objectpath.pxi", + "python.pxd", + "etreepublic.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +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 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 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 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 INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +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) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (obj == Py_None || PyObject_TypeCheck(obj, type)) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + + +static 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 int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_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; + PyErr_NormalizeException(type, value, tb); + if (PyErr_Occurred()) + goto bad; + Py_INCREF(*type); + Py_INCREF(*value); + Py_INCREF(*tb); + 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; + /* 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: + Py_XDECREF(*type); + Py_XDECREF(*value); + Py_XDECREF(*tb); + return -1; +} + + + +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 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 *__import__ = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!__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(__import__, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(__import__); + Py_XDECREF(empty_dict); + return module; +} + +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_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 , */ + 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; +} + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + 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 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; +} + + +static 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 0; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + 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, + (((unsigned char)-1) > ((unsigned char)0) && 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 INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + 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, + (((unsigned short)-1) > ((unsigned short)0) && 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 INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + 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, + (((unsigned int)-1) > ((unsigned int)0) && 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 INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + 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, + (((char)-1) > ((char)0) && 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 INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + 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, + (((short)-1) > ((short)0) && 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 INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + 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, + (((int)-1) > ((int)0) && 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 INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + 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, + (((signed char)-1) > ((signed char)0) && 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 INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + 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, + (((signed short)-1) > ((signed short)0) && 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 INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + 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, + (((signed int)-1) > ((signed int)0) && 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 INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && 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 (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(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 INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && 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 (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && 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 (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(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 INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && 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 (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(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 INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && 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 (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(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 INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && 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 (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(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 INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && 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 (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && 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 (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(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); + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#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->is_identifier)) { + *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_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *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 INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static 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 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 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 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 */ diff --git a/src/lxml/lxml.objectify.pyx b/src/lxml/lxml.objectify.pyx new file mode 100644 index 0000000..f8071bd --- /dev/null +++ b/src/lxml/lxml.objectify.pyx @@ -0,0 +1,2003 @@ +u"""The ``lxml.objectify`` module implements a Python object API for +XML. It is based on `lxml.etree`. +""" + +from etreepublic cimport _Document, _Element, ElementBase +from etreepublic cimport _ElementIterator, ElementClassLookup +from etreepublic cimport elementFactory, import_lxml__etree, textOf, pyunicode +from python cimport callable, _cstr +cimport etreepublic as cetree +cimport python +cimport tree +cimport cstd + +__all__ = [u'BoolElement', u'DataElement', u'E', u'Element', u'ElementMaker', + u'FloatElement', u'IntElement', u'LongElement', u'NoneElement', + u'NumberElement', u'ObjectPath', u'ObjectifiedDataElement', + u'ObjectifiedElement', u'ObjectifyElementClassLookup', + u'PYTYPE_ATTRIBUTE', u'PyType', u'StringElement', u'XML', + u'annotate', u'deannotate', u'dump', u'enable_recursive_str', + u'fromstring', u'getRegisteredTypes', u'makeparser', u'parse', + u'pyannotate', u'pytypename', u'set_default_parser', + u'set_pytype_attribute_tag', u'xsiannotate'] + +cdef object etree +from lxml import etree +# initialize C-API of lxml.etree +import_lxml__etree() + +__version__ = etree.__version__ + +cdef object re +import re + +cdef tuple IGNORABLE_ERRORS = (ValueError, TypeError) +cdef object is_special_method = re.compile(u'__.*__$').match + +cdef object islice +from itertools import islice + +cdef object _typename(object t): + cdef char* c_name + cdef char* s + c_name = python._fqtypename(t) + s = cstd.strrchr(c_name, c'.') + if s is not NULL: + c_name = s + 1 + return pyunicode(c_name) + +# namespace/name for "pytype" hint attribute +cdef object PYTYPE_NAMESPACE +cdef object PYTYPE_NAMESPACE_UTF8 +cdef char* _PYTYPE_NAMESPACE + +cdef object PYTYPE_ATTRIBUTE_NAME +cdef object PYTYPE_ATTRIBUTE_NAME_UTF8 +cdef char* _PYTYPE_ATTRIBUTE_NAME + +PYTYPE_ATTRIBUTE = None + +cdef object TREE_PYTYPE_NAME +TREE_PYTYPE_NAME = u"TREE" + +cdef _unicodeAndUtf8(s): + return (s, python.PyUnicode_AsUTF8String(s)) + +def set_pytype_attribute_tag(attribute_tag=None): + u"""set_pytype_attribute_tag(attribute_tag=None) + Change name and namespace of the XML attribute that holds Python type + information. + + Do not use this unless you know what you are doing. + + Reset by calling without argument. + + Default: "{http://codespeak.net/lxml/objectify/pytype}pytype" + """ + global PYTYPE_ATTRIBUTE, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME + global PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 + global PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 + if attribute_tag is None: + PYTYPE_NAMESPACE, PYTYPE_NAMESPACE_UTF8 = \ + _unicodeAndUtf8(u"http://codespeak.net/lxml/objectify/pytype") + PYTYPE_ATTRIBUTE_NAME, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + _unicodeAndUtf8(u"pytype") + else: + PYTYPE_NAMESPACE_UTF8, PYTYPE_ATTRIBUTE_NAME_UTF8 = \ + cetree.getNsTag(attribute_tag) + PYTYPE_NAMESPACE = python.PyUnicode_FromEncodedObject( + PYTYPE_NAMESPACE_UTF8, 'UTF-8', NULL) + PYTYPE_ATTRIBUTE_NAME = python.PyUnicode_FromEncodedObject( + PYTYPE_ATTRIBUTE_NAME_UTF8, 'UTF-8', NULL) + + _PYTYPE_NAMESPACE = _cstr(PYTYPE_NAMESPACE_UTF8) + _PYTYPE_ATTRIBUTE_NAME = _cstr(PYTYPE_ATTRIBUTE_NAME_UTF8) + PYTYPE_ATTRIBUTE = cetree.namespacedNameFromNsName( + _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + +set_pytype_attribute_tag() + + +# namespaces for XML Schema +cdef object XML_SCHEMA_NS, XML_SCHEMA_NS_UTF8 +XML_SCHEMA_NS, XML_SCHEMA_NS_UTF8 = \ + _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema") +cdef char* _XML_SCHEMA_NS +_XML_SCHEMA_NS = _cstr(XML_SCHEMA_NS_UTF8) + +cdef object XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 +XML_SCHEMA_INSTANCE_NS, XML_SCHEMA_INSTANCE_NS_UTF8 = \ + _unicodeAndUtf8(u"http://www.w3.org/2001/XMLSchema-instance") +cdef char* _XML_SCHEMA_INSTANCE_NS +_XML_SCHEMA_INSTANCE_NS = _cstr(XML_SCHEMA_INSTANCE_NS_UTF8) + +cdef object XML_SCHEMA_INSTANCE_NIL_ATTR +XML_SCHEMA_INSTANCE_NIL_ATTR = u"{%s}nil" % XML_SCHEMA_INSTANCE_NS +cdef object XML_SCHEMA_INSTANCE_TYPE_ATTR +XML_SCHEMA_INSTANCE_TYPE_ATTR = u"{%s}type" % XML_SCHEMA_INSTANCE_NS + + +# Forward declaration +cdef class PyType + +################################################################################ +# Element class for the main API + +cdef class ObjectifiedElement(ElementBase): + u"""Main XML Element class. + + Element children are accessed as object attributes. Multiple children + with the same name are available through a list index. Example:: + + >>> root = XML("01") + >>> second_c2 = root.c1.c2[1] + >>> print(second_c2.text) + 1 + + Note that you cannot (and must not) instantiate this class or its + subclasses. + """ + def __iter__(self): + u"""Iterate over self and all siblings with the same tag. + """ + parent = self.getparent() + if parent is None: + return iter([self]) + return etree.ElementChildIterator(parent, tag=self.tag) + + def __str__(self): + if __RECURSIVE_STR: + return _dump(self, 0) + else: + return textOf(self._c_node) or u'' + + property text: + def __get__(self): + return textOf(self._c_node) + + property __dict__: + u"""A fake implementation for __dict__ to support dir() etc. + + Note that this only considers the first child with a given name. + """ + def __get__(self): + cdef char* c_ns + cdef char* c_child_ns + cdef _Element child + cdef dict children + c_ns = tree._getNs(self._c_node) + if c_ns is NULL: + tag = None + else: + tag = u"{%s}*" % pyunicode(c_ns) + children = {} + for child in etree.ElementChildIterator(self, tag=tag): + if c_ns is NULL and tree._getNs(child._c_node) is not NULL: + continue + name = pyunicode(child._c_node.name) + if python.PyDict_GetItem(children, name) is NULL: + children[name] = child + return children + + def __len__(self): + u"""Count self and siblings with the same tag. + """ + return _countSiblings(self._c_node) + + def countchildren(self): + u"""countchildren(self) + + Return the number of children of this element, regardless of their + name. + """ + # copied from etree + cdef Py_ssize_t c + cdef tree.xmlNode* c_node + c = 0 + 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 + return c + + def getchildren(self): + u"""getchildren(self) + + Returns a sequence of all direct children. The elements are + returned in document order. + """ + cdef tree.xmlNode* c_node + cdef list result = [] + c_node = self._c_node.children + while c_node is not NULL: + if tree._isElement(c_node): + result.append(cetree.elementFactory(self._doc, c_node)) + c_node = c_node.next + return result + + def __getattr__(self, tag): + u"""Return the (first) child with the given tag name. If no namespace + is provided, the child will be looked up in the same one as self. + """ + if is_special_method(tag): + return object.__getattr__(self, tag) + return _lookupChildOrRaise(self, tag) + + def __setattr__(self, tag, value): + u"""Set the value of the (first) child with the given tag name. If no + namespace is provided, the child will be looked up in the same one as + self. + """ + cdef _Element element + # properties are looked up /after/ __setattr__, so we must emulate them + if tag == u'text' or tag == u'pyval': + # read-only ! + raise TypeError, u"attribute '%s' of '%s' objects is not writable" % \ + (tag, _typename(self)) + elif tag == u'tail': + cetree.setTailText(self._c_node, value) + return + elif tag == u'tag': + ElementBase.tag.__set__(self, value) + return + elif tag == u'base': + ElementBase.base.__set__(self, value) + return + tag = _buildChildTag(self, tag) + element = _lookupChild(self, tag) + if element is None: + _appendValue(self, tag, value) + else: + _replaceElement(element, value) + + def __delattr__(self, tag): + child = _lookupChildOrRaise(self, tag) + self.remove(child) + + def addattr(self, tag, value): + u"""addattr(self, tag, value) + + Add a child value to the element. + + As opposed to append(), it sets a data value, not an element. + """ + _appendValue(self, _buildChildTag(self, tag), value) + + def __getitem__(self, key): + u"""Return a sibling, counting from the first child of the parent. The + method behaves like both a dict and a sequence. + + * If argument is an integer, returns the sibling at that position. + + * If argument is a string, does the same as getattr(). This can be + used to provide namespaces for element lookup, or to look up + children with special names (``text`` etc.). + + * If argument is a slice object, returns the matching slice. + """ + cdef tree.xmlNode* c_self_node + cdef tree.xmlNode* c_parent + cdef tree.xmlNode* c_node + cdef Py_ssize_t start, stop, step, slicelength + if python._isString(key): + return _lookupChildOrRaise(self, key) + elif python.PySlice_Check(key): + return list(self)[key] + # normal item access + c_self_node = self._c_node + c_parent = c_self_node.parent + if c_parent is NULL: + if key == 0: + return self + else: + raise IndexError, unicode(key) + if key < 0: + c_node = c_parent.last + else: + c_node = c_parent.children + c_node = _findFollowingSibling( + c_node, tree._getNs(c_self_node), c_self_node.name, key) + if c_node is NULL: + raise IndexError, unicode(key) + return elementFactory(self._doc, c_node) + + def __setitem__(self, key, value): + u"""Set the value of a sibling, counting from the first child of the + parent. Implements key assignment, item assignment and slice + assignment. + + * If argument is an integer, sets the sibling at that position. + + * If argument is a string, does the same as setattr(). This is used + to provide namespaces for element lookup. + + * If argument is a sequence (list, tuple, etc.), assign the contained + items to the siblings. + """ + cdef _Element element + cdef tree.xmlNode* c_node + if python._isString(key): + key = _buildChildTag(self, key) + element = _lookupChild(self, key) + if element is None: + _appendValue(self, key, value) + else: + _replaceElement(element, value) + return + + if self._c_node.parent is NULL: + # the 'root[i] = ...' case + raise TypeError, u"assignment to root element is invalid" + + if python.PySlice_Check(key): + # slice assignment + _setSlice(key, self, value) + else: + # normal index assignment + if key < 0: + c_node = self._c_node.parent.last + else: + c_node = self._c_node.parent.children + c_node = _findFollowingSibling( + c_node, tree._getNs(self._c_node), self._c_node.name, key) + if c_node is NULL: + raise IndexError, unicode(key) + element = elementFactory(self._doc, c_node) + _replaceElement(element, value) + + def __delitem__(self, key): + cdef Py_ssize_t start, stop, step, slicelength + parent = self.getparent() + if parent is None: + raise TypeError, u"deleting items not supported by root element" + if python.PySlice_Check(key): + # slice deletion + del_items = list(self)[key] + remove = parent.remove + for el in del_items: + remove(el) + else: + # normal index deletion + sibling = self.__getitem__(key) + parent.remove(sibling) + + def iterfind(self, path): + u"iterfind(self, path)" + # Reimplementation of Element.iterfind() to make it work without child + # iteration. + xpath = etree.ETXPath(path) + return iter(xpath(self)) + + def findall(self, path): + u"findall(self, path)" + # Reimplementation of Element.findall() to make it work without child + # iteration. + xpath = etree.ETXPath(path) + return xpath(self) + + def find(self, path): + u"find(self, path)" + # Reimplementation of Element.find() to make it work without child + # iteration. + result = self.findall(path) + if isinstance(result, list) and len(result): + return result[0] + elif isinstance(result, _Element): + return result + else: + return None + + def findtext(self, path, default=None): + u"findtext(self, path, default=None)" + # Reimplementation of Element.findtext() to make it work without child + # iteration. + result = self.find(path) + if isinstance(result, _Element): + return result.text or u"" + else: + return default + + def descendantpaths(self, prefix=None): + u"""descendantpaths(self, prefix=None) + + Returns a list of object path expressions for all descendants. + """ + if prefix is not None and not python._isString(prefix): + prefix = u'.'.join(prefix) + return _buildDescendantPaths(self._c_node, prefix) + +cdef inline bint _tagMatches(tree.xmlNode* c_node, char* c_href, char* c_name): + cdef char* c_node_href + if c_node.name != c_name: + return 0 + if c_href == NULL: + return 1 + c_node_href = tree._getNs(c_node) + if c_node_href == NULL: + return c_href[0] == c'\0' + return cstd.strcmp(c_node_href, c_href) == 0 + +cdef Py_ssize_t _countSiblings(tree.xmlNode* c_start_node): + cdef tree.xmlNode* c_node + cdef char* c_href + cdef char* c_tag + cdef Py_ssize_t count + c_tag = c_start_node.name + c_href = tree._getNs(c_start_node) + count = 1 + c_node = c_start_node.next + while c_node is not NULL: + if c_node.type == tree.XML_ELEMENT_NODE and \ + _tagMatches(c_node, c_href, c_tag): + count = count + 1 + c_node = c_node.next + c_node = c_start_node.prev + while c_node is not NULL: + if c_node.type == tree.XML_ELEMENT_NODE and \ + _tagMatches(c_node, c_href, c_tag): + count = count + 1 + c_node = c_node.prev + return count + +cdef tree.xmlNode* _findFollowingSibling(tree.xmlNode* c_node, + char* href, char* name, + Py_ssize_t index): + cdef tree.xmlNode* (*next)(tree.xmlNode*) + if index >= 0: + next = cetree.nextElement + else: + index = -1 - index + next = cetree.previousElement + while c_node is not NULL: + if c_node.type == tree.XML_ELEMENT_NODE and \ + _tagMatches(c_node, href, name): + index = index - 1 + if index < 0: + return c_node + c_node = next(c_node) + return NULL + +cdef object _lookupChild(_Element parent, tag): + cdef tree.xmlNode* c_result + cdef tree.xmlNode* c_node + cdef char* c_href + cdef char* c_tag + c_node = parent._c_node + ns, tag = cetree.getNsTag(tag) + c_tag = tree.xmlDictExists( + c_node.doc.dict, _cstr(tag), python.PyString_GET_SIZE(tag)) + if c_tag is NULL: + return None + if ns is None: + c_href = tree._getNs(c_node) + else: + c_href = _cstr(ns) + c_result = _findFollowingSibling(c_node.children, c_href, c_tag, 0) + if c_result is NULL: + return None + return elementFactory(parent._doc, c_result) + +cdef object _lookupChildOrRaise(_Element parent, tag): + element = _lookupChild(parent, tag) + if element is None: + raise AttributeError, \ + u"no such child: " + _buildChildTag(parent, tag) + return element + +cdef object _buildChildTag(_Element parent, tag): + cdef char* c_href + cdef char* c_tag + ns, tag = cetree.getNsTag(tag) + c_tag = _cstr(tag) + if ns is None: + c_href = tree._getNs(parent._c_node) + else: + c_href = _cstr(ns) + return cetree.namespacedNameFromNsName(c_href, c_tag) + +cdef _replaceElement(_Element element, value): + cdef _Element new_element + if isinstance(value, _Element): + # deep copy the new element + new_element = cetree.deepcopyNodeToDocument( + element._doc, (<_Element>value)._c_node) + new_element.tag = element.tag + elif python.PyList_Check(value) or python.PyTuple_Check(value): + element[:] = value + return + else: + new_element = element.makeelement(element.tag) + _setElementValue(new_element, value) + element.getparent().replace(element, new_element) + +cdef _appendValue(_Element parent, tag, value): + cdef _Element new_element + if isinstance(value, _Element): + # deep copy the new element + new_element = cetree.deepcopyNodeToDocument( + parent._doc, (<_Element>value)._c_node) + new_element.tag = tag + cetree.appendChild(parent, new_element) + elif python.PyList_Check(value) or python.PyTuple_Check(value): + for item in value: + _appendValue(parent, tag, item) + else: + new_element = cetree.makeElement( + tag, parent._doc, None, None, None, None, None) + _setElementValue(new_element, value) + cetree.appendChild(parent, new_element) + +cdef _setElementValue(_Element element, value): + cdef python.PyObject* _pytype + if value is None: + cetree.setAttributeValue( + element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + elif isinstance(value, _Element): + _replaceElement(element, value) + return + else: + cetree.delAttributeFromNsName( + element._c_node, _XML_SCHEMA_INSTANCE_NS, "nil") + if python._isString(value): + pytype_name = u"str" + _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + else: + pytype_name = _typename(value) + _pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + if _pytype is not NULL: + value = (_pytype).stringify(value) + else: + value = unicode(value) + if _pytype is not NULL: + cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + else: + cetree.delAttributeFromNsName( + element._c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + cetree.setNodeText(element._c_node, value) + +cdef _setSlice(slice, _Element target, items): + cdef _Element parent + cdef tree.xmlNode* c_node + cdef Py_ssize_t c_step, c_start, pos + cdef list new_items + # collect existing slice + if (slice).step is None: + c_step = 1 + else: + c_step = (slice).step + if c_step == 0: + raise ValueError, u"Invalid slice" + del_items = target[slice] + + # collect new values + new_items = [] + tag = target.tag + for item in items: + if isinstance(item, _Element): + # deep copy the new element + new_element = cetree.deepcopyNodeToDocument( + target._doc, (<_Element>item)._c_node) + new_element.tag = tag + else: + new_element = cetree.makeElement( + tag, target._doc, None, None, None, None, None) + _setElementValue(new_element, item) + new_items.append(new_element) + + # sanity check - raise what a list would raise + if c_step != 1 and \ + python.PyList_GET_SIZE(del_items) != python.PyList_GET_SIZE(new_items): + raise ValueError, \ + u"attempt to assign sequence of size %d to extended slice of size %d" % ( + python.PyList_GET_SIZE(new_items), + python.PyList_GET_SIZE(del_items)) + + # replace existing items + pos = 0 + parent = target.getparent() + replace = parent.replace + while pos < python.PyList_GET_SIZE(new_items) and \ + pos < python.PyList_GET_SIZE(del_items): + replace(del_items[pos], new_items[pos]) + pos += 1 + # remove leftover items + if pos < python.PyList_GET_SIZE(del_items): + remove = parent.remove + while pos < python.PyList_GET_SIZE(del_items): + remove(del_items[pos]) + pos += 1 + # append remaining new items + if pos < python.PyList_GET_SIZE(new_items): + # the sanity check above guarantees (step == 1) + if pos > 0: + item = new_items[pos-1] + else: + if (slice).start > 0: + c_node = parent._c_node.children + else: + c_node = parent._c_node.last + c_node = _findFollowingSibling( + c_node, tree._getNs(target._c_node), target._c_node.name, + (slice).start - 1) + if c_node is NULL: + while pos < python.PyList_GET_SIZE(new_items): + cetree.appendChild(parent, new_items[pos]) + pos += 1 + return + item = cetree.elementFactory(parent._doc, c_node) + while pos < python.PyList_GET_SIZE(new_items): + add = item.addnext + item = new_items[pos] + add(item) + pos += 1 + +################################################################################ +# Data type support in subclasses + +cdef class ObjectifiedDataElement(ObjectifiedElement): + u"""This is the base class for all data type Elements. Subclasses should + override the 'pyval' property and possibly the __str__ method. + """ + property pyval: + def __get__(self): + return textOf(self._c_node) + + def __str__(self): + return textOf(self._c_node) or u'' + + def __repr__(self): + return textOf(self._c_node) or u'' + + def _setText(self, s): + u"""For use in subclasses only. Don't use unless you know what you are + doing. + """ + cetree.setNodeText(self._c_node, s) + +cdef class NumberElement(ObjectifiedDataElement): + cdef object _parse_value + def _setValueParser(self, function): + u"""Set the function that parses the Python value from a string. + + Do not use this unless you know what you are doing. + """ + self._parse_value = function + + property pyval: + def __get__(self): + return _parseNumber(self) + + def __int__(self): + return int(_parseNumber(self)) + + def __long__(self): + return long(_parseNumber(self)) + + def __float__(self): + return float(_parseNumber(self)) + + def __complex__(self): + return complex(_parseNumber(self)) + + def __str__(self): + return unicode(_parseNumber(self)) + + def __repr__(self): + return repr(_parseNumber(self)) + + def __oct__(self): + return oct(_parseNumber(self)) + + def __hex__(self): + return hex(_parseNumber(self)) + + def __richcmp__(self, other, int op): + return _richcmpPyvals(self, other, op) + + def __add__(self, other): + return _numericValueOf(self) + _numericValueOf(other) + + def __sub__(self, other): + return _numericValueOf(self) - _numericValueOf(other) + + def __mul__(self, other): + return _numericValueOf(self) * _numericValueOf(other) + + def __div__(self, other): + return _numericValueOf(self) / _numericValueOf(other) + + def __truediv__(self, other): + return _numericValueOf(self) / _numericValueOf(other) + + def __mod__(self, other): + return _numericValueOf(self) % _numericValueOf(other) + + def __pow__(self, other, modulo): + if modulo is None: + return _numericValueOf(self) ** _numericValueOf(other) + else: + return pow(_numericValueOf(self), _numericValueOf(other), modulo) + + def __neg__(self): + return - _numericValueOf(self) + + def __pos__(self): + return + _numericValueOf(self) + + def __abs__(self): + return abs( _numericValueOf(self) ) + + def __nonzero__(self): + return _numericValueOf(self) != 0 + + def __invert__(self): + return ~ _numericValueOf(self) + + def __lshift__(self, other): + return _numericValueOf(self) << _numericValueOf(other) + + def __rshift__(self, other): + return _numericValueOf(self) >> _numericValueOf(other) + + def __and__(self, other): + return _numericValueOf(self) & _numericValueOf(other) + + def __or__(self, other): + return _numericValueOf(self) | _numericValueOf(other) + + def __xor__(self, other): + return _numericValueOf(self) ^ _numericValueOf(other) + +cdef class IntElement(NumberElement): + def _init(self): + self._parse_value = int + +cdef class LongElement(NumberElement): + def _init(self): + self._parse_value = long + +cdef class FloatElement(NumberElement): + def _init(self): + self._parse_value = float + +cdef class StringElement(ObjectifiedDataElement): + u"""String data class. + + Note that this class does *not* support the sequence protocol of strings: + len(), iter(), str_attr[0], str_attr[0:1], etc. are *not* supported. + Instead, use the .text attribute to get a 'real' string. + """ + property pyval: + def __get__(self): + return textOf(self._c_node) or u'' + + def __repr__(self): + return repr(textOf(self._c_node) or u'') + + def strlen(self): + text = textOf(self._c_node) + if text is None: + return 0 + else: + return len(text) + + def __nonzero__(self): + text = textOf(self._c_node) + if text is None: + return False + return len(text) > 0 + + def __richcmp__(self, other, int op): + return _richcmpPyvals(self, other, op) + + def __add__(self, other): + text = _strValueOf(self) + other = _strValueOf(other) + if text is None: + return other + if other is None: + return text + return text + other + + def __mul__(self, other): + if isinstance(self, StringElement): + return textOf((self)._c_node) * _numericValueOf(other) + elif isinstance(other, StringElement): + return _numericValueOf(self) * textOf((other)._c_node) + else: + raise TypeError, u"invalid types for * operator" + + def __mod__(self, other): + return _strValueOf(self) % other + + def __int__(self): + return int(textOf(self._c_node)) + + def __long__(self): + return long(textOf(self._c_node)) + + def __float__(self): + return float(textOf(self._c_node)) + + def __complex__(self): + return complex(textOf(self._c_node)) + +cdef class NoneElement(ObjectifiedDataElement): + def __str__(self): + return u"None" + + def __repr__(self): + return u"None" + + def __nonzero__(self): + return False + + def __richcmp__(self, other, int op): + if other is None or self is None: + return python.PyObject_RichCompare(None, None, op) + if isinstance(self, NoneElement): + return python.PyObject_RichCompare(None, other, op) + else: + return python.PyObject_RichCompare(self, None, op) + + property pyval: + def __get__(self): + return None + +cdef class BoolElement(IntElement): + u"""Boolean type base on string values: 'true' or 'false'. + + Note that this inherits from IntElement to mimic the behaviour of + Python's bool type. + """ + def _init(self): + self._parse_value = __parseBool + + def __nonzero__(self): + return __parseBool(textOf(self._c_node)) + + def __richcmp__(self, other, int op): + return _richcmpPyvals(self, other, op) + + def __str__(self): + return unicode(__parseBool(textOf(self._c_node))) + + def __repr__(self): + return repr(__parseBool(textOf(self._c_node))) + + property pyval: + def __get__(self): + return __parseBool(textOf(self._c_node)) + +def __checkBool(s): + cdef int value = -1 + if s is not None: + value = __parseBoolAsInt(s) + if value == -1: + raise ValueError + +cpdef __parseBool(s): + cdef int value + if s is None: + return False + value = __parseBoolAsInt(s) + if value == -1: + raise ValueError, u"Invalid boolean value: '%s'" % s + return value + +cdef inline int __parseBoolAsInt(text): + if text == u'false': + return 0 + elif text == u'true': + return 1 + elif text == u'0': + return 0 + elif text == u'1': + return 1 + return -1 + +cdef inline object _parseNumber(NumberElement element): + return element._parse_value(textOf(element._c_node)) + +cdef inline object _strValueOf(obj): + if python._isString(obj): + return obj + if isinstance(obj, _Element): + return textOf((<_Element>obj)._c_node) or u'' + if obj is None: + return u'' + return unicode(obj) + +cdef inline object _numericValueOf(obj): + if isinstance(obj, NumberElement): + return _parseNumber(obj) + elif hasattr(obj, u'pyval'): + # not always numeric, but Python will raise the right exception + return obj.pyval + return obj + +cdef inline _richcmpPyvals(left, right, int op): + left = getattr3(left, u'pyval', left) + right = getattr3(right, u'pyval', right) + return python.PyObject_RichCompare(left, right, op) + + +################################################################################ +# Python type registry + +cdef class PyType: + u"""PyType(self, name, type_check, type_class, stringify=None) + User defined type. + + Named type that contains a type check function and a type class that + inherits from ObjectifiedDataElement. The type check must take a string + as argument and raise ValueError or TypeError if it cannot handle the + string value. It may be None in which case it is not considered for type + guessing. + + Example:: + + PyType('int', int, MyIntClass).register() + + Note that the order in which types are registered matters. The first + matching type will be used. + """ + cdef readonly object name + cdef readonly object type_check + cdef readonly object stringify + cdef object _type + cdef list _schema_types + def __init__(self, name, type_check, type_class, stringify=None): + if python.PyString_Check(name): + name = python.PyUnicode_FromEncodedObject(name, 'ASCII', NULL) + elif not python.PyUnicode_Check(name): + raise TypeError, u"Type name must be a string" + if type_check is not None and not callable(type_check): + raise TypeError, u"Type check function must be callable (or None)" + if name != TREE_PYTYPE_NAME and \ + not issubclass(type_class, ObjectifiedDataElement): + raise TypeError, \ + u"Data classes must inherit from ObjectifiedDataElement" + self.name = name + self._type = type_class + self.type_check = type_check + if stringify is None: + stringify = unicode + self.stringify = stringify + self._schema_types = [] + + def __repr__(self): + return u"PyType(%s, %s)" % (self.name, self._type.__name__) + + def register(self, before=None, after=None): + u"""register(self, before=None, after=None) + + Register the type. + + The additional keyword arguments 'before' and 'after' accept a + sequence of type names that must appear before/after the new type in + the type list. If any of them is not currently known, it is simply + ignored. Raises ValueError if the dependencies cannot be fulfilled. + """ + if self.name == TREE_PYTYPE_NAME: + raise ValueError, u"Cannot register tree type" + if self.type_check is not None: + for item in _TYPE_CHECKS: + if item[0] is self.type_check: + _TYPE_CHECKS.remove(item) + break + entry = (self.type_check, self) + first_pos = 0 + last_pos = -1 + if before or after: + if before is None: + before = () + elif after is None: + after = () + for i, (check, pytype) in enumerate(_TYPE_CHECKS): + if last_pos == -1 and pytype.name in before: + last_pos = i + if pytype.name in after: + first_pos = i+1 + if last_pos == -1: + _TYPE_CHECKS.append(entry) + elif first_pos > last_pos: + raise ValueError, u"inconsistent before/after dependencies" + else: + _TYPE_CHECKS.insert(last_pos, entry) + + _PYTYPE_DICT[self.name] = self + for xs_type in self._schema_types: + _SCHEMA_TYPE_DICT[xs_type] = self + + def unregister(self): + u"unregister(self)" + if _PYTYPE_DICT.get(self.name) is self: + del _PYTYPE_DICT[self.name] + for xs_type, pytype in list(_SCHEMA_TYPE_DICT.items()): + if pytype is self: + del _SCHEMA_TYPE_DICT[xs_type] + if self.type_check is None: + return + try: + _TYPE_CHECKS.remove( (self.type_check, self) ) + except ValueError: + pass + + property xmlSchemaTypes: + u"""The list of XML Schema datatypes this Python type maps to. + + Note that this must be set before registering the type! + """ + def __get__(self): + return self._schema_types + def __set__(self, types): + self._schema_types = list(map(unicode, types)) + + +cdef dict _PYTYPE_DICT +_PYTYPE_DICT = {} + +cdef dict _SCHEMA_TYPE_DICT +_SCHEMA_TYPE_DICT = {} + +cdef list _TYPE_CHECKS +_TYPE_CHECKS = [] + +cdef _lower_bool(b): + if b: + return u"true" + else: + return u"false" + +def __lower_bool(b): + return _lower_bool(b) + +cdef _pytypename(obj): + if python._isString(obj): + return u"str" + else: + return _typename(obj) + +def pytypename(obj): + u"""pytypename(obj) + + Find the name of the corresponding PyType for a Python object. + """ + return _pytypename(obj) + +cdef _registerPyTypes(): + pytype = PyType(u'int', int, IntElement) + pytype.xmlSchemaTypes = (u"integer", u"int", u"short", u"byte", u"unsignedShort", + u"unsignedByte", u"nonPositiveInteger", + u"negativeInteger", u"long", u"nonNegativeInteger", + u"unsignedLong", u"unsignedInt", u"positiveInteger",) + pytype.register() + + # 'long' type just for backwards compatibility + pytype = PyType(u'long', None, IntElement) + pytype.register() + + pytype = PyType(u'float', float, FloatElement) + pytype.xmlSchemaTypes = (u"double", u"float") + pytype.register() + + pytype = PyType(u'bool', __checkBool, BoolElement, __lower_bool) + pytype.xmlSchemaTypes = (u"boolean",) + pytype.register() + + pytype = PyType(u'str', None, StringElement) + pytype.xmlSchemaTypes = (u"string", u"normalizedString", u"token", u"language", + u"Name", u"NCName", u"ID", u"IDREF", u"ENTITY", + u"NMTOKEN", ) + pytype.register() + + # since lxml 2.0 + pytype = PyType(u'NoneType', None, NoneElement) + pytype.register() + + # backwards compatibility + pytype = PyType(u'none', None, NoneElement) + pytype.register() + +# non-registered PyType for inner tree elements +cdef PyType TREE_PYTYPE +TREE_PYTYPE = PyType(TREE_PYTYPE_NAME, None, ObjectifiedElement) + +_registerPyTypes() + +def getRegisteredTypes(): + u"""getRegisteredTypes() + + Returns a list of the currently registered PyType objects. + + To add a new type, retrieve this list and call unregister() for all + entries. Then add the new type at a suitable position (possibly replacing + an existing one) and call register() for all entries. + + This is necessary if the new type interferes with the type check functions + of existing ones (normally only int/float/bool) and must the tried before + other types. To add a type that is not yet parsable by the current type + check functions, you can simply register() it, which will append it to the + end of the type list. + """ + cdef list types = [] + cdef set known = set() + for check, pytype in _TYPE_CHECKS: + name = pytype.name + if name not in known: + known.add(name) + types.append(pytype) + for pytype in _PYTYPE_DICT.values(): + name = pytype.name + if name not in known: + known.add(name) + types.append(pytype) + return types + +cdef PyType _guessPyType(value, PyType defaulttype): + if value is None: + return None + for type_check, tested_pytype in _TYPE_CHECKS: + try: + type_check(value) + return tested_pytype + except IGNORABLE_ERRORS: + # could not be parsed as the specififed type => ignore + pass + return defaulttype + +cdef object _guessElementClass(tree.xmlNode* c_node): + value = textOf(c_node) + if value is None: + return None + if value == u'': + return StringElement + + for type_check, pytype in _TYPE_CHECKS: + try: + type_check(value) + return (pytype)._type + except IGNORABLE_ERRORS: + pass + return None + +################################################################################ +# adapted ElementMaker supports registered PyTypes + +cdef class _ObjectifyElementMakerCaller: + cdef object _tag + cdef object _nsmap + cdef object _element_factory + cdef bint _annotate + + def __call__(self, *children, **attrib): + u"__call__(self, *children, **attrib)" + cdef _ObjectifyElementMakerCaller elementMaker + cdef python.PyObject* pytype + cdef _Element element + cdef _Element childElement + cdef bint has_children + cdef bint has_string_value + if self._element_factory is None: + element = _makeElement(self._tag, None, attrib, self._nsmap) + else: + element = self._element_factory(self._tag, attrib, self._nsmap) + + pytype_name = None + has_children = 0 + has_string_value = 0 + for child in children: + if child is None: + if python.PyTuple_GET_SIZE(children) == 1: + cetree.setAttributeValue( + element, XML_SCHEMA_INSTANCE_NIL_ATTR, u"true") + elif python._isString(child): + _add_text(element, child) + has_string_value = 1 + elif isinstance(child, _Element): + cetree.appendChild(element, <_Element>child) + has_children = 1 + elif isinstance(child, _ObjectifyElementMakerCaller): + elementMaker = <_ObjectifyElementMakerCaller>child + if elementMaker._element_factory is None: + cetree.makeSubElement(element, elementMaker._tag, + None, None, None, None) + else: + childElement = elementMaker._element_factory( + elementMaker._tag) + cetree.appendChild(element, childElement) + has_children = 1 + else: + if pytype_name is not None: + # concatenation always makes the result a string + has_string_value = 1 + pytype_name = _typename(child) + pytype = python.PyDict_GetItem(_PYTYPE_DICT, pytype_name) + if pytype is not NULL: + _add_text(element, (pytype).stringify(child)) + else: + has_string_value = 1 + child = unicode(child) + _add_text(element, child) + + if self._annotate and not has_children: + if has_string_value: + cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, u"str") + elif pytype_name is not None: + cetree.setAttributeValue(element, PYTYPE_ATTRIBUTE, pytype_name) + + return element + +cdef _add_text(_Element elem, text): + # add text to the tree in construction, either as element text or + # tail text, depending on the current tree state + cdef tree.xmlNode* c_child + c_child = cetree.findChildBackwards(elem._c_node, 0) + if c_child is not NULL: + old = cetree.tailOf(c_child) + if old is not None: + text = old + text + cetree.setTailText(c_child, text) + else: + old = cetree.textOf(elem._c_node) + if old is not None: + text = old + text + cetree.setNodeText(elem._c_node, text) + +cdef extern from "etree_defs.h": + # macro call to 't->tp_new()' for fast instantiation + cdef _ObjectifyElementMakerCaller NEW_ELEMENT_MAKER "PY_NEW" (object t) + +cdef class ElementMaker: + u"""ElementMaker(self, namespace=None, nsmap=None, annotate=True, makeelement=None) + + An ElementMaker that can be used for constructing trees. + + Example:: + + >>> M = ElementMaker(annotate=False) + >>> html = M.html( M.body( M.p('hello', M.br, 'objectify') ) ) + + >>> from lxml.etree import tostring + >>> print(tostring(html, method='html').decode('ASCII')) +

hello
objectify

+ + Note that this module has a predefined ElementMaker instance called ``E``. + """ + cdef object _makeelement + cdef object _namespace + cdef object _nsmap + cdef bint _annotate + def __init__(self, *, namespace=None, nsmap=None, annotate=True, + makeelement=None): + if nsmap is None: + if annotate: + nsmap = _DEFAULT_NSMAP + else: + nsmap = {} + self._nsmap = nsmap + if namespace is None: + self._namespace = None + else: + self._namespace = u"{%s}" % namespace + self._annotate = annotate + if makeelement is not None: + assert callable(makeelement) + self._makeelement = makeelement + else: + self._makeelement = None + + def __getattr__(self, tag): + cdef _ObjectifyElementMakerCaller element_maker + if is_special_method(tag): + return object.__getattr__(self, tag) + if self._namespace is not None and tag[0] != u"{": + tag = self._namespace + tag + element_maker = NEW_ELEMENT_MAKER(_ObjectifyElementMakerCaller) + element_maker._tag = tag + element_maker._nsmap = self._nsmap + element_maker._annotate = self._annotate + element_maker._element_factory = self._makeelement + return element_maker + +################################################################################ +# Recursive element dumping + +cdef bint __RECURSIVE_STR +__RECURSIVE_STR = 0 # default: off + +def enable_recursive_str(on=True): + u"""enable_recursive_str(on=True) + + Enable a recursively generated tree representation for str(element), + based on objectify.dump(element). + """ + global __RECURSIVE_STR + __RECURSIVE_STR = on + +def dump(_Element element not None): + u"""dump(_Element element not None) + + Return a recursively generated string representation of an element. + """ + return _dump(element, 0) + +cdef object _dump(_Element element, int indent): + indentstr = u" " * indent + if isinstance(element, ObjectifiedDataElement): + value = repr(element) + else: + value = textOf(element._c_node) + if value is not None: + if not value.strip(): + value = None + else: + value = repr(value) + result = u"%s%s = %s [%s]\n" % (indentstr, element.tag, + value, _typename(element)) + xsi_ns = u"{%s}" % XML_SCHEMA_INSTANCE_NS + pytype_ns = u"{%s}" % PYTYPE_NAMESPACE + for name, value in cetree.iterattributes(element, 3): + if u'{' in name: + if name == PYTYPE_ATTRIBUTE: + if value == TREE_PYTYPE_NAME: + continue + else: + name = name.replace(pytype_ns, u'py:') + name = name.replace(xsi_ns, u'xsi:') + result = result + u"%s * %s = %r\n" % (indentstr, name, value) + + indent = indent + 1 + for child in element.iterchildren(): + result = result + _dump(child, indent) + if indent == 1: + return result[:-1] # strip last '\n' + else: + return result + + +################################################################################ +# Pickle support + +def __unpickleElementTree(data): + return etree.ElementTree(fromstring(data)) + +cdef _setupPickle(elementReduceFunction, elementTreeReduceFunction): + if python.IS_PYTHON3: + import copyreg + else: + import copy_reg as copyreg + copyreg.constructor(fromstring) + copyreg.constructor(__unpickleElementTree) + copyreg.pickle(ObjectifiedElement, + elementReduceFunction, fromstring) + copyreg.pickle(etree._ElementTree, + elementTreeReduceFunction, __unpickleElementTree) + +def pickleReduceElement(obj): + return (fromstring, (etree.tostring(obj),)) + +def pickleReduceElementTree(obj): + return (__unpickleElementTree, (etree.tostring(obj),)) + +_setupPickle(pickleReduceElement, pickleReduceElementTree) +del pickleReduceElement, pickleReduceElementTree + +################################################################################ +# Element class lookup + +cdef class ObjectifyElementClassLookup(ElementClassLookup): + u"""ObjectifyElementClassLookup(self, tree_class=None, empty_data_class=None) + Element class lookup method that uses the objectify classes. + """ + cdef object empty_data_class + cdef object tree_class + def __init__(self, tree_class=None, empty_data_class=None): + u"""Lookup mechanism for objectify. + + The default Element classes can be replaced by passing subclasses of + ObjectifiedElement and ObjectifiedDataElement as keyword arguments. + 'tree_class' defines inner tree classes (defaults to + ObjectifiedElement), 'empty_data_class' defines the default class for + empty data elements (defauls to StringElement). + """ + self._lookup_function = _lookupElementClass + if tree_class is None: + tree_class = ObjectifiedElement + self.tree_class = tree_class + if empty_data_class is None: + empty_data_class = StringElement + self.empty_data_class = empty_data_class + +cdef object _lookupElementClass(state, _Document doc, tree.xmlNode* c_node): + cdef ObjectifyElementClassLookup lookup + cdef python.PyObject* dict_result + lookup = state + # if element has children => no data class + if cetree.hasChild(c_node): + return lookup.tree_class + + # if element is defined as xsi:nil, return NoneElement class + if u"true" == cetree.attributeValueFromNsName( + c_node, _XML_SCHEMA_INSTANCE_NS, "nil"): + return NoneElement + + # check for Python type hint + value = cetree.attributeValueFromNsName( + c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + if value is not None: + if value == TREE_PYTYPE_NAME: + return lookup.tree_class + dict_result = python.PyDict_GetItem(_PYTYPE_DICT, value) + if dict_result is not NULL: + return (dict_result)._type + # unknown 'pyval' => try to figure it out ourself, just go on + + # check for XML Schema type hint + value = cetree.attributeValueFromNsName( + c_node, _XML_SCHEMA_INSTANCE_NS, "type") + + if value is not None: + dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + if dict_result is NULL and u':' in value: + prefix, value = value.split(u':', 1) + dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, value) + if dict_result is not NULL: + return (dict_result)._type + + # otherwise determine class based on text content type + el_class = _guessElementClass(c_node) + if el_class is not None: + return el_class + + # if element is a root node => default to tree node + if c_node.parent is NULL or not tree._isElement(c_node.parent): + return lookup.tree_class + + return lookup.empty_data_class + + +################################################################################ +# Type annotations + +cdef PyType _check_type(tree.xmlNode* c_node, PyType pytype): + if pytype is None: + return None + value = textOf(c_node) + try: + pytype.type_check(value) + return pytype + except IGNORABLE_ERRORS: + # could not be parsed as the specified type => ignore + pass + return None + +def pyannotate(element_or_tree, *, ignore_old=False, ignore_xsi=False, + empty_pytype=None): + u"""pyannotate(element_or_tree, ignore_old=False, ignore_xsi=False, empty_pytype=None) + + Recursively annotates the elements of an XML tree with 'pytype' + attributes. + + If the 'ignore_old' keyword argument is True (the default), current 'pytype' + attributes will be ignored and replaced. Otherwise, they will be checked + and only replaced if they no longer fit the current text value. + + Setting the keyword argument ``ignore_xsi`` to True makes the function + additionally ignore existing ``xsi:type`` annotations. The default is to + use them as a type hint. + + The default annotation of empty elements can be set with the + ``empty_pytype`` keyword argument. The default is not to annotate empty + elements. Pass 'str', for example, to make string values the default. + """ + cdef _Element element + element = cetree.rootNodeOrRaise(element_or_tree) + _annotate(element, 0, 1, ignore_xsi, ignore_old, None, empty_pytype) + +def xsiannotate(element_or_tree, *, ignore_old=False, ignore_pytype=False, + empty_type=None): + u"""xsiannotate(element_or_tree, ignore_old=False, ignore_pytype=False, empty_type=None) + + Recursively annotates the elements of an XML tree with 'xsi:type' + attributes. + + If the 'ignore_old' keyword argument is True (the default), current + 'xsi:type' attributes will be ignored and replaced. Otherwise, they will be + checked and only replaced if they no longer fit the current text value. + + Note that the mapping from Python types to XSI types is usually ambiguous. + Currently, only the first XSI type name in the corresponding PyType + definition will be used for annotation. Thus, you should consider naming + the widest type first if you define additional types. + + Setting the keyword argument ``ignore_pytype`` to True makes the function + additionally ignore existing ``pytype`` annotations. The default is to + use them as a type hint. + + The default annotation of empty elements can be set with the + ``empty_type`` keyword argument. The default is not to annotate empty + elements. Pass 'string', for example, to make string values the default. + """ + cdef _Element element + element = cetree.rootNodeOrRaise(element_or_tree) + _annotate(element, 1, 0, ignore_old, ignore_pytype, empty_type, None) + +def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False, + empty_pytype=None, empty_type=None, annotate_xsi=0, + annotate_pytype=1): + u"""annotate(element_or_tree, ignore_old=True, ignore_xsi=False, empty_pytype=None, empty_type=None, annotate_xsi=0, annotate_pytype=1) + + Recursively annotates the elements of an XML tree with 'xsi:type' + and/or 'py:pytype' attributes. + + If the 'ignore_old' keyword argument is True (the default), current + 'py:pytype' attributes will be ignored for the type annotation. Set to False + if you want reuse existing 'py:pytype' information (iff appropriate for the + element text value). + + If the 'ignore_xsi' keyword argument is False (the default), existing + 'xsi:type' attributes will be used for the type annotation, if they fit the + element text values. + + Note that the mapping from Python types to XSI types is usually ambiguous. + Currently, only the first XSI type name in the corresponding PyType + definition will be used for annotation. Thus, you should consider naming + the widest type first if you define additional types. + + The default 'py:pytype' annotation of empty elements can be set with the + ``empty_pytype`` keyword argument. Pass 'str', for example, to make + string values the default. + + The default 'xsi:type' annotation of empty elements can be set with the + ``empty_type`` keyword argument. The default is not to annotate empty + elements. Pass 'string', for example, to make string values the default. + + The keyword arguments 'annotate_xsi' (default: 0) and 'annotate_pytype' + (default: 1) control which kind(s) of annotation to use. + """ + cdef _Element element + element = cetree.rootNodeOrRaise(element_or_tree) + _annotate(element, annotate_xsi, annotate_pytype, ignore_xsi, + ignore_old, empty_type, empty_pytype) + + +cdef _annotate(_Element element, bint annotate_xsi, bint annotate_pytype, + bint ignore_xsi, bint ignore_pytype, + empty_type_name, empty_pytype_name): + cdef _Document doc + cdef tree.xmlNode* c_node + cdef tree.xmlNs* c_ns + cdef python.PyObject* dict_result + cdef PyType pytype, empty_pytype, StrType, NoneType + + if not annotate_xsi and not annotate_pytype: + return + + doc = element._doc + + if empty_type_name is not None: + if python.PyString_Check(empty_type_name): + empty_type_name = python.PyUnicode_FromEncodedObject( + empty_type_name, "ASCII", NULL) + dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, empty_type_name) + elif empty_pytype_name is not None: + if python.PyString_Check(empty_pytype_name): + empty_pytype_name = python.PyUnicode_FromEncodedObject( + empty_pytype_name, "ASCII", NULL) + dict_result = python.PyDict_GetItem(_PYTYPE_DICT, empty_pytype_name) + else: + dict_result = NULL + if dict_result is not NULL: + empty_pytype = dict_result + else: + empty_pytype = None + + StrType = _PYTYPE_DICT.get(u'str') + NoneType = _PYTYPE_DICT.get(u'NoneType') + c_node = element._c_node + tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1) + if c_node.type == tree.XML_ELEMENT_NODE: + typename = None + pytype = None + value = None + istree = 0 + # if element is defined as xsi:nil, represent it as None + if cetree.attributeValueFromNsName( + c_node, _XML_SCHEMA_INSTANCE_NS, "nil") == u"true": + pytype = NoneType + + if pytype is None and not ignore_xsi: + # check that old xsi type value is valid + typename = cetree.attributeValueFromNsName( + c_node, _XML_SCHEMA_INSTANCE_NS, "type") + if typename is not None: + dict_result = python.PyDict_GetItem( + _SCHEMA_TYPE_DICT, typename) + if dict_result is NULL and u':' in typename: + prefix, typename = typename.split(u':', 1) + dict_result = python.PyDict_GetItem( + _SCHEMA_TYPE_DICT, typename) + if dict_result is not NULL: + pytype = dict_result + if pytype is not StrType: + # StrType does not have a typecheck but is the default + # anyway, so just accept it if given as type + # information + pytype = _check_type(c_node, pytype) + if pytype is None: + typename = None + + if pytype is None and not ignore_pytype: + # check that old pytype value is valid + old_pytypename = cetree.attributeValueFromNsName( + c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + if old_pytypename is not None: + if old_pytypename == TREE_PYTYPE_NAME: + if not cetree.hasChild(c_node): + # only case where we should keep it, + # everything else is clear enough + pytype = TREE_PYTYPE + else: + if old_pytypename == u'none': + # transition from lxml 1.x + old_pytypename = u"NoneType" + dict_result = python.PyDict_GetItem( + _PYTYPE_DICT, old_pytypename) + if dict_result is not NULL: + pytype = dict_result + if pytype is not StrType: + # StrType does not have a typecheck but is the + # default anyway, so just accept it if given as + # type information + pytype = _check_type(c_node, pytype) + + if pytype is None: + # try to guess type + if not cetree.hasChild(c_node): + # element has no children => data class + pytype = _guessPyType(textOf(c_node), StrType) + else: + istree = 1 + + if pytype is None: + # use default type for empty elements + if cetree.hasText(c_node): + pytype = StrType + else: + pytype = empty_pytype + if typename is None: + typename = empty_type_name + + if pytype is not None: + if typename is None: + if not istree: + if python.PyList_GET_SIZE(pytype._schema_types) > 0: + # pytype->xsi:type is a 1:n mapping + # simply take the first + typename = pytype._schema_types[0] + elif typename not in pytype._schema_types: + typename = pytype._schema_types[0] + + if annotate_xsi: + if typename is None or istree: + cetree.delAttributeFromNsName( + c_node, _XML_SCHEMA_INSTANCE_NS, "type") + else: + # update or create attribute + typename_utf8 = cetree.utf8(typename) + c_ns = cetree.findOrBuildNodeNsPrefix( + doc, c_node, _XML_SCHEMA_NS, 'xsd') + if c_ns is not NULL: + if ':' in typename_utf8: + prefix, name = typename_utf8.split(':', 1) + if c_ns.prefix is NULL or c_ns.prefix[0] == c'\0': + typename_utf8 = name + elif cstd.strcmp(_cstr(prefix), c_ns.prefix) != 0: + prefix = c_ns.prefix + typename_utf8 = prefix + ':' + name + elif c_ns.prefix is not NULL or c_ns.prefix[0] != c'\0': + prefix = c_ns.prefix + typename_utf8 = prefix + ':' + typename_utf8 + c_ns = cetree.findOrBuildNodeNsPrefix( + doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + tree.xmlSetNsProp(c_node, c_ns, "type", _cstr(typename_utf8)) + + if annotate_pytype: + if pytype is None: + # delete attribute if it exists + cetree.delAttributeFromNsName( + c_node, _PYTYPE_NAMESPACE, _PYTYPE_ATTRIBUTE_NAME) + else: + # update or create attribute + c_ns = cetree.findOrBuildNodeNsPrefix( + doc, c_node, _PYTYPE_NAMESPACE, 'py') + pytype_name = cetree.utf8(pytype.name) + tree.xmlSetNsProp(c_node, c_ns, _PYTYPE_ATTRIBUTE_NAME, + _cstr(pytype_name)) + if pytype is NoneType: + c_ns = cetree.findOrBuildNodeNsPrefix( + doc, c_node, _XML_SCHEMA_INSTANCE_NS, 'xsi') + tree.xmlSetNsProp(c_node, c_ns, "nil", "true") + tree.END_FOR_EACH_ELEMENT_FROM(c_node) + +cdef object _strip_attributes = etree.strip_attributes + +def deannotate(element_or_tree, *, pytype=True, xsi=True, xsi_nil=False): + u"""deannotate(element_or_tree, pytype=True, xsi=True, xsi_nil=False) + + Recursively de-annotate the elements of an XML tree by removing 'py:pytype' + and/or 'xsi:type' attributes and/or 'xsi:nil' attributes. + + If the 'pytype' keyword argument is True (the default), 'py:pytype' + attributes will be removed. If the 'xsi' keyword argument is True (the + default), 'xsi:type' attributes will be removed. + If the 'xsi_nil' keyword argument is True (default: False), 'xsi:nil' + attributes will be removed. + + Note that this does not touch the namespace declarations. If you + want to remove unused namespace declarations from the tree, use + ``lxml.etree.cleanup_namespaces()``. + """ + cdef list attribute_names = [] + + if pytype: + attribute_names.append(PYTYPE_ATTRIBUTE) + if xsi: + attribute_names.append(XML_SCHEMA_INSTANCE_TYPE_ATTR) + if xsi_nil: + attribute_names.append(XML_SCHEMA_INSTANCE_NIL_ATTR) + + _strip_attributes(element_or_tree, *attribute_names) + +################################################################################ +# Module level parser setup + +cdef object __DEFAULT_PARSER +__DEFAULT_PARSER = etree.XMLParser(remove_blank_text=True) +__DEFAULT_PARSER.set_element_class_lookup( ObjectifyElementClassLookup() ) + +cdef object objectify_parser +objectify_parser = __DEFAULT_PARSER + +def set_default_parser(new_parser = None): + u"""set_default_parser(new_parser = None) + + Replace the default parser used by objectify's Element() and + fromstring() functions. + + The new parser must be an etree.XMLParser. + + Call without arguments to reset to the original parser. + """ + global objectify_parser + if new_parser is None: + objectify_parser = __DEFAULT_PARSER + elif isinstance(new_parser, etree.XMLParser): + objectify_parser = new_parser + else: + raise TypeError, u"parser must inherit from lxml.etree.XMLParser" + +def makeparser(**kw): + u"""makeparser(remove_blank_text=True, **kw) + + Create a new XML parser for objectify trees. + + You can pass all keyword arguments that are supported by + ``etree.XMLParser()``. Note that this parser defaults to removing + blank text. You can disable this by passing the + ``remove_blank_text`` boolean keyword option yourself. + """ + if python.IS_PYTHON3: + remove_blank_text = u'remove_blank_text' + else: + remove_blank_text = 'remove_blank_text' + if remove_blank_text not in kw: + kw[remove_blank_text] = True + parser = etree.XMLParser(**kw) + parser.set_element_class_lookup( ObjectifyElementClassLookup() ) + return parser + +cdef _Element _makeElement(tag, text, attrib, nsmap): + return cetree.makeElement(tag, None, objectify_parser, text, None, attrib, nsmap) + +################################################################################ +# Module level factory functions + +cdef object _fromstring +_fromstring = etree.fromstring + +def fromstring(xml, parser=None, *, base_url=None): + u"""fromstring(xml, parser=None, base_url=None) + + Objectify specific version of the lxml.etree fromstring() function + that uses the objectify parser. + + You can pass a different parser as second argument. + + The ``base_url`` keyword argument allows to set the original base URL of + the document to support relative Paths when looking up external entities + (DTD, XInclude, ...). + """ + if parser is None: + parser = objectify_parser + return _fromstring(xml, parser, base_url=base_url) + +def XML(xml, parser=None, *, base_url=None): + u"""XML(xml, parser=None, base_url=None) + + Objectify specific version of the lxml.etree XML() literal factory + that uses the objectify parser. + + You can pass a different parser as second argument. + + The ``base_url`` keyword argument allows to set the original base URL of + the document to support relative Paths when looking up external entities + (DTD, XInclude, ...). + """ + if parser is None: + parser = objectify_parser + return _fromstring(xml, parser, base_url=base_url) + +cdef object _parse +_parse = etree.parse + +def parse(f, parser=None, *, base_url=None): + u"""parse(f, parser=None, base_url=None) + + Parse a file or file-like object with the objectify parser. + + You can pass a different parser as second argument. + + The ``base_url`` keyword allows setting a URL for the document + when parsing from a file-like object. This is needed when looking + up external entities (DTD, XInclude, ...) with relative paths. + """ + if parser is None: + parser = objectify_parser + return _parse(f, parser, base_url=base_url) + +cdef dict _DEFAULT_NSMAP +_DEFAULT_NSMAP = { u"py" : PYTYPE_NAMESPACE, + u"xsi" : XML_SCHEMA_INSTANCE_NS, + u"xsd" : XML_SCHEMA_NS} + +E = ElementMaker() + +def Element(_tag, attrib=None, nsmap=None, *, _pytype=None, **_attributes): + u"""Element(_tag, attrib=None, nsmap=None, _pytype=None, **_attributes) + + Objectify specific version of the lxml.etree Element() factory that + always creates a structural (tree) element. + + NOTE: requires parser based element class lookup activated in lxml.etree! + """ + if attrib is not None: + if python.PyDict_Size(_attributes): + attrib.update(_attributes) + _attributes = attrib + if _pytype is None: + _pytype = TREE_PYTYPE_NAME + if nsmap is None: + nsmap = _DEFAULT_NSMAP + _attributes[PYTYPE_ATTRIBUTE] = _pytype + return _makeElement(_tag, None, _attributes, nsmap) + +def DataElement(_value, attrib=None, nsmap=None, *, _pytype=None, _xsi=None, + **_attributes): + u"""DataElement(_value, attrib=None, nsmap=None, _pytype=None, _xsi=None, **_attributes) + + Create a new element from a Python value and XML attributes taken from + keyword arguments or a dictionary passed as second argument. + + Automatically adds a 'pytype' attribute for the Python type of the value, + if the type can be identified. If '_pytype' or '_xsi' are among the + keyword arguments, they will be used instead. + + If the _value argument is an ObjectifiedDataElement instance, its py:pytype, + xsi:type and other attributes and nsmap are reused unless they are redefined + in attrib and/or keyword arguments. + """ + cdef python.PyObject* dict_result + if nsmap is None: + nsmap = _DEFAULT_NSMAP + if attrib is not None and attrib: + if python.PyDict_Size(_attributes): + attrib = dict(attrib) + attrib.update(_attributes) + _attributes = attrib + if isinstance(_value, ObjectifiedElement): + if _pytype is None: + if _xsi is None and not _attributes and nsmap is _DEFAULT_NSMAP: + # special case: no change! + return _value.__copy__() + if isinstance(_value, ObjectifiedDataElement): + # reuse existing nsmap unless redefined in nsmap parameter + temp = _value.nsmap + if temp is not None and temp: + temp = dict(temp) + temp.update(nsmap) + nsmap = temp + # reuse existing attributes unless redefined in attrib/_attributes + temp = _value.attrib + if temp is not None and temp: + temp = dict(temp) + temp.update(_attributes) + _attributes = temp + # reuse existing xsi:type or py:pytype attributes, unless provided as + # arguments + if _xsi is None and _pytype is None: + dict_result = python.PyDict_GetItem(_attributes, + XML_SCHEMA_INSTANCE_TYPE_ATTR) + if dict_result is not NULL: + _xsi = dict_result + dict_result = python.PyDict_GetItem(_attributes, PYTYPE_ATTRIBUTE) + if dict_result is not NULL: + _pytype = dict_result + + if _xsi is not None: + if u':' in _xsi: + prefix, name = _xsi.split(u':', 1) + ns = nsmap.get(prefix) + if ns != XML_SCHEMA_NS: + raise ValueError, u"XSD types require the XSD namespace" + elif nsmap is _DEFAULT_NSMAP: + name = _xsi + _xsi = u'xsd:' + _xsi + else: + name = _xsi + for prefix, ns in nsmap.items(): + if ns == XML_SCHEMA_NS: + if prefix is not None and prefix: + _xsi = prefix + u':' + _xsi + break + else: + raise ValueError, u"XSD types require the XSD namespace" + _attributes[XML_SCHEMA_INSTANCE_TYPE_ATTR] = _xsi + if _pytype is None: + # allow using unregistered or even wrong xsi:type names + dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, _xsi) + if dict_result is NULL: + dict_result = python.PyDict_GetItem(_SCHEMA_TYPE_DICT, name) + if dict_result is not NULL: + _pytype = (dict_result).name + + if _value is None and _pytype != u"str": + _pytype = _pytype or u"NoneType" + strval = None + elif python._isString(_value): + strval = _value + elif python.PyBool_Check(_value): + if _value: + strval = u"true" + else: + strval = u"false" + else: + strval = unicode(_value) + + if _pytype is None: + _pytype = _pytypename(_value) + + if _pytype is not None: + if _pytype == u"NoneType" or _pytype == u"none": + strval = None + _attributes[XML_SCHEMA_INSTANCE_NIL_ATTR] = u"true" + else: + # check if type information from arguments is valid + dict_result = python.PyDict_GetItem(_PYTYPE_DICT, _pytype) + if dict_result is not NULL: + type_check = (dict_result).type_check + if type_check is not None: + type_check(strval) + + _attributes[PYTYPE_ATTRIBUTE] = _pytype + + return _makeElement(u"value", strval, _attributes, nsmap) + + +################################################################################ +# ObjectPath + +include "objectpath.pxi" diff --git a/src/lxml/nsclasses.pxi b/src/lxml/nsclasses.pxi new file mode 100644 index 0000000..f9d450e --- /dev/null +++ b/src/lxml/nsclasses.pxi @@ -0,0 +1,244 @@ +# module-level API for namespace implementations + +class LxmlRegistryError(LxmlError): + u"""Base class of lxml registry errors. + """ + pass + +class NamespaceRegistryError(LxmlRegistryError): + u"""Error registering a namespace extension. + """ + pass + + +cdef class _NamespaceRegistry: + u"Dictionary-like namespace registry" + cdef object _ns_uri + cdef object _ns_uri_utf + cdef dict _entries + cdef char* _c_ns_uri_utf + def __init__(self, ns_uri): + self._ns_uri = ns_uri + if ns_uri is None: + self._ns_uri_utf = None + 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 = {} + + def update(self, class_dict_iterable): + u"""update(self, class_dict_iterable) + + Forgivingly update the registry. + + If registered values do not match the required type for this + registry, or if their name starts with '_', they will be + 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: + if (name is None or name[:1] != u'_') and callable(item): + self[name] = item + + def __getitem__(self, name): + if name is not None: + name = _utf8(name) + return self._get(name) + + def __delitem__(self, name): + if name is not None: + name = _utf8(name) + del self._entries[name] + + 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." + return dict_result + + 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." + return dict_result + + def __iter__(self): + return iter(self._entries) + + def items(self): + return list(self._entries.items()) + + def iteritems(self): + return iter(self._entries.items()) + + def clear(self): + python.PyDict_Clear(self._entries) + +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, \ + u"Registered element classes must be subtypes of ElementBase" + if name is not None: + name = _utf8(name) + self._entries[name] = item + + def __repr__(self): + return u"Namespace(%r)" % self._ns_uri + + +cdef class ElementNamespaceClassLookup(FallbackElementClassLookup): + u"""ElementNamespaceClassLookup(self, fallback=None) + + Element class lookup scheme that searches the Element class in the + Namespace registry. + """ + cdef object _namespace_registries + def __init__(self, ElementClassLookup fallback=None): + self._namespace_registries = {} + FallbackElementClassLookup.__init__(self, fallback) + self._lookup_function = _find_nselement_class + + def get_namespace(self, ns_uri): + u"""get_namespace(self, ns_uri) + + Retrieve the namespace object associated with the given URI. + + Creates a new one if it does not yet exist.""" + if ns_uri: + ns_utf = _utf8(ns_uri) + else: + ns_utf = None + try: + return self._namespace_registries[ns_utf] + except KeyError: + registry = self._namespace_registries[ns_utf] = \ + _ClassNamespaceRegistry(ns_uri) + return registry + +cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node): + cdef python.PyObject* dict_result + cdef ElementNamespaceClassLookup lookup + cdef _NamespaceRegistry registry + cdef char* c_namespace_utf + if state is None: + return _lookupDefaultElementClass(None, doc, c_node) + + lookup = state + if c_node.type != tree.XML_ELEMENT_NODE: + return _callLookupFallback(lookup, doc, c_node) + + c_namespace_utf = _getNs(c_node) + if c_namespace_utf is not NULL: + dict_result = python.PyDict_GetItem( + lookup._namespace_registries, c_namespace_utf) + else: + dict_result = python.PyDict_GetItem( + lookup._namespace_registries, None) + if dict_result is not NULL: + registry = <_NamespaceRegistry>dict_result + classes = registry._entries + + if c_node.name is not NULL: + dict_result = python.PyDict_GetItem( + classes, c_node.name) + else: + dict_result = NULL + + if dict_result is NULL: + dict_result = python.PyDict_GetItem(classes, None) + + if dict_result is not NULL: + return dict_result + return _callLookupFallback(lookup, doc, c_node) + + +################################################################################ +# XPath extension functions + +cdef dict __FUNCTION_NAMESPACE_REGISTRIES +__FUNCTION_NAMESPACE_REGISTRIES = {} + +def FunctionNamespace(ns_uri): + u"""FunctionNamespace(ns_uri) + + Retrieve the function namespace object associated with the given + URI. + + 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: + ns_utf = None + try: + return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] + except KeyError: + registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \ + _XPathFunctionNamespaceRegistry(ns_uri) + return registry + +cdef class _FunctionNamespaceRegistry(_NamespaceRegistry): + def __setitem__(self, name, item): + if not callable(item): + raise NamespaceRegistryError, \ + u"Registered functions must be callable." + if not name: + raise ValueError, \ + u"extensions must have non empty names" + self._entries[_utf8(name)] = item + + def __repr__(self): + return u"FunctionNamespace(%r)" % self._ns_uri + +cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry): + cdef object _prefix + cdef object _prefix_utf + + property prefix: + u"Namespace prefix for extension functions." + def __del__(self): + self._prefix = None # no prefix configured + self._prefix_utf = None + def __get__(self): + if self._prefix is None: + return '' + else: + return self._prefix + def __set__(self, prefix): + if prefix == '': + prefix = None # empty prefix + if prefix is None: + self._prefix_utf = None + else: + self._prefix_utf = _utf8(prefix) + self._prefix = prefix + +cdef list _find_all_extension_prefixes(): + 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: + if registry._ns_uri_utf is not None: + ns_prefixes.append( + (registry._prefix_utf, registry._ns_uri_utf)) + return ns_prefixes + +cdef object _find_extension(ns_uri_utf, name_utf): + cdef python.PyObject* dict_result + dict_result = python.PyDict_GetItem( + __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) + if dict_result is NULL: + return None + else: + return dict_result diff --git a/src/lxml/objectpath.pxi b/src/lxml/objectpath.pxi new file mode 100644 index 0000000..ee85b0d --- /dev/null +++ b/src/lxml/objectpath.pxi @@ -0,0 +1,357 @@ +################################################################################ +# ObjectPath + +ctypedef struct _ObjectPath: + char* href + char* name + Py_ssize_t index + + +cdef class ObjectPath: + u"""ObjectPath(path) + Immutable object that represents a compiled object path. + + Example for a path: 'root.child[1].{other}child[25]' + """ + cdef readonly object find + cdef object _path + cdef object _path_str + cdef _ObjectPath* _c_path + cdef Py_ssize_t _path_len + def __init__(self, path): + if python._isString(path): + self._path = _parseObjectPathString(path) + self._path_str = path + else: + self._path = _parseObjectPathList(path) + self._path_str = u'.'.join(path) + self._path_len = python.PyList_GET_SIZE(self._path) + self._c_path = _buildObjectPathSegments(self._path) + self.find = self.__call__ + + def __dealloc__(self): + if self._c_path is not NULL: + python.PyMem_Free(self._c_path) + + def __str__(self): + return self._path_str + + def __call__(self, _Element root not None, *default): + u"""Follow the attribute path in the object structure and return the + target attribute value. + + If it it not found, either returns a default value (if one was passed + as second argument) or raises AttributeError. + """ + cdef Py_ssize_t use_default + use_default = python.PyTuple_GET_SIZE(default) + if use_default == 1: + default = python.PyTuple_GET_ITEM(default, 0) + python.Py_INCREF(default) + use_default = 1 + elif use_default > 1: + raise TypeError, u"invalid number of arguments: needs one or two" + return _findObjectPath(root, self._c_path, self._path_len, + default, use_default) + + def hasattr(self, _Element root not None): + u"hasattr(self, root)" + try: + _findObjectPath(root, self._c_path, self._path_len, None, 0) + except AttributeError: + return False + return True + + def setattr(self, _Element root not None, value): + u"""setattr(self, root, value) + + Set the value of the target element in a subtree. + + If any of the children on the path does not exist, it is created. + """ + _createObjectPath(root, self._c_path, self._path_len, 1, value) + + def addattr(self, _Element root not None, value): + u"""addattr(self, root, value) + + Append a value to the target element in a subtree. + + If any of the children on the path does not exist, it is created. + """ + _createObjectPath(root, self._c_path, self._path_len, 0, value) + +cdef object __MATCH_PATH_SEGMENT +__MATCH_PATH_SEGMENT = re.compile( + ur"(\.?)\s*(?:\{([^}]*)\})?\s*([^.{}\[\]\s]+)\s*(?:\[\s*([-0-9]+)\s*\])?", + re.U).match + +cdef object _RELATIVE_PATH_SEGMENT +_RELATIVE_PATH_SEGMENT = (None, None, 0) + +cdef _parseObjectPathString(path): + u"""Parse object path string into a (ns, name, index) list. + """ + cdef bint has_dot + cdef list new_path = [] + if python.PyString_Check(path): + path = python.PyUnicode_FromEncodedObject(path, 'ASCII', NULL) + path = path.strip() + if path == u'.': + return [_RELATIVE_PATH_SEGMENT] + path_pos = 0 + while python.PyUnicode_GET_SIZE(path) > 0: + match = __MATCH_PATH_SEGMENT(path, path_pos) + if match is None: + break + + dot, ns, name, index = match.groups() + if index is None or not index: + index = 0 + else: + index = int(index) + has_dot = dot == u'.' + if python.PyList_GET_SIZE(new_path) == 0: + if has_dot: + # path '.child' => ignore root + new_path.append(_RELATIVE_PATH_SEGMENT) + elif index != 0: + raise ValueError, u"index not allowed on root node" + elif not has_dot: + raise ValueError, u"invalid path" + if ns is not None: + ns = python.PyUnicode_AsUTF8String(ns) + name = python.PyUnicode_AsUTF8String(name) + new_path.append( (ns, name, index) ) + + path_pos = match.end() + if python.PyList_GET_SIZE(new_path) == 0 or \ + python.PyUnicode_GET_SIZE(path) > path_pos: + raise ValueError, u"invalid path" + return new_path + +cdef _parseObjectPathList(path): + u"""Parse object path sequence into a (ns, name, index) list. + """ + cdef char* index_pos + cdef char* index_end + cdef char* c_name + cdef list new_path = [] + for item in path: + item = item.strip() + if python.PyList_GET_SIZE(new_path) == 0 and item == u'': + # path '.child' => ignore root + ns = name = None + index = 0 + else: + ns, name = cetree.getNsTag(item) + c_name = _cstr(name) + index_pos = cstd.strchr(c_name, c'[') + if index_pos is NULL: + index = 0 + else: + index_end = cstd.strchr(index_pos + 1, c']') + if index_end is NULL: + raise ValueError, u"index must be enclosed in []" + index = int( + python.PyString_FromStringAndSize( + index_pos + 1, (index_end - index_pos - 1))) + if python.PyList_GET_SIZE(new_path) == 0 and index != 0: + raise ValueError, u"index not allowed on root node" + name = python.PyString_FromStringAndSize( + c_name, (index_pos - c_name)) + new_path.append( (ns, name, index) ) + if python.PyList_GET_SIZE(new_path) == 0: + raise ValueError, u"invalid path" + return new_path + +cdef _ObjectPath* _buildObjectPathSegments(path_list) except NULL: + cdef _ObjectPath* c_path + cdef _ObjectPath* c_path_segments + c_path_segments = <_ObjectPath*>python.PyMem_Malloc( + sizeof(_ObjectPath) * python.PyList_GET_SIZE(path_list)) + if c_path_segments is NULL: + python.PyErr_NoMemory() + c_path = c_path_segments + for href, name, index in path_list: + if href is None: + c_path[0].href = NULL + else: + c_path[0].href = _cstr(href) + if name is None: + c_path[0].name = NULL + else: + c_path[0].name = _cstr(name) + c_path[0].index = index + c_path = c_path + 1 + return c_path_segments + +cdef _findObjectPath(_Element root, _ObjectPath* c_path, Py_ssize_t c_path_len, + default_value, int use_default): + u"""Follow the path to find the target element. + """ + cdef tree.xmlNode* c_node + cdef char* c_href + cdef char* c_name + cdef Py_ssize_t c_index + c_node = root._c_node + c_name = c_path[0].name + c_href = c_path[0].href + if c_href is NULL or c_href[0] == c'\0': + c_href = tree._getNs(c_node) + if not cetree.tagMatches(c_node, c_href, c_name): + if use_default: + return default_value + else: + raise ValueError, \ + u"root element does not match: need %s, got %s" % \ + (cetree.namespacedNameFromNsName(c_href, c_name), root.tag) + + while c_node is not NULL: + c_path_len = c_path_len - 1 + if c_path_len <= 0: + break + + c_path = c_path + 1 + if c_path[0].href is not NULL: + c_href = c_path[0].href # otherwise: keep parent namespace + c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + if c_name is NULL: + c_name = c_path[0].name + c_node = NULL + break + c_index = c_path[0].index + + if c_index < 0: + c_node = c_node.last + else: + c_node = c_node.children + c_node = _findFollowingSibling(c_node, c_href, c_name, c_index) + + if c_node is not NULL: + return cetree.elementFactory(root._doc, c_node) + elif use_default: + return default_value + else: + tag = cetree.namespacedNameFromNsName(c_href, c_name) + raise AttributeError, u"no such child: " + tag + +cdef _createObjectPath(_Element root, _ObjectPath* c_path, + Py_ssize_t c_path_len, int replace, value): + u"""Follow the path to find the target element, build the missing children + as needed and set the target element to 'value'. If replace is true, an + existing value is replaced, otherwise the new value is added. + """ + cdef _Element child + cdef tree.xmlNode* c_node + cdef tree.xmlNode* c_child + cdef char* c_href + cdef char* c_name + cdef Py_ssize_t c_index + if c_path_len == 1: + raise TypeError, u"cannot update root node" + + c_node = root._c_node + c_name = c_path[0].name + c_href = c_path[0].href + if c_href is NULL or c_href[0] == c'\0': + c_href = tree._getNs(c_node) + if not cetree.tagMatches(c_node, c_href, c_name): + raise ValueError, \ + u"root element does not match: need %s, got %s" % \ + (cetree.namespacedNameFromNsName(c_href, c_name), root.tag) + + while c_path_len > 1: + c_path_len = c_path_len - 1 + c_path = c_path + 1 + if c_path[0].href is not NULL: + c_href = c_path[0].href # otherwise: keep parent namespace + c_index = c_path[0].index + c_name = tree.xmlDictExists(c_node.doc.dict, c_path[0].name, -1) + if c_name is NULL: + c_name = c_path[0].name + c_child = NULL + else: + if c_index < 0: + c_child = c_node.last + else: + c_child = c_node.children + c_child = _findFollowingSibling(c_child, c_href, c_name, c_index) + + if c_child is not NULL: + c_node = c_child + elif c_index != 0: + raise TypeError, \ + u"creating indexed path attributes is not supported" + elif c_path_len == 1: + _appendValue(cetree.elementFactory(root._doc, c_node), + cetree.namespacedNameFromNsName(c_href, c_name), + value) + return + else: + child = cetree.makeSubElement( + cetree.elementFactory(root._doc, c_node), + cetree.namespacedNameFromNsName(c_href, c_name), + None, None, None, None) + c_node = child._c_node + + # if we get here, the entire path was already there + if replace: + element = cetree.elementFactory(root._doc, c_node) + _replaceElement(element, value) + else: + _appendValue(cetree.elementFactory(root._doc, c_node.parent), + cetree.namespacedName(c_node), value) + +cdef list _buildDescendantPaths(tree.xmlNode* c_node, prefix_string): + u"""Returns a list of all descendant paths. + """ + cdef list path, path_list + tag = cetree.namespacedName(c_node) + if prefix_string: + if prefix_string[-1] != u'.': + prefix_string = prefix_string + u'.' + prefix_string = prefix_string + tag + else: + prefix_string = tag + path = [prefix_string] + path_list = [] + _recursiveBuildDescendantPaths(c_node, path, path_list) + return path_list + +cdef int _recursiveBuildDescendantPaths(tree.xmlNode* c_node, + list path, list path_list) except -1: + u"""Fills the list 'path_list' with all descendant paths, initial prefix + being in the list 'path'. + """ + cdef python.PyObject* dict_result + cdef tree.xmlNode* c_child + cdef char* c_href + cdef dict tags = {} + path_list.append( u'.'.join(path) ) + c_href = tree._getNs(c_node) + c_child = c_node.children + while c_child is not NULL: + while c_child.type != tree.XML_ELEMENT_NODE: + c_child = c_child.next + if c_child is NULL: + return 0 + if c_href is tree._getNs(c_child): + tag = pyunicode(c_child.name) + elif c_href is not NULL and tree._getNs(c_child) is NULL: + # special case: parent has namespace, child does not + tag = u'{}' + pyunicode(c_child.name) + else: + tag = cetree.namespacedName(c_child) + dict_result = python.PyDict_GetItem(tags, tag) + if dict_result is NULL: + count = 0 + else: + count = (dict_result) + 1 + tags[tag] = count + if count > 0: + tag += u'[%d]' % count + path.append(tag) + _recursiveBuildDescendantPaths(c_child, path, path_list) + del path[-1] + c_child = c_child.next + return 0 diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi new file mode 100644 index 0000000..f19e0bc --- /dev/null +++ b/src/lxml/parser.pxi @@ -0,0 +1,1553 @@ +# Parsers for XML and HTML + +cimport xmlparser +cimport htmlparser + +cdef class _ParserContext(_ResolverContext) +cdef class _SaxParserContext(_ParserContext) +cdef class _TargetParserContext(_SaxParserContext) +cdef class _ParserSchemaValidationContext +cdef class _Validator +cdef class XMLSchema(_Validator) + +class ParseError(LxmlSyntaxError): + u"""Syntax error while parsing an XML document. + + For compatibility with ElementTree 1.3 and later. + """ + pass + +class XMLSyntaxError(ParseError): + u"""Syntax error while parsing an XML document. + """ + def __init__(self, message, code, line, column): + if python.PY_VERSION_HEX >= 0x02050000: + # Python >= 2.5 uses new style class exceptions + super(_XMLSyntaxError, self).__init__(message) + else: + ParseError.__init__(self, message) + self.position = (line, column) + self.code = code + +cdef object _XMLSyntaxError +_XMLSyntaxError = XMLSyntaxError + +class ParserError(LxmlError): + u"""Internal lxml parser error. + """ + pass + +cdef class _ParserDictionaryContext: + # Global parser context to share the string dictionary. + # + # This class is a delegate singleton! + # + # It creates _ParserDictionaryContext objects for each thread to keep thread state, + # but those must never be used directly. Always stick to using the static + # __GLOBAL_PARSER_CONTEXT as defined below the class. + # + + cdef tree.xmlDict* _c_dict + cdef _BaseParser _default_parser + cdef list _implied_parser_contexts + + def __init__(self): + self._implied_parser_contexts = [] + + def __dealloc__(self): + if self._c_dict is not NULL: + 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.""" + cdef python.PyObject* thread_dict + cdef python.PyObject* result + thread_dict = python.PyThreadState_GetDict() + if thread_dict is not NULL: + (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 + cdef python.PyObject* result + cdef _ParserDictionaryContext context + thread_dict = python.PyThreadState_GetDict() + if thread_dict is NULL: + return self + d = thread_dict + result = python.PyDict_GetItem(d, u"_ParserDictionaryContext") + if result is not NULL: + return result + context = _ParserDictionaryContext() + d[u"_ParserDictionaryContext"] = context + return context + + cdef void setDefaultParser(self, _BaseParser parser): + u"Set the default parser for the current thread" + cdef _ParserDictionaryContext context + context = self._findThreadParserContext() + context._default_parser = parser + + cdef _BaseParser getDefaultParser(self): + 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: + self._default_parser = __DEFAULT_XML_PARSER._copy() + if context is not self: + context._default_parser = self._default_parser._copy() + 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 + 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: + context._c_dict = default + xmlparser.xmlDictReference(default) + 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) + return context._c_dict + + cdef void initThreadDictRef(self, tree.xmlDict** c_dict_ref): + 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: + return + if c_dict is not NULL: + xmlparser.xmlDictFree(c_dict) + c_dict_ref[0] = c_thread_dict + 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) + + 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): + 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. + # 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): + u"""Return any current implied xml parser context for the current + thread. This is used when the resolver functions are called + with an xmlParserCtxt that was generated from within libxml2 + (i.e. without a _ParserContext) - which happens when parsing + schema and xinclude external references.""" + cdef _ParserDictionaryContext context + cdef _ParserContext implied_context + + # 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 + return None + + 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: + self.pushImpliedContext(None) + + cdef void pushImpliedContext(self, _ParserContext parser_context): + u"Push a new implied context object." + cdef _ParserDictionaryContext context + context = self._findThreadParserContext() + context._implied_parser_contexts.append(parser_context) + + cdef void popImpliedContext(self): + u"Pop the current implied context object." + cdef _ParserDictionaryContext context + context = self._findThreadParserContext() + context._implied_parser_contexts.pop() + +cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT +__GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext() +__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. + """ + #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 + +############################################################ +## support for Python unicode I/O +############################################################ + +# name of Python unicode encoding as known to libxml2 +cdef char* _UNICODE_ENCODING +_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 + on iconv and the local Python installation, so we simply check if we find + a matching encoding handler. + """ + cdef tree.xmlCharEncodingHandler* enchandler + cdef Py_ssize_t l + cdef char* buffer + cdef char* enc + utext = python.PyUnicode_DecodeUTF8("", 7, NULL) + 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 + 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 \ + 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 :) + return + enchandler = tree.xmlFindCharEncodingHandler(enc) + if enchandler is not NULL: + global _UNICODE_ENCODING + tree.xmlCharEncCloseFunc(enchandler) + _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 + 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" + 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: + return NULL + else: + return tree.xmlGetCharEncodingName(enc) + +_setupPythonUnicode() + +############################################################ +## support for file-like objects +############################################################ + +cdef class _FileReaderContext: + cdef object _filelike + cdef object _encoding + cdef object _url + cdef object _bytes + cdef _ExceptionContext _exc_context + cdef Py_ssize_t _bytes_read + cdef char* _c_url + def __init__(self, filelike, exc_context, url, encoding): + self._exc_context = exc_context + self._filelike = filelike + self._encoding = encoding + if url is None: + self._c_url = NULL + else: + url = _encodeFilename(url) + self._c_url = _cstr(url) + self._url = url + self._bytes = '' + self._bytes_read = 0 + + cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self): + 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: + c_buffer.readcallback = _readFilelikeParser + c_buffer.context = self + else: + c_buffer.readcallback = _readFileParser + c_buffer.context = c_stream + return c_buffer + + cdef xmlparser.xmlParserInput* _createParserInput( + self, xmlparser.xmlParserCtxt* ctxt): + cdef xmlparser.xmlParserInputBuffer* c_buffer + c_buffer = self._createParserInputBuffer() + return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0) + + cdef tree.xmlDtd* _readDtd(self): + cdef xmlparser.xmlParserInputBuffer* c_buffer + c_buffer = self._createParserInputBuffer() + with nogil: + return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0) + + cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options): + cdef xmlDoc* result + cdef char* c_encoding + cdef cstd.FILE* c_stream + cdef xmlparser.xmlInputReadCallback c_read_callback + cdef xmlparser.xmlInputCloseCallback c_close_callback + cdef void* c_callback_context + + if self._encoding is None: + c_encoding = NULL + else: + c_encoding = _cstr(self._encoding) + + c_stream = python.PyFile_AsFile(self._filelike) + if c_stream is NULL: + c_read_callback = _readFilelikeParser + c_callback_context = self + else: + c_read_callback = _readFileParser + c_callback_context = c_stream + + with nogil: + if ctxt.html: + 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: + tree.xmlFreeDoc(result) + result = NULL + else: + result = xmlparser.xmlCtxtReadIO( + ctxt, c_read_callback, NULL, c_callback_context, + self._c_url, c_encoding, options) + + return result + + cdef int copyToBuffer(self, char* c_buffer, int c_requested): + cdef int c_byte_count + cdef char* c_start + cdef Py_ssize_t byte_count, remaining + if self._bytes_read < 0: + return 0 + try: + c_byte_count = 0 + byte_count = python.PyString_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) + c_byte_count += remaining + c_buffer += remaining + c_requested -= remaining + + self._bytes = self._filelike.read(c_requested) + if not python.PyString_Check(self._bytes): + if python.PyUnicode_Check(self._bytes): + if self._encoding is None: + self._bytes = python.PyUnicode_AsUTF8String(self._bytes) + else: + self._bytes = python.PyUnicode_AsEncodedString( + self._bytes, _cstr(self._encoding), NULL) + else: + raise TypeError, \ + u"reading from file-like objects must return byte strings or unicode strings" + + remaining = python.PyString_GET_SIZE(self._bytes) + if remaining == 0: + self._bytes_read = -1 + return c_byte_count + self._bytes_read = 0 + + 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 + return c_byte_count + except: + self._exc_context._store_raised() + return -1 + +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: + return cstd.fread(c_buffer, 1, c_size, ctxt) + +############################################################ +## support for custom document loaders +############################################################ + +cdef xmlparser.xmlParserInput* _local_resolver(char* c_url, char* c_pubid, + xmlparser.xmlParserCtxt* c_context) with gil: + cdef _ResolverContext context + cdef xmlparser.xmlParserInput* c_input + cdef _InputDocument doc_ref + cdef _FileReaderContext file_context + # if there is no _ParserContext associated with the xmlParserCtxt + # 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: + context = __GLOBAL_PARSER_CONTEXT.findImpliedContext() + + if context is None: + if __DEFAULT_ENTITY_LOADER is NULL: + return NULL + return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context) + + try: + if c_url is NULL: + url = None + else: + # parsing a related document (DTD etc.) => UTF-8 encoded URL? + url = _decodeFilename(c_url) + if c_pubid is NULL: + pubid = None + else: + pubid = funicode(c_pubid) # always UTF-8 + + doc_ref = context._resolvers.resolve(url, pubid, context) + except: + context._store_raised() + return NULL + + 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: + c_input.base = _cstr(data) + c_input.length = python.PyString_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( + 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 + else: + data = None + c_input = NULL + + if data is not None: + context._storage.add(data) + if c_input is not NULL: + return c_input + + if __DEFAULT_ENTITY_LOADER is NULL: + return NULL + return __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context) + +cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER +__DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader() + +xmlparser.xmlSetExternalEntityLoader(_local_resolver) + +############################################################ +## Parsers +############################################################ + +cdef class _ParserContext(_ResolverContext): + cdef _ErrorLog _error_log + cdef _ParserSchemaValidationContext _validator + cdef xmlparser.xmlParserCtxt* _c_ctxt + cdef python.PyThread_type_lock _lock + + def __dealloc__(self): + 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: + xmlparser.xmlFreeParserCtxt(self._c_ctxt) + + cdef _ParserContext _copy(self): + cdef _ParserContext context + context = self.__class__() + context._validator = self._validator.copy() + _initParserContext(context, self._resolvers._copy(), NULL) + return context + + cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt): + self._c_ctxt = c_ctxt + c_ctxt._private = self + + cdef void _resetParserContext(self): + if self._c_ctxt is not NULL: + if self._c_ctxt.html: + htmlparser.htmlCtxtReset(self._c_ctxt) + 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: + 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) + 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) + return 0 + + cdef int cleanup(self) except -1: + if self._validator is not None: + self._validator.disconnect() + self._resetParserContext() + self.clear() + self._error_log.disconnect() + if config.ENABLE_THREADING and self._lock is not NULL: + python.PyThread_release_lock(self._lock) + return 0 + + cdef object _handleParseResult(self, _BaseParser parser, + xmlDoc* result, filename): + 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) + return _documentFactory(c_doc, parser) + + cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser, + 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) + +cdef _initParserContext(_ParserContext context, + _ResolverRegistry resolvers, + xmlparser.xmlParserCtxt* c_ctxt): + _initResolverContext(context, resolvers) + if not config.ENABLE_THREADING: + context._lock = NULL + else: + context._lock = python.PyThread_allocate_lock() + if c_ctxt is not NULL: + context._initParserContext(c_ctxt) + context._error_log = _ErrorLog() + +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: + message = u"Error reading file '%s': %s" % ( + filename, (ctxt.lastError.message).strip()) + else: + message = u"Error reading '%s'" % filename + raise IOError, message + 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() + code = ctxt.lastError.code + 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) + else: + raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0) + +cdef xmlDoc* _handleParseResult(_ParserContext context, + xmlparser.xmlParserCtxt* c_ctxt, + xmlDoc* result, filename, + bint recover) except NULL: + cdef bint well_formed + if result is not NULL: + __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) + tree.xmlFreeDoc(c_ctxt.myDoc) + c_ctxt.myDoc = NULL + + 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 \ + 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 + 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 + else: + well_formed = 1 + else: + well_formed = 0 + + if not well_formed: + # free broken document + tree.xmlFreeDoc(result) + result = NULL + + if context is not None and context._has_raised(): + if result is not NULL: + tree.xmlFreeDoc(result) + result = NULL + context._raise_if_stored() + + if result is NULL: + if context is not None: + _raiseParseError(c_ctxt, filename, context._error_log) + else: + _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: + 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 + # support inserting default attributes during parse-time + # validation + context._validator.inject_default_attributes(result) + + return result + +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 + tree.BEGIN_FOR_EACH_ELEMENT_FROM(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) + return 0 + +cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict, + xmlNode* c_node) nogil: + 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 + if c_name is not c_node.name: + tree.xmlFree(c_node.name) + c_node.name = c_name + c_attr = 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 + 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 + +cdef class _BaseParser: + cdef ElementClassLookup _class_lookup + cdef _ResolverRegistry _resolvers + cdef _ParserContext _parser_context + cdef _ParserContext _push_parser_context + cdef int _parse_options + cdef bint _for_html + cdef bint _remove_comments + cdef bint _remove_pis + cdef bint _strip_cdata + cdef XMLSchema _schema + cdef object _filename + cdef object _target + cdef object _default_encoding + + def __init__(self, int parse_options, bint for_html, XMLSchema schema, + remove_comments, remove_pis, strip_cdata, target, + filename, encoding): + cdef tree.xmlCharEncodingHandler* enchandler + 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" + + self._parse_options = parse_options + self._filename = filename + self._target = target + self._for_html = for_html + self._remove_comments = remove_comments + self._remove_pis = remove_pis + self._strip_cdata = strip_cdata + self._schema = schema + + self._resolvers = _ResolverRegistry() + + if encoding is None: + self._default_encoding = None + else: + encoding = _utf8(encoding) + enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding)) + if enchandler is NULL: + raise LookupError, u"unknown encoding: '%s'" % encoding + tree.xmlCharEncCloseFunc(enchandler) + self._default_encoding = encoding + + 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: + self._parser_context._validator = \ + self._schema._newSaxValidator( + self._parse_options & xmlparser.XML_PARSE_DTDATTR) + pctxt = self._newParserCtxt() + if pctxt is NULL: + python.PyErr_NoMemory() + _initParserContext(self._parser_context, self._resolvers, pctxt) + if self._remove_comments: + 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 + pctxt.sax.cdataBlock = NULL + return self._parser_context + + 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: + self._push_parser_context._validator = \ + self._schema._newSaxValidator( + self._parse_options & xmlparser.XML_PARSE_DTDATTR) + pctxt = self._newPushParserCtxt() + if pctxt is NULL: + python.PyErr_NoMemory() + _initParserContext( + self._push_parser_context, self._resolvers, pctxt) + if self._remove_comments: + 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 + pctxt.sax.cdataBlock = NULL + return self._push_parser_context + + cdef _ParserContext _createContext(self, target): + cdef _TargetParserContext context + if target is None: + return _ParserContext() + context = _TargetParserContext() + context._setTarget(target) + return context + + cdef xmlparser.xmlParserCtxt* _newParserCtxt(self): + if self._for_html: + return htmlparser.htmlCreateMemoryParserCtxt('dummy', 5) + else: + return xmlparser.xmlNewParserCtxt() + + cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self): + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef char* c_filename + if self._filename is not None: + c_filename = _cstr(self._filename) + else: + c_filename = NULL + 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) + else: + 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 + + property error_log: + u"""The error log of the last parser run. + """ + def __get__(self): + cdef _ParserContext context + context = self._getParserContext() + return context._error_log.copy() + + property resolvers: + u"The custom resolver registry of this parser." + def __get__(self): + return self._resolvers + + property version: + 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): + 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): + u"""set_element_class_lookup(self, lookup = None) + + Set a lookup scheme for element classes generated from this parser. + + Reset it by passing None or nothing. + """ + self._class_lookup = lookup + + cdef _BaseParser _copy(self): + 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 + 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 + parser._target = self._target + parser._class_lookup = self._class_lookup + return parser + + def copy(self): + u"""copy(self) + + Create a new parser with the same configuration. + """ + return self._copy() + + def makeelement(self, _tag, attrib=None, nsmap=None, **_extra): + u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra) + + Creates a new element associated with this parser. + """ + return _makeElement(_tag, NULL, None, self, None, None, + attrib, nsmap, _extra) + + # internal parser methods + + cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL: + u"""Parse unicode document, share dictionary if possible. + """ + cdef _ParserContext context + cdef xmlDoc* result + cdef xmlparser.xmlParserCtxt* pctxt + cdef Py_ssize_t py_buffer_len + 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) + py_buffer_len = python.PyString_GET_SIZE(text_utf) + return self._parseDoc(_cstr(text_utf), py_buffer_len, c_filename) + buffer_len = py_buffer_len + + context = self._getParserContext() + context.prepare() + try: + pctxt = context._c_ctxt + __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + + 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, + self._parse_options) + if result is not NULL: + if _fixHtmlDictNames(pctxt.dict, result) < 0: + tree.xmlFreeDoc(result) + result = NULL + else: + result = xmlparser.xmlCtxtReadMemory( + pctxt, c_text, buffer_len, c_filename, _UNICODE_ENCODING, + self._parse_options) + + return context._handleParseResultDoc(self, result, None) + finally: + 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. + """ + cdef _ParserContext context + cdef xmlDoc* result + 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" + + context = self._getParserContext() + context.prepare() + try: + pctxt = context._c_ctxt + __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + + if self._default_encoding is None: + c_encoding = NULL + else: + c_encoding = _cstr(self._default_encoding) + + with nogil: + if self._for_html: + 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: + tree.xmlFreeDoc(result) + result = NULL + else: + result = xmlparser.xmlCtxtReadMemory( + pctxt, c_text, c_len, c_filename, + c_encoding, self._parse_options) + + return context._handleParseResultDoc(self, result, None) + finally: + context.cleanup() + + cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL: + cdef _ParserContext context + cdef xmlDoc* result + cdef xmlparser.xmlParserCtxt* pctxt + cdef int orig_options + cdef char* c_encoding + result = NULL + + context = self._getParserContext() + context.prepare() + try: + pctxt = context._c_ctxt + __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + + if self._default_encoding is None: + c_encoding = NULL + else: + c_encoding = _cstr(self._default_encoding) + + orig_options = pctxt.options + with nogil: + 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: + tree.xmlFreeDoc(result) + result = NULL + else: + 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) + finally: + context.cleanup() + + cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename) except NULL: + cdef _ParserContext context + cdef _FileReaderContext file_context + cdef xmlDoc* result + cdef xmlparser.xmlParserCtxt* pctxt + cdef char* c_filename + if not filename: + filename = None + + context = self._getParserContext() + context.prepare() + try: + pctxt = context._c_ctxt + __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + file_context = _FileReaderContext( + filelike, context, filename, self._default_encoding) + result = file_context._readDoc(pctxt, self._parse_options) + + return context._handleParseResultDoc( + self, result, filename) + finally: + context.cleanup() + +############################################################ +## ET feed parser +############################################################ + +cdef class _FeedParser(_BaseParser): + cdef bint _feed_parser_running + + property feed_error_log: + u"""The error log of the last (or current) run of the feed parser. + + Note that this is local to the feed parser and thus is + different from what the ``error_log`` property returns. + """ + def __get__(self): + cdef _ParserContext context + context = self._getPushParserContext() + return context._error_log.copy() + + def feed(self, data): + u"""feed(self, data) + + Feeds data to the parser. The argument should be an 8-bit string + buffer containing encoded data, although Unicode is supported as long + as both string types are not mixed. + + This is the main entry point to the consumer interface of a + parser. The parser will parse as much of the XML stream as it + can on each call. To finish parsing or to reset the parser, + call the ``close()`` method. Both methods may raise + ParseError if errors occur in the input data. If an error is + raised, there is no longer a need to call ``close()``. + + The feed parser interface is independent of the normal parser + usage. You can use the same parser as a feed parser and in + the ``parse()`` function concurrently. + """ + cdef _ParserContext context + cdef xmlparser.xmlParserCtxt* pctxt + cdef Py_ssize_t py_buffer_len + cdef char* c_data + cdef char* c_encoding + cdef int buffer_len + cdef int error + cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER + if python.PyString_Check(data): + if self._default_encoding is None: + c_encoding = NULL + else: + c_encoding = self._default_encoding + c_data = _cstr(data) + py_buffer_len = python.PyString_GET_SIZE(data) + 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 + c_data = python.PyUnicode_AS_DATA(data) + py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data) + else: + raise TypeError, u"Parsing requires string data" + + context = self._getPushParserContext() + pctxt = context._c_ctxt + error = 0 + if not self._feed_parser_running: + context.prepare() + self._feed_parser_running = 1 + __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt) + + if py_buffer_len > python.INT_MAX: + buffer_len = python.INT_MAX + else: + buffer_len = py_buffer_len + if self._for_html: + error = _htmlCtxtResetPush(pctxt, c_data, buffer_len, + c_encoding, self._parse_options) + else: + 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 + + while (recover or error == 0) and py_buffer_len > 0: + if py_buffer_len > python.INT_MAX: + buffer_len = python.INT_MAX + else: + buffer_len = 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) + py_buffer_len -= buffer_len + 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 entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \ + entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY: + break + else: + error = 0 + + if not recover and (error or not pctxt.wellFormed): + self._feed_parser_running = 0 + try: + context._handleParseResult(self, NULL, None) + finally: + context.cleanup() + + def close(self): + u"""close(self) + + Terminates feeding data to this parser. This tells the parser to + process any remaining data in the feed buffer, and then returns the + root Element of the tree that was parsed. + + This method must be called after passing the last chunk of data into + the ``feed()`` method. It should only be called when using the feed + parser interface, all other usage is undefined. + """ + cdef _ParserContext context + cdef xmlparser.xmlParserCtxt* pctxt + 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) + + context = self._getPushParserContext() + pctxt = context._c_ctxt + + self._feed_parser_running = 0 + if self._for_html: + htmlparser.htmlParseChunk(pctxt, NULL, 0, 1) + else: + xmlparser.xmlParseChunk(pctxt, NULL, 0, 1) + try: + result = context._handleParseResult(self, pctxt.myDoc, None) + finally: + context.cleanup() + + if isinstance(result, _Document): + return (<_Document>result).getroot() + else: + return result + +cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt, + char* c_data, int buffer_len, + char* c_encoding, int parse_options) except -1: + 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 = tree.xmlMalloc(10 * sizeof(int)) + c_ctxt.spaceMax = 10 + + # libxml2 lacks an HTML push parser setup function + error = xmlparser.xmlCtxtResetPush(c_ctxt, NULL, 0, NULL, c_encoding) + if error: + return error + + # fix libxml2 setup for HTML + c_ctxt.progressive = 1 + c_ctxt.html = 1 + 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 + +############################################################ +## XML parser +############################################################ + +cdef int _XML_DEFAULT_PARSE_OPTIONS +_XML_DEFAULT_PARSE_OPTIONS = ( + xmlparser.XML_PARSE_NOENT | + xmlparser.XML_PARSE_NOCDATA | + xmlparser.XML_PARSE_NONET | + xmlparser.XML_PARSE_COMPACT + ) + +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) + + The XML parser. + + Parsers can be supplied as additional argument to various parse + functions of the lxml API. A default parser is always available + and can be replaced by a call to the global function + 'set_default_parser'. New parsers can be created at any time + without a major run-time overhead. + + The keyword arguments in the constructor are mainly based on the + libxml2 parser configuration. A DTD will also be loaded if DTD + validation or attribute default values are requested (unless you + additionally provide an XMLSchema from which the default + attributes can be read). + + Available boolean keyword arguments: + + - attribute_defaults - inject default attributes from DTD or XMLSchema + - dtd_validation - validate against a DTD referenced by the document + - load_dtd - use DTD for parsing + - no_network - prevent network access for related files (default: True) + - ns_clean - clean up redundant namespace declarations + - recover - try hard to parse through broken XML + - remove_blank_text - discard blank text nodes + - remove_comments - discard comments + - remove_pis - discard processing instructions + - strip_cdata - replace CDATA sections by normal text content (default: True) + - compact - safe memory for short text content (default: True) + - resolve_entities - replace entities by their text value (default: True) + - huge_tree - disable security restrictions and support very deep trees + and very long text content (only affects libxml2 2.7+) + + Other keyword arguments: + + - encoding - override the document encoding + - target - a parser target object that will receive the parse events + - schema - an XMLSchema to validate against + + Note that you should avoid sharing parsers between threads. While this is + not harmful, it is more efficient to use separate parsers. This does not + 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, + 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 + 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 + 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: + 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 + 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: + 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 + + _BaseParser.__init__(self, parse_options, 0, schema, + remove_comments, remove_pis, strip_cdata, + target, None, encoding) + +cdef class ETCompatXMLParser(XMLParser): + u"""ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \ + dtd_validation=False, load_dtd=False, no_network=True, \ + ns_clean=False, recover=False, schema=None, \ + remove_blank_text=False, resolve_entities=True, \ + remove_comments=True, remove_pis=True, strip_cdata=True, \ + target=None, compact=True) + + An XML parser with an ElementTree compatible default setup. + + See the XMLParser class for details. + + This parser has ``remove_comments`` and ``remove_pis`` enabled by default + 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, + 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, + dtd_validation=dtd_validation, + load_dtd=load_dtd, + no_network=no_network, + ns_clean=ns_clean, + recover=recover, + remove_blank_text=remove_blank_text, + huge_tree=huge_tree, + compact=compact, + resolve_entities=resolve_entities, + remove_comments=remove_comments, + remove_pis=remove_pis, + strip_cdata=strip_cdata, + target=target, + encoding=encoding, + schema=schema) + + +cdef XMLParser __DEFAULT_XML_PARSER +__DEFAULT_XML_PARSER = XMLParser() + +__GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER) + +def set_default_parser(_BaseParser parser=None): + u"""set_default_parser(parser=None) + + Set a default parser for the current thread. This parser is used + globally whenever no parser is supplied to the various parse functions of + the lxml API. If this function is called without a parser (or if it is + None), the default parser is reset to the original configuration. + + Note that the pre-installed default parser is not thread-safe. Avoid the + default parser in multi-threaded environments. You can create a separate + parser for each thread explicitly or use a parser pool. + """ + if parser is None: + parser = __DEFAULT_XML_PARSER + __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser) + +def get_default_parser(): + u"get_default_parser()" + return __GLOBAL_PARSER_CONTEXT.getDefaultParser() + +############################################################ +## HTML parser +############################################################ + +cdef int _HTML_DEFAULT_PARSE_OPTIONS +_HTML_DEFAULT_PARSE_OPTIONS = ( + htmlparser.HTML_PARSE_RECOVER | + htmlparser.HTML_PARSE_NONET | + htmlparser.HTML_PARSE_COMPACT + ) + +cdef class HTMLParser(_FeedParser): + u"""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) + + The HTML parser. + + This parser allows reading HTML into a normal XML tree. By + default, it can read broken (non well-formed) HTML, depending on + the capabilities of libxml2. Use the 'recover' option to switch + this off. + + Available boolean keyword arguments: + + - recover - try hard to parse through broken HTML (default: True) + - no_network - prevent network access for related files (default: True) + - remove_blank_text - discard empty text nodes + - remove_comments - discard comments + - remove_pis - discard processing instructions + - strip_cdata - replace CDATA sections by normal text content (default: True) + - compact - safe memory for short text content (default: True) + + Other keyword arguments: + + - encoding - override the document encoding + - target - a parser target object that will receive the parse events + - schema - an XMLSchema to validate against + + Note that you should avoid sharing parsers between threads for performance + 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, + 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 + 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: + parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT + + _BaseParser.__init__(self, parse_options, 1, schema, + remove_comments, remove_pis, strip_cdata, + target, None, encoding) + +cdef HTMLParser __DEFAULT_HTML_PARSER +__DEFAULT_HTML_PARSER = HTMLParser() + +############################################################ +## helper functions for document creation +############################################################ + +cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL: + cdef char* c_filename + cdef char* c_text + cdef Py_ssize_t c_len + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + if not filename: + c_filename = NULL + else: + 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: + return (<_BaseParser>parser)._parseDocFromFilelike( + StringIO(text), filename) + return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename) + else: + c_len = python.PyString_GET_SIZE(text) + 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) + +cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL: + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8)) + +cdef xmlDoc* _parseDocFromFilelike(source, filename, + _BaseParser parser) except NULL: + if parser is None: + parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser() + return (<_BaseParser>parser)._parseDocFromFilelike(source, filename) + +cdef xmlDoc* _newXMLDoc() except NULL: + cdef xmlDoc* result + result = tree.xmlNewDoc(NULL) + if result is NULL: + python.PyErr_NoMemory() + if result.encoding is NULL: + result.encoding = tree.xmlStrdup("UTF-8") + __GLOBAL_PARSER_CONTEXT.initDocDict(result) + return result + +cdef xmlDoc* _newHTMLDoc() except NULL: + cdef xmlDoc* result + result = tree.htmlNewDoc(NULL, NULL) + if result is NULL: + python.PyErr_NoMemory() + __GLOBAL_PARSER_CONTEXT.initDocDict(result) + return result + +cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL: + cdef xmlDoc* result + if recursive: + with nogil: + result = tree.xmlCopyDoc(c_doc, recursive) + else: + result = tree.xmlCopyDoc(c_doc, 0) + if result is NULL: + python.PyErr_NoMemory() + __GLOBAL_PARSER_CONTEXT.initDocDict(result) + 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 + 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 + if c_node is NULL: + python.PyErr_NoMemory() + 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: + 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() + _copyTail(c_node.next, c_root) + return c_root + + +############################################################ +## API level helper functions for _Document creation +## (here we convert to UTF-8) +############################################################ + +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) + # 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) + doc._c_doc.URL = tree.xmlStrdup(_cstr(base_url)) + return doc + + if base_url is not None: + url = base_url + else: + url = _getFilenameForFile(source) + + 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) + + # Support for file-like objects (urlgrabber.urlopen, ...) + if hasattr(source, u'read'): + return _parseFilelikeDocument( + source, _encodeFilenameUTF8(url), parser) + + 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) + return _documentFactory(c_doc, parser) + +cdef _Document _parseMemoryDocument(text, url, _BaseParser parser): + cdef xmlDoc* c_doc + 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 + if _UNICODE_ENCODING is NULL: + text = python.PyUnicode_AsUTF8String(text) + elif not python.PyString_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) + return _documentFactory(c_doc, parser) + +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) + return _documentFactory(c_doc, parser) diff --git a/src/lxml/parsertarget.pxi b/src/lxml/parsertarget.pxi new file mode 100644 index 0000000..5accc6c --- /dev/null +++ b/src/lxml/parsertarget.pxi @@ -0,0 +1,141 @@ +# Parser target context (ET target interface) + +cdef object inspect_getargspec +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 + # machinery towards the API level functions + def __init__(self, result): + self.result = result + +cdef class _PythonSaxParserTarget(_SaxParserTarget): + cdef object _target_start + cdef object _target_end + cdef object _target_data + cdef object _target_doctype + cdef object _target_pi + cdef object _target_comment + cdef bint _start_takes_nsmap + + def __init__(self, target): + cdef int event_filter + event_filter = 0 + 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 + except AttributeError: + pass + else: + 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: + pass + try: + self._target_end = target.end + if self._target_end is not None: + event_filter = event_filter | SAX_EVENT_END + except AttributeError: + pass + try: + self._target_data = target.data + if self._target_data is not None: + event_filter = event_filter | SAX_EVENT_DATA + except AttributeError: + pass + try: + self._target_doctype = target.doctype + if self._target_doctype is not None: + event_filter = event_filter | SAX_EVENT_DOCTYPE + except AttributeError: + pass + try: + self._target_pi = target.pi + if self._target_pi is not None: + event_filter = event_filter | SAX_EVENT_PI + except AttributeError: + pass + try: + self._target_comment = target.comment + if self._target_comment is not None: + event_filter = event_filter | SAX_EVENT_COMMENT + except AttributeError: + pass + self._sax_event_filter = event_filter + + 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) + + cdef _handleSaxEnd(self, tag): + return self._target_end(tag) + + cdef int _handleSaxData(self, data) except -1: + 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) + + cdef _handleSaxPi(self, target, data): + return self._target_pi(target, data) + + cdef _handleSaxComment(self, comment): + return self._target_comment(comment) + + +cdef class _TargetParserContext(_SaxParserContext): + u"""This class maps SAX2 events to the ET parser target interface. + """ + 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__'): + target = _PythonSaxParserTarget(target) + self._setSaxParserTarget(target) + return 0 + + cdef _ParserContext _copy(self): + cdef _TargetParserContext context + context = _ParserContext._copy(self) + context._setTarget(self._python_target) + 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 \ + self._c_ctxt.myDoc._private is NULL: + # no _Document proxy => orphen + tree.xmlFreeDoc(self._c_ctxt.myDoc) + self._c_ctxt.myDoc = NULL + + cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result, + filename): + cdef bint recover + recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER + 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) + return self._python_target.close() + + cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser, + 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 + tree.xmlFreeDoc(result) + self._cleanupTargetParserContext(result) + self._raise_if_stored() + if not self._c_ctxt.wellFormed and not recover: + _raiseParseError(self._c_ctxt, filename, self._error_log) + raise _TargetParserResult(self._python_target.close()) diff --git a/src/lxml/proxy.pxi b/src/lxml/proxy.pxi new file mode 100644 index 0000000..3079795 --- /dev/null +++ b/src/lxml/proxy.pxi @@ -0,0 +1,479 @@ +# Proxy functions and low level node allocation stuff + +# Proxies represent elements, their reference is stored in the C +# structure of the respective node to avoid multiple instantiation of +# the Python class + +cdef inline _Element getProxy(xmlNode* c_node): + u"""Get a proxy for a given node. + """ + #print "getProxy for:", c_node + if c_node is not NULL and c_node._private is not NULL: + return <_Element>c_node._private + else: + return None + +cdef inline int hasProxy(xmlNode* c_node): + 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. + """ + #print "registering for:", proxy._c_node + assert c_node._private is NULL, u"double registering proxy!" + proxy._doc = doc + proxy._c_node = c_node + c_node._private = proxy + # additional INCREF to make sure _Document is GC-ed LAST! + proxy._gc_doc = doc + python.Py_INCREF(doc) + +cdef inline int _unregisterProxy(_Element proxy) except -1: + u"""Unregister a proxy for the node it's proxying for. + """ + cdef xmlNode* c_node + c_node = proxy._c_node + assert c_node._private is proxy, u"Tried to unregister unknown proxy" + c_node._private = NULL + return 0 + +cdef inline void _releaseProxy(_Element proxy): + u"""An additional DECREF for the document. + """ + python.Py_XDECREF(proxy._gc_doc) + 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). + """ + cdef _Document old_doc + cdef _Element element = <_Element>c_node._private + if element._doc is not doc: + old_doc = element._doc + element._doc = doc + python.Py_INCREF(doc) + element._gc_doc = doc + python.Py_DECREF(old_doc) + +################################################################################ +# temporarily make a node the root node of its document + +cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL: + # build a temporary document that has the given node as root node + # note that copy and original must not be modified during its lifetime!! + # always call _destroyFakeDoc() after use! + cdef xmlNode* c_child + cdef xmlNode* c_root + cdef xmlNode* c_new_root + cdef xmlDoc* c_doc + c_root = tree.xmlDocGetRootElement(c_base_doc) + if c_root is c_node: + # already the root node + 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) + _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 + + # store original node + c_doc._private = c_node + + # 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 + + c_doc.children = c_new_root + return c_doc + +cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc): + # delete a temporary document + cdef xmlNode* c_child + cdef xmlNode* c_parent + cdef xmlNode* c_root + if c_doc is c_base_doc: + return + c_root = tree.xmlDocGetRootElement(c_doc) + + # restore parent pointers of children + c_parent = c_doc._private + c_child = c_root.children + while c_child is not NULL: + c_child.parent = c_parent + c_child = c_child.next + + # prevent recursive removal of children + c_root.children = c_root.last = NULL + 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 + it. If we instantiate the fake root node, things will turn bad + when it's destroyed. + + Instead, if we are asked to instantiate the fake root node, we + 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: + c_element = c_element.doc._private + #assert c_element.type == tree.XML_ELEMENT_NODE + return _elementFactory(doc, c_element) + +################################################################################ +# 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). + """ + 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 + c_top = getDeallocationTop(c_node) + if c_top is not NULL: + #print "freeing:", c_top.name + _removeText(c_top.next) # tail + tree.xmlFreeNode(c_top) + return 1 + return 0 + +cdef xmlNode* getDeallocationTop(xmlNode* c_node): + u"""Return the top of the tree that can be deallocated, or NULL. + """ + cdef xmlNode* c_current + 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 + 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 \ + 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: + #print "Not freeing: proxies still exist" + return NULL + c_top = c_current + c_current = c_current.parent + # see whether we have children to deallocate + if canDeallocateChildNodes(c_top): + return c_top + else: + return NULL + +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: + return 0 + tree.END_FOR_EACH_ELEMENT_FROM(c_node) + return 1 + +################################################################################ +# 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. + """ + cdef xmlNode* c_parent + cdef xmlNs* c_ns + 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): + 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) + c_new_ns = c_new_ns.next + c_parent = c_parent.parent + +ctypedef struct _nscache: + xmlNs** new + xmlNs** old + size_t size + size_t last + +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: + c_ns_cache.size *= 2 + c_ns_ptr = 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 = 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: + cstd.free(c_ns_cache.new) + cstd.free(c_ns_cache.old) + python.PyErr_NoMemory() + return -1 + 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: + _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 + +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 + defined in its parents. Does not free the xmlNs's, just prepends + them to the c_del_ns_list. + """ + cdef xmlNs* c_ns + cdef xmlNs* c_ns_next + 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( + 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]) + c_nsdef = &c_nsdef[0].next + else: + # known namespace href => strip the ns + if c_ns is tree.xmlSearchNs(c_element.doc, c_element.parent, + c_ns.prefix): + # prefix is not shadowed by parents => ns is reusable + _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] + c_nsdef[0] = c_ns_next + 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. + + Originally copied from libxml2's xmlReconciliateNs(). Expects + libxml2 doc pointers of node to be correct already, but fixes + _Document references. + + For each node in the subtree, we do this: + + 1) Remove redundant declarations of namespace that are already + defined in its parents. + + 2) Replace namespaces that are *not* defined on the node or its + parents by the equivalent namespace declarations that *are* + defined on the node or its parents (possibly using a different + prefix). If a namespace is unknown, declare a new one on the + node. + + 3) Reassign the names of tags and attribute from the dict of the + target document *iff* it is different from the dict used in the + source subtree. + + 4) Set the Document reference to the new Document (if different). + This is done on backtracking to keep the original Document + alive as long as possible, until all its elements are updated. + + Note that the namespace declarations are removed from the tree in + step 1), but freed only after the complete subtree was traversed + and all occurrences were replaced by tree-internal pointers. + """ + cdef xmlNode* c_start_node + cdef xmlNode* c_node + cdef char* c_name + cdef _nscache c_ns_cache + cdef xmlNs* c_ns + cdef xmlNs* c_ns_next + cdef xmlNs* c_nsdef + cdef xmlNs* c_del_ns_list + cdef size_t i, proxy_count = 0 + + if not tree._isElementOrXInclude(c_element): + return 0 + + c_start_node = c_element + c_del_ns_list = NULL + + c_ns_cache.new = NULL + 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) + 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 + # the ancestors + 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 + # 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: + 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 + c_ns = doc._findOrBuildNodeNs( + c_start_node, c_node.ns.href, c_node.ns.prefix) + _appendToNsCache(&c_ns_cache, c_node.ns, c_ns) + c_node.ns = c_ns + + if c_node is c_element: + # after the element, continue with its attributes + c_node = c_element.properties + else: + c_node = c_node.next + tree.END_FOR_EACH_FROM(c_element) + + # free now unused namespace declarations + if c_del_ns_list is not NULL: + tree.xmlFreeNsList(c_del_ns_list) + + # 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) + + # 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 + # (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: + fixElementDocument(c_start_node, doc, proxy_count) + + return 0 + + +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: + _updateProxyDocument(c_node, doc) + proxy_count -= 1 + if proxy_count == 0: + return + tree.END_FOR_EACH_FROM(c_node) + +cdef void fixThreadDictNames(xmlNode* c_element, + tree.xmlDict* c_src_dict, + tree.xmlDict* c_dict) nogil: + # re-assign the names of tags and attributes + # + # 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 + fixThreadDictNsForNode(c_element, c_src_dict, c_dict) + c_element = c_element.children + while c_element is not NULL: + if tree._isElementOrXInclude(c_element): + 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) + +cdef void fixThreadDictNamesForNode(xmlNode* c_element, + 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: + fixThreadDictNameForNode(c_node, c_src_dict, c_dict) + if c_node.type == tree.XML_ELEMENT_NODE: + fixThreadDictNamesForAttributes( + c_node.properties, 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) + 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: + cdef xmlNode* c_child + cdef xmlNode* c_node = 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 + while c_child is not NULL: + 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, + 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 \ + 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) + if c_name is not NULL: + c_node.name = c_name + +cdef inline void fixThreadDictContentForNode(xmlNode* c_node, + tree.xmlDict* c_src_dict, + tree.xmlDict* c_dict) nogil: + if c_node.content is not NULL and \ + c_node.content is not &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) + +cdef inline void fixThreadDictNsForNode(xmlNode* c_node, + 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: + 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) + c_ns = c_ns.next diff --git a/src/lxml/public-api.pxi b/src/lxml/public-api.pxi new file mode 100644 index 0000000..a3a73dc --- /dev/null +++ b/src/lxml/public-api.pxi @@ -0,0 +1,157 @@ +# 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 + c_node = _copyNodeToDoc(c_root, doc._c_doc) + return _elementFactory(doc, c_node) + +cdef public api _ElementTree elementTreeFactory(_Element context_node): + return newElementTree(context_node, _ElementTree) + +cdef public api _ElementTree newElementTree(_Element context_node, + object subclass): + if context_node is NULL or context_node is None: + raise TypeError + + 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 + 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) + +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( + _element_class_lookup_function function, state): + _setElementClassLookupFunction(function, state) + +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): + 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) + +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) + +cdef public api _Document documentOrRaise(object input): + return _documentOrRaise(input) + +cdef public api _Element rootNodeOrRaise(object input): + return _rootNodeOrRaise(input) + +cdef public api bint hasText(xmlNode* c_node): + return _hasText(c_node) + +cdef public api bint hasTail(xmlNode* c_node): + return _hasTail(c_node) + +cdef public api object textOf(xmlNode* c_node): + if c_node is NULL: + return None + return _collectText(c_node.children) + +cdef public api object tailOf(xmlNode* c_node): + if c_node is NULL: + return None + return _collectText(c_node.next) + +cdef public api int setNodeText(xmlNode* c_node, text) except -1: + if c_node is NULL: + raise ValueError + return _setNodeText(c_node, text) + +cdef public api int setTailText(xmlNode* c_node, text) except -1: + if c_node is NULL: + raise ValueError + return _setTailText(c_node, text) + +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, + char* ns, char* name): + return _attributeValueFromNsName(c_element, ns, name) + +cdef public api object getAttributeValue(_Element element, key, default): + return _getAttributeValue(element, key, default) + +cdef public api object iterattributes(_Element element, int keysvalues): + return _attributeIteratorFactory(element, keysvalues) + +cdef public api object collectAttributes(xmlNode* c_element, int keysvalues): + return _collectAttributes(c_element, keysvalues) + +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: + 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) + +cdef public api bint hasChild(xmlNode* c_node): + return _hasChild(c_node) + +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): + return _findChildForwards(c_node, index) + +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): + return _nextElement(c_node) + +cdef public api xmlNode* previousElement(xmlNode* c_node): + return _previousElement(c_node) + +cdef public api void appendChild(_Element parent, _Element child): + _appendChild(parent, child) + +cdef public api object pyunicode(char* s): + if s is NULL: + raise TypeError + return funicode(s) + +cdef public api object utf8(object s): + return _utf8(s) + +cdef public api object getNsTag(object tag): + return _getNsTag(tag) + +cdef public api object namespacedName(xmlNode* c_node): + return _namespacedName(c_node) + +cdef public api object namespacedNameFromNsName(char* href, char* name): + return _namespacedNameFromNsName(href, name) + +cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node): + iterator._storeNext(node) + +cdef public api void initTagMatch(_ElementTagMatcher matcher, tag): + matcher._initTagMatch(tag) + +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) diff --git a/src/lxml/pyclasslookup.py b/src/lxml/pyclasslookup.py new file mode 100644 index 0000000..32c010c --- /dev/null +++ b/src/lxml/pyclasslookup.py @@ -0,0 +1,3 @@ +# dummy module for backwards compatibility + +from etree import PythonElementClassLookup diff --git a/src/lxml/python.pxd b/src/lxml/python.pxd new file mode 100644 index 0000000..94ca06a --- /dev/null +++ b/src/lxml/python.pxd @@ -0,0 +1,137 @@ +from cstd cimport FILE + +cdef extern from "Python.h": + ctypedef struct PyObject + ctypedef struct PyThreadState + cdef int INT_MAX + cdef int PY_SSIZE_T_MAX + cdef int PY_VERSION_HEX + + cdef void Py_INCREF(object o) + cdef void Py_DECREF(object o) + cdef void Py_XDECREF(PyObject* o) + + ctypedef class __builtin__.slice [object PySliceObject]: + cdef object start + cdef object stop + cdef object step + + ctypedef class __builtin__.unicode [object PyUnicodeObject]: + pass + + cdef FILE* PyFile_AsFile(object p) + + cdef bint PyUnicode_Check(object obj) + cdef bint PyUnicode_CheckExact(object obj) + cdef bint PyString_Check(object obj) + cdef bint PyString_CheckExact(object obj) + + cdef object PyUnicode_FromEncodedObject(object s, char* encoding, + char* errors) + cdef object PyUnicode_AsEncodedString(object u, char* encoding, + char* errors) + cdef object PyUnicode_FromFormat(char* format, ...) # Python 3 + cdef object PyUnicode_Decode(char* s, Py_ssize_t size, + char* encoding, char* errors) + cdef object PyUnicode_DecodeUTF8(char* s, Py_ssize_t size, char* errors) + cdef object PyUnicode_DecodeLatin1(char* s, Py_ssize_t size, char* errors) + cdef object PyUnicode_AsUTF8String(object ustring) + cdef object PyUnicode_AsASCIIString(object ustring) + cdef char* PyUnicode_AS_DATA(object ustring) + cdef Py_ssize_t PyUnicode_GET_DATA_SIZE(object ustring) + cdef Py_ssize_t PyUnicode_GET_SIZE(object ustring) + cdef object PyString_FromStringAndSize(char* s, Py_ssize_t size) + cdef object PyString_FromFormat(char* format, ...) + cdef Py_ssize_t PyString_GET_SIZE(object s) + + cdef object PyNumber_Int(object value) + cdef Py_ssize_t PyInt_AsSsize_t(object value) + + cdef Py_ssize_t PyTuple_GET_SIZE(object t) + cdef object PyTuple_GET_ITEM(object o, Py_ssize_t pos) + + cdef object PyList_New(Py_ssize_t index) + cdef Py_ssize_t PyList_GET_SIZE(object l) + cdef object PyList_GET_ITEM(object l, Py_ssize_t index) + cdef void PyList_SET_ITEM(object l, Py_ssize_t index, object value) + cdef int PyList_Insert(object l, Py_ssize_t index, object o) except -1 + cdef object PyList_AsTuple(object l) + cdef void PyList_Clear(object l) + +# cdef int PyDict_SetItemString(object d, char* key, object value) except -1 +# cdef int PyDict_SetItem(object d, object key, object value) except -1 + cdef PyObject* PyDict_GetItemString(object d, char* key) + cdef PyObject* PyDict_GetItem(object d, object key) +# cdef int PyDict_DelItem(object d, object key) except -1 + cdef void PyDict_Clear(object d) +# cdef object PyDict_Copy(object d) + cdef object PyDictProxy_New(object d) + # cdef int PyDict_Contains(object d, object key) except -1 # Python 2.4+ + cdef Py_ssize_t PyDict_Size(object d) + cdef object PySequence_List(object o) + cdef object PySequence_Tuple(object o) + + cdef bint PyDict_Check(object instance) + cdef bint PyList_Check(object instance) + cdef bint PyTuple_Check(object instance) + cdef bint PyNumber_Check(object instance) + cdef bint PyBool_Check(object instance) + cdef bint PySequence_Check(object instance) + cdef bint PyType_Check(object instance) + cdef bint PyTuple_CheckExact(object instance) + cdef bint PySlice_Check(object instance) + + cdef int _PyEval_SliceIndex(object value, Py_ssize_t* index) except 0 + cdef int PySlice_GetIndicesEx(slice slice, Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, + Py_ssize_t *slicelength) except -1 + + cdef int PyObject_SetAttr(object o, object name, object value) + cdef object PyObject_RichCompare(object o1, object o2, int op) + cdef int PyObject_RichCompareBool(object o1, object o2, int op) + + cdef void* PyMem_Malloc(size_t size) + cdef void* PyMem_Realloc(void* p, size_t size) + cdef void PyMem_Free(void* p) + + # these two always return NULL to pass on the exception + cdef object PyErr_NoMemory() + cdef object PyErr_SetFromErrno(object type) + + cdef PyThreadState* PyEval_SaveThread() + cdef void PyEval_RestoreThread(PyThreadState* state) + cdef PyObject* PyThreadState_GetDict() + + # some handy functions + cdef int callable "PyCallable_Check" (object obj) + cdef char* _cstr "PyString_AS_STRING" (object s) + + # Py_buffer related flags + cdef int PyBUF_SIMPLE + cdef int PyBUF_WRITABLE + cdef int PyBUF_LOCK + cdef int PyBUF_FORMAT + cdef int PyBUF_ND + cdef int PyBUF_STRIDES + cdef int PyBUF_C_CONTIGUOUS + cdef int PyBUF_F_CONTIGUOUS + cdef int PyBUF_ANY_CONTIGUOUS + cdef int PyBUF_INDIRECT + +cdef extern from "pythread.h": + ctypedef void* PyThread_type_lock + cdef PyThread_type_lock PyThread_allocate_lock() + cdef void PyThread_free_lock(PyThread_type_lock lock) + cdef int PyThread_acquire_lock(PyThread_type_lock lock, int mode) nogil + cdef void PyThread_release_lock(PyThread_type_lock lock) + cdef long PyThread_get_thread_ident() + + ctypedef enum __WaitLock: + WAIT_LOCK + NOWAIT_LOCK + +cdef extern from "etree_defs.h": # redefines some functions as macros + cdef bint _isString(object obj) + cdef char* _fqtypename(object t) + cdef object PY_NEW(object t) + cdef bint IS_PYTHON3 diff --git a/src/lxml/readonlytree.pxi b/src/lxml/readonlytree.pxi new file mode 100644 index 0000000..807cdbb --- /dev/null +++ b/src/lxml/readonlytree.pxi @@ -0,0 +1,337 @@ +# read-only tree implementation + +cdef class _ReadOnlyElementProxy: + u"The main read-only Element proxy class (for internal use only!)." + cdef bint _free_after_use + cdef xmlNode* _c_node + cdef object _source_proxy + cdef list _dependent_proxies + + cdef int _assertNode(self) except -1: + u"""This is our way of saying: this proxy is invalid! + """ + assert self._c_node is not NULL, u"Proxy invalidated!" + return 0 + + cdef void free_after_use(self): + u"""Should the xmlNode* be freed when releasing the proxy? + """ + self._free_after_use = 1 + + property tag: + u"""Element tag + """ + def __get__(self): + self._assertNode() + return _namespacedName(self._c_node) + + property text: + u"""Text before the first subelement. This is either a string or + the value None, if there was no text. + """ + def __get__(self): + self._assertNode() + return _collectText(self._c_node.children) + + property tail: + u"""Text after this element's end tag, but before the next sibling + element's start tag. This is either a string or the value None, if + there was no text. + """ + def __get__(self): + self._assertNode() + return _collectText(self._c_node.next) + + property attrib: + def __get__(self): + self._assertNode() + return dict(_collectAttributes(self._c_node, 3)) + + property prefix: + u"""Namespace prefix or None. + """ + 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) + return None + + property sourceline: + u"""Original line number as found by the parser or None if unknown. + """ + def __get__(self): + cdef long line + self._assertNode() + line = tree.xmlGetLineNo(self._c_node) + if line > 0: + return line + else: + return None + + def __repr__(self): + return u"" % (self.tag, id(self)) + + def __getitem__(self, x): + u"""Returns the subelement at the given position or the requested + slice. + """ + cdef xmlNode* c_node + cdef Py_ssize_t step, slicelength + cdef Py_ssize_t c, i + cdef _node_to_node_function next_element + cdef list result + if python.PySlice_Check(x): + # slicing + if _isFullSlice(x): + return _collectChildren(self) + _findChildSlice(x, self._c_node, &c_node, &step, &slicelength) + if c_node is NULL: + return [] + if step > 0: + next_element = _nextElement + else: + step = -step + next_element = _previousElement + 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)) + c = c + 1 + for i from 0 <= i < step: + c_node = next_element(c_node) + return result + else: + # 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) + + def __len__(self): + u"""Returns the number of subelements. + """ + cdef Py_ssize_t c + cdef xmlNode* c_node + self._assertNode() + c = 0 + 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 + return c + + def __nonzero__(self): + cdef xmlNode* c_node + self._assertNode() + c_node = _findChildBackwards(self._c_node, 0) + return c_node != NULL + + def __deepcopy__(self, memo): + u"__deepcopy__(self, memo)" + return self.__copy__() + + def __copy__(self): + u"__copy__(self)" + cdef xmlDoc* c_doc + cdef xmlNode* c_node + cdef _Document new_doc + 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 + # 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: + return None + return _elementFactory(new_doc, c_node) + + def __iter__(self): + return iter(self.getchildren()) + + def iterchildren(self, tag=None, *, reversed=False): + u"""iterchildren(self, tag=None, reversed=False) + + 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 ] + if reversed: + children = children[::-1] + return iter(children) + + def get(self, key, default=None): + u"""Gets an element attribute. + """ + self._assertNode() + 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). + """ + self._assertNode() + return _collectAttributes(self._c_node, 1) + + def values(self): + u"""Gets element attributes, as a sequence. The attributes are returned + in an arbitrary order. + """ + self._assertNode() + return _collectAttributes(self._c_node, 2) + + def items(self): + u"""Gets element attributes, as a sequence. The attributes are returned + in an arbitrary order. + """ + self._assertNode() + return _collectAttributes(self._c_node, 3) + + cpdef getchildren(self): + u"""Returns all subelements. The elements are returned in document + order. + """ + cdef xmlNode* c_node + cdef list result + self._assertNode() + 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)) + c_node = c_node.next + return result + + def getparent(self): + u"""Returns the parent of this element or None for the root element. + """ + 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 + else: + return _newReadOnlyProxy(self._source_proxy, c_parent) + + def getnext(self): + u"""Returns the following sibling of this element or None. + """ + 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) + return None + + def getprevious(self): + u"""Returns the preceding sibling of this element or None. + """ + 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) + return None + + +cdef extern from "etree_defs.h": + # macro call to 't->tp_new()' for fast instantiation + cdef _ReadOnlyElementProxy NEW_RO_PROXY "PY_NEW" (object t) + +cdef _ReadOnlyElementProxy _newReadOnlyProxy( + _ReadOnlyElementProxy source_proxy, xmlNode* c_node): + cdef _ReadOnlyElementProxy el + el = NEW_RO_PROXY(_ReadOnlyElementProxy) + el._c_node = c_node + _initReadOnlyProxy(el, source_proxy) + return el + +cdef inline _initReadOnlyProxy(_ReadOnlyElementProxy el, + _ReadOnlyElementProxy source_proxy): + el._free_after_use = 0 + if source_proxy is None: + el._source_proxy = el + el._dependent_proxies = [el] + else: + el._source_proxy = source_proxy + source_proxy._dependent_proxies.append(el) + +cdef _freeReadOnlyProxies(_ReadOnlyElementProxy sourceProxy): + cdef xmlNode* c_node + cdef _ReadOnlyElementProxy el + if sourceProxy is None: + return + if sourceProxy._dependent_proxies is None: + return + for el in sourceProxy._dependent_proxies: + c_node = el._c_node + el._c_node = NULL + if el._free_after_use: + tree.xmlFreeNode(c_node) + del sourceProxy._dependent_proxies[:] + +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). + """ + cpdef append(self, other_element): + u"""Append a copy of an Element to the list of children. + """ + cdef xmlNode* c_next + 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 + tree.xmlAddChild(self._c_node, c_node) + _moveTail(c_next, c_node) + + def extend(self, elements): + u"""Append a copy of all Elements from a sequence to the list of + children. + """ + self._assertNode() + for element in elements: + self.append(element) + + property text: + u"""Text before the first subelement. This is either a string or the + value None, if there was no text. + """ + def __get__(self): + self._assertNode() + return _collectText(self._c_node.children) + + def __set__(self, value): + self._assertNode() + if isinstance(value, QName): + value = python.PyUnicode_FromEncodedObject( + _resolveQNameText(self, value), 'UTF-8', 'strict') + _setNodeText(self._c_node, value) + +cdef _AppendOnlyElementProxy _newAppendOnlyProxy( + _ReadOnlyElementProxy source_proxy, xmlNode* c_node): + cdef _AppendOnlyElementProxy el + el = <_AppendOnlyElementProxy>NEW_RO_PROXY(_AppendOnlyElementProxy) + el._c_node = c_node + _initReadOnlyProxy(el, source_proxy) + return el + +cdef xmlNode* _roNodeOf(element) except NULL: + cdef xmlNode* c_node + if isinstance(element, _Element): + c_node = (<_Element>element)._c_node + elif isinstance(element, _ReadOnlyElementProxy): + c_node = (<_ReadOnlyElementProxy>element)._c_node + else: + raise TypeError, u"invalid value to append()" + + if c_node is NULL: + raise TypeError, u"invalid element" + return c_node diff --git a/src/lxml/relaxng.pxd b/src/lxml/relaxng.pxd new file mode 100644 index 0000000..5fbeba2 --- /dev/null +++ b/src/lxml/relaxng.pxd @@ -0,0 +1,59 @@ +cimport tree +from tree cimport xmlDoc + +cdef extern from "libxml/relaxng.h": + ctypedef struct xmlRelaxNG + ctypedef struct xmlRelaxNGParserCtxt + + ctypedef struct xmlRelaxNGValidCtxt + + ctypedef enum xmlRelaxNGValidErr: + XML_RELAXNG_OK = 0 + XML_RELAXNG_ERR_MEMORY = 1 + XML_RELAXNG_ERR_TYPE = 2 + XML_RELAXNG_ERR_TYPEVAL = 3 + XML_RELAXNG_ERR_DUPID = 4 + XML_RELAXNG_ERR_TYPECMP = 5 + XML_RELAXNG_ERR_NOSTATE = 6 + XML_RELAXNG_ERR_NODEFINE = 7 + XML_RELAXNG_ERR_LISTEXTRA = 8 + XML_RELAXNG_ERR_LISTEMPTY = 9 + XML_RELAXNG_ERR_INTERNODATA = 10 + XML_RELAXNG_ERR_INTERSEQ = 11 + XML_RELAXNG_ERR_INTEREXTRA = 12 + XML_RELAXNG_ERR_ELEMNAME = 13 + XML_RELAXNG_ERR_ATTRNAME = 14 + XML_RELAXNG_ERR_ELEMNONS = 15 + XML_RELAXNG_ERR_ATTRNONS = 16 + XML_RELAXNG_ERR_ELEMWRONGNS = 17 + XML_RELAXNG_ERR_ATTRWRONGNS = 18 + XML_RELAXNG_ERR_ELEMEXTRANS = 19 + XML_RELAXNG_ERR_ATTREXTRANS = 20 + XML_RELAXNG_ERR_ELEMNOTEMPTY = 21 + XML_RELAXNG_ERR_NOELEM = 22 + XML_RELAXNG_ERR_NOTELEM = 23 + XML_RELAXNG_ERR_ATTRVALID = 24 + XML_RELAXNG_ERR_CONTENTVALID = 25 + XML_RELAXNG_ERR_EXTRACONTENT = 26 + XML_RELAXNG_ERR_INVALIDATTR = 27 + XML_RELAXNG_ERR_DATAELEM = 28 + XML_RELAXNG_ERR_VALELEM = 29 + XML_RELAXNG_ERR_LISTELEM = 30 + XML_RELAXNG_ERR_DATATYPE = 31 + XML_RELAXNG_ERR_VALUE = 32 + XML_RELAXNG_ERR_LIST = 33 + XML_RELAXNG_ERR_NOGRAMMAR = 34 + XML_RELAXNG_ERR_EXTRADATA = 35 + XML_RELAXNG_ERR_LACKDATA = 36 + XML_RELAXNG_ERR_INTERNAL = 37 + XML_RELAXNG_ERR_ELEMWRONG = 38 + XML_RELAXNG_ERR_TEXTWRONG = 39 + + cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) nogil + cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) nogil + cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) nogil + cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) nogil + cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) nogil + cdef void xmlRelaxNGFree(xmlRelaxNG* schema) nogil + cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) nogil + cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) nogil diff --git a/src/lxml/relaxng.pxi b/src/lxml/relaxng.pxi new file mode 100644 index 0000000..9813ca8 --- /dev/null +++ b/src/lxml/relaxng.pxi @@ -0,0 +1,130 @@ +# support for RelaxNG validation +cimport relaxng + +class RelaxNGError(LxmlError): + u"""Base class for RelaxNG errors. + """ + pass + +class RelaxNGParseError(RelaxNGError): + u"""Error while parsing an XML document as RelaxNG. + """ + pass + +class RelaxNGValidateError(RelaxNGError): + u"""Error while validating an XML document with a RelaxNG schema. + """ + pass + +################################################################################ +# RelaxNG + +cdef class RelaxNG(_Validator): + u"""RelaxNG(self, etree=None, file=None) + Turn a document into a Relax NG validator. + + Either pass a schema as Element or ElementTree, or pass a file or + filename through the ``file`` keyword argument. + """ + cdef relaxng.xmlRelaxNG* _c_schema + def __init__(self, etree=None, *, file=None): + cdef _Document doc + cdef _Element root_node + cdef xmlNode* c_node + cdef xmlDoc* fake_c_doc + cdef char* c_href + cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt + _Validator.__init__(self) + self._c_schema = NULL + fake_c_doc = NULL + 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 + 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: + 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: + if _isString(file): + filename = _encodeFilename(file) + self._error_log.connect() + parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename)) + else: + 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" + + 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( + 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() + + 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: + relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt) + _destroyFakeDoc(doc._c_doc, fake_c_doc) + raise RelaxNGParseError( + 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) + + def __dealloc__(self): + relaxng.xmlRelaxNGFree(self._c_schema) + + def __call__(self, etree): + u"""__call__(self, etree) + + Validate doc using Relax NG. + + Returns true if document is valid, false if not.""" + cdef _Document doc + cdef _Element root_node + cdef xmlDoc* c_doc + cdef relaxng.xmlRelaxNGValidCtxt* valid_ctxt + cdef int ret + + doc = _documentOrRaise(etree) + root_node = _rootNodeOrRaise(etree) + + self._error_log.connect() + valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema) + if valid_ctxt is NULL: + self._error_log.disconnect() + python.PyErr_NoMemory() + + 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) + + relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt) + + self._error_log.disconnect() + if ret == -1: + raise RelaxNGValidateError( + u"Internal error in Relax NG validation", + self._error_log) + if ret == 0: + return True + else: + return False diff --git a/src/lxml/sax.py b/src/lxml/sax.py new file mode 100644 index 0000000..53668f4 --- /dev/null +++ b/src/lxml/sax.py @@ -0,0 +1,238 @@ +""" +SAX-based adapter to copy trees from/to the Python standard library. + +Use the `ElementTreeContentHandler` class to build an ElementTree from +SAX events. + +Use the `ElementTreeProducer` class or the `saxify()` function to fire +the SAX events of an ElementTree against a SAX ContentHandler. + +See http://codespeak.net/lxml/sax.html +""" + +from xml.sax.handler import ContentHandler +from lxml import etree +from lxml.etree import ElementTree, SubElement +from lxml.etree import Comment, ProcessingInstruction + +class SaxError(etree.LxmlError): + """General SAX error. + """ + pass + +def _getNsTag(tag): + if tag[0] == '{': + return tuple(tag[1:].split('}', 1)) + else: + return (None, tag) + +class ElementTreeContentHandler(ContentHandler): + """Build an lxml ElementTree from SAX events. + """ + def __init__(self, makeelement=None): + self._root = None + self._root_siblings = [] + self._element_stack = [] + self._default_ns = None + self._ns_mapping = { None : [None] } + self._new_mappings = {} + if makeelement is None: + makeelement = etree.Element + self._makeelement = makeelement + + def _get_etree(self): + "Contains the generated ElementTree after parsing is finished." + return ElementTree(self._root) + + etree = property(_get_etree, doc=_get_etree.__doc__) + + def setDocumentLocator(self, locator): + pass + + def startDocument(self): + pass + + def endDocument(self): + pass + + def startPrefixMapping(self, prefix, uri): + self._new_mappings[prefix] = uri + try: + self._ns_mapping[prefix].append(uri) + except KeyError: + self._ns_mapping[prefix] = [uri] + if prefix is None: + self._default_ns = uri + + def endPrefixMapping(self, prefix): + ns_uri_list = self._ns_mapping[prefix] + ns_uri_list.pop() + if prefix is None: + self._default_ns = ns_uri_list[-1] + + def startElementNS(self, ns_name, qname, attributes=None): + ns_uri, local_name = ns_name + if ns_uri: + el_name = "{%s}%s" % ns_name + elif self._default_ns: + el_name = "{%s}%s" % (self._default_ns, local_name) + else: + el_name = local_name + + if attributes: + attrs = {} + try: + iter_attributes = attributes.iteritems() + except AttributeError: + iter_attributes = attributes.items() + + for name_tuple, value in iter_attributes: + if name_tuple[0]: + attr_name = "{%s}%s" % name_tuple + else: + attr_name = name_tuple[1] + attrs[attr_name] = value + else: + attrs = None + + element_stack = self._element_stack + if self._root is None: + element = self._root = \ + self._makeelement(el_name, attrs, self._new_mappings) + if self._root_siblings and hasattr(element, 'addprevious'): + for sibling in self._root_siblings: + element.addprevious(sibling) + del self._root_siblings[:] + else: + element = SubElement(element_stack[-1], el_name, + attrs, self._new_mappings) + element_stack.append(element) + + self._new_mappings.clear() + + def processingInstruction(self, target, data): + pi = ProcessingInstruction(target, data) + if self._root is None: + self._root_siblings.append(pi) + else: + self._element_stack[-1].append(pi) + + def endElementNS(self, ns_name, qname): + element = self._element_stack.pop() + if ns_name != _getNsTag(element.tag): + raise SaxError("Unexpected element closed: {%s}%s" % ns_name) + + def startElement(self, name, attributes=None): + self.startElementNS((None, name), name, attributes) + + def endElement(self, name): + self.endElementNS((None, name), name) + + def characters(self, data): + last_element = self._element_stack[-1] + try: + # if there already is a child element, we must append to its tail + last_element = last_element[-1] + last_element.tail = (last_element.tail or '') + data + except IndexError: + # otherwise: append to the text + last_element.text = (last_element.text or '') + data + + ignorableWhitespace = characters + + +class ElementTreeProducer(object): + """Produces SAX events for an element and children. + """ + def __init__(self, element_or_tree, content_handler): + try: + element = element_or_tree.getroot() + except AttributeError: + element = element_or_tree + self._element = element + self._content_handler = content_handler + from xml.sax.xmlreader import AttributesNSImpl as attr_class + self._attr_class = attr_class + self._empty_attributes = attr_class({}, {}) + + def saxify(self): + self._content_handler.startDocument() + + element = self._element + if hasattr(element, 'getprevious'): + siblings = [] + sibling = element.getprevious() + while getattr(sibling, 'tag', None) is ProcessingInstruction: + siblings.append(sibling) + sibling = sibling.getprevious() + for sibling in siblings[::-1]: + self._recursive_saxify(sibling, {}) + + self._recursive_saxify(element, {}) + + if hasattr(element, 'getnext'): + sibling = element.getnext() + while getattr(sibling, 'tag', None) is ProcessingInstruction: + self._recursive_saxify(sibling, {}) + sibling = sibling.getnext() + + self._content_handler.endDocument() + + def _recursive_saxify(self, element, prefixes): + content_handler = self._content_handler + tag = element.tag + if tag is Comment or tag is ProcessingInstruction: + if tag is ProcessingInstruction: + content_handler.processingInstruction( + element.target, element.text) + if element.tail: + content_handler.characters(element.tail) + return + + new_prefixes = [] + build_qname = self._build_qname + attribs = element.items() + if attribs: + attr_values = {} + attr_qnames = {} + for attr_ns_name, value in attribs: + attr_ns_tuple = _getNsTag(attr_ns_name) + attr_values[attr_ns_tuple] = value + attr_qnames[attr_ns_tuple] = build_qname( + attr_ns_tuple[0], attr_ns_tuple[1], prefixes, new_prefixes) + sax_attributes = self._attr_class(attr_values, attr_qnames) + else: + sax_attributes = self._empty_attributes + + ns_uri, local_name = _getNsTag(tag) + qname = build_qname(ns_uri, local_name, prefixes, new_prefixes) + + for prefix, uri in new_prefixes: + content_handler.startPrefixMapping(prefix, uri) + content_handler.startElementNS((ns_uri, local_name), + qname, sax_attributes) + if element.text: + content_handler.characters(element.text) + for child in element: + self._recursive_saxify(child, prefixes) + content_handler.endElementNS((ns_uri, local_name), qname) + for prefix, uri in new_prefixes: + content_handler.endPrefixMapping(prefix) + if element.tail: + content_handler.characters(element.tail) + + def _build_qname(self, ns_uri, local_name, prefixes, new_prefixes): + if ns_uri is None: + return local_name + try: + prefix = prefixes[ns_uri] + except KeyError: + prefix = prefixes[ns_uri] = 'ns%02d' % len(prefixes) + new_prefixes.append( (prefix, ns_uri) ) + return prefix + ':' + local_name + +def saxify(element_or_tree, content_handler): + """One-shot helper to generate SAX events from an XML tree and fire + them against a SAX ContentHandler. + """ + return ElementTreeProducer(element_or_tree, content_handler).saxify() diff --git a/src/lxml/saxparser.pxi b/src/lxml/saxparser.pxi new file mode 100644 index 0000000..f75ea7c --- /dev/null +++ b/src/lxml/saxparser.pxi @@ -0,0 +1,462 @@ +# SAX-like interfaces + +ctypedef enum _SaxParserEvents: + SAX_EVENT_START = 1 + SAX_EVENT_END = 2 + SAX_EVENT_DATA = 4 + SAX_EVENT_DOCTYPE = 8 + SAX_EVENT_PI = 16 + SAX_EVENT_COMMENT = 32 + +cdef class _SaxParserTarget: + cdef int _sax_event_filter + cdef int _sax_event_propagate + def __cinit__(self): + self._sax_event_filter = 0 + self._sax_event_propagate = 0 + + cdef _handleSaxStart(self, tag, attrib, nsmap): + return None + 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: + return 0 + cdef _handleSaxPi(self, target, data): + return None + cdef _handleSaxComment(self, comment): + return None + +cdef class _SaxParserContext(_ParserContext): + u"""This class maps SAX2 events to method calls. + """ + cdef _SaxParserTarget _target + cdef xmlparser.startElementNsSAX2Func _origSaxStart + cdef xmlparser.endElementNsSAX2Func _origSaxEnd + cdef xmlparser.startElementSAXFunc _origSaxStartNoNs + cdef xmlparser.endElementSAXFunc _origSaxEndNoNs + cdef xmlparser.charactersSAXFunc _origSaxData + cdef xmlparser.cdataBlockSAXFunc _origSaxCData + cdef xmlparser.internalSubsetSAXFunc _origSaxDoctype + cdef xmlparser.commentSAXFunc _origSaxComment + cdef xmlparser.processingInstructionSAXFunc _origSaxPi + + cdef void _setSaxParserTarget(self, _SaxParserTarget target): + self._target = target + + cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt): + 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: + # propagate => keep orig callback + self._origSaxStart = sax.startElementNs + self._origSaxStartNoNs = sax.startElement + 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: + # intercept => overwrite orig callback + if sax.initialized == xmlparser.XML_SAX2_MAGIC: + sax.startElementNs = _handleSaxStart + sax.startElement = _handleSaxStartNoNs + + if self._target._sax_event_propagate & SAX_EVENT_END: + self._origSaxEnd = sax.endElementNs + self._origSaxEndNoNs = sax.endElement + 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: + sax.endElementNs = _handleSaxEnd + sax.endElement = _handleSaxEndNoNs + + 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 + if self._target._sax_event_filter & SAX_EVENT_DATA: + sax.characters = _handleSaxData + sax.cdataBlock = _handleSaxCData + + # doctype propagation is always required for entity replacement + 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: + self._origSaxPi = sax.processingInstruction + else: + 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: + self._origSaxComment = sax.comment + else: + self._origSaxComment = sax.comment = NULL + if self._target._sax_event_filter & SAX_EVENT_COMMENT: + sax.comment = _handleSaxComment + + # enforce entity replacement + sax.reference = NULL + 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 + # stop parsing immediately + c_ctxt.wellFormed = 0 + c_ctxt.disableSAX = 1 + self._store_raised() + +cdef void _handleSaxStart(void* ctxt, char* c_localname, char* c_prefix, + char* c_namespace, int c_nb_namespaces, + char** c_namespaces, + int c_nb_attributes, int c_nb_defaulted, + char** c_attributes) with gil: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _Element element + cdef int i + c_ctxt = ctxt + 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, + 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: + # 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 + else: + attrib = {} + 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: + value = u'' + else: + value = '' + else: + value = python.PyUnicode_DecodeUTF8( + c_attributes[3], c_attributes[4] - c_attributes[3], + "strict") + attrib[name] = value + c_attributes += 5 + if c_nb_namespaces == 0: + nsmap = EMPTY_READ_ONLY_DICT + else: + nsmap = {} + for i from 0 <= i < c_nb_namespaces: + if c_namespaces[0] is NULL: + prefix = None + else: + 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: + if c_ctxt.input.line < 65535: + element._c_node.line = c_ctxt.input.line + else: + element._c_node.line = 65535 + except: + context._handleSaxException(c_ctxt) + +cdef void _handleSaxStartNoNs(void* ctxt, char* c_name, + char** c_attributes) with gil: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + cdef _Element element + c_ctxt = ctxt + 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) + try: + tag = funicode(c_name) + if c_attributes is NULL: + attrib = EMPTY_READ_ONLY_DICT + else: + attrib = {} + while c_attributes[0] is not NULL: + name = funicode(c_attributes[0]) + if c_attributes[1] is NULL: + if python.IS_PYTHON3: + value = u'' + else: + value = '' + else: + value = funicode(c_attributes[1]) + c_attributes = c_attributes + 2 + 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: + element._c_node.line = c_ctxt.input.line + else: + element._c_node.line = 65535 + except: + context._handleSaxException(c_ctxt) + +cdef void _handleSaxEnd(void* ctxt, char* c_localname, char* c_prefix, + char* c_namespace) with gil: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + c_ctxt = ctxt + 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) + try: + tag = _namespacedNameFromNsName(c_namespace, c_localname) + context._target._handleSaxEnd(tag) + except: + context._handleSaxException(c_ctxt) + +cdef void _handleSaxEndNoNs(void* ctxt, char* c_name) with gil: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + c_ctxt = ctxt + if c_ctxt._private is NULL: + return + context = <_SaxParserContext>c_ctxt._private + if context._origSaxEndNoNs is not NULL: + context._origSaxEndNoNs(c_ctxt, c_name) + try: + context._target._handleSaxEnd(funicode(c_name)) + except: + 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 + c_ctxt = ctxt + 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) + try: + context._target._handleSaxData( + 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: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + c_ctxt = ctxt + 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) + try: + context._target._handleSaxData( + python.PyUnicode_DecodeUTF8(c_data, data_len, NULL)) + except: + context._handleSaxException(c_ctxt) + +cdef void _handleSaxDoctype(void* ctxt, char* c_name, char* c_public, + char* c_system) with gil: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + c_ctxt = ctxt + 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) + try: + 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( + 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: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + c_ctxt = ctxt + 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) + try: + if c_data is not NULL: + data = funicode(c_data) + context._target._handleSaxPi(funicode(c_target), data) + except: + context._handleSaxException(c_ctxt) + +cdef void _handleSaxComment(void* ctxt, char* c_data) with gil: + cdef _SaxParserContext context + cdef xmlparser.xmlParserCtxt* c_ctxt + c_ctxt = ctxt + if c_ctxt._private is NULL: + return + context = <_SaxParserContext>c_ctxt._private + if context._origSaxComment is not NULL: + context._origSaxComment(c_ctxt, c_data) + try: + context._target._handleSaxComment(funicode(c_data)) + except: + context._handleSaxException(c_ctxt) + + +############################################################ +## ET compatible XML tree builder +############################################################ + +cdef class TreeBuilder(_SaxParserTarget): + u"""TreeBuilder(self, element_factory=None, parser=None) + Parser target that builds a tree. + + The final tree is returned by the ``close()`` method. + """ + cdef _BaseParser _parser + cdef object _factory + cdef list _data + cdef list _element_stack + cdef object _element_stack_pop + cdef _Element _last + 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 | \ + 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 + 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 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)" + self._last.tail = text + else: + assert self._last.text is None, u"internal error (text)" + self._last.text = text + del self._data[:] + return 0 + + # Python level event handlers + + def close(self): + u"""close(self) + + Flushes the builder buffers, and returns the toplevel document + 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 + + def data(self, data): + u"""data(self, data) + + Adds text to the current element. The value should be either an + 8-bit string containing ASCII text, or a Unicode string. + """ + self._handleSaxData(data) + + def start(self, tag, attrs, nsmap=None): + u"""start(self, tag, attrs, nsmap=None) + + Opens a new element. + """ + if nsmap is None: + nsmap = EMPTY_READ_ONLY_DICT + return self._handleSaxStart(tag, attrs, nsmap) + + def end(self, tag): + u"""end(self, tag) + + Closes the current element. + """ + element = self._handleSaxEnd(tag) + assert self._last.tag == tag,\ + u"end tag mismatch (expected %s, got %s)" % ( + self._last.tag, tag) + return element + + def pi(self, target, data): + u"""pi(self, target, data) + """ + return self._handleSaxPi(target, data) + + def comment(self, comment): + u"""comment(self, comment) + """ + return self._handleSaxComment(comment) + + # internal SAX event handlers + + 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: + _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: + 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 + + cdef _handleSaxEnd(self, tag): + self._flush() + self._last = self._element_stack_pop() + self._in_tail = 1 + return self._last + + cdef int _handleSaxData(self, data) except -1: + self._data.append(data) + + 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) + self._in_tail = 1 + return self._last + + 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) + self._in_tail = 1 + return self._last diff --git a/src/lxml/schematron.pxd b/src/lxml/schematron.pxd new file mode 100644 index 0000000..ac7d17a --- /dev/null +++ b/src/lxml/schematron.pxd @@ -0,0 +1,34 @@ +cimport tree, xmlerror +from tree cimport xmlDoc, xmlDtd + +cdef extern from "libxml/schematron.h": + ctypedef struct xmlSchematron + ctypedef struct xmlSchematronParserCtxt + ctypedef struct xmlSchematronValidCtxt + + ctypedef enum xmlSchematronValidOptions: + XML_SCHEMATRON_OUT_QUIET = 1 # quiet no report + XML_SCHEMATRON_OUT_TEXT = 2 # build a textual report + XML_SCHEMATRON_OUT_XML = 4 # output SVRL + XML_SCHEMATRON_OUT_ERROR = 8 # output via xmlStructuredErrorFunc + XML_SCHEMATRON_OUT_FILE = 256 # output to a file descriptor + XML_SCHEMATRON_OUT_BUFFER = 512 # output to a buffer + XML_SCHEMATRON_OUT_IO = 1024 # output to I/O mechanism + + cdef xmlSchematronParserCtxt* xmlSchematronNewDocParserCtxt( + xmlDoc* doc) nogil + cdef xmlSchematronParserCtxt* xmlSchematronNewParserCtxt( + char* filename) nogil + cdef xmlSchematronValidCtxt* xmlSchematronNewValidCtxt( + xmlSchematron* schema, int options) nogil + + cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) nogil + cdef int xmlSchematronValidateDoc(xmlSchematronValidCtxt* ctxt, + xmlDoc* instance) nogil + + cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) nogil + cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) nogil + cdef void xmlSchematronFree(xmlSchematron* schema) nogil + cdef void xmlSchematronSetValidStructuredErrors( + xmlSchematronValidCtxt* ctxt, + xmlerror.xmlStructuredErrorFunc error_func, void *data) diff --git a/src/lxml/schematron.pxi b/src/lxml/schematron.pxi new file mode 100644 index 0000000..0291c8f --- /dev/null +++ b/src/lxml/schematron.pxi @@ -0,0 +1,176 @@ +# support for Schematron validation +cimport schematron + +class SchematronError(LxmlError): + u"""Base class of all Schematron errors. + """ + pass + +class SchematronParseError(SchematronError): + u"""Error while parsing an XML document as Schematron schema. + """ + pass + +class SchematronValidateError(SchematronError): + u"""Error while validating an XML document with a Schematron schema. + """ + pass + +################################################################################ +# Schematron + +cdef class Schematron(_Validator): + u"""Schematron(self, etree=None, file=None) + A Schematron validator. + + Pass a root Element or an ElementTree to turn it into a validator. + Alternatively, pass a filename as keyword argument 'file' to parse from + the file system. + + Schematron is a less well known, but very powerful schema language. The main + idea is to use the capabilities of XPath to put restrictions on the structure + and the content of XML documents. Here is a simple example:: + + >>> schematron = etree.Schematron(etree.XML(''' + ... + ... + ... + ... Attribute + ... is forbidden + ... + ... + ... + ... + ... ''')) + + >>> xml = etree.XML(''' + ... + ... + ... + ... + ... ''') + + >>> schematron.validate(xml) + 0 + + >>> xml = etree.XML(''' + ... + ... + ... + ... + ... ''') + + >>> schematron.validate(xml) + 1 + + Schematron was added to libxml2 in version 2.6.21. Before version 2.6.32, + however, Schematron lacked support for error reporting other than to stderr. + This version is therefore required to retrieve validation warnings and + errors in lxml. + """ + cdef schematron.xmlSchematron* _c_schema + cdef xmlDoc* _c_schema_doc + def __init__(self, etree=None, *, file=None): + cdef _Document doc + cdef _Element root_node + cdef xmlNode* c_node + cdef char* c_href + cdef schematron.xmlSchematronParserCtxt* parser_ctxt + self._c_schema = NULL + self._c_schema_doc = NULL + _Validator.__init__(self) + if not config.ENABLE_SCHEMATRON: + raise SchematronError, \ + 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) + self._error_log.connect() + parser_ctxt = schematron.xmlSchematronNewDocParserCtxt( + self._c_schema_doc) + elif file is not None: + filename = _getFilenameForFile(file) + if filename is None: + # XXX assume a string object + filename = file + filename = _encodeFilename(filename) + self._error_log.connect() + parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename)) + else: + 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: + tree.xmlFreeDoc(self._c_schema_doc) + self._c_schema_doc = NULL + python.PyErr_NoMemory() + return + + self._c_schema = schematron.xmlSchematronParse(parser_ctxt) + self._error_log.disconnect() + + schematron.xmlSchematronFreeParserCtxt(parser_ctxt) + if self._c_schema is NULL: + raise SchematronParseError( + u"Document is not a valid Schematron schema", + self._error_log) + + 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 ... + if self._c_schema_doc is not NULL: + tree.xmlFreeDoc(self._c_schema_doc) + + def __call__(self, etree): + u"""__call__(self, etree) + + Validate doc using Schematron. + + Returns true if document is valid, false if not.""" + cdef _Document doc + cdef _Element root_node + cdef xmlDoc* c_doc + cdef schematron.xmlSchematronValidCtxt* valid_ctxt + cdef int ret + cdef int options + + doc = _documentOrRaise(etree) + root_node = _rootNodeOrRaise(etree) + + 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 + # hack to switch off stderr output + options = options | schematron.XML_SCHEMATRON_OUT_XML + + valid_ctxt = schematron.xmlSchematronNewValidCtxt( + self._c_schema, options) + if valid_ctxt is NULL: + return python.PyErr_NoMemory() + + self._error_log.connect() + if _LIBXML_VERSION_INT >= 20632: + schematron.xmlSchematronSetValidStructuredErrors( + valid_ctxt, _receiveError, 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) + self._error_log.disconnect() + + schematron.xmlSchematronFreeValidCtxt(valid_ctxt) + + if ret == -1: + raise SchematronValidateError( + u"Internal error in Schematron validation", + self._error_log) + if ret == 0: + return True + else: + return False diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi new file mode 100644 index 0000000..84a189d --- /dev/null +++ b/src/lxml/serializer.pxi @@ -0,0 +1,495 @@ +# XML serialization and output functions + +class SerialisationError(LxmlError): + u"""A libxml2 error that occurred during serialisation. + """ + +cdef enum _OutputMethods: + OUTPUT_METHOD_XML + OUTPUT_METHOD_HTML + OUTPUT_METHOD_TEXT + +cdef int _findOutputMethod(method) except -1: + if method is None: + return OUTPUT_METHOD_XML + method = method.lower() + if method == u"xml": + return OUTPUT_METHOD_XML + if method == u"html": + return OUTPUT_METHOD_HTML + 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): + cdef bint needs_conversion + cdef char* c_text + cdef xmlNode* c_text_node + cdef tree.xmlBuffer* c_buffer + cdef int error_result + + c_buffer = tree.xmlBufferCreate() + if c_buffer is NULL: + return python.PyErr_NoMemory() + + 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: + 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: + tree.xmlBufferFree(c_buffer) + raise SerialisationError, u"Error during serialisation (out of memory?)" + + try: + needs_conversion = 0 + if encoding is _unicode: + needs_conversion = 1 + elif encoding is not None: + encoding = encoding.upper() + if encoding != u'UTF-8': + if encoding == u'ASCII': + if isutf8(c_text): + # will raise a decode error below + needs_conversion = 1 + else: + needs_conversion = 1 + + if needs_conversion: + text = python.PyUnicode_DecodeUTF8( + c_text, tree.xmlBufferLength(c_buffer), 'strict') + if encoding is not _unicode: + encoding = _utf8(encoding) + text = python.PyUnicode_AsEncodedString( + text, encoding, 'strict') + else: + text = c_text + finally: + tree.xmlBufferFree(c_buffer) + return text + + +cdef _tostring(_Element element, encoding, method, + bint write_xml_declaration, bint write_complete_document, + bint pretty_print, bint with_tail, int standalone): + u"""Serialize an element to an encoded string representation of its XML + tree. + """ + cdef tree.xmlOutputBuffer* c_buffer + cdef tree.xmlBuffer* c_result_buffer + cdef tree.xmlCharEncodingHandler* enchandler + cdef char* c_enc + cdef char* c_version + cdef int c_method + cdef int error_result + if element is None: + return None + 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 + else: + encoding = _utf8(encoding) + c_enc = _cstr(encoding) + # 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: + 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) + return python.PyErr_NoMemory() + + with nogil: + _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_method, + 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 + else: + c_result_buffer = c_buffer.buffer + + error_result = c_buffer.error + if error_result != xmlerror.XML_ERR_OK: + tree.xmlOutputBufferClose(c_buffer) + _raiseSerialisationError(error_result) + + try: + if encoding is _unicode: + result = python.PyUnicode_DecodeUTF8( + tree.xmlBufferContent(c_result_buffer), + tree.xmlBufferLength(c_result_buffer), + 'strict') + else: + result = python.PyString_FromStringAndSize( + tree.xmlBufferContent(c_result_buffer), + tree.xmlBufferLength(c_result_buffer)) + finally: + error_result = tree.xmlOutputBufferClose(c_buffer) + if error_result < 0: + _raiseSerialisationError(error_result) + return result + +cdef _raiseSerialisationError(int error_result): + if error_result == xmlerror.XML_ERR_NO_MEMORY: + return python.PyErr_NoMemory() + else: + message = ErrorTypes._getName(error_result) + if message is None: + message = u"unknown error %d" % error_result + raise SerialisationError, message + +############################################################ +# low-level serialisation functions + +cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer, + xmlNode* c_node, char* encoding, int c_method, + bint write_xml_declaration, + bint write_complete_document, + bint pretty_print, bint with_tail, + int standalone) nogil: + 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) + + # write internal DTD subset, preceding PIs/comments, etc. + if write_complete_document: + _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding) + _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 + # 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 + _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 + + # write node + if c_method == OUTPUT_METHOD_XML: + tree.xmlNodeDumpOutput( + c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding) + else: + tree.htmlNodeDumpFormatOutput( + c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print) + + if c_nsdecl_node is not c_node: + # clean up + c_nsdecl_node.children = c_nsdecl_node.last = NULL + tree.xmlFreeNode(c_nsdecl_node) + + # 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) + if pretty_print: + tree.xmlOutputBufferWrite(c_buffer, 1, "\n") + +cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer, + char* version, char* encoding, + int standalone) nogil: + if version is NULL: + version = "1.0" + tree.xmlOutputBufferWrite(c_buffer, 15, "\n") + elif standalone == 1: + tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n") + else: + tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n") + +cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer, + xmlDoc* c_doc, char* c_root_name, + char* encoding) nogil: + 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 + if cstd.strcmp(c_root_name, c_dtd.name) != 0: + return + tree.xmlOutputBufferWrite(c_buffer, 10, "\n') + return + tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n') + if c_dtd.notations != NULL: + tree.xmlDumpNotationTable(c_buffer.buffer, + 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 + 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." + 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) + 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 + 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 + 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: + 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 + +cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node, + 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 + 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: + tree.xmlOutputBufferWriteString(c_buffer, "\n") + tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0, + pretty_print, encoding) + c_sibling = c_sibling.next + +############################################################ +# output to file-like objects + +cdef class _FilelikeWriter: + cdef object _filelike + cdef object _close_filelike + cdef _ExceptionContext _exc_context + cdef _ErrorLog error_log + def __init__(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 + self._filelike = filelike + if exc_context is None: + self._exc_context = _ExceptionContext() + else: + self._exc_context = exc_context + self.error_log = _ErrorLog() + + cdef tree.xmlOutputBuffer* _createOutputBuffer( + self, tree.xmlCharEncodingHandler* enchandler) except NULL: + cdef tree.xmlOutputBuffer* c_buffer + c_buffer = tree.xmlOutputBufferCreateIO( + _writeFilelikeWriter, _closeFilelikeWriter, + self, enchandler) + 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): + try: + if self._filelike is None: + raise IOError, u"File is already closed" + py_buffer = python.PyString_FromStringAndSize(c_buffer, size) + self._filelike.write(py_buffer) + return size + except: + self._exc_context._store_raised() + return -1 + + 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 + self._filelike = None + return 0 + except: + self._exc_context._store_raised() + return -1 + +cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int len): + return (<_FilelikeWriter>ctxt).write(c_buffer, len) + +cdef int _closeFilelikeWriter(void* ctxt): + return (<_FilelikeWriter>ctxt).close() + +cdef _tofilelike(f, _Element element, encoding, method, + bint write_xml_declaration, bint write_doctype, + bint pretty_print, bint with_tail, int standalone, + int compression): + cdef python.PyThreadState* state = NULL + cdef _FilelikeWriter writer + cdef tree.xmlOutputBuffer* c_buffer + cdef tree.xmlCharEncodingHandler* enchandler + cdef char* c_enc + cdef int error_result + if encoding is None: + c_enc = NULL + else: + encoding = _utf8(encoding) + c_enc = _cstr(encoding) + c_method = _findOutputMethod(method) + if c_method == OUTPUT_METHOD_TEXT: + 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) + try: + gzip_file.write(data) + finally: + gzip_file.close() + data = bytes_out + if _isString(f): + filename8 = _encodeFilename(f) + f = open(filename8, u'wb') + try: + f.write(data) + finally: + f.close() + else: + f.write(data) + return + 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 + + if _isString(f): + filename8 = _encodeFilename(f) + c_buffer = tree.xmlOutputBufferCreateFilename( + _cstr(filename8), enchandler, compression) + if c_buffer is NULL: + return python.PyErr_SetFromErrno(IOError) + state = python.PyEval_SaveThread() + elif hasattr(f, u'write'): + writer = _FilelikeWriter(f, compression=compression) + c_buffer = writer._createOutputBuffer(enchandler) + else: + 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_method, + 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) + if error_result > 0: + error_result = xmlerror.XML_ERR_OK + else: + tree.xmlOutputBufferClose(c_buffer) + if writer is None: + python.PyEval_RestoreThread(state) + else: + 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, + int compression): + cdef _FilelikeWriter writer + cdef tree.xmlOutputBuffer* c_buffer + cdef char* c_filename + cdef xmlDoc* c_base_doc + cdef xmlDoc* c_doc + cdef int bytes = -1 + + c_base_doc = element._c_node.doc + c_doc = _fakeRootDoc(c_base_doc, element._c_node) + try: + if _isString(f): + filename8 = _encodeFilename(f) + c_filename = _cstr(filename8) + 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) + c_buffer = writer._createOutputBuffer(NULL) + writer.error_log.connect() + bytes = c14n.xmlC14NDocSaveTo(c_doc, NULL, exclusive, NULL, + with_comments, c_buffer) + writer.error_log.disconnect() + if bytes >= 0: + bytes = tree.xmlOutputBufferClose(c_buffer) + else: + tree.xmlOutputBufferClose(c_buffer) + else: + raise TypeError, \ + u"File or filename expected, got '%s'" % funicode(python._fqtypename(f)) + finally: + _destroyFakeDoc(c_base_doc, c_doc) + + if writer is not None: + writer._exc_context._raise_if_stored() + + if bytes < 0: + message = u"C14N failed" + if writer is not None: + errors = writer.error_log + if len(errors): + message = errors[0].message + raise C14NError, message + +# 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 + 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) + if with_tail: + _writeTail(c_buffer, c_node, NULL, 0) + if not pretty_print: + # not written yet + tree.xmlOutputBufferWriteString(c_buffer, '\n') + tree.xmlOutputBufferFlush(c_buffer) diff --git a/src/lxml/tests/__init__.py b/src/lxml/tests/__init__.py new file mode 100644 index 0000000..85dfe70 --- /dev/null +++ b/src/lxml/tests/__init__.py @@ -0,0 +1,4 @@ +""" +The lxml test suite for lxml, ElementTree and cElementTree. +""" + diff --git a/src/lxml/tests/common_imports.py b/src/lxml/tests/common_imports.py new file mode 100644 index 0000000..f0387af --- /dev/null +++ b/src/lxml/tests/common_imports.py @@ -0,0 +1,219 @@ +import unittest +import os.path +import re, gc, sys + +from lxml import etree + +def make_version_tuple(version_string): + l = [] + for part in re.findall('([0-9]+|[^0-9.]+)', version_string): + try: + l.append(int(part)) + except ValueError: + l.append(part) + return tuple(l) + +try: + from elementtree import ElementTree # standard ET +except ImportError: + try: + from xml.etree import ElementTree # Python 2.5+ + except ImportError: + ElementTree = None + +if hasattr(ElementTree, 'VERSION'): + if make_version_tuple(ElementTree.VERSION)[:2] < (1,3): + # compatibility tests require ET 1.3+ + ElementTree = None + +try: + import cElementTree # standard ET +except ImportError: + try: + from xml.etree import cElementTree # Python 2.5+ + except ImportError: + cElementTree = None + +if hasattr(cElementTree, 'VERSION'): + if make_version_tuple(cElementTree.VERSION)[:2] <= (1,0): + # compatibility tests do not run with cET 1.0.7 + cElementTree = None + +try: + import doctest + # check if the system version has everything we need + doctest.DocFileSuite + doctest.DocTestParser + doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS +except (ImportError, AttributeError): + # we need our own version to make it work (Python 2.3?) + import local_doctest as doctest + +try: + sorted +except NameError: + def sorted(seq, **kwargs): + seq = list(seq) + seq.sort(**kwargs) + return seq +else: + locals()['sorted'] = sorted + +def _get_caller_relative_path(filename, frame_depth=2): + module = sys.modules[sys._getframe(frame_depth).f_globals['__name__']] + return os.path.normpath(os.path.join( + os.path.dirname(getattr(module, '__file__', '')), filename)) + +if sys.version_info[0] >= 3: + # Python 3 + unicode = str + def _str(s, encoding="UTF-8"): + return s + def _bytes(s, encoding="UTF-8"): + return s.encode(encoding) + from io import StringIO, BytesIO as _BytesIO + def BytesIO(*args): + if args and isinstance(args[0], str): + args = (args[0].encode("UTF-8"),) + return _BytesIO(*args) + + doctest_parser = doctest.DocTestParser() + _fix_unicode = re.compile(r'(\s+)u(["\'])').sub + _fix_exceptions = re.compile(r'(.*except [^(]*),\s*(.*:)').sub + def make_doctest(filename): + filename = _get_caller_relative_path(filename) + doctests = open(filename).read() + doctests = _fix_unicode(r'\1\2', doctests) + doctests = _fix_exceptions(r'\1 as \2', doctests) + return doctest.DocTestCase( + doctest_parser.get_doctest( + doctests, {}, os.path.basename(filename), filename, 0)) +else: + # Python 2 + def _str(s, encoding="UTF-8"): + return unicode(s, encoding=encoding) + def _bytes(s, encoding="UTF-8"): + return s + from StringIO import StringIO + BytesIO = StringIO + + doctest_parser = doctest.DocTestParser() + _fix_traceback = re.compile(r'^(\s*)(?:\w+\.)+(\w*(?:Error|Exception|Invalid):)', re.M).sub + _fix_exceptions = re.compile(r'(.*except [^(]*)\s+as\s+(.*:)').sub + _fix_bytes = re.compile(r'(\s+)b(["\'])').sub + def make_doctest(filename): + filename = _get_caller_relative_path(filename) + doctests = open(filename).read() + doctests = _fix_traceback(r'\1\2', doctests) + doctests = _fix_exceptions(r'\1, \2', doctests) + doctests = _fix_bytes(r'\1\2', doctests) + return doctest.DocTestCase( + doctest_parser.get_doctest( + doctests, {}, os.path.basename(filename), filename, 0)) + +class HelperTestCase(unittest.TestCase): + def tearDown(self): + gc.collect() + + def parse(self, text, parser=None): + f = BytesIO(text) + return etree.parse(f, parser=parser) + + def _rootstring(self, tree): + return etree.tostring(tree.getroot()).replace( + _bytes(' '), _bytes('')).replace(_bytes('\n'), _bytes('')) + + # assertFalse doesn't exist in Python 2.3 + try: + unittest.TestCase.assertFalse + except AttributeError: + assertFalse = unittest.TestCase.failIf + +class SillyFileLike: + def __init__(self, xml_data=_bytes('')): + self.xml_data = xml_data + + def read(self, amount=None): + if self.xml_data: + if amount: + data = self.xml_data[:amount] + self.xml_data = self.xml_data[amount:] + else: + data = self.xml_data + self.xml_data = _bytes('') + return data + return _bytes('') + +class LargeFileLike: + def __init__(self, charlen=100, depth=4, children=5): + self.data = BytesIO() + self.chars = _bytes('a') * charlen + self.children = range(children) + self.more = self.iterelements(depth) + + def iterelements(self, depth): + yield _bytes('') + depth -= 1 + if depth > 0: + for child in self.children: + for element in self.iterelements(depth): + yield element + yield self.chars + else: + yield self.chars + yield _bytes('') + + def read(self, amount=None): + data = self.data + append = data.write + if amount: + for element in self.more: + append(element) + if data.tell() >= amount: + break + else: + for element in self.more: + append(element) + result = data.getvalue() + data.seek(0) + data.truncate() + if amount: + append(result[amount:]) + result = result[:amount] + return result + +class LargeFileLikeUnicode(LargeFileLike): + def __init__(self, charlen=100, depth=4, children=5): + LargeFileLike.__init__(self, charlen, depth, children) + self.data = StringIO() + self.chars = _str('a') * charlen + self.more = self.iterelements(depth) + + def iterelements(self, depth): + yield _str('') + depth -= 1 + if depth > 0: + for child in self.children: + for element in self.iterelements(depth): + yield element + yield self.chars + else: + yield self.chars + yield _str('') + +def fileInTestDir(name): + _testdir = os.path.dirname(__file__) + return os.path.join(_testdir, name) + +def canonicalize(xml): + f = BytesIO(xml) + tree = etree.parse(f) + f = BytesIO() + tree.write_c14n(f) + return f.getvalue() + +def unentitify(xml): + for entity_name, value in re.findall("(&#([0-9]+);)", xml): + xml = xml.replace(entity_name, unichr(int(value))) + return xml diff --git a/src/lxml/tests/css_shakespear.html b/src/lxml/tests/css_shakespear.html new file mode 100644 index 0000000..821ca6a --- /dev/null +++ b/src/lxml/tests/css_shakespear.html @@ -0,0 +1,526 @@ + + + + + + + + + +
+
+

As You Like It

+
+ + by William Shakespeare + + +
+
+ +

ACT I, SCENE III. A room in the palace.

+ +
+
Enter CELIA and ROSALIND
+ +
+ +
CELIA
+ +
+
Why, cousin! why, Rosalind! Cupid have mercy! not a word?
+ +
+ +
ROSALIND
+ +
+
Not one to throw at a dog.
+ +
+ +
CELIA
+ +
+
No, thy words are too precious to be cast away upon
+ +
curs; throw some of them at me; come, lame me with reasons.
+ +
+ +
ROSALIND
+ +
CELIA
+ +
+
But is all this for your father?
+ +
+ +
+
Then there were two cousins laid up; when the one
+
should be lamed with reasons and the other mad
+ +
without any.
+
+ +
ROSALIND
+ +
+
No, some of it is for my child's father. O, how
+ +
full of briers is this working-day world!
+ +
+ +
CELIA
+ +
+ +
They are but burs, cousin, thrown upon thee in
+
holiday foolery: if we walk not in the trodden
+ +
paths our very petticoats will catch them.
+ +
+ +
ROSALIND
+ +
+
I could shake them off my coat: these burs are in my heart.
+
+ +
CELIA
+ +
+
Hem them away.
+ +
+ +
ROSALIND
+ +
+ +
I would try, if I could cry 'hem' and have him.
+
+ +
CELIA
+ +
+
Come, come, wrestle with thy affections.
+ +
+ +
ROSALIND
+
+
O, they take the part of a better wrestler than myself!
+ +
+ +
CELIA
+ +
+ +
O, a good wish upon you! you will try in time, in
+
despite of a fall. But, turning these jests out of
+
service, let us talk in good earnest: is it
+ +
possible, on such a sudden, you should fall into so
+ +
strong a liking with old Sir Rowland's youngest son?
+ +
+ +
ROSALIND
+
+
The duke my father loved his father dearly.
+ +
+ +
CELIA
+ +
+ +
Doth it therefore ensue that you should love his son
+ +
dearly? By this kind of chase, I should hate him,
+ +
for my father hated his father dearly; yet I hate
+ +
not Orlando.
+ +
+ +
ROSALIND
+ +
+ +
No, faith, hate him not, for my sake.
+ +
+ +
CELIA
+ +
+
Why should I not? doth he not deserve well?
+ +
+ +
ROSALIND
+ +
+
Let me love him for that, and do you love him
+
because I do. Look, here comes the duke.
+
+ +
CELIA
+ +
+ +
With his eyes full of anger.
+
Enter DUKE FREDERICK, with Lords
+
+ +
DUKE FREDERICK
+ +
+ +
Mistress, dispatch you with your safest haste
+ +
And get you from our court.
+
+ +
ROSALIND
+ +
+ +
Me, uncle?
+ +
+ +
DUKE FREDERICK
+
+
You, cousin
+ +
Within these ten days if that thou be'st found
+ +
So near our public court as twenty miles,
+ +
Thou diest for it.
+ +
+ +
ROSALIND
+ +
+ +
I do beseech your grace,
+ +
Let me the knowledge of my fault bear with me:
+
If with myself I hold intelligence
+ +
Or have acquaintance with mine own desires,
+ +
If that I do not dream or be not frantic,--
+ +
As I do trust I am not--then, dear uncle,
+ +
Never so much as in a thought unborn
+ +
Did I offend your highness.
+ +
+ +
DUKE FREDERICK
+ +
+
Thus do all traitors:
+ +
If their purgation did consist in words,
+ +
They are as innocent as grace itself:
+ +
Let it suffice thee that I trust thee not.
+ +
+ +
ROSALIND
+ +
+ +
Yet your mistrust cannot make me a traitor:
+ +
Tell me whereon the likelihood depends.
+ +
+ +
DUKE FREDERICK
+
+ +
Thou art thy father's daughter; there's enough.
+ +
+ +
ROSALIND
+ +
+
So was I when your highness took his dukedom;
+
So was I when your highness banish'd him:
+ +
Treason is not inherited, my lord;
+ +
Or, if we did derive it from our friends,
+ +
What's that to me? my father was no traitor:
+ +
Then, good my liege, mistake me not so much
+
To think my poverty is treacherous.
+ +
+ +
CELIA
+
+ +
Dear sovereign, hear me speak.
+ +
+ +
DUKE FREDERICK
+ +
+
Ay, Celia; we stay'd her for your sake,
+
Else had she with her father ranged along.
+ +
+ +
CELIA
+ +
+ +
I did not then entreat to have her stay;
+
It was your pleasure and your own remorse:
+
I was too young that time to value her;
+ +
But now I know her: if she be a traitor,
+ +
Why so am I; we still have slept together,
+ +
Rose at an instant, learn'd, play'd, eat together,
+
And wheresoever we went, like Juno's swans,
+ +
Still we went coupled and inseparable.
+
+ +
DUKE FREDERICK
+ +
+
She is too subtle for thee; and her smoothness,
+
Her very silence and her patience
+
Speak to the people, and they pity her.
+
Thou art a fool: she robs thee of thy name;
+ +
And thou wilt show more bright and seem more virtuous
+ +
When she is gone. Then open not thy lips:
+
Firm and irrevocable is my doom
+
Which I have pass'd upon her; she is banish'd.
+
+ +
CELIA
+ +
+
Pronounce that sentence then on me, my liege:
+
I cannot live out of her company.
+
+ +
DUKE FREDERICK
+ +
+
You are a fool. You, niece, provide yourself:
+ +
If you outstay the time, upon mine honour,
+
And in the greatness of my word, you die.
+
Exeunt DUKE FREDERICK and Lords
+
+ +
CELIA
+
+ +
O my poor Rosalind, whither wilt thou go?
+ +
Wilt thou change fathers? I will give thee mine.
+
I charge thee, be not thou more grieved than I am.
+ +
+ +
ROSALIND
+ +
+ +
I have more cause.
+
+ +
CELIA
+ +
+
Thou hast not, cousin;
+ +
Prithee be cheerful: know'st thou not, the duke
+ +
Hath banish'd me, his daughter?
+ +
+ +
ROSALIND
+
+
That he hath not.
+ +
+ +
CELIA
+ +
+ +
No, hath not? Rosalind lacks then the love
+ +
Which teacheth thee that thou and I am one:
+
Shall we be sunder'd? shall we part, sweet girl?
+ +
No: let my father seek another heir.
+ +
Therefore devise with me how we may fly,
+ +
Whither to go and what to bear with us;
+
And do not seek to take your change upon you,
+
To bear your griefs yourself and leave me out;
+ +
For, by this heaven, now at our sorrows pale,
+ +
Say what thou canst, I'll go along with thee.
+ +
+ +
ROSALIND
+
+ +
Why, whither shall we go?
+ +
+ +
CELIA
+ +
+
To seek my uncle in the forest of Arden.
+
+ +
ROSALIND
+ +
+ +
Alas, what danger will it be to us,
+ +
Maids as we are, to travel forth so far!
+
Beauty provoketh thieves sooner than gold.
+ +
+ +
CELIA
+ +
+
I'll put myself in poor and mean attire
+ +
And with a kind of umber smirch my face;
+
The like do you: so shall we pass along
+ +
And never stir assailants.
+ +
+ +
ROSALIND
+
+ +
Were it not better,
+ +
Because that I am more than common tall,
+ +
That I did suit me all points like a man?
+ +
A gallant curtle-axe upon my thigh,
+ +
A boar-spear in my hand; and--in my heart
+ +
Lie there what hidden woman's fear there will--
+ +
We'll have a swashing and a martial outside,
+ +
As many other mannish cowards have
+ +
That do outface it with their semblances.
+ +
+ +
CELIA
+ +
+ +
What shall I call thee when thou art a man?
+
+ +
ROSALIND
+ +
+
I'll have no worse a name than Jove's own page;
+ +
And therefore look you call me Ganymede.
+ +
But what will you be call'd?
+ +
+ +
CELIA
+ +
+ +
Something that hath a reference to my state
+
No longer Celia, but Aliena.
+ +
+ +
ROSALIND
+
+ +
But, cousin, what if we assay'd to steal
+ +
The clownish fool out of your father's court?
+ +
Would he not be a comfort to our travel?
+ +
+ +
CELIA
+ +
+ +
He'll go along o'er the wide world with me;
+ +
Leave me alone to woo him. Let's away,
+
And get our jewels and our wealth together,
+ +
Devise the fittest time and safest way
+ +
To hide us from pursuit that will be made
+ +
After my flight. Now go we in content
+ +
To liberty and not to banishment.
+
Exeunt
+ +
+ +
+
+
+ + + \ No newline at end of file diff --git a/src/lxml/tests/include/test_xinclude.xml b/src/lxml/tests/include/test_xinclude.xml new file mode 100644 index 0000000..1cc05cf --- /dev/null +++ b/src/lxml/tests/include/test_xinclude.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/lxml/tests/test-document.xslt b/src/lxml/tests/test-document.xslt new file mode 100644 index 0000000..5d80c4b --- /dev/null +++ b/src/lxml/tests/test-document.xslt @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/src/lxml/tests/test-string.xml b/src/lxml/tests/test-string.xml new file mode 100644 index 0000000..25ae180 --- /dev/null +++ b/src/lxml/tests/test-string.xml @@ -0,0 +1,2 @@ + +Søk på nettet diff --git a/src/lxml/tests/test.dtd b/src/lxml/tests/test.dtd new file mode 100644 index 0000000..c0e98a8 --- /dev/null +++ b/src/lxml/tests/test.dtd @@ -0,0 +1,9 @@ + + + + + diff --git a/src/lxml/tests/test.xml b/src/lxml/tests/test.xml new file mode 100644 index 0000000..2eccc29 --- /dev/null +++ b/src/lxml/tests/test.xml @@ -0,0 +1,2 @@ + + diff --git a/src/lxml/tests/test.xsd b/src/lxml/tests/test.xsd new file mode 100644 index 0000000..9a085b3 --- /dev/null +++ b/src/lxml/tests/test.xsd @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/lxml/tests/test1.rng b/src/lxml/tests/test1.rng new file mode 100644 index 0000000..bef4d00 --- /dev/null +++ b/src/lxml/tests/test1.rng @@ -0,0 +1,6 @@ + + + + + diff --git a/src/lxml/tests/test1.xslt b/src/lxml/tests/test1.xslt new file mode 100644 index 0000000..f25763e --- /dev/null +++ b/src/lxml/tests/test1.xslt @@ -0,0 +1,9 @@ + + + + +

Foo

+
+ +
diff --git a/src/lxml/tests/test2.rng b/src/lxml/tests/test2.rng new file mode 100644 index 0000000..f6d0389 --- /dev/null +++ b/src/lxml/tests/test2.rng @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/lxml/tests/test2.xslt b/src/lxml/tests/test2.xslt new file mode 100644 index 0000000..5c01e21 --- /dev/null +++ b/src/lxml/tests/test2.xslt @@ -0,0 +1,8 @@ + + + +

hello

+
+ +
diff --git a/src/lxml/tests/test_broken.xml b/src/lxml/tests/test_broken.xml new file mode 100644 index 0000000..3dd455a --- /dev/null +++ b/src/lxml/tests/test_broken.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lxml/tests/test_classlookup.py b/src/lxml/tests/test_classlookup.py new file mode 100644 index 0000000..81bed54 --- /dev/null +++ b/src/lxml/tests/test_classlookup.py @@ -0,0 +1,215 @@ +# -*- coding: utf-8 -*- + +""" +Tests for different Element class lookup mechanisms. +""" + + +import unittest, doctest, operator, os.path, sys + +this_dir = os.path.dirname(__file__) +if this_dir not in sys.path: + sys.path.insert(0, this_dir) # needed for Py3 + +from common_imports import etree, HelperTestCase, SillyFileLike, fileInTestDir +from common_imports import canonicalize, _bytes, _str, BytesIO, StringIO + +xml_str = _bytes('''\ + + + 0 + 1 + 2 + +''') + +class ClassLookupTestCase(HelperTestCase): + """Test cases for different Element class lookup mechanisms. + """ + etree = etree + + def tearDown(self): + etree.set_element_class_lookup() + super(ClassLookupTestCase, self).tearDown() + + def test_namespace_lookup(self): + class TestElement(etree.ElementBase): + FIND_ME = "namespace class" + + lookup = etree.ElementNamespaceClassLookup() + etree.set_element_class_lookup(lookup) + + ns = lookup.get_namespace("myNS") + ns[None] = TestElement + + root = etree.XML(xml_str) + self.assertEquals(root.FIND_ME, + TestElement.FIND_ME) + self.assertEquals(root[0].FIND_ME, + TestElement.FIND_ME) + self.assertFalse(hasattr(root[0][-1], 'FIND_ME')) + + def test_default_class_lookup(self): + class TestElement(etree.ElementBase): + FIND_ME = "default element" + class TestComment(etree.CommentBase): + FIND_ME = "default comment" + class TestPI(etree.PIBase): + FIND_ME = "default pi" + + parser = etree.XMLParser() + + lookup = etree.ElementDefaultClassLookup( + element=TestElement, comment=TestComment, pi=TestPI) + parser.set_element_class_lookup(lookup) + + root = etree.XML(_bytes(""" + + + + + """), parser) + + self.assertEquals("default element", root.FIND_ME) + self.assertEquals("default pi", root[0].FIND_ME) + self.assertEquals("default comment", root[1].FIND_ME) + + def test_attribute_based_lookup(self): + class TestElement(etree.ElementBase): + FIND_ME = "attribute_based" + + class_dict = {"A1" : TestElement} + + lookup = etree.AttributeBasedElementClassLookup( + "a1", class_dict) + etree.set_element_class_lookup(lookup) + + root = etree.XML(xml_str) + self.assertFalse(hasattr(root, 'FIND_ME')) + self.assertEquals(root[0].FIND_ME, + TestElement.FIND_ME) + self.assertFalse(hasattr(root[0][0], 'FIND_ME')) + + def test_custom_lookup(self): + class TestElement(etree.ElementBase): + FIND_ME = "custom" + + class MyLookup(etree.CustomElementClassLookup): + def lookup(self, t, d, ns, name): + if name == 'c1': + return TestElement + + etree.set_element_class_lookup( MyLookup() ) + + root = etree.XML(xml_str) + self.assertFalse(hasattr(root, 'FIND_ME')) + self.assertEquals(root[0].FIND_ME, + TestElement.FIND_ME) + self.assertFalse(hasattr(root[0][1], 'FIND_ME')) + + def test_custom_lookup_ns_fallback(self): + class TestElement1(etree.ElementBase): + FIND_ME = "custom" + + class TestElement2(etree.ElementBase): + FIND_ME = "nsclasses" + + class MyLookup(etree.CustomElementClassLookup): + def lookup(self, t, d, ns, name): + if name == 'c1': + return TestElement1 + + lookup = etree.ElementNamespaceClassLookup( MyLookup() ) + etree.set_element_class_lookup(lookup) + + ns = lookup.get_namespace("otherNS") + ns[None] = TestElement2 + + root = etree.XML(xml_str) + self.assertFalse(hasattr(root, 'FIND_ME')) + self.assertEquals(root[0].FIND_ME, + TestElement1.FIND_ME) + self.assertFalse(hasattr(root[0][1], 'FIND_ME')) + self.assertEquals(root[0][-1].FIND_ME, + TestElement2.FIND_ME) + + def test_parser_based_lookup(self): + class TestElement(etree.ElementBase): + FIND_ME = "parser_based" + + lookup = etree.ParserBasedElementClassLookup() + etree.set_element_class_lookup(lookup) + + class MyLookup(etree.CustomElementClassLookup): + def lookup(self, t, d, ns, name): + return TestElement + + parser = etree.XMLParser() + parser.set_element_class_lookup( MyLookup() ) + + root = etree.parse(BytesIO(xml_str), parser).getroot() + self.assertEquals(root.FIND_ME, + TestElement.FIND_ME) + self.assertEquals(root[0].FIND_ME, + TestElement.FIND_ME) + + root = etree.parse(BytesIO(xml_str)).getroot() + self.assertFalse(hasattr(root, 'FIND_ME')) + self.assertFalse(hasattr(root[0], 'FIND_ME')) + + def test_class_lookup_reentry(self): + XML = self.etree.XML + + class TestElement(etree.ElementBase): + FIND_ME = "here" + + root = None + class MyLookup(etree.CustomElementClassLookup): + el = None + def lookup(self, t, d, ns, name): + if root is not None: # not in the parser + if self.el is None and name == "a": + self.el = [] + self.el.append(root.find(name)) + return TestElement + + parser = self.etree.XMLParser() + parser.set_element_class_lookup(MyLookup()) + + root = XML(_bytes('AB'), + parser) + + a = root[0] + self.assertEquals(a.tag, "a") + self.assertEquals(root[0].tag, "a") + del a + self.assertEquals(root[0].tag, "a") + + def test_lookup_without_fallback(self): + class Lookup(etree.CustomElementClassLookup): + def __init__(self): + # no super call here, so no fallback is set + pass + + def lookup(self, node_type, document, namespace, name): + return Foo + + class Foo(etree.ElementBase): + def custom(self): + return "test" + + parser = self.etree.XMLParser() + parser.set_element_class_lookup( Lookup() ) + + root = etree.XML('', parser) + + self.assertEquals("test", root.custom()) + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTests([unittest.makeSuite(ClassLookupTestCase)]) + return suite + +if __name__ == '__main__': + print('to test use test.py %s' % __file__) diff --git a/src/lxml/tests/test_css.py b/src/lxml/tests/test_css.py new file mode 100644 index 0000000..a3cfdc7 --- /dev/null +++ b/src/lxml/tests/test_css.py @@ -0,0 +1,133 @@ +import unittest, sys +from lxml.tests.common_imports import doctest, make_doctest, HelperTestCase +from lxml import html +from lxml import cssselect +import os + +doc_fn = os.path.join(os.path.dirname(__file__), + 'css_shakespear.html') + +try: + basestring = __builtins__['basestring'] +except (NameError, KeyError): + basestring = (str, bytes) + +# Data borrowed from http://mootools.net/slickspeed/ + +class CSSTestCase(HelperTestCase): + + selectors = [ + ## Changed from original; probably because I'm only searching the body + #('*', 252), + ('*', 246), + ('div:only-child', 22), # ? + ## Changed from original, because the original doesn't make sense. + ## There really aren't that many occurrances of 'celia' + #('div:contains(CELIA)', 243), + ('div:contains(CELIA)', 30), + ('div:nth-child(even)', 106), + ('div:nth-child(2n)', 106), + ('div:nth-child(odd)', 137), + ('div:nth-child(2n+1)', 137), + ('div:nth-child(n)', 243), + ('div:last-child', 53), + ('div:first-child', 51), + ('div > div', 242), + ('div + div', 190), + ('div ~ div', 190), + ('body', 1), + ('body div', 243), + ('div', 243), + ('div div', 242), + ('div div div', 241), + ('div, div, div', 243), + ('div, a, span', 243), + ('.dialog', 51), + ('div.dialog', 51), + ('div .dialog', 51), + ('div.character, div.dialog', 99), + ('div.direction.dialog', 0), + ('div.dialog.direction', 0), + ('div.dialog.scene', 1), + ('div.scene.scene', 1), + ('div.scene .scene', 0), + ('div.direction .dialog ', 0), + ('div .dialog .direction', 4), + ('div.dialog .dialog .direction', 4), + ('#speech5', 1), + ('div#speech5', 1), + ('div #speech5', 1), + ('div.scene div.dialog', 49), + ('div#scene1 div.dialog div', 142), + ('#scene1 #speech1', 1), + ('div[class]', 103), + ('div[class=dialog]', 50), + ('div[class^=dia]', 51), + ('div[class$=log]', 50), + ('div[class*=sce]', 1), + ('div[class|=dialog]', 50), # ? Seems right + ('div[class!=madeup]', 243), # ? Seems right + ('div[class~=dialog]', 51), # ? Seems right + ] + + def __init__(self, index): + self.index = index + super(HelperTestCase, self).__init__() + + def all(cls): + for i in range(len(cls.selectors)): + yield cls(i) + all = classmethod(all) + + def runTest(self): + f = open(doc_fn, 'rb') + c = f.read() + f.close() + doc = html.document_fromstring(c) + body = doc.xpath('//body')[0] + bad = [] + selector, count = self.selectors[self.index] + xpath = cssselect.css_to_xpath(cssselect.parse(selector)) + try: + results = body.xpath(xpath) + except Exception: + e = sys.exc_info()[1] + e.args = ("%s for xpath %r" % (e, xpath)) + raise + found = {} + for item in results: + if item in found: + assert 0, ( + "Element shows up multiple times: %r" % item) + found[item] = None + if isinstance(results, basestring): + assert 0, ( + "Got string result (%r), not element, for xpath %r" + % (results[:20], str(xpath))) + if len(results) != count: + #if self.shortDescription() == 'div.character, div.dialog': + # import pdb; pdb.set_trace() + assert 0, ( + "Did not get expected results (%s) instead %s for xpath %r" + % (count, len(results), str(xpath))) + + def shortDescription(self): + return self.selectors[self.index][0] + +def unique(s): + found = {} + result = [] + for item in s: + if item in found: + continue + found[item] = None + result.append(s) + return result + +def test_suite(): + suite = unittest.TestSuite() + if sys.version_info >= (2,4): + suite.addTests([make_doctest('test_css_select.txt')]) + suite.addTests([make_doctest('test_css.txt')]) + suite.addTests(list(CSSTestCase.all())) + return suite diff --git a/src/lxml/tests/test_css.txt b/src/lxml/tests/test_css.txt new file mode 100644 index 0000000..08ac4b7 --- /dev/null +++ b/src/lxml/tests/test_css.txt @@ -0,0 +1,185 @@ +A quick test of tokenizing: + + >>> from lxml.cssselect import tokenize, parse + >>> def ptok(s): + ... for item in tokenize(s): + ... print(repr(item).replace("u'", "'")) + >>> ptok('E > f[a~="y\\"x"]') + Symbol('E', 0) + Token('>', 2) + Symbol('f', 4) + Token('[', 5) + Symbol('a', 6) + Token('~=', 7) + String('y"x', 9) + Token(']', 15) + +Then of parsing: + + >>> parse('td.foo, .bar') + Or([Class[Element[td].foo], CombinedSelector[Element[*] Class[Element[*].bar]]]) + >>> parse('div, td.foo, div.bar span') + Or([Element[div], Class[Element[td].foo], CombinedSelector[Class[Element[div].bar] Element[span]]]) + >>> parse('div > p') + CombinedSelector[Element[div] > Element[p]] + >>> parse('td:first') + Pseudo[Element[td]:first] + >>> parse('a[name]') + Attrib[Element[a][name]] + >>> repr(parse('a[rel="include"]')).replace("u'", "'") + "Attrib[Element[a][rel = String('include', 6)]]" + >>> repr(parse('a[hreflang |= \'en\']')).replace("u'", "'") + "Attrib[Element[a][hreflang |= String('en', 14)]]" + >>> parse('div:nth-child(10)') + Function[Element[div]:nth-child(10)] + >>> parse('div:nth-of-type(10)') + Function[Element[div]:nth-of-type(10)] + >>> parse('div div:nth-of-type(10) .aclass') + CombinedSelector[CombinedSelector[Element[div] Function[Element[div]:nth-of-type(10)]] Class[Element[*].aclass]] + >>> parse('label:only') + Pseudo[Element[label]:only] + >>> parse('a:lang(fr)') + Function[Element[a]:lang(Element[fr])] + >>> repr(parse('div:contains("foo")')).replace("u'", "'") + "Function[Element[div]:contains(String('foo', 13))]" + >>> parse('div#foobar') + Hash[Element[div]#foobar] + >>> parse('div:not(div.foo)') + Function[Element[div]:not(Class[Element[div].foo])] + >>> parse('td ~ th') + CombinedSelector[Element[td] ~ Element[th]] + +Some parse error tests: + + >>> try: parse('attributes(href)/html/body/a') + ... except: # Py2, Py3, ... + ... import sys + ... print(str(sys.exc_info()[1]).replace("(u'", "('")) + Expected selector, got '(' at [Symbol('attributes', 0)] -> Token('(', 10) + +Now of translation: + + >>> def xpath(css): + ... print(parse(css).xpath()) + >>> xpath('*') + * + >>> xpath('E') + e + >>> xpath('E[foo]') + e[@foo] + >>> xpath('E[foo="bar"]') + e[@foo = 'bar'] + >>> xpath('E[foo~="bar"]') + e[contains(concat(' ', normalize-space(@foo), ' '), ' bar ')] + >>> xpath('E[foo^="bar"]') + e[starts-with(@foo, 'bar')] + >>> xpath('E[foo$="bar"]') + e[substring(@foo, string-length(@foo)-2) = 'bar'] + >>> xpath('E[foo*="bar"]') + e[contains(@foo, 'bar')] + >>> xpath('E[hreflang|="en"]') + e[@hreflang = 'en' or starts-with(@hreflang, 'en-')] + >>> #xpath('E:root') + >>> xpath('E:nth-child(1)') + */*[name() = 'e' and (position() = 1)] + >>> xpath('E:nth-last-child(1)') + */*[name() = 'e' and (position() = last() - 1)] + >>> xpath('E:nth-last-child(2n+2)') + */*[name() = 'e' and ((position() +2) mod -2 = 0 and position() < (last() -2))] + >>> xpath('E:nth-of-type(1)') + */e[position() = 1] + >>> xpath('E:nth-last-of-type(1)') + */e[position() = last() - 1] + >>> xpath('E:nth-last-of-type(1)') + */e[position() = last() - 1] + >>> xpath('div E:nth-last-of-type(1) .aclass') + div/descendant::e[position() = last() - 1]/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' aclass ')] + >>> xpath('E:first-child') + */*[name() = 'e' and (position() = 1)] + >>> xpath('E:last-child') + */*[name() = 'e' and (position() = last())] + >>> xpath('E:first-of-type') + */e[position() = 1] + >>> xpath('E:last-of-type') + */e[position() = last()] + >>> xpath('E:only-child') + */*[name() = 'e' and (last() = 1)] + >>> xpath('E:only-of-type') + e[last() = 1] + >>> xpath('E:empty') + e[not(*) and not(normalize-space())] + >>> xpath('E:contains("foo")') + e[contains(css:lower-case(string(.)), 'foo')] + >>> xpath('E.warning') + e[contains(concat(' ', normalize-space(@class), ' '), ' warning ')] + >>> xpath('E#myid') + e[@id = 'myid'] + >>> xpath('E:not(:contains("foo"))') + e[not(contains(css:lower-case(string(.)), 'foo'))] + >>> xpath('E F') + e/descendant::f + >>> xpath('E > F') + e/f + >>> xpath('E + F') + e/following-sibling::*[name() = 'f' and (position() = 1)] + >>> xpath('E ~ F') + e/following-sibling::f + >>> xpath('div#container p') + div[@id = 'container']/descendant::p + >>> xpath('p *:only-of-type') + Traceback (most recent call last): + ... + NotImplementedError: *:only-of-type is not implemented + +Now a Unicode character test: + + >>> from lxml.cssselect import css_to_xpath + >>> import sys + >>> if sys.version_info[0] >= 3: + ... css_expr = '.a\xc1b' + ... else: + ... css_expr = '.a\xc1b'.decode('ISO-8859-1') + + >>> xpath_expr = css_to_xpath(css_expr) + >>> print( css_expr[1:] in xpath_expr ) + True + >>> print( xpath_expr.encode('ascii', 'xmlcharrefreplace').decode('ASCII') ) + descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' aÁb ')] + +And some special character tests: + + >>> print( css_to_xpath('*[aval="\'"]') ) + descendant-or-self::*[@aval = "'"] + >>> print( css_to_xpath('*[aval="\'\'\'"]') ) + descendant-or-self::*[@aval = "'''"] + >>> print( css_to_xpath('*[aval=\'"\']') ) + descendant-or-self::*[@aval = '"'] + >>> print( css_to_xpath('*[aval=\'"""\']') ) + descendant-or-self::*[@aval = '"""'] + +Some Unicode escape tests (including the trailing whitespace rules): + + >>> print( css_to_xpath(r'*[aval="\'\22\'"]') ) # \22 == '"' + descendant-or-self::*[@aval = concat("'",'"',"'")] + >>> print( css_to_xpath(r'*[aval="\'\22 2\'"]') ) + descendant-or-self::*[@aval = concat("'",'"2',"'")] + >>> print( css_to_xpath(r'*[aval="\'\20 \'"]') ) # \20 == ' ' + descendant-or-self::*[@aval = "' '"] + >>> print( css_to_xpath('*[aval="\'\\20\r\n \'"]') ) + descendant-or-self::*[@aval = "' '"] + +Then some test for parse_series: + + >>> from lxml.cssselect import parse_series + >>> parse_series('1n+3') + (1, 3) + >>> parse_series('n-5') + (1, -5) + >>> parse_series('odd') + (2, 1) + >>> parse_series('3n') + (3, 0) + >>> parse_series('n') + (1, 0) + >>> parse_series('5') + (0, 5) diff --git a/src/lxml/tests/test_css_select.txt b/src/lxml/tests/test_css_select.txt new file mode 100644 index 0000000..cc50ebf --- /dev/null +++ b/src/lxml/tests/test_css_select.txt @@ -0,0 +1,150 @@ +This is a test of CSS selectors. We setup a document we'll use for +all our selections, and a function make querying simpler: + + >>> from lxml.cssselect import CSSSelector + >>> from lxml.etree import HTML + >>> doc = HTML(''' + ... + ...
+ ... + ... + ... link + ...
    + ...
  1. content
  2. + ...
  3. + ...
    + ...
    + ...
  4. + ...
  5. + ...
  6. + ...
  7. + ...
  8. + ...
  9. + ...
+ ...

+ ... hi there + ... guy

+ ...
    + ...
+ ...
+ ...
+ ... ''') + >>> order = {} + >>> for count, el in enumerate(doc.getiterator()): + ... order[el] = count + >>> def select_ids(selector): + ... items = CSSSelector(selector)(doc) + ... if not items: + ... return 'empty' + ... items = CSSSelector(selector)(doc) + ... items.sort(key=lambda el: order[el]) + ... return ', '.join([el.get('id', 'nil') for el in items]) + >>> def pcss(main, *selectors): + ... result = select_ids(main) + ... for selector in selectors: + ... sel_result = select_ids(selector) + ... if sel_result != result: + ... print('Selector %r returns %s' % (selector, sel_result)) + ... print(result) + +Now, the tests: + + >>> pcss('*') # doctest: +ELLIPSIS + nil, nil, nil, outer-div, ... foobar-span + >>> pcss('div') + outer-div, li-div, foobar-div + >>> pcss('a[name]') + name-anchor + >>> pcss('a[rel]') + tag-anchor, nofollow-anchor + >>> pcss('a[rel="tag"]') + tag-anchor + >>> pcss('a[href*="localhost"]') + tag-anchor + >>> pcss('a[href^="http"]') + tag-anchor, nofollow-anchor + >>> pcss('a[href^="http:"]') + tag-anchor + >>> pcss('a[href$="org"]') + nofollow-anchor + >>> pcss('div[foobar~="bc"]', 'div[foobar~="cde"]') + foobar-div + >>> pcss('div[foobar~="cd"]') + empty + >>> pcss('*[lang|="en"]', '*[lang|="en-US"]') + second-li + >>> pcss('*[lang|="e"]') + empty + >>> pcss('li:nth-child(3)') + third-li + >>> pcss('li:nth-child(10)') + empty + >>> pcss('li:nth-child(2n)', 'li:nth-child(even)', 'li:nth-child(2n+0)') + second-li, fourth-li, sixth-li + >>> pcss('li:nth-child(+2n+1)', 'li:nth-child(odd)') + first-li, third-li, fifth-li, seventh-li + >>> pcss('li:nth-child(2n+4)') + fourth-li, sixth-li + >>> # FIXME: I'm not 100% sure this is right: + >>> pcss('li:nth-child(3n+1)') + first-li, fourth-li, seventh-li + >>> # FIXME: I'm not sure if nth-last-child(1) or nth-last-child(1) + >>> # should be equivalent to nth-last-child() + >>> pcss('li:nth-last-child()', 'li:nth-last-child(0)') + seventh-li + >>> pcss('li:nth-last-child(2n)', 'li:nth-last-child(even)') + second-li, fourth-li, sixth-li + >>> pcss('li:nth-last-child(2n+2)') + second-li, fourth-li + >>> pcss('ol:first-of-type') + first-ol + >>> pcss('ol:nth-child(1)') + empty + >>> pcss('ol:nth-of-type(2)') + second-ol + >>> # FIXME: like above, (1) or (2)? + >>> pcss('ol:nth-last-of-type(1)') + first-ol + >>> pcss('span:only-child') + foobar-span + >>> pcss('li div:only-child') + li-div + >>> pcss('div *:only-child') + foobar-span + >>> pcss('p *:only-of-type') + Traceback (most recent call last): + ... + NotImplementedError: *:only-of-type is not implemented + >>> pcss('p:only-of-type') + paragraph + >>> pcss('a:empty') + name-anchor + >>> pcss('li:empty') + third-li, fourth-li, fifth-li, sixth-li, seventh-li + >>> pcss('*:contains("link")') + nil, nil, outer-div, tag-anchor, nofollow-anchor + >>> pcss('*:contains("E")') + nil, nil, outer-div, first-ol, first-li, paragraph, p-em + >>> pcss('.a', '.b', '*.a', 'ol.a') + first-ol + >>> pcss('.c', '*.c') + first-ol, third-li, fourth-li + >>> pcss('ol *.c', 'ol li.c', 'li ~ li.c', 'ol > li.c') + third-li, fourth-li + >>> pcss('#first-li', 'li#first-li', '*#first-li') + first-li + >>> # Need some tests of :not() + >>> pcss('li div', 'li > div', 'div div') + li-div + >>> pcss('div > div') + empty + >>> pcss('div + div') + foobar-div + >>> pcss('a ~ a') + tag-anchor, nofollow-anchor + >>> pcss('a[rel="tag"] ~ a') + nofollow-anchor + >>> pcss('ol#first-ol li:last-child', 'ol#first-ol *:last-child') + seventh-li diff --git a/src/lxml/tests/test_dtd.py b/src/lxml/tests/test_dtd.py new file mode 100644 index 0000000..0cb034d --- /dev/null +++ b/src/lxml/tests/test_dtd.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- + +""" +Test cases related to DTD parsing and validation +""" + +import unittest, sys, os.path + +this_dir = os.path.dirname(__file__) +if this_dir not in sys.path: + sys.path.insert(0, this_dir) # needed for Py3 + +from common_imports import etree, StringIO, BytesIO, _bytes, doctest +from common_imports import HelperTestCase, fileInTestDir, make_doctest + +class ETreeDtdTestCase(HelperTestCase): + def test_dtd(self): + pass + + def test_dtd_file(self): + parse = etree.parse + tree = parse(fileInTestDir("test.xml")) + root = tree.getroot() + + dtd = etree.DTD(fileInTestDir("test.dtd")) + self.assert_(dtd.validate(root)) + + def test_dtd_stringio(self): + root = etree.XML(_bytes("")) + dtd = etree.DTD(BytesIO("")) + self.assert_(dtd.validate(root)) + + def test_dtd_parse_invalid(self): + fromstring = etree.fromstring + parser = etree.XMLParser(dtd_validation=True) + xml = _bytes('' % fileInTestDir("test.dtd")) + self.assertRaises(etree.XMLSyntaxError, + fromstring, xml, parser=parser) + + def test_dtd_parse_file_not_found(self): + fromstring = etree.fromstring + dtd_filename = fileInTestDir("__nosuch.dtd") + parser = etree.XMLParser(dtd_validation=True) + xml = _bytes('' % dtd_filename) + self.assertRaises(etree.XMLSyntaxError, + fromstring, xml, parser=parser) + errors = None + try: + fromstring(xml, parser=parser) + except etree.XMLSyntaxError: + e = sys.exc_info()[1] + errors = [ entry.message for entry in e.error_log + if dtd_filename in entry.message ] + self.assert_(errors) + + def test_dtd_parse_valid(self): + parser = etree.XMLParser(dtd_validation=True) + xml = '' % fileInTestDir("test.dtd") + root = etree.fromstring(xml, parser=parser) + + def test_dtd_parse_valid_relative(self): + parser = etree.XMLParser(dtd_validation=True) + xml = '' + root = etree.fromstring(xml, parser=parser, + base_url=fileInTestDir("test.xml")) + + def test_dtd_invalid(self): + root = etree.XML("") + dtd = etree.DTD(BytesIO("")) + self.assertRaises(etree.DocumentInvalid, dtd.assertValid, root) + + def test_dtd_assertValid(self): + root = etree.XML("") + dtd = etree.DTD(BytesIO("")) + dtd.assertValid(root) + + def test_dtd_internal(self): + root = etree.XML(_bytes(''' + + + ]> + + ''')) + dtd = etree.ElementTree(root).docinfo.internalDTD + self.assert_(dtd) + dtd.assertValid(root) + + def test_dtd_internal_invalid(self): + root = etree.XML(_bytes(''' + + + + ]> + + ''')) + dtd = etree.ElementTree(root).docinfo.internalDTD + self.assert_(dtd) + self.assertFalse(dtd.validate(root)) + + def test_dtd_broken(self): + self.assertRaises(etree.DTDParseError, etree.DTD, + BytesIO("")) + + def test_parse_file_dtd(self): + parser = etree.XMLParser(attribute_defaults=True) + + tree = etree.parse(fileInTestDir('test.xml'), parser) + root = tree.getroot() + + self.assertEquals( + "valueA", + root.get("default")) + self.assertEquals( + "valueB", + root[0].get("default")) + + def test_iterparse_file_dtd(self): + iterparse = etree.iterparse + iterator = iterparse(fileInTestDir("test.xml"), events=("start",), + attribute_defaults=True) + attributes = [ element.get("default") + for event, element in iterator ] + self.assertEquals( + ["valueA", "valueB"], + attributes) + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTests([unittest.makeSuite(ETreeDtdTestCase)]) + suite.addTests( + [make_doctest('../../../doc/validation.txt')]) + return suite + +if __name__ == '__main__': + print('to test use test.py %s' % __file__) diff --git a/src/lxml/tests/test_elementtree.py b/src/lxml/tests/test_elementtree.py new file mode 100644 index 0000000..115261d --- /dev/null +++ b/src/lxml/tests/test_elementtree.py @@ -0,0 +1,3707 @@ +# -*- coding: utf-8 -*- + +""" +Tests for the ElementTree API + +Only test cases that apply equally well to etree and ElementTree +belong here. Note that there is a second test module called test_io.py +for IO related test cases. +""" + +import unittest +import os, re, tempfile, copy, operator, gc, sys + +this_dir = os.path.dirname(__file__) +if this_dir not in sys.path: + sys.path.insert(0, this_dir) # needed for Py3 + +from common_imports import StringIO, BytesIO, etree, ElementTree, cElementTree +from common_imports import fileInTestDir, canonicalize, HelperTestCase +from common_imports import _str, _bytes + +if cElementTree is not None: + if tuple([int(n) for n in + getattr(cElementTree, "VERSION", "0.0").split(".")]) <= (1,0,7): + cElementTree = None + +try: + reversed +except NameError: + # Python 2.3 + def reversed(seq): + seq = list(seq)[::-1] + return seq + +class ETreeTestCaseBase(HelperTestCase): + etree = None + + def test_element(self): + for i in range(10): + e = self.etree.Element('foo') + self.assertEquals(e.tag, 'foo') + self.assertEquals(e.text, None) + self.assertEquals(e.tail, None) + + def test_simple(self): + Element = self.etree.Element + + root = Element('root') + root.append(Element('one')) + root.append(Element('two')) + root.append(Element('three')) + self.assertEquals(3, len(root)) + self.assertEquals('one', root[0].tag) + self.assertEquals('two', root[1].tag) + self.assertEquals('three', root[2].tag) + self.assertRaises(IndexError, operator.getitem, root, 3) + + # test weird dictionary interaction leading to segfault previously + def test_weird_dict_interaction(self): + root = self.etree.Element('root') + self.assertEquals(root.tag, "root") + add = self.etree.ElementTree(file=BytesIO('Foo')) + self.assertEquals(add.getroot().tag, "foo") + self.assertEquals(add.getroot().text, "Foo") + root.append(self.etree.Element('baz')) + self.assertEquals(root.tag, "root") + self.assertEquals(root[0].tag, "baz") + + def test_subelement(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + root = Element('root') + SubElement(root, 'one') + SubElement(root, 'two') + SubElement(root, 'three') + self.assertEquals(3, len(root)) + self.assertEquals('one', root[0].tag) + self.assertEquals('two', root[1].tag) + self.assertEquals('three', root[2].tag) + + def test_element_contains(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + root1 = Element('root') + SubElement(root1, 'one') + self.assert_(root1[0] in root1) + + root2 = Element('root') + SubElement(root2, 'two') + SubElement(root2, 'three') + self.assert_(root2[0] in root2) + self.assert_(root2[1] in root2) + + self.assertFalse(root1[0] in root2) + self.assertFalse(root2[0] in root1) + self.assertFalse(None in root2) + + def test_element_indexing_with_text(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('TestOne') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(1, len(root)) + self.assertEquals('one', root[0].tag) + self.assertRaises(IndexError, operator.getitem, root, 1) + + def test_element_indexing_with_text2(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('OneTwohmThree') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(3, len(root)) + self.assertEquals('one', root[0].tag) + self.assertEquals('two', root[1].tag) + self.assertEquals('three', root[2].tag) + + def test_element_indexing_only_text(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('Test') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(0, len(root)) + + def test_element_indexing_negative(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + self.assertEquals(d, a[-1]) + self.assertEquals(c, a[-2]) + self.assertEquals(b, a[-3]) + self.assertRaises(IndexError, operator.getitem, a, -4) + a[-1] = e = Element('e') + self.assertEquals(e, a[-1]) + del a[-1] + self.assertEquals(2, len(a)) + + def test_elementtree(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('OneTwo') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(2, len(root)) + self.assertEquals('one', root[0].tag) + self.assertEquals('two', root[1].tag) + + def test_text(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('This is a text') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals('This is a text', root.text) + + def test_text_empty(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(None, root.text) + + def test_text_other(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('One') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(None, root.text) + self.assertEquals('One', root[0].text) + + def test_text_escape_in(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('This is > than a text') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals('This is > than a text', root.text) + + def test_text_escape_out(self): + Element = self.etree.Element + + a = Element("a") + a.text = "<>&" + self.assertXML(_bytes('<>&'), + a) + + def test_text_escape_tostring(self): + tostring = self.etree.tostring + Element = self.etree.Element + + a = Element("a") + a.text = "<>&" + self.assertEquals(_bytes('<>&'), + tostring(a)) + + def test_text_str_subclass(self): + Element = self.etree.Element + + class strTest(str): + pass + + a = Element("a") + a.text = strTest("text") + self.assertXML(_bytes('text'), + a) + + def test_tail(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('This is mixed content.') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals(1, len(root)) + self.assertEquals('This is ', root.text) + self.assertEquals(None, root.tail) + self.assertEquals('mixed', root[0].text) + self.assertEquals(' content.', root[0].tail) + + def test_tail_str_subclass(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + class strTest(str): + pass + + a = Element("a") + SubElement(a, "t").tail = strTest("tail") + self.assertXML(_bytes('tail'), + a) + + def _test_del_tail(self): + # this is discouraged for ET compat, should not be tested... + XML = self.etree.XML + + root = XML(_bytes('This is mixed content.')) + self.assertEquals(1, len(root)) + self.assertEquals('This is ', root.text) + self.assertEquals(None, root.tail) + self.assertEquals('mixed', root[0].text) + self.assertEquals(' content.', root[0].tail) + + del root[0].tail + + self.assertEquals(1, len(root)) + self.assertEquals('This is ', root.text) + self.assertEquals(None, root.tail) + self.assertEquals('mixed', root[0].text) + self.assertEquals(None, root[0].tail) + + root[0].tail = "TAIL" + + self.assertEquals(1, len(root)) + self.assertEquals('This is ', root.text) + self.assertEquals(None, root.tail) + self.assertEquals('mixed', root[0].text) + self.assertEquals('TAIL', root[0].tail) + + def test_ElementTree(self): + Element = self.etree.Element + ElementTree = self.etree.ElementTree + + el = Element('hoi') + doc = ElementTree(el) + root = doc.getroot() + self.assertEquals(None, root.text) + self.assertEquals('hoi', root.tag) + + def test_attributes(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals('One', root.attrib['one']) + self.assertEquals('Two', root.attrib['two']) + self.assertRaises(KeyError, operator.getitem, root.attrib, 'three') + + def test_attributes2(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals('One', root.attrib.get('one')) + self.assertEquals('Two', root.attrib.get('two')) + self.assertEquals(None, root.attrib.get('three')) + self.assertEquals('foo', root.attrib.get('three', 'foo')) + + def test_attributes3(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals('One', root.get('one')) + self.assertEquals('Two', root.get('two')) + self.assertEquals(None, root.get('three')) + self.assertEquals('foo', root.get('three', 'foo')) + + def test_attrib_clear(self): + XML = self.etree.XML + + root = XML(_bytes('')) + self.assertEquals('One', root.get('one')) + self.assertEquals('Two', root.get('two')) + root.attrib.clear() + self.assertEquals(None, root.get('one')) + self.assertEquals(None, root.get('two')) + + def test_attrib_set_clear(self): + Element = self.etree.Element + + root = Element("root", one="One") + root.set("two", "Two") + self.assertEquals('One', root.get('one')) + self.assertEquals('Two', root.get('two')) + root.attrib.clear() + self.assertEquals(None, root.get('one')) + self.assertEquals(None, root.get('two')) + + def test_attrib_ns_clear(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + attribNS = '{http://foo/bar}x' + + parent = Element('parent') + parent.set(attribNS, 'a') + child = SubElement(parent, 'child') + child.set(attribNS, 'b') + + self.assertEquals('a', parent.get(attribNS)) + self.assertEquals('b', child.get(attribNS)) + + parent.clear() + self.assertEquals(None, parent.get(attribNS)) + self.assertEquals('b', child.get(attribNS)) + + def test_attrib_pop(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + root = doc.getroot() + self.assertEquals('One', root.attrib['one']) + self.assertEquals('Two', root.attrib['two']) + + self.assertEquals('One', root.attrib.pop('one')) + + self.assertEquals(None, root.attrib.get('one')) + self.assertEquals('Two', root.attrib['two']) + + def test_attrib_pop_unknown(self): + root = self.etree.XML(_bytes('')) + self.assertRaises(KeyError, root.attrib.pop, 'NONE') + + self.assertEquals('One', root.attrib['one']) + self.assertEquals('Two', root.attrib['two']) + + def test_attrib_pop_default(self): + root = self.etree.XML(_bytes('')) + self.assertEquals('Three', root.attrib.pop('three', 'Three')) + + def test_attrib_pop_empty_default(self): + root = self.etree.XML(_bytes('')) + self.assertEquals('Three', root.attrib.pop('three', 'Three')) + + def test_attrib_pop_invalid_args(self): + root = self.etree.XML(_bytes('')) + self.assertRaises(TypeError, root.attrib.pop, 'One', None, None) + + def test_attribute_update_dict(self): + XML = self.etree.XML + + root = XML(_bytes('')) + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('alpha', 'Alpha'), ('beta', 'Beta')], + items) + + root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}) + + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + items) + + def test_attribute_update_sequence(self): + XML = self.etree.XML + + root = XML(_bytes('')) + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('alpha', 'Alpha'), ('beta', 'Beta')], + items) + + root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}.items()) + + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + items) + + def test_attribute_update_iter(self): + XML = self.etree.XML + + root = XML(_bytes('')) + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('alpha', 'Alpha'), ('beta', 'Beta')], + items) + + root.attrib.update({'alpha' : 'test', 'gamma' : 'Gamma'}.items()) + + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('alpha', 'test'), ('beta', 'Beta'), ('gamma', 'Gamma')], + items) + + def test_attribute_keys(self): + XML = self.etree.XML + + root = XML(_bytes('')) + keys = root.attrib.keys() + keys.sort() + self.assertEquals(['alpha', 'beta', 'gamma'], keys) + + def test_attribute_keys2(self): + XML = self.etree.XML + + root = XML(_bytes('')) + keys = root.keys() + keys.sort() + self.assertEquals(['alpha', 'beta', 'gamma'], keys) + + def test_attribute_items2(self): + XML = self.etree.XML + + root = XML(_bytes('')) + items = list(root.items()) + items.sort() + self.assertEquals( + [('alpha','Alpha'), ('beta','Beta'), ('gamma','Gamma')], + items) + + def test_attribute_keys_ns(self): + XML = self.etree.XML + + root = XML(_bytes('')) + keys = root.keys() + keys.sort() + self.assertEquals(['bar', '{http://ns.codespeak.net/test}baz'], + keys) + + def test_attribute_values(self): + XML = self.etree.XML + + root = XML(_bytes('')) + values = root.attrib.values() + values.sort() + self.assertEquals(['Alpha', 'Beta', 'Gamma'], values) + + def test_attribute_values_ns(self): + XML = self.etree.XML + + root = XML(_bytes('')) + values = root.attrib.values() + values.sort() + self.assertEquals( + ['Bar', 'Baz'], values) + + def test_attribute_items(self): + XML = self.etree.XML + + root = XML(_bytes('')) + items = list(root.attrib.items()) + items.sort() + self.assertEquals([ + ('alpha', 'Alpha'), + ('beta', 'Beta'), + ('gamma', 'Gamma'), + ], + items) + + def test_attribute_items_ns(self): + XML = self.etree.XML + + root = XML(_bytes('')) + items = list(root.attrib.items()) + items.sort() + self.assertEquals( + [('bar', 'Bar'), ('{http://ns.codespeak.net/test}baz', 'Baz')], + items) + + def test_attribute_str(self): + XML = self.etree.XML + + expected = "{'{http://ns.codespeak.net/test}baz': 'Baz', 'bar': 'Bar'}" + alternative = "{'bar': 'Bar', '{http://ns.codespeak.net/test}baz': 'Baz'}" + + root = XML(_bytes('')) + try: + self.assertEquals(expected, str(root.attrib)) + except AssertionError: + self.assertEquals(alternative, str(root.attrib)) + + def test_attribute_has_key(self): + XML = self.etree.XML + + root = XML(_bytes('')) + self.assertEquals( + True, root.attrib.has_key('bar')) + self.assertEquals( + False, root.attrib.has_key('baz')) + self.assertEquals( + False, root.attrib.has_key('hah')) + self.assertEquals( + True, + root.attrib.has_key('{http://ns.codespeak.net/test}baz')) + + def test_attribute_contains(self): + XML = self.etree.XML + + root = XML(_bytes('')) + self.assertEquals( + True, 'bar' in root.attrib) + self.assertEquals( + False, 'baz' in root.attrib) + self.assertEquals( + False, 'hah' in root.attrib) + self.assertEquals( + True, + '{http://ns.codespeak.net/test}baz' in root.attrib) + + def test_attribute_set(self): + Element = self.etree.Element + + root = Element("root") + root.set("attr", "TEST") + self.assertEquals("TEST", root.get("attr")) + + def test_del_attribute_ns(self): + Element = self.etree.Element + + a = Element('a') + a.attrib['{http://a/}foo'] = 'Foo' + a.attrib['{http://a/}bar'] = 'Bar' + self.assertEquals(None, a.get('foo')) + self.assertEquals('Foo', a.get('{http://a/}foo')) + self.assertEquals('Foo', a.attrib['{http://a/}foo']) + + self.assertRaises(KeyError, operator.delitem, a.attrib, 'foo') + self.assertEquals('Foo', a.attrib['{http://a/}foo']) + + del a.attrib['{http://a/}foo'] + self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + + def test_del_attribute_ns_parsed(self): + XML = self.etree.XML + + a = XML(_bytes('')) + + self.assertEquals('Foo', a.attrib['foo']) + self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + + del a.attrib['foo'] + self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + self.assertRaises(KeyError, operator.delitem, a.attrib, 'foo') + + del a.attrib['{http://a/}foo'] + self.assertRaises(KeyError, operator.getitem, a.attrib, '{http://a/}foo') + self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + + a = XML(_bytes('')) + + self.assertEquals('Foo', a.attrib['foo']) + self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + + del a.attrib['foo'] + self.assertEquals('FooNS', a.attrib['{http://a/}foo']) + self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + + del a.attrib['{http://a/}foo'] + self.assertRaises(KeyError, operator.getitem, a.attrib, '{http://a/}foo') + self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + + def test_XML(self): + XML = self.etree.XML + + root = XML(_bytes('This is a text.')) + self.assertEquals(0, len(root)) + self.assertEquals('This is a text.', root.text) + + def test_XMLID(self): + XMLID = self.etree.XMLID + XML = self.etree.XML + xml_text = _bytes(''' + +

...

+

...

+

Regular paragraph.

+

XML:ID paragraph.

+

...

+
+ ''') + + root, dic = XMLID(xml_text) + root2 = XML(xml_text) + self.assertEquals(self._writeElement(root), + self._writeElement(root2)) + expected = { + "chapter1" : root[0], + "note1" : root[1], + "warn1" : root[4] + } + self.assertEquals(dic, expected) + + def test_fromstring(self): + fromstring = self.etree.fromstring + + root = fromstring('This is a text.') + self.assertEquals(0, len(root)) + self.assertEquals('This is a text.', root.text) + + def test_fromstringlist(self): + fromstringlist = self.etree.fromstringlist + + root = fromstringlist(["T", "hi", "s is", + " a text.<", "/doc", ">"]) + self.assertEquals(0, len(root)) + self.assertEquals('This is a text.', root.text) + + def test_fromstringlist_characters(self): + fromstringlist = self.etree.fromstringlist + + root = fromstringlist(list('This is a text.')) + self.assertEquals(0, len(root)) + self.assertEquals('This is a text.', root.text) + + def test_fromstringlist_single(self): + fromstringlist = self.etree.fromstringlist + + root = fromstringlist(['This is a text.']) + self.assertEquals(0, len(root)) + self.assertEquals('This is a text.', root.text) + + def test_iselement(self): + iselement = self.etree.iselement + Element = self.etree.Element + ElementTree = self.etree.ElementTree + XML = self.etree.XML + Comment = self.etree.Comment + ProcessingInstruction = self.etree.ProcessingInstruction + + el = Element('hoi') + self.assert_(iselement(el)) + + el2 = XML(_bytes('')) + self.assert_(iselement(el2)) + + tree = ElementTree(element=Element('dag')) + self.assert_(not iselement(tree)) + self.assert_(iselement(tree.getroot())) + + c = Comment('test') + self.assert_(iselement(c)) + + p = ProcessingInstruction("test", "some text") + self.assert_(iselement(p)) + + def test_iteration(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHm')) + result = [] + for el in root: + result.append(el.tag) + self.assertEquals(['one', 'two', 'three'], result) + + def test_iteration_empty(self): + XML = self.etree.XML + + root = XML(_bytes('')) + result = [] + for el in root: + result.append(el.tag) + self.assertEquals([], result) + + def test_iteration_text_only(self): + XML = self.etree.XML + + root = XML(_bytes('Text')) + result = [] + for el in root: + result.append(el.tag) + self.assertEquals([], result) + + def test_iteration_crash(self): + # this would cause a crash in the past + fromstring = self.etree.fromstring + root = etree.fromstring('

x') + for elem in root: + elem.tail = '' + + def test_iteration_reversed(self): + XML = self.etree.XML + root = XML(_bytes('TwoHm')) + result = [] + for el in reversed(root): + result.append(el.tag) + self.assertEquals(['three', 'two', 'one'], result) + + def test_iteration_subelement(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHm')) + result = [] + add = True + for el in root: + result.append(el.tag) + if add: + self.etree.SubElement(root, 'four') + add = False + self.assertEquals(['one', 'two', 'three', 'four'], result) + + def test_iteration_del_child(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHm')) + result = [] + for el in root: + result.append(el.tag) + del root[-1] + self.assertEquals(['one', 'two'], result) + + def test_iteration_double(self): + XML = self.etree.XML + + root = XML(_bytes('')) + result = [] + for el0 in root: + result.append(el0.tag) + for el1 in root: + result.append(el1.tag) + self.assertEquals(['one','one', 'two', 'two', 'one', 'two'], result) + + def test_attribute_iterator(self): + XML = self.etree.XML + + root = XML(_bytes('')) + result = [] + for key in root.attrib: + result.append(key) + result.sort() + self.assertEquals(['alpha', 'beta', 'gamma'], result) + + def test_itertext(self): + # ET 1.3+ + XML = self.etree.XML + root = XML(_bytes("RTEXT
ATAILCTEXTCTAIL")) + + text = list(root.itertext()) + self.assertEquals(["RTEXT", "ATAIL", "CTEXT", "CTAIL"], + text) + + def test_itertext_child(self): + # ET 1.3+ + XML = self.etree.XML + root = XML(_bytes("RTEXTATAILCTEXTCTAIL")) + + text = list(root[2].itertext()) + self.assertEquals(["CTEXT"], + text) + + def test_findall(self): + XML = self.etree.XML + root = XML(_bytes('')) + self.assertEquals(len(list(root.findall("c"))), 1) + self.assertEquals(len(list(root.findall(".//c"))), 2) + self.assertEquals(len(list(root.findall(".//b"))), 3) + self.assertEquals(len(list(root.findall(".//b"))[0]), 1) + self.assertEquals(len(list(root.findall(".//b"))[1]), 0) + self.assertEquals(len(list(root.findall(".//b"))[2]), 0) + + def test_findall_ns(self): + XML = self.etree.XML + root = XML(_bytes('')) + self.assertEquals(len(list(root.findall(".//{X}b"))), 2) + self.assertEquals(len(list(root.findall(".//b"))), 3) + self.assertEquals(len(list(root.findall("b"))), 2) + + def test_element_with_attributes_keywords(self): + Element = self.etree.Element + + el = Element('tag', foo='Foo', bar='Bar') + self.assertEquals('Foo', el.attrib['foo']) + self.assertEquals('Bar', el.attrib['bar']) + + def test_element_with_attributes(self): + Element = self.etree.Element + + el = Element('tag', {'foo':'Foo', 'bar':'Bar'}) + self.assertEquals('Foo', el.attrib['foo']) + self.assertEquals('Bar', el.attrib['bar']) + + def test_element_with_attributes_ns(self): + Element = self.etree.Element + + el = Element('tag', {'{ns1}foo':'Foo', '{ns2}bar':'Bar'}) + self.assertEquals('Foo', el.attrib['{ns1}foo']) + self.assertEquals('Bar', el.attrib['{ns2}bar']) + + def test_subelement_with_attributes(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('tag') + SubElement(el, 'foo', {'foo':'Foo'}, baz="Baz") + self.assertEquals("Baz", el[0].attrib['baz']) + self.assertEquals('Foo', el[0].attrib['foo']) + + def test_subelement_with_attributes_ns(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('tag') + SubElement(el, 'foo', {'{ns1}foo':'Foo', '{ns2}bar':'Bar'}) + self.assertEquals('Foo', el[0].attrib['{ns1}foo']) + self.assertEquals('Bar', el[0].attrib['{ns2}bar']) + + def test_write(self): + ElementTree = self.etree.ElementTree + XML = self.etree.XML + + for i in range(10): + f = BytesIO() + root = XML(_bytes('This is a test.' % (i, i))) + tree = ElementTree(element=root) + tree.write(f) + data = f.getvalue() + self.assertEquals( + _bytes('This is a test.' % (i, i)), + canonicalize(data)) + + def test_write_method_html(self): + ElementTree = self.etree.ElementTree + Element = self.etree.Element + SubElement = self.etree.SubElement + + html = Element('html') + body = SubElement(html, 'body') + p = SubElement(body, 'p') + p.text = "html" + SubElement(p, 'br').tail = "test" + + tree = ElementTree(element=html) + f = BytesIO() + tree.write(f, method="html") + data = f.getvalue().replace(_bytes('\n'),_bytes('')) + + self.assertEquals(_bytes('

html
test

'), + data) + + def test_write_method_text(self): + ElementTree = self.etree.ElementTree + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = "A" + a.tail = "tail" + b = SubElement(a, 'b') + b.text = "B" + b.tail = "TAIL" + c = SubElement(a, 'c') + c.text = "C" + + tree = ElementTree(element=a) + f = BytesIO() + tree.write(f, method="text") + data = f.getvalue() + + self.assertEquals(_bytes('ABTAILCtail'), + data) + + def test_write_fail(self): + ElementTree = self.etree.ElementTree + XML = self.etree.XML + + tree = ElementTree( XML(_bytes('This is a test.')) ) + self.assertRaises(IOError, tree.write, + "definitely////\\-\\nonexisting\\-\\////FILE") + + # this could trigger a crash, apparently because the document + # reference was prematurely garbage collected + def test_crash(self): + Element = self.etree.Element + + element = Element('tag') + for i in range(10): + element.attrib['key'] = 'value' + value = element.attrib['key'] + self.assertEquals(value, 'value') + + # from doctest; for some reason this caused crashes too + def test_write_ElementTreeDoctest(self): + Element = self.etree.Element + ElementTree = self.etree.ElementTree + + f = BytesIO() + for i in range(10): + element = Element('tag%s' % i) + self._check_element(element) + tree = ElementTree(element) + tree.write(f) + self._check_element_tree(tree) + + def test_subelement_reference(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('foo') + el2 = SubElement(el, 'bar') + el3 = SubElement(el2, 'baz') + + al = Element('foo2') + al2 = SubElement(al, 'bar2') + al3 = SubElement(al2, 'baz2') + + # now move al2 into el + el.append(al2) + + # now change al3 directly + al3.text = 'baz2-modified' + + # it should have changed through this route too + self.assertEquals( + 'baz2-modified', + el[1][0].text) + + def test_set_text(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + a.text = 'hoi' + self.assertEquals( + 'hoi', + a.text) + self.assertEquals( + 'b', + a[0].tag) + + def test_set_text2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = 'hoi' + b = SubElement(a ,'b') + self.assertEquals( + 'hoi', + a.text) + self.assertEquals( + 'b', + a[0].tag) + + def test_set_text_none(self): + Element = self.etree.Element + + a = Element('a') + + a.text = 'foo' + a.text = None + + self.assertEquals( + None, + a.text) + self.assertXML(_bytes(''), a) + + def test_set_text_empty(self): + Element = self.etree.Element + + a = Element('a') + self.assertEquals(None, a.text) + + a.text = '' + self.assertEquals('', a.text) + self.assertXML(_bytes(''), a) + + def test_tail1(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.tail = 'dag' + self.assertEquals('dag', + a.tail) + b = SubElement(a, 'b') + b.tail = 'hoi' + self.assertEquals('hoi', + b.tail) + self.assertEquals('dag', + a.tail) + + def test_tail_append(self): + Element = self.etree.Element + + a = Element('a') + b = Element('b') + b.tail = 'b_tail' + a.append(b) + self.assertEquals('b_tail', + b.tail) + + def test_tail_set_twice(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + b.tail = 'foo' + b.tail = 'bar' + self.assertEquals('bar', + b.tail) + self.assertXML(_bytes('bar'), a) + + def test_tail_set_none(self): + Element = self.etree.Element + a = Element('a') + a.tail = 'foo' + a.tail = None + self.assertEquals( + None, + a.tail) + self.assertXML(_bytes(''), a) + + def test_extend(self): + root = self.etree.Element('foo') + for i in range(3): + element = self.etree.SubElement(root, 'a%s' % i) + element.text = "text%d" % i + element.tail = "tail%d" % i + + elements = [] + for i in range(3): + new_element = self.etree.Element("test%s" % i) + new_element.text = "TEXT%s" % i + new_element.tail = "TAIL%s" % i + elements.append(new_element) + + root.extend(elements) + + self.assertEquals( + ["a0", "a1", "a2", "test0", "test1", "test2"], + [ el.tag for el in root ]) + self.assertEquals( + ["text0", "text1", "text2", "TEXT0", "TEXT1", "TEXT2"], + [ el.text for el in root ]) + self.assertEquals( + ["tail0", "tail1", "tail2", "TAIL0", "TAIL1", "TAIL2"], + [ el.tail for el in root ]) + + def test_comment(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + Comment = self.etree.Comment + + a = Element('a') + a.append(Comment('foo')) + self.assertEquals(a[0].tag, Comment) + self.assertEquals(a[0].text, 'foo') + + # ElementTree < 1.3 adds whitespace around comments + def test_comment_text(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + Comment = self.etree.Comment + tostring = self.etree.tostring + + a = Element('a') + a.append(Comment('foo')) + self.assertEquals(a[0].text, 'foo') + + self.assertEquals( + _bytes(''), + tostring(a)) + + a[0].text = "TEST" + self.assertEquals(a[0].text, 'TEST') + + self.assertEquals( + _bytes(''), + tostring(a)) + + # ElementTree < 1.3 adds whitespace around comments + def test_comment_whitespace(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + Comment = self.etree.Comment + tostring = self.etree.tostring + + a = Element('a') + a.append(Comment(' foo ')) + self.assertEquals(a[0].text, ' foo ') + self.assertEquals( + _bytes(''), + tostring(a)) + + def test_comment_nonsense(self): + Comment = self.etree.Comment + c = Comment('foo') + self.assertEquals({}, c.attrib) + self.assertEquals([], list(c.keys())) + self.assertEquals([], list(c.items())) + self.assertEquals(None, c.get('hoi')) + self.assertEquals(0, len(c)) + # should not iterate + for i in c: + pass + + def test_pi(self): + # lxml.etree separates target and text + Element = self.etree.Element + SubElement = self.etree.SubElement + ProcessingInstruction = self.etree.ProcessingInstruction + + a = Element('a') + a.append(ProcessingInstruction('foo', 'some more text')) + self.assertEquals(a[0].tag, ProcessingInstruction) + self.assertXML(_bytes(""), + a) + + def test_processinginstruction(self): + # lxml.etree separates target and text + Element = self.etree.Element + SubElement = self.etree.SubElement + ProcessingInstruction = self.etree.PI + + a = Element('a') + a.append(ProcessingInstruction('foo', 'some more text')) + self.assertEquals(a[0].tag, ProcessingInstruction) + self.assertXML(_bytes(""), + a) + + def test_pi_nonsense(self): + ProcessingInstruction = self.etree.ProcessingInstruction + pi = ProcessingInstruction('foo') + self.assertEquals({}, pi.attrib) + self.assertEquals([], list(pi.keys())) + self.assertEquals([], list(pi.items())) + self.assertEquals(None, pi.get('hoi')) + self.assertEquals(0, len(pi)) + # should not iterate + for i in pi: + pass + + def test_setitem(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = Element('c') + a[0] = c + self.assertEquals( + c, + a[0]) + self.assertXML(_bytes(''), + a) + self.assertXML(_bytes(''), + b) + + def test_setitem2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + for i in range(5): + b = SubElement(a, 'b%s' % i) + c = SubElement(b, 'c') + for i in range(5): + d = Element('d') + e = SubElement(d, 'e') + a[i] = d + self.assertXML( + _bytes(''), + a) + self.assertXML(_bytes(''), + c) + + def test_setitem_replace(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + SubElement(a, 'b') + d = Element('d') + a[0] = d + self.assertXML(_bytes(''), a) + + def test_setitem_indexerror(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + + self.assertRaises(IndexError, operator.setitem, a, 1, Element('c')) + + def test_setitem_tail(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + b.tail = 'B2' + c = Element('c') + c.tail = 'C2' + + a[0] = c + self.assertXML( + _bytes('C2'), + a) + + def test_tag_write(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + + a.tag = 'c' + + self.assertEquals( + 'c', + a.tag) + + self.assertXML( + _bytes(''), + a) + + def test_tag_reset_ns(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + tostring = self.etree.tostring + + a = Element('{a}a') + b1 = SubElement(a, '{a}b') + b2 = SubElement(a, '{b}b') + + self.assertEquals('{a}b', b1.tag) + + b1.tag = 'c' + + # can't use C14N here! + self.assertEquals('c', b1.tag) + self.assertEquals(_bytes(''), + a) + + def test_delitem(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + del a[1] + self.assertXML( + _bytes(''), + a) + + del a[0] + self.assertXML( + _bytes(''), + a) + + del a[0] + self.assertXML( + _bytes(''), + a) + # move deleted element into other tree afterwards + other = Element('other') + other.append(c) + self.assertXML( + _bytes(''), + other) + + def test_del_insert(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + bs = SubElement(b, 'bs') + c = SubElement(a, 'c') + cs = SubElement(c, 'cs') + + el = a[0] + self.assertXML( + _bytes(''), + a) + self.assertXML(_bytes(''), b) + self.assertXML(_bytes(''), c) + + del a[0] + self.assertXML( + _bytes(''), + a) + self.assertXML(_bytes(''), b) + self.assertXML(_bytes(''), c) + + a.insert(0, el) + self.assertXML( + _bytes(''), + a) + self.assertXML(_bytes(''), b) + self.assertXML(_bytes(''), c) + + def test_del_setitem(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + bs = SubElement(b, 'bs') + c = SubElement(a, 'c') + cs = SubElement(c, 'cs') + + el = a[0] + del a[0] + a[0] = el + self.assertXML( + _bytes(''), + a) + self.assertXML(_bytes(''), b) + self.assertXML(_bytes(''), c) + + def test_del_setslice(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + bs = SubElement(b, 'bs') + c = SubElement(a, 'c') + cs = SubElement(c, 'cs') + + el = a[0] + del a[0] + a[0:0] = [el] + self.assertXML( + _bytes(''), + a) + self.assertXML(_bytes(''), b) + self.assertXML(_bytes(''), c) + + def test_replace_slice_tail(self): + XML = self.etree.XML + a = XML(_bytes('B2C2')) + b, c = a + + a[:] = [] + + self.assertEquals("B2", b.tail) + self.assertEquals("C2", c.tail) + + def test_merge_namespaced_subtree_as_slice(self): + XML = self.etree.XML + root = XML(_bytes( + '')) + root[:] = root.findall('.//puh') # delete bar from hierarchy + + # previously, this lost a namespace declaration on bump2 + result = self.etree.tostring(root) + foo = self.etree.fromstring(result) + + self.assertEquals('puh', foo[0].tag) + self.assertEquals('{http://huhu}bump1', foo[0][0].tag) + self.assertEquals('{http://huhu}bump2', foo[0][1].tag) + + def test_delitem_tail(self): + ElementTree = self.etree.ElementTree + f = BytesIO('B2C2') + doc = ElementTree(file=f) + a = doc.getroot() + del a[0] + self.assertXML( + _bytes('C2'), + a) + + def test_clear(self): + Element = self.etree.Element + + a = Element('a') + a.text = 'foo' + a.tail = 'bar' + a.set('hoi', 'dag') + a.clear() + self.assertEquals(None, a.text) + self.assertEquals(None, a.tail) + self.assertEquals(None, a.get('hoi')) + self.assertEquals('a', a.tag) + + def test_clear_sub(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = 'foo' + a.tail = 'bar' + a.set('hoi', 'dag') + b = SubElement(a, 'b') + c = SubElement(b, 'c') + a.clear() + self.assertEquals(None, a.text) + self.assertEquals(None, a.tail) + self.assertEquals(None, a.get('hoi')) + self.assertEquals('a', a.tag) + self.assertEquals(0, len(a)) + self.assertXML(_bytes(''), + a) + self.assertXML(_bytes(''), + b) + + def test_clear_tail(self): + ElementTree = self.etree.ElementTree + f = BytesIO('B2C2') + doc = ElementTree(file=f) + a = doc.getroot() + a.clear() + self.assertXML( + _bytes(''), + a) + + def test_insert(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = Element('d') + a.insert(0, d) + + self.assertEquals( + d, + a[0]) + + self.assertXML( + _bytes(''), + a) + + e = Element('e') + a.insert(2, e) + self.assertEquals( + e, + a[2]) + self.assertXML( + _bytes(''), + a) + + def test_insert_beyond_index(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = Element('c') + + a.insert(2, c) + self.assertEquals( + c, + a[1]) + self.assertXML( + _bytes(''), + a) + + def test_insert_negative(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + d = Element('d') + a.insert(-1, d) + self.assertEquals( + d, + a[-2]) + self.assertXML( + _bytes(''), + a) + + def test_insert_tail(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + + c = Element('c') + c.tail = 'C2' + + a.insert(0, c) + self.assertXML( + _bytes('C2'), + a) + + def test_remove(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + a.remove(b) + self.assertEquals( + c, + a[0]) + self.assertXML( + _bytes(''), + a) + + def test_remove_ns(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('{http://test}a') + b = SubElement(a, '{http://test}b') + c = SubElement(a, '{http://test}c') + + a.remove(b) + self.assertXML( + _bytes(''), + a) + self.assertXML( + _bytes(''), + b) + + def test_remove_nonexisting(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = Element('d') + self.assertRaises( + ValueError, a.remove, d) + + def test_remove_tail(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + b.tail = 'b2' + a.remove(b) + self.assertXML( + _bytes(''), + a) + self.assertEquals('b2', b.tail) + + def _test_getchildren(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + self.assertXML( + _bytes(''), + a) + self.assertEquals( + [b, c], + a.getchildren()) + self.assertEquals( + [d], + b.getchildren()) + self.assertEquals( + [], + d.getchildren()) + + def test_makeelement(self): + Element = self.etree.Element + + a = Element('a') + b = a.makeelement('c', {'hoi':'dag'}) + self.assertXML( + _bytes(''), + b) + + def test_iter(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [a, b, d, c, e], + list(a.iter())) + self.assertEquals( + [d], + list(d.iter())) + + def test_getiterator(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [a, b, d, c, e], + list(a.getiterator())) + self.assertEquals( + [d], + list(d.getiterator())) + + def test_getiterator_empty(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [], + list(a.getiterator('none'))) + self.assertEquals( + [], + list(e.getiterator('none'))) + self.assertEquals( + [e], + list(e.getiterator())) + + def test_getiterator_filter(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [a], + list(a.getiterator('a'))) + a2 = SubElement(e, 'a') + self.assertEquals( + [a, a2], + list(a.getiterator('a'))) + self.assertEquals( + [a2], + list(c.getiterator('a'))) + + def test_getiterator_filter_all(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [a, b, d, c, e], + list(a.getiterator('*'))) + + def test_getiterator_filter_comment(self): + Element = self.etree.Element + Comment = self.etree.Comment + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + comment_b = Comment("TEST-b") + b.append(comment_b) + + self.assertEquals( + [comment_b], + list(a.getiterator(Comment))) + + comment_a = Comment("TEST-a") + a.append(comment_a) + + self.assertEquals( + [comment_b, comment_a], + list(a.getiterator(Comment))) + + self.assertEquals( + [comment_b], + list(b.getiterator(Comment))) + + def test_getiterator_filter_pi(self): + Element = self.etree.Element + PI = self.etree.ProcessingInstruction + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + pi_b = PI("TEST-b") + b.append(pi_b) + + self.assertEquals( + [pi_b], + list(a.getiterator(PI))) + + pi_a = PI("TEST-a") + a.append(pi_a) + + self.assertEquals( + [pi_b, pi_a], + list(a.getiterator(PI))) + + self.assertEquals( + [pi_b], + list(b.getiterator(PI))) + + def test_getiterator_with_text(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = 'a' + b = SubElement(a, 'b') + b.text = 'b' + b.tail = 'b1' + c = SubElement(a, 'c') + c.text = 'c' + c.tail = 'c1' + d = SubElement(b, 'd') + c.text = 'd' + c.tail = 'd1' + e = SubElement(c, 'e') + e.text = 'e' + e.tail = 'e1' + + self.assertEquals( + [a, b, d, c, e], + list(a.getiterator())) + #self.assertEquals( + # [d], + # list(d.getiterator())) + + def test_getiterator_filter_with_text(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = 'a' + b = SubElement(a, 'b') + b.text = 'b' + b.tail = 'b1' + c = SubElement(a, 'c') + c.text = 'c' + c.tail = 'c1' + d = SubElement(b, 'd') + c.text = 'd' + c.tail = 'd1' + e = SubElement(c, 'e') + e.text = 'e' + e.tail = 'e1' + + self.assertEquals( + [a], + list(a.getiterator('a'))) + a2 = SubElement(e, 'a') + self.assertEquals( + [a, a2], + list(a.getiterator('a'))) + self.assertEquals( + [a2], + list(e.getiterator('a'))) + + def test_attribute_manipulation(self): + Element = self.etree.Element + + a = Element('a') + a.attrib['foo'] = 'Foo' + a.attrib['bar'] = 'Bar' + self.assertEquals('Foo', a.attrib['foo']) + del a.attrib['foo'] + self.assertRaises(KeyError, operator.getitem, a.attrib, 'foo') + + def test_getslice(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + self.assertEquals( + [b, c], + a[0:2]) + self.assertEquals( + [b, c, d], + a[:]) + self.assertEquals( + [b, c, d], + a[:10]) + self.assertEquals( + [b], + a[0:1]) + self.assertEquals( + [], + a[10:12]) + + def test_getslice_negative(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + self.assertEquals( + [d], + a[-1:]) + self.assertEquals( + [c, d], + a[-2:]) + self.assertEquals( + [c], + a[-2:-1]) + self.assertEquals( + [b, c], + a[-3:-1]) + self.assertEquals( + [b, c], + a[-3:2]) + + def test_getslice_step(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + self.assertEquals( + [e,d,c,b], + a[::-1]) + self.assertEquals( + [b,d], + a[::2]) + self.assertEquals( + [e,c], + a[::-2]) + self.assertEquals( + [d,c], + a[-2:0:-1]) + self.assertEquals( + [e], + a[:1:-2]) + + def test_getslice_text(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('BB1CC1') + doc = ElementTree(file=f) + a = doc.getroot() + b = a[0] + c = a[1] + self.assertEquals( + [b, c], + a[:]) + self.assertEquals( + [b], + a[0:1]) + self.assertEquals( + [c], + a[1:]) + + def test_comment_getitem_getslice(self): + Element = self.etree.Element + Comment = self.etree.Comment + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + foo = Comment('foo') + a.append(foo) + c = SubElement(a, 'c') + self.assertEquals( + [b, foo, c], + a[:]) + self.assertEquals( + foo, + a[1]) + a[1] = new = Element('new') + self.assertEquals( + new, + a[1]) + self.assertXML( + _bytes(''), + a) + + def test_delslice(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + del a[1:3] + self.assertEquals( + [b, e], + list(a)) + + def test_delslice_negative1(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + del a[1:-1] + self.assertEquals( + [b, e], + list(a)) + + def test_delslice_negative2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + del a[-3:-1] + self.assertEquals( + [b, e], + list(a)) + + def test_delslice_step(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + del a[1::2] + self.assertEquals( + [b, d], + list(a)) + + def test_delslice_step_negative(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + del a[::-1] + self.assertEquals( + [], + list(a)) + + def test_delslice_step_negative2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + del a[::-2] + self.assertEquals( + [b, d], + list(a)) + + def test_delslice_child_tail(self): + ElementTree = self.etree.ElementTree + f = BytesIO('B2C2D2E2') + doc = ElementTree(file=f) + a = doc.getroot() + del a[1:3] + self.assertXML( + _bytes('B2E2'), + a) + + def test_delslice_tail(self): + XML = self.etree.XML + a = XML(_bytes('B2C2')) + b, c = a + + del a[:] + + self.assertEquals("B2", b.tail) + self.assertEquals("C2", c.tail) + + def test_delslice_memory(self): + # this could trigger a crash + Element = self.etree.Element + SubElement = self.etree.SubElement + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(b, 'c') + del b # no more reference to b + del a[:] + self.assertEquals('c', c.tag) + + def test_setslice(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + e = Element('e') + f = Element('f') + g = Element('g') + + s = [e, f, g] + a[1:2] = s + self.assertEquals( + [b, e, f, g, d], + list(a)) + + def test_setslice_all(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + e = Element('e') + f = Element('f') + g = Element('g') + + s = [e, f, g] + a[:] = s + self.assertEquals( + [e, f, g], + list(a)) + + def test_setslice_all_empty(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + + e = Element('e') + f = Element('f') + g = Element('g') + + s = [e, f, g] + a[:] = s + self.assertEquals( + [e, f, g], + list(a)) + + def test_setslice_all_replace(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + s = [b, c, d] + a[:] = s + self.assertEquals( + [b, c, d], + list(a)) + + def test_setslice_all_replace_reversed(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + s = [d, c, b] + a[:] = s + self.assertEquals( + [d, c, b], + list(a)) + + def test_setslice_all_replace_reversed_ns1(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('{ns}a') + b = SubElement(a, '{ns}b', {'{ns1}a1': 'test'}) + c = SubElement(a, '{ns}c', {'{ns2}a2': 'test'}) + d = SubElement(a, '{ns}d', {'{ns3}a3': 'test'}) + + s = [d, c, b] + a[:] = s + self.assertEquals( + [d, c, b], + list(a)) + self.assertEquals( + ['{ns}d', '{ns}c', '{ns}b'], + [ child.tag for child in a ]) + + self.assertEquals( + [['{ns3}a3'], ['{ns2}a2'], ['{ns1}a1']], + [ child.attrib.keys() for child in a ]) + + def test_setslice_all_replace_reversed_ns2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('{ns}a') + b = SubElement(a, '{ns1}b', {'{ns}a1': 'test'}) + c = SubElement(a, '{ns2}c', {'{ns}a2': 'test'}) + d = SubElement(a, '{ns3}d', {'{ns}a3': 'test'}) + + s = [d, c, b] + a[:] = s + self.assertEquals( + [d, c, b], + list(a)) + self.assertEquals( + ['{ns3}d', '{ns2}c', '{ns1}b'], + [ child.tag for child in a ]) + + self.assertEquals( + [['{ns}a3'], ['{ns}a2'], ['{ns}a1']], + [ child.attrib.keys() for child in a ]) + + def test_setslice_end(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + e = Element('e') + f = Element('f') + g = Element('g') + h = Element('h') + + s = [e, f] + a[99:] = s + self.assertEquals( + [a, b, e, f], + list(a)) + + s = [g, h] + a[:0] = s + self.assertEquals( + [g, h, a, b, e, f], + list(a)) + + def test_setslice_single(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + e = Element('e') + f = Element('f') + + s = [e] + a[0:1] = s + self.assertEquals( + [e, c], + list(a)) + + s = [f] + a[1:2] = s + self.assertEquals( + [e, f], + list(a)) + + def test_setslice_tail(self): + ElementTree = self.etree.ElementTree + Element = self.etree.Element + f = BytesIO('B2C2D2E2') + doc = ElementTree(file=f) + a = doc.getroot() + x = Element('x') + y = Element('y') + z = Element('z') + x.tail = 'X2' + y.tail = 'Y2' + z.tail = 'Z2' + a[1:3] = [x, y, z] + self.assertXML( + _bytes('B2X2Y2Z2E2'), + a) + + def test_setslice_negative(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + x = Element('x') + y = Element('y') + + a[1:-1] = [x, y] + self.assertEquals( + [b, x, y, d], + list(a)) + + def test_setslice_negative2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + x = Element('x') + y = Element('y') + + a[1:-2] = [x, y] + self.assertEquals( + [b, x, y, c, d], + list(a)) + + def test_setslice_end(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + + e = Element('e') + f = Element('f') + g = Element('g') + + s = [e, f, g] + a[3:] = s + self.assertEquals( + [b, c, d, e, f, g], + list(a)) + + def test_setslice_empty(self): + Element = self.etree.Element + + a = Element('a') + + b = Element('b') + c = Element('c') + + a[:] = [b, c] + self.assertEquals( + [b, c], + list(a)) + + def test_tail_elementtree_root(self): + Element = self.etree.Element + ElementTree = self.etree.ElementTree + + a = Element('a') + a.tail = 'A2' + t = ElementTree(element=a) + self.assertEquals('A2', + a.tail) + + def test_elementtree_getiterator(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + ElementTree = self.etree.ElementTree + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + t = ElementTree(element=a) + + self.assertEquals( + [a, b, d, c, e], + list(t.getiterator())) + + def test_elementtree_getiterator_filter(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + ElementTree = self.etree.ElementTree + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + t = ElementTree(element=a) + + self.assertEquals( + [a], + list(t.getiterator('a'))) + a2 = SubElement(e, 'a') + self.assertEquals( + [a, a2], + list(t.getiterator('a'))) + + def test_ns_access(self): + ElementTree = self.etree.ElementTree + ns = 'http://xml.infrae.com/1' + f = BytesIO('' % ns) + t = ElementTree(file=f) + a = t.getroot() + self.assertEquals('{%s}a' % ns, + a.tag) + self.assertEquals('{%s}b' % ns, + a[0].tag) + + def test_ns_access2(self): + ElementTree = self.etree.ElementTree + ns = 'http://xml.infrae.com/1' + ns2 = 'http://xml.infrae.com/2' + f = BytesIO('' % (ns, ns2)) + t = ElementTree(file=f) + a = t.getroot() + self.assertEquals('{%s}a' % ns, + a.tag) + self.assertEquals('{%s}b' % ns, + a[0].tag) + self.assertEquals('{%s}b' % ns2, + a[1].tag) + + def test_ns_setting(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + ns = 'http://xml.infrae.com/1' + ns2 = 'http://xml.infrae.com/2' + a = Element('{%s}a' % ns) + b = SubElement(a, '{%s}b' % ns2) + c = SubElement(a, '{%s}c' % ns) + self.assertEquals('{%s}a' % ns, + a.tag) + self.assertEquals('{%s}b' % ns2, + b.tag) + self.assertEquals('{%s}c' % ns, + c.tag) + self.assertEquals('{%s}a' % ns, + a.tag) + self.assertEquals('{%s}b' % ns2, + b.tag) + self.assertEquals('{%s}c' % ns, + c.tag) + + def test_ns_tag_parse(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + ElementTree = self.etree.ElementTree + + ns = 'http://xml.infrae.com/1' + ns2 = 'http://xml.infrae.com/2' + f = BytesIO('' % (ns, ns2)) + t = ElementTree(file=f) + + a = t.getroot() + self.assertEquals('{%s}a' % ns, + a.tag) + self.assertEquals('{%s}b' % ns2, + a[0].tag) + self.assertEquals('{%s}b' % ns, + a[1].tag) + + def test_ns_attr(self): + Element = self.etree.Element + ns = 'http://xml.infrae.com/1' + ns2 = 'http://xml.infrae.com/2' + a = Element('a') + a.set('{%s}foo' % ns, 'Foo') + a.set('{%s}bar' % ns2, 'Bar') + self.assertEquals( + 'Foo', + a.get('{%s}foo' % ns)) + self.assertEquals( + 'Bar', + a.get('{%s}bar' % ns2)) + try: + self.assertXML( + _bytes('' % (ns, ns2)), + a) + except AssertionError: + self.assertXML( + _bytes('' % (ns2, ns)), + a) + + def test_ns_move(self): + Element = self.etree.Element + one = self.etree.fromstring( + _bytes('')) + baz = one[0][0] + + two = Element('root') + two.append(baz) + # removing the originating document could cause a crash/error before + # as namespace is not moved along with it + del one, baz + self.assertEquals('{http://a.b.c}baz', two[0].tag) + + def test_ns_decl_tostring(self): + tostring = self.etree.tostring + root = self.etree.XML( + _bytes('')) + baz = root[0][0] + + nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), + tostring(baz)) + self.assertEquals([_bytes("http://a.b.c")], nsdecl) + + def test_ns_decl_tostring_default(self): + tostring = self.etree.tostring + root = self.etree.XML( + _bytes('')) + baz = root[0][0] + + nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), + tostring(baz)) + self.assertEquals([_bytes("http://a.b.c")], nsdecl) + + def test_ns_decl_tostring_root(self): + tostring = self.etree.tostring + root = self.etree.XML( + _bytes('')) + baz = root[0][0] + + nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), + tostring(baz)) + + self.assertEquals([_bytes("http://a.b.c")], nsdecl) + + def test_ns_decl_tostring_element(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + root = Element("foo") + bar = SubElement(root, "{http://a.b.c}bar") + baz = SubElement(bar, "{http://a.b.c}baz") + + nsdecl = re.findall(_bytes("xmlns(?::[a-z0-9]+)?=[\"']([^\"']+)[\"']"), + self.etree.tostring(baz)) + + self.assertEquals([_bytes("http://a.b.c")], nsdecl) + + def test_attribute_xmlns_move(self): + Element = self.etree.Element + + root = Element('element') + + subelement = Element('subelement', + {"{http://www.w3.org/XML/1998/namespace}id": "foo"}) + self.assertEquals(1, len(subelement.attrib)) + self.assertEquals( + "foo", + subelement.get("{http://www.w3.org/XML/1998/namespace}id")) + + root.append(subelement) + self.assertEquals(1, len(subelement.attrib)) + self.assertEquals( + list({"{http://www.w3.org/XML/1998/namespace}id" : "foo"}.items()), + list(subelement.attrib.items())) + self.assertEquals( + "foo", + subelement.get("{http://www.w3.org/XML/1998/namespace}id")) + + def test_namespaces_after_serialize(self): + parse = self.etree.parse + tostring = self.etree.tostring + + ns_href = "http://a.b.c" + one = parse( + BytesIO('' % ns_href)) + baz = one.getroot()[0][0] + + parsed = parse(BytesIO( tostring(baz) )).getroot() + self.assertEquals('{%s}baz' % ns_href, parsed.tag) + + def test_tostring(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + self.assertEquals(_bytes(''), + canonicalize(tostring(a))) + + def test_tostring_element(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(c, 'd') + self.assertEquals(_bytes(''), + canonicalize(tostring(b))) + self.assertEquals(_bytes(''), + canonicalize(tostring(c))) + + def test_tostring_element_tail(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(c, 'd') + b.tail = 'Foo' + + self.assert_(tostring(b) == _bytes('Foo') or + tostring(b) == _bytes('Foo')) + + def test_tostring_method_html(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + html = Element('html') + body = SubElement(html, 'body') + p = SubElement(body, 'p') + p.text = "html" + SubElement(p, 'br').tail = "test" + + self.assertEquals(_bytes('

html
test

'), + tostring(html, method="html")) + + def test_tostring_method_text(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = "A" + a.tail = "tail" + b = SubElement(a, 'b') + b.text = "B" + b.tail = "TAIL" + c = SubElement(a, 'c') + c.text = "C" + + self.assertEquals(_bytes('ABTAILCtail'), + tostring(a, method="text")) + + def test_iterparse(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + iterator = iterparse(f) + self.assertEquals(None, + iterator.root) + events = list(iterator) + root = iterator.root + self.assertEquals( + [('end', root[0]), ('end', root[1]), ('end', root)], + events) + + def test_iterparse_file(self): + iterparse = self.etree.iterparse + iterator = iterparse(fileInTestDir("test.xml")) + self.assertEquals(None, + iterator.root) + events = list(iterator) + root = iterator.root + self.assertEquals( + [('end', root[0]), ('end', root)], + events) + + def test_iterparse_start(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + iterator = iterparse(f, events=('start',)) + events = list(iterator) + root = iterator.root + self.assertEquals( + [('start', root), ('start', root[0]), ('start', root[1])], + events) + + def test_iterparse_start_end(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + iterator = iterparse(f, events=('start','end')) + events = list(iterator) + root = iterator.root + self.assertEquals( + [('start', root), ('start', root[0]), ('end', root[0]), + ('start', root[1]), ('end', root[1]), ('end', root)], + events) + + def test_iterparse_clear(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + iterator = iterparse(f) + for event, elem in iterator: + elem.clear() + + root = iterator.root + self.assertEquals(0, + len(root)) + + def test_iterparse_large(self): + iterparse = self.etree.iterparse + CHILD_COUNT = 12345 + f = BytesIO('%s' % ('test'*CHILD_COUNT)) + + i = 0 + for key in iterparse(f): + event, element = key + i += 1 + self.assertEquals(i, CHILD_COUNT + 1) + + def test_iterparse_attrib_ns(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + attr_name = '{http://testns/}bla' + events = [] + iterator = iterparse(f, events=('start','end','start-ns','end-ns')) + for event, elem in iterator: + events.append(event) + if event == 'start': + if elem.tag != '{http://ns1/}a': + elem.set(attr_name, 'value') + + self.assertEquals( + ['start-ns', 'start', 'start', 'start-ns', 'start', + 'end', 'end-ns', 'end', 'end', 'end-ns'], + events) + + root = iterator.root + self.assertEquals( + None, + root.get(attr_name)) + self.assertEquals( + 'value', + root[0].get(attr_name)) + + def test_iterparse_getiterator(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + counts = [] + for event, elem in iterparse(f): + counts.append(len(list(elem.getiterator()))) + self.assertEquals( + [1,2,1,4], + counts) + + def test_iterparse_move_elements(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + for event, node in etree.iterparse(f): pass + + root = etree.Element('new_root', {}) + root[:] = node[:] + + self.assertEquals( + ['b', 'c'], + [ el.tag for el in root ]) + + def test_iterparse_cdata(self): + tostring = self.etree.tostring + f = BytesIO('') + context = self.etree.iterparse(f) + content = [ el.text for event,el in context ] + + self.assertEquals(['test'], content) + self.assertEquals(_bytes('test'), + tostring(context.root)) + + def test_parse_file(self): + parse = self.etree.parse + # from file + tree = parse(fileInTestDir('test.xml')) + self.assertXML( + _bytes(''), + tree.getroot()) + + def test_parse_file_nonexistent(self): + parse = self.etree.parse + self.assertRaises(IOError, parse, fileInTestDir('notthere.xml')) + + def test_parse_error_none(self): + parse = self.etree.parse + self.assertRaises(TypeError, parse, None) + + def test_parse_error(self): + # ET < 1.3 raises ExpatError + parse = self.etree.parse + f = BytesIO('') + self.assertRaises(SyntaxError, parse, f) + f.close() + + def test_parse_error_from_file(self): + parse = self.etree.parse + # from file + f = open(fileInTestDir('test_broken.xml'), 'rb') + self.assertRaises(SyntaxError, parse, f) + f.close() + + def test_parse_file_object(self): + parse = self.etree.parse + # from file object + f = open(fileInTestDir('test.xml'), 'rb') + tree = parse(f) + f.close() + self.assertXML( + _bytes(''), + tree.getroot()) + + def test_parse_stringio(self): + parse = self.etree.parse + f = BytesIO('') + tree = parse(f) + f.close() + self.assertXML( + _bytes(''), + tree.getroot() + ) + + def test_parse_cdata(self): + tostring = self.etree.tostring + root = self.etree.XML(_bytes('')) + + self.assertEquals('test', root.text) + self.assertEquals(_bytes('test'), + tostring(root)) + + def test_parse_with_encoding(self): + # this can fail in libxml2 <= 2.6.22 + parse = self.etree.parse + tree = parse(BytesIO('')) + self.assertXML(_bytes(''), + tree.getroot()) + + def test_encoding(self): + Element = self.etree.Element + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + self.assertXML( + _str('Søk pÃ¥ nettet').encode('UTF-8'), + a, 'utf-8') + + def test_encoding_exact(self): + ElementTree = self.etree.ElementTree + Element = self.etree.Element + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + + f = BytesIO() + tree = ElementTree(element=a) + tree.write(f, encoding='utf-8') + self.assertEquals(_str('Søk pÃ¥ nettet').encode('UTF-8'), + f.getvalue().replace(_bytes('\n'),_bytes(''))) + + def test_parse_file_encoding(self): + parse = self.etree.parse + # from file + tree = parse(fileInTestDir('test-string.xml')) + self.assertXML( + _str('Søk pÃ¥ nettet').encode('UTF-8'), + tree.getroot(), 'UTF-8') + + def test_parse_file_object_encoding(self): + parse = self.etree.parse + # from file object + f = open(fileInTestDir('test-string.xml'), 'rb') + tree = parse(f) + f.close() + self.assertXML( + _str('Søk pÃ¥ nettet').encode('UTF-8'), + tree.getroot(), 'UTF-8') + + def test_encoding_8bit_latin1(self): + ElementTree = self.etree.ElementTree + Element = self.etree.Element + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + + f = BytesIO() + tree = ElementTree(element=a) + tree.write(f, encoding='iso-8859-1') + result = f.getvalue() + declaration = _bytes("") + self.assertEncodingDeclaration(result, _bytes('iso-8859-1')) + result = result.split(_bytes('?>'), 1)[-1].replace(_bytes('\n'),_bytes('')) + self.assertEquals(_str('Søk pÃ¥ nettet').encode('iso-8859-1'), + result) + + def test_parse_encoding_8bit_explicit(self): + XMLParser = self.etree.XMLParser + + text = _str('Søk pÃ¥ nettet') + xml_latin1 = (_str('%s') % text).encode('iso-8859-1') + + self.assertRaises(self.etree.ParseError, + self.etree.parse, + BytesIO(xml_latin1)) + + tree = self.etree.parse(BytesIO(xml_latin1), + XMLParser(encoding="iso-8859-1")) + a = tree.getroot() + self.assertEquals(a.text, text) + + def test_parse_encoding_8bit_override(self): + XMLParser = self.etree.XMLParser + + text = _str('Søk pÃ¥ nettet') + wrong_declaration = _str("") + xml_latin1 = (_str('%s%s') % (wrong_declaration, text) + ).encode('iso-8859-1') + + self.assertRaises(self.etree.ParseError, + self.etree.parse, + BytesIO(xml_latin1)) + + tree = self.etree.parse(BytesIO(xml_latin1), + XMLParser(encoding="iso-8859-1")) + a = tree.getroot() + self.assertEquals(a.text, text) + + def _test_wrong_unicode_encoding(self): + # raise error on wrong encoding declaration in unicode strings + XML = self.etree.XML + test_utf = (_str('') + + _str('Søk pÃ¥ nettet')) + self.assertRaises(SyntaxError, XML, test_utf) + + def test_encoding_write_default_encoding(self): + ElementTree = self.etree.ElementTree + Element = self.etree.Element + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + + f = BytesIO() + tree = ElementTree(element=a) + tree.write(f) + data = f.getvalue().replace(_bytes('\n'),_bytes('')) + self.assertEquals( + _str('Søk pÃ¥ nettet').encode('ASCII', 'xmlcharrefreplace'), + data) + + def test_encoding_tostring(self): + Element = self.etree.Element + tostring = self.etree.tostring + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + self.assertEquals(_str('Søk pÃ¥ nettet').encode('UTF-8'), + tostring(a, encoding='utf-8')) + + def test_encoding_tostring_unknown(self): + Element = self.etree.Element + tostring = self.etree.tostring + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + self.assertRaises(LookupError, tostring, a, + encoding='Invalid Encoding') + + def test_encoding_tostring_sub(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + tostring = self.etree.tostring + + a = Element('a') + b = SubElement(a, 'b') + b.text = _str('Søk pÃ¥ nettet') + self.assertEquals(_str('Søk pÃ¥ nettet').encode('UTF-8'), + tostring(b, encoding='utf-8')) + + def test_encoding_tostring_sub_tail(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + tostring = self.etree.tostring + + a = Element('a') + b = SubElement(a, 'b') + b.text = _str('Søk pÃ¥ nettet') + b.tail = _str('Søk') + self.assertEquals(_str('Søk pÃ¥ nettetSøk').encode('UTF-8'), + tostring(b, encoding='utf-8')) + + def test_encoding_tostring_default_encoding(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + tostring = self.etree.tostring + + a = Element('a') + a.text = _str('Søk pÃ¥ nettet') + + expected = _bytes('Søk på nettet') + self.assertEquals( + expected, + tostring(a)) + + def test_encoding_sub_tostring_default_encoding(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + tostring = self.etree.tostring + + a = Element('a') + b = SubElement(a, 'b') + b.text = _str('Søk pÃ¥ nettet') + + expected = _bytes('Søk på nettet') + self.assertEquals( + expected, + tostring(b)) + + def test_encoding_8bit_xml(self): + utext = _str('Søk pÃ¥ nettet') + uxml = _str('

%s

') % utext + prologue = _bytes('') + isoxml = prologue + uxml.encode('iso-8859-1') + tree = self.etree.XML(isoxml) + self.assertEquals(utext, tree.text) + + def test_encoding_utf8_bom(self): + utext = _str('Søk på nettet') + uxml = (_str('') + + _str('

%s

') % utext) + bom = _bytes('\\xEF\\xBB\\xBF').decode("unicode_escape").encode("latin1") + xml = bom + uxml.encode("utf-8") + tree = etree.XML(xml) + self.assertEquals(utext, tree.text) + + def test_encoding_8bit_parse_stringio(self): + utext = _str('Søk på nettet') + uxml = _str('

%s

') % utext + prologue = _bytes('') + isoxml = prologue + uxml.encode('iso-8859-1') + el = self.etree.parse(BytesIO(isoxml)).getroot() + self.assertEquals(utext, el.text) + + def test_deepcopy_elementtree(self): + Element = self.etree.Element + ElementTree = self.etree.ElementTree + + a = Element('a') + a.text = "Foo" + atree = ElementTree(a) + + btree = copy.deepcopy(atree) + self.assertEqual("Foo", atree.getroot().text) + self.assertEqual("Foo", btree.getroot().text) + self.assertFalse(btree is atree) + self.assertFalse(btree.getroot() is atree.getroot()) + + def test_deepcopy(self): + Element = self.etree.Element + + a = Element('a') + a.text = 'Foo' + + b = copy.deepcopy(a) + self.assertEquals('Foo', b.text) + + b.text = 'Bar' + self.assertEquals('Bar', b.text) + self.assertEquals('Foo', a.text) + + del a + self.assertEquals('Bar', b.text) + + def test_deepcopy_tail(self): + Element = self.etree.Element + + a = Element('a') + a.tail = 'Foo' + + b = copy.deepcopy(a) + self.assertEquals('Foo', b.tail) + + b.tail = 'Bar' + self.assertEquals('Bar', b.tail) + self.assertEquals('Foo', a.tail) + + del a + self.assertEquals('Bar', b.tail) + + def test_deepcopy_subelement(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + root = Element('root') + a = SubElement(root, 'a') + a.text = 'FooText' + a.tail = 'FooTail' + + b = copy.deepcopy(a) + self.assertEquals('FooText', b.text) + self.assertEquals('FooTail', b.tail) + + b.text = 'BarText' + b.tail = 'BarTail' + self.assertEquals('BarTail', b.tail) + self.assertEquals('FooTail', a.tail) + self.assertEquals('BarText', b.text) + self.assertEquals('FooText', a.text) + + del a + self.assertEquals('BarTail', b.tail) + self.assertEquals('BarText', b.text) + + def test_deepcopy_namespaces(self): + root = self.etree.XML(_bytes(''' + + ''')) + self.assertEquals( + root[0][0].get('{tns}foo'), + copy.deepcopy(root[0])[0].get('{tns}foo') ) + self.assertEquals( + root[0][0].get('{tns}foo'), + copy.deepcopy(root[0][0]).get('{tns}foo') ) + + def test_deepcopy_append(self): + # previously caused a crash + Element = self.etree.Element + tostring = self.etree.tostring + + a = Element('a') + b = copy.deepcopy(a) + a.append( Element('C') ) + b.append( Element('X') ) + + self.assertEquals(_bytes(''), + tostring(a).replace(_bytes(' '), _bytes(''))) + self.assertEquals(_bytes(''), + tostring(b).replace(_bytes(' '), _bytes(''))) + + def test_deepcopy_comment(self): + # previously caused a crash + # not supported by ET < 1.3! + Comment = self.etree.Comment + + a = Comment("ONE") + b = copy.deepcopy(a) + b.text = "ANOTHER" + + self.assertEquals('ONE', a.text) + self.assertEquals('ANOTHER', b.text) + + def test_shallowcopy(self): + Element = self.etree.Element + + a = Element('a') + a.text = 'Foo' + + b = copy.copy(a) + self.assertEquals('Foo', b.text) + + b.text = 'Bar' + self.assertEquals('Bar', b.text) + self.assertEquals('Foo', a.text) + # XXX ElementTree will share nodes, but lxml.etree won't.. + + def test_shallowcopy_elementtree(self): + Element = self.etree.Element + ElementTree = self.etree.ElementTree + + a = Element('a') + a.text = 'Foo' + atree = ElementTree(a) + + btree = copy.copy(atree) + self.assertFalse(btree is atree) + self.assert_(btree.getroot() is atree.getroot()) + self.assertEquals('Foo', atree.getroot().text) + + def _test_element_boolean(self): + # deprecated as of ET 1.3/lxml 2.0 + etree = self.etree + e = etree.Element('foo') + self.assertEquals(False, bool(e)) + etree.SubElement(e, 'bar') + self.assertEquals(True, bool(e)) + e = etree.Element('foo') + e.text = 'hey' + self.assertEquals(False, bool(e)) + e = etree.Element('foo') + e.tail = 'bar' + self.assertEquals(False, bool(e)) + e = etree.Element('foo') + e.set('bar', 'Bar') + self.assertEquals(False, bool(e)) + + def test_multiple_elementrees(self): + etree = self.etree + + a = etree.Element('a') + b = etree.SubElement(a, 'b') + + t = etree.ElementTree(a) + self.assertEquals(self._rootstring(t), _bytes('')) + + t1 = etree.ElementTree(a) + self.assertEquals(self._rootstring(t1), _bytes('')) + self.assertEquals(self._rootstring(t), _bytes('')) + + t2 = etree.ElementTree(b) + self.assertEquals(self._rootstring(t2), _bytes('')) + self.assertEquals(self._rootstring(t1), _bytes('')) + self.assertEquals(self._rootstring(t), _bytes('')) + + def test_qname(self): + etree = self.etree + qname = etree.QName('myns', 'a') + a1 = etree.Element(qname) + a2 = etree.SubElement(a1, qname) + self.assertEquals(a1.tag, "{myns}a") + self.assertEquals(a2.tag, "{myns}a") + + def test_qname_cmp(self): + etree = self.etree + qname1 = etree.QName('myns', 'a') + qname2 = etree.QName('myns', 'a') + self.assertEquals(qname1, "{myns}a") + self.assertEquals("{myns}a", qname2) + self.assertEquals(qname1, qname1) + self.assertEquals(qname1, qname2) + + def test_qname_attribute_getset(self): + etree = self.etree + qname = etree.QName('myns', 'a') + + a = etree.Element(qname) + a.set(qname, "value") + + self.assertEquals(a.get(qname), "value") + self.assertEquals(a.get("{myns}a"), "value") + + def test_qname_attrib(self): + etree = self.etree + qname = etree.QName('myns', 'a') + + a = etree.Element(qname) + a.attrib[qname] = "value" + + self.assertEquals(a.attrib[qname], "value") + self.assertEquals(a.attrib.get(qname), "value") + + self.assertEquals(a.attrib["{myns}a"], "value") + self.assertEquals(a.attrib.get("{myns}a"), "value") + + def test_qname_attribute_resolve(self): + etree = self.etree + qname = etree.QName('http://myns', 'a') + a = etree.Element(qname) + a.set(qname, qname) + + self.assertXML( + _bytes(''), + a) + + def test_qname_attribute_resolve_new(self): + etree = self.etree + qname = etree.QName('http://myns', 'a') + a = etree.Element('a') + a.set('a', qname) + + self.assertXML( + _bytes(''), + a) + + def test_qname_attrib_resolve(self): + etree = self.etree + qname = etree.QName('http://myns', 'a') + a = etree.Element(qname) + a.attrib[qname] = qname + + self.assertXML( + _bytes(''), + a) + + def test_parser_version(self): + etree = self.etree + parser = etree.XMLParser() + if hasattr(parser, "version"): + # ElementTree 1.3+, cET + self.assert_(re.match("[^ ]+ [0-9.]+", parser.version)) + + # feed parser interface + + def test_feed_parser(self): + parser = self.etree.XMLParser() + + parser.feed('<') + parser.feed('a test="works"/') + parser.feed('>') + + root = parser.close() + + self.assertEquals(root.tag, "root") + self.assertEquals(root[0].tag, "a") + self.assertEquals(root[0].get("test"), "works") + + def test_feed_parser_error_close_empty(self): + ParseError = self.etree.ParseError + parser = self.etree.XMLParser() + self.assertRaises(ParseError, parser.close) + + def test_feed_parser_error_close_incomplete(self): + ParseError = self.etree.ParseError + parser = self.etree.XMLParser() + + parser.feed('<><><><><><') + except ParseError: + # can raise, but not required before close() + pass + + self.assertRaises(ParseError, parser.close) + + def test_feed_parser_error_position(self): + ParseError = self.etree.ParseError + parser = self.etree.XMLParser() + try: + parser.close() + except ParseError: + e = sys.exc_info()[1] + self.assertNotEquals(None, e.code) + self.assertNotEquals(0, e.code) + self.assert_(isinstance(e.position, tuple)) + self.assert_(e.position >= (0, 0)) + + # parser target interface + + def test_parser_target_tag(self): + assertEquals = self.assertEquals + assertFalse = self.assertFalse + + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start") + assertFalse(attrib) + assertEquals("TAG", tag) + def end(self, tag): + events.append("end") + assertEquals("TAG", tag) + def close(self): + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + parser.feed("") + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["start", "end"], events) + + def test_elementtree_parser_target(self): + assertEquals = self.assertEquals + assertFalse = self.assertFalse + Element = self.etree.Element + + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start") + assertFalse(attrib) + assertEquals("TAG", tag) + def end(self, tag): + events.append("end") + assertEquals("TAG", tag) + def close(self): + return Element("DONE") + + parser = self.etree.XMLParser(target=Target()) + tree = self.etree.ElementTree() + tree.parse(BytesIO(""), parser=parser) + + self.assertEquals("DONE", tree.getroot().tag) + self.assertEquals(["start", "end"], events) + + def test_parser_target_attrib(self): + assertEquals = self.assertEquals + + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + for name, value in attrib.items(): + assertEquals(tag + name, value) + def end(self, tag): + events.append("end-" + tag) + def close(self): + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + parser.feed('') + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["start-root", "start-sub", "end-sub", "end-root"], + events) + + def test_parser_target_data(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + def data(self, data): + events.append("data-" + data) + def close(self): + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + parser.feed('AB') + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["start-root", "data-A", "start-sub", + "end-sub", "data-B", "end-root"], + events) + + def test_parser_target_entity(self): + events = [] + class Target(object): + def __init__(self): + self._data = [] + def _flush_data(self): + if self._data: + events.append("data-" + ''.join(self._data)) + del self._data[:] + def start(self, tag, attrib): + self._flush_data() + events.append("start-" + tag) + def end(self, tag): + self._flush_data() + events.append("end-" + tag) + def data(self, data): + self._data.append(data) + def close(self): + self._flush_data() + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + dtd = ''' + + + + ]> + ''' + parser.feed(dtd+'this is &ent;') + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["start-root", "start-sub", "end-sub", "start-sub", + "data-this is an entity", + "end-sub", "start-sub", "end-sub", "end-root"], + events) + + def test_parser_target_entity_unknown(self): + events = [] + class Target(object): + def __init__(self): + self._data = [] + def _flush_data(self): + if self._data: + events.append("data-" + ''.join(self._data)) + del self._data[:] + def start(self, tag, attrib): + self._flush_data() + events.append("start-" + tag) + def end(self, tag): + self._flush_data() + events.append("end-" + tag) + def data(self, data): + self._data.append(data) + def close(self): + self._flush_data() + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + def feed(): + parser.feed('some &ent;') + parser.close() + + self.assertRaises(self.etree.ParseError, feed) + + def test_parser_target_feed_exception(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + if tag == 'a': + raise ValueError("dead and gone") + def data(self, data): + events.append("data-" + data) + def close(self): + events.append("close") + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + try: + parser.feed(_bytes('AcaB')) + done = parser.close() + self.fail("error expected, but parsing succeeded") + except ValueError: + done = 'value error received as expected' + + self.assertEquals(["start-root", "data-A", "start-a", + "data-ca", "end-a"], + events) + + def test_parser_target_fromstring_exception(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + if tag == 'a': + raise ValueError("dead and gone") + def data(self, data): + events.append("data-" + data) + def close(self): + events.append("close") + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + try: + done = self.etree.fromstring(_bytes('AcaB'), + parser=parser) + self.fail("error expected, but parsing succeeded") + except ValueError: + done = 'value error received as expected' + + self.assertEquals(["start-root", "data-A", "start-a", + "data-ca", "end-a"], + events) + + def test_treebuilder(self): + builder = self.etree.TreeBuilder() + el = builder.start("root", {'a':'A', 'b':'B'}) + self.assertEquals("root", el.tag) + self.assertEquals({'a':'A', 'b':'B'}, el.attrib) + builder.data("ROOTTEXT") + el = builder.start("child", {'x':'X', 'y':'Y'}) + self.assertEquals("child", el.tag) + self.assertEquals({'x':'X', 'y':'Y'}, el.attrib) + builder.data("CHILDTEXT") + el = builder.end("child") + self.assertEquals("child", el.tag) + self.assertEquals({'x':'X', 'y':'Y'}, el.attrib) + self.assertEquals("CHILDTEXT", el.text) + self.assertEquals(None, el.tail) + builder.data("CHILDTAIL") + root = builder.end("root") + + self.assertEquals("root", root.tag) + self.assertEquals("ROOTTEXT", root.text) + self.assertEquals("CHILDTEXT", root[0].text) + self.assertEquals("CHILDTAIL", root[0].tail) + + def test_treebuilder_target(self): + parser = self.etree.XMLParser(target=self.etree.TreeBuilder()) + parser.feed('ROOTTEXTCHILDTEXTCHILDTAIL') + root = parser.close() + + self.assertEquals("root", root.tag) + self.assertEquals("ROOTTEXT", root.text) + self.assertEquals("CHILDTEXT", root[0].text) + self.assertEquals("CHILDTAIL", root[0].tail) + + # helper methods + + def _writeElement(self, element, encoding='us-ascii'): + """Write out element for comparison. + """ + data = self.etree.tostring(element, encoding=encoding) + if encoding != 'us-ascii': + data = data.decode(encoding) + return canonicalize(data) + + def _writeElementFile(self, element, encoding='us-ascii'): + """Write out element for comparison, using real file. + """ + ElementTree = self.etree.ElementTree + handle, filename = tempfile.mkstemp() + try: + f = open(filename, 'wb') + tree = ElementTree(element=element) + tree.write(f, encoding=encoding) + f.close() + f = open(filename, 'rb') + data = f.read() + f.close() + finally: + os.close(handle) + os.remove(filename) + if encoding != 'us-ascii': + data = data.decode(encoding) + return canonicalize(data) + + def assertXML(self, expected, element, encoding='us-ascii'): + """Writes element out and checks whether it is expected. + + Does this two ways; once using BytesIO, once using a real file. + """ + self.assertEquals(expected, self._writeElement(element, encoding)) + self.assertEquals(expected, self._writeElementFile(element, encoding)) + + def assertEncodingDeclaration(self, result, encoding): + "Checks if the result XML byte string specifies the encoding." + enc_re = r"<\?xml[^>]+ encoding=[\"']([^\"']+)[\"']" + if isinstance(result, str): + has_encoding = re.compile(enc_re).match + else: + has_encoding = re.compile(_bytes(enc_re)).match + self.assert_(has_encoding(result)) + result_encoding = has_encoding(result).group(1) + self.assertEquals(result_encoding.upper(), encoding.upper()) + + def _rootstring(self, tree): + return self.etree.tostring(tree.getroot()).replace( + _bytes(' '), _bytes('')).replace(_bytes('\n'), _bytes('')) + + def _check_element_tree(self, tree): + self._check_element(tree.getroot()) + + def _check_element(self, element): + self.assert_(hasattr(element, 'tag')) + self.assert_(hasattr(element, 'attrib')) + self.assert_(hasattr(element, 'text')) + self.assert_(hasattr(element, 'tail')) + self._check_string(element.tag) + self._check_mapping(element.attrib) + if element.text != None: + self._check_string(element.text) + if element.tail != None: + self._check_string(element.tail) + + def _check_string(self, string): + len(string) + for char in string: + self.assertEquals(1, len(char)) + new_string = string + "" + new_string = string + " " + string[:0] + + def _check_mapping(self, mapping): + len(mapping) + keys = mapping.keys() + values = mapping.values() + items = mapping.items() + for key in keys: + item = mapping[key] + mapping["key"] = "value" + self.assertEquals("value", mapping["key"]) + + +if etree: + class ETreeTestCase(ETreeTestCaseBase): + etree = etree + +if ElementTree: + class ElementTreeTestCase(ETreeTestCaseBase): + etree = ElementTree + +if cElementTree: + class CElementTreeTestCase(ETreeTestCaseBase): + etree = cElementTree + +def test_suite(): + suite = unittest.TestSuite() + if etree: + suite.addTests([unittest.makeSuite(ETreeTestCase)]) + if ElementTree: + suite.addTests([unittest.makeSuite(ElementTreeTestCase)]) + if cElementTree: + suite.addTests([unittest.makeSuite(CElementTreeTestCase)]) + return suite + +if __name__ == '__main__': + print('to test use test.py %s' % __file__) diff --git a/src/lxml/tests/test_errors.py b/src/lxml/tests/test_errors.py new file mode 100644 index 0000000..cff9e2a --- /dev/null +++ b/src/lxml/tests/test_errors.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +import unittest, doctest + +# These tests check that error handling in the Pyrex code is +# complete. +# It is likely that if there are errors, instead of failing the code +# will simply crash. + +import sys, gc, os.path +from lxml import etree + +this_dir = os.path.dirname(__file__) +if this_dir not in sys.path: + sys.path.insert(0, this_dir) # needed for Py3 + +from common_imports import HelperTestCase + +class ErrorTestCase(HelperTestCase): + etree = etree + + def test_bad_element(self): + # attrib argument of Element() should be a dictionary, so if + # we pass a string we should get an error. + self.assertRaises(TypeError, self.etree.Element, 'a', 'b') + + def test_empty_parse(self): + self.assertRaises(etree.XMLSyntaxError, etree.fromstring, '') + + def test_element_cyclic_gc_none(self): + # test if cyclic reference can crash etree + Element = self.etree.Element + gc.collect() + + count = sys.getrefcount(None) + + l = [Element('name'), Element('name')] + l.append(l) + + del l + gc.collect() + + self.assertEquals(sys.getrefcount(None), count) + +def test_suite(): + suite = unittest.TestSuite() + suite.addTests([unittest.makeSuite(ErrorTestCase)]) + return suite + +if __name__ == '__main__': + print('to test use test.py %s' % __file__) diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py new file mode 100644 index 0000000..ea78165 --- /dev/null +++ b/src/lxml/tests/test_etree.py @@ -0,0 +1,3055 @@ +# -*- coding: utf-8 -*- + +""" +Tests specific to the extended etree API + +Tests that apply to the general ElementTree API should go into +test_elementtree +""" + +import os.path, unittest, copy, sys, operator, tempfile, gzip + +this_dir = os.path.dirname(__file__) +if this_dir not in sys.path: + sys.path.insert(0, this_dir) # needed for Py3 + +from common_imports import etree, StringIO, BytesIO, HelperTestCase, fileInTestDir +from common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_doctest +from common_imports import canonicalize, sorted, _str, _bytes + +print("") +print("TESTED VERSION: %s" % etree.__version__) +print(" Python: " + repr(sys.version_info)) +print(" lxml.etree: " + repr(etree.LXML_VERSION)) +print(" libxml used: " + repr(etree.LIBXML_VERSION)) +print(" libxml compiled: " + repr(etree.LIBXML_COMPILED_VERSION)) +print(" libxslt used: " + repr(etree.LIBXSLT_VERSION)) +print(" libxslt compiled: " + repr(etree.LIBXSLT_COMPILED_VERSION)) +print("") + +try: + _unicode = unicode +except NameError: + # Python 3 + _unicode = str + +class ETreeOnlyTestCase(HelperTestCase): + """Tests only for etree, not ElementTree""" + etree = etree + + def test_version(self): + self.assert_(isinstance(etree.__version__, _unicode)) + self.assert_(isinstance(etree.LXML_VERSION, tuple)) + self.assertEqual(len(etree.LXML_VERSION), 4) + self.assert_(isinstance(etree.LXML_VERSION[0], int)) + self.assert_(isinstance(etree.LXML_VERSION[1], int)) + self.assert_(isinstance(etree.LXML_VERSION[2], int)) + self.assert_(isinstance(etree.LXML_VERSION[3], int)) + self.assert_(etree.__version__.startswith( + str(etree.LXML_VERSION[0]))) + + def test_c_api(self): + if hasattr(self.etree, '__pyx_capi__'): + # newer Pyrex compatible C-API + self.assert_(isinstance(self.etree.__pyx_capi__, dict)) + self.assert_(len(self.etree.__pyx_capi__) > 0) + else: + # older C-API mechanism + self.assert_(hasattr(self.etree, '_import_c_api')) + + def test_element_names(self): + Element = self.etree.Element + el = Element('name') + self.assertEquals(el.tag, 'name') + el = Element('{}name') + self.assertEquals(el.tag, 'name') + + def test_element_name_empty(self): + Element = self.etree.Element + el = Element('name') + self.assertRaises(ValueError, Element, '{}') + self.assertRaises(ValueError, setattr, el, 'tag', '{}') + + self.assertRaises(ValueError, Element, '{test}') + self.assertRaises(ValueError, setattr, el, 'tag', '{test}') + + def test_element_name_colon(self): + Element = self.etree.Element + self.assertRaises(ValueError, Element, 'p:name') + self.assertRaises(ValueError, Element, '{test}p:name') + + el = Element('name') + self.assertRaises(ValueError, setattr, el, 'tag', 'p:name') + + def test_element_name_quote(self): + Element = self.etree.Element + self.assertRaises(ValueError, Element, "p'name") + self.assertRaises(ValueError, Element, 'p"name') + + self.assertRaises(ValueError, Element, "{test}p'name") + self.assertRaises(ValueError, Element, '{test}p"name') + + el = Element('name') + self.assertRaises(ValueError, setattr, el, 'tag', "p'name") + self.assertRaises(ValueError, setattr, el, 'tag', 'p"name') + + def test_element_name_space(self): + Element = self.etree.Element + self.assertRaises(ValueError, Element, ' name ') + self.assertRaises(ValueError, Element, 'na me') + self.assertRaises(ValueError, Element, '{test} name') + + el = Element('name') + self.assertRaises(ValueError, setattr, el, 'tag', ' name ') + + def test_subelement_name_empty(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, '{}') + self.assertRaises(ValueError, SubElement, el, '{test}') + + def test_subelement_name_colon(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, 'p:name') + self.assertRaises(ValueError, SubElement, el, '{test}p:name') + + def test_subelement_name_quote(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, "p'name") + self.assertRaises(ValueError, SubElement, el, "{test}p'name") + + self.assertRaises(ValueError, SubElement, el, 'p"name') + self.assertRaises(ValueError, SubElement, el, '{test}p"name') + + def test_subelement_name_space(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, ' name ') + self.assertRaises(ValueError, SubElement, el, 'na me') + self.assertRaises(ValueError, SubElement, el, '{test} name') + + def test_subelement_attribute_invalid(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, 'name', {'a b c' : 'abc'}) + self.assertRaises(ValueError, SubElement, el, 'name', {'a' : 'a\0\n'}) + self.assertEquals(0, len(el)) + + def test_qname_empty(self): + QName = self.etree.QName + self.assertRaises(ValueError, QName, '') + self.assertRaises(ValueError, QName, 'test', '') + + def test_qname_colon(self): + QName = self.etree.QName + self.assertRaises(ValueError, QName, 'p:name') + self.assertRaises(ValueError, QName, 'test', 'p:name') + + def test_qname_space(self): + QName = self.etree.QName + self.assertRaises(ValueError, QName, ' name ') + self.assertRaises(ValueError, QName, 'na me') + self.assertRaises(ValueError, QName, 'test', ' name') + + def test_qname_namespace_localname(self): + # ET doesn't have namespace/localname properties on QNames + QName = self.etree.QName + namespace, localname = 'http://myns', 'a' + qname = QName(namespace, localname) + self.assertEquals(namespace, qname.namespace) + self.assertEquals(localname, qname.localname) + + def test_qname_element(self): + # ET doesn't have namespace/localname properties on QNames + QName = self.etree.QName + qname1 = QName('http://myns', 'a') + a = self.etree.Element(qname1, nsmap={'p' : 'http://myns'}) + + qname2 = QName(a) + self.assertEquals(a.tag, qname1.text) + self.assertEquals(qname1.text, qname2.text) + self.assertEquals(qname1, qname2) + + def test_qname_text_resolve(self): + # ET doesn't resove QNames as text values + etree = self.etree + qname = etree.QName('http://myns', 'a') + a = etree.Element(qname, nsmap={'p' : 'http://myns'}) + a.text = qname + + self.assertEquals("p:a", a.text) + + def test_nsmap_prefix_invalid(self): + etree = self.etree + self.assertRaises(ValueError, + etree.Element, "root", nsmap={'"' : 'testns'}) + self.assertRaises(ValueError, + etree.Element, "root", nsmap={'&' : 'testns'}) + self.assertRaises(ValueError, + etree.Element, "root", nsmap={'a:b' : 'testns'}) + + def test_attribute_set(self): + Element = self.etree.Element + root = Element("root") + root.set("attr", "TEST") + self.assertEquals("TEST", root.get("attr")) + + def test_attribute_set_invalid(self): + # ElementTree accepts arbitrary attribute values + # lxml.etree allows only strings + Element = self.etree.Element + root = Element("root") + self.assertRaises(TypeError, root.set, "newattr", 5) + self.assertRaises(TypeError, root.set, "newattr", None) + + def test_strip_attributes(self): + XML = self.etree.XML + xml = _bytes('') + + root = XML(xml) + self.etree.strip_attributes(root, 'a') + self.assertEquals(_bytes(''), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_attributes(root, 'b', 'c') + self.assertEquals(_bytes(''), + self._writeElement(root)) + + def test_strip_attributes_ns(self): + XML = self.etree.XML + xml = _bytes('') + + root = XML(xml) + self.etree.strip_attributes(root, 'a') + self.assertEquals( + _bytes(''), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_attributes(root, '{http://test/ns}a', 'c') + self.assertEquals( + _bytes(''), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_attributes(root, '{http://test/ns}*') + self.assertEquals( + _bytes(''), + self._writeElement(root)) + + def test_strip_elements(self): + XML = self.etree.XML + xml = _bytes('') + + root = XML(xml) + self.etree.strip_elements(root, 'a') + self.assertEquals(_bytes(''), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_elements(root, 'b', 'c', 'X', 'Y', 'Z') + self.assertEquals(_bytes(''), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_elements(root, 'c') + self.assertEquals(_bytes(''), + self._writeElement(root)) + + def test_strip_elements_ns(self): + XML = self.etree.XML + xml = _bytes('TESTABCBTATXABTCTATXT') + + root = XML(xml) + self.etree.strip_elements(root, 'a') + self.assertEquals(_bytes('TESTABCBTATXXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_elements(root, '{urn:a}b', 'c') + self.assertEquals(_bytes('TESTABCBTATXACTATXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_elements(root, '{urn:a}*', 'c') + self.assertEquals(_bytes('TESTXACTATXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_elements(root, '{urn:a}*', 'c', with_tail=False) + self.assertEquals(_bytes('TESTATXABTCTATXT'), + self._writeElement(root)) + + def test_strip_tags(self): + XML = self.etree.XML + xml = _bytes('TESTABCTBTATXABTCTATXT') + + root = XML(xml) + self.etree.strip_tags(root, 'a') + self.assertEquals(_bytes('TESTABCTBTATXABTCTATXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_tags(root, 'b', 'c', 'X', 'Y', 'Z') + self.assertEquals(_bytes('TESTABCTBTATXABTCTATXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_tags(root, 'c') + self.assertEquals(_bytes('TESTABCTBTATXABTCTATXT'), + self._writeElement(root)) + + def test_strip_tags_ns(self): + XML = self.etree.XML + xml = _bytes('TESTABCTBTATXABTCTATXT') + + root = XML(xml) + self.etree.strip_tags(root, 'a') + self.assertEquals(_bytes('TESTABCTBTATXABTCTATXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_tags(root, '{urn:a}b', 'c') + self.assertEquals(_bytes('TESTABCTBTATXABTCTATXT'), + self._writeElement(root)) + + root = XML(xml) + self.etree.strip_tags(root, '{urn:a}*', 'c') + self.assertEquals(_bytes('TESTABCTBTATXABTCTATXT'), + self._writeElement(root)) + + def test_pi(self): + # lxml.etree separates target and text + Element = self.etree.Element + SubElement = self.etree.SubElement + ProcessingInstruction = self.etree.ProcessingInstruction + + a = Element('a') + a.append(ProcessingInstruction('foo', 'some more text')) + self.assertEquals(a[0].target, 'foo') + self.assertEquals(a[0].text, 'some more text') + + def test_pi_parse(self): + XML = self.etree.XML + root = XML(_bytes("")) + self.assertEquals(root[0].target, "mypi") + self.assertEquals(root[0].text, "my test ") + + def test_deepcopy_pi(self): + # previously caused a crash + ProcessingInstruction = self.etree.ProcessingInstruction + + a = ProcessingInstruction("PI", "ONE") + b = copy.deepcopy(a) + b.text = "ANOTHER" + + self.assertEquals('ONE', a.text) + self.assertEquals('ANOTHER', b.text) + + def test_deepcopy_elementtree_pi(self): + XML = self.etree.XML + tostring = self.etree.tostring + root = XML(_bytes("")) + tree1 = self.etree.ElementTree(root) + self.assertEquals(_bytes(""), + tostring(tree1)) + + tree2 = copy.deepcopy(tree1) + self.assertEquals(_bytes(""), + tostring(tree2)) + + root2 = copy.deepcopy(tree1.getroot()) + self.assertEquals(_bytes(""), + tostring(root2)) + + def test_deepcopy_elementtree_dtd(self): + XML = self.etree.XML + tostring = self.etree.tostring + xml = _bytes('\n]>\n') + root = XML(xml) + tree1 = self.etree.ElementTree(root) + self.assertEquals(xml, tostring(tree1)) + + tree2 = copy.deepcopy(tree1) + self.assertEquals(xml, tostring(tree2)) + + root2 = copy.deepcopy(tree1.getroot()) + self.assertEquals(_bytes(""), + tostring(root2)) + + def test_attribute_set(self): + # ElementTree accepts arbitrary attribute values + # lxml.etree allows only strings + Element = self.etree.Element + + root = Element("root") + root.set("attr", "TEST") + self.assertEquals("TEST", root.get("attr")) + self.assertRaises(TypeError, root.set, "newattr", 5) + + def test_parse_remove_comments(self): + fromstring = self.etree.fromstring + tostring = self.etree.tostring + XMLParser = self.etree.XMLParser + + xml = _bytes('') + parser = XMLParser(remove_comments=True) + root = fromstring(xml, parser) + self.assertEquals( + _bytes(''), + tostring(root)) + + def test_parse_remove_pis(self): + parse = self.etree.parse + tostring = self.etree.tostring + XMLParser = self.etree.XMLParser + + xml = _bytes('') + + f = BytesIO(xml) + tree = parse(f) + self.assertEquals( + xml, + tostring(tree)) + + parser = XMLParser(remove_pis=True) + tree = parse(f, parser) + self.assertEquals( + _bytes(''), + tostring(tree)) + + def test_parse_parser_type_error(self): + # ET raises IOError only + parse = self.etree.parse + self.assertRaises(TypeError, parse, 'notthere.xml', object()) + + def test_iterparse_tree_comments(self): + # ET removes comments + iterparse = self.etree.iterparse + tostring = self.etree.tostring + + f = BytesIO('') + events = list(iterparse(f)) + root = events[-1][1] + self.assertEquals(3, len(events)) + self.assertEquals( + _bytes(''), + tostring(root)) + + def test_iterparse_comments(self): + # ET removes comments + iterparse = self.etree.iterparse + tostring = self.etree.tostring + + def name(event, el): + if event == 'comment': + return el.text + else: + return el.tag + + f = BytesIO('') + events = list(iterparse(f, events=('end', 'comment'))) + root = events[-1][1] + self.assertEquals(6, len(events)) + self.assertEquals(['A', ' B ', 'c', 'b', 'C', 'a'], + [ name(*item) for item in events ]) + self.assertEquals( + _bytes(''), + tostring(root)) + + def test_iterparse_pis(self): + # ET removes pis + iterparse = self.etree.iterparse + tostring = self.etree.tostring + ElementTree = self.etree.ElementTree + + def name(event, el): + if event == 'pi': + return (el.target, el.text) + else: + return el.tag + + f = BytesIO('') + events = list(iterparse(f, events=('end', 'pi'))) + root = events[-2][1] + self.assertEquals(8, len(events)) + self.assertEquals([('pia','a'), ('pib','b'), ('pic','c'), 'c', 'b', + ('pid','d'), 'a', ('pie','e')], + [ name(*item) for item in events ]) + self.assertEquals( + _bytes(''), + tostring(ElementTree(root))) + + def test_iterparse_remove_comments(self): + iterparse = self.etree.iterparse + tostring = self.etree.tostring + + f = BytesIO('') + events = list(iterparse(f, remove_comments=True, + events=('end', 'comment'))) + root = events[-1][1] + self.assertEquals(3, len(events)) + self.assertEquals(['c', 'b', 'a'], + [ el.tag for (event, el) in events ]) + self.assertEquals( + _bytes(''), + tostring(root)) + + def test_iterparse_broken(self): + iterparse = self.etree.iterparse + f = BytesIO('') + # ET raises ExpatError, lxml raises XMLSyntaxError + self.assertRaises(self.etree.XMLSyntaxError, list, iterparse(f)) + + def test_iterparse_strip(self): + iterparse = self.etree.iterparse + f = BytesIO(""" + \n \n b test \n + + \n\t \n \n """) + iterator = iterparse(f, remove_blank_text=True) + text = [ (element.text, element.tail) + for event, element in iterator ] + self.assertEquals( + [(" b test ", None), (" \n ", None), (None, None)], + text) + + def test_iterparse_tag(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + iterator = iterparse(f, tag="b", events=('start', 'end')) + events = list(iterator) + root = iterator.root + self.assertEquals( + [('start', root[0]), ('end', root[0])], + events) + + def test_iterparse_tag_all(self): + iterparse = self.etree.iterparse + f = BytesIO('') + + iterator = iterparse(f, tag="*", events=('start', 'end')) + events = list(iterator) + self.assertEquals( + 8, + len(events)) + + def test_iterparse_encoding_error(self): + text = _str('Søk pÃ¥ nettet') + wrong_declaration = "" + xml_latin1 = (_str('%s%s') % (wrong_declaration, text) + ).encode('iso-8859-1') + + self.assertRaises(self.etree.ParseError, + list, self.etree.iterparse(BytesIO(xml_latin1))) + + def test_iterparse_encoding_8bit_override(self): + text = _str('Søk pÃ¥ nettet', encoding="UTF-8") + wrong_declaration = "" + xml_latin1 = (_str('%s%s') % (wrong_declaration, text) + ).encode('iso-8859-1') + + iterator = self.etree.iterparse(BytesIO(xml_latin1), + encoding="iso-8859-1") + self.assertEquals(1, len(list(iterator))) + + a = iterator.root + self.assertEquals(a.text, text) + + def test_iterparse_keep_cdata(self): + tostring = self.etree.tostring + f = BytesIO('') + context = self.etree.iterparse(f, strip_cdata=False) + content = [ el.text for event,el in context ] + + self.assertEquals(['test'], content) + self.assertEquals(_bytes(''), + tostring(context.root)) + + def test_parser_encoding_unknown(self): + self.assertRaises( + LookupError, self.etree.XMLParser, encoding="hopefully unknown") + + def test_parser_encoding(self): + self.etree.XMLParser(encoding="ascii") + self.etree.XMLParser(encoding="utf-8") + self.etree.XMLParser(encoding="iso-8859-1") + + def test_feed_parser_recover(self): + parser = self.etree.XMLParser(recover=True) + + parser.feed('<') + parser.feed('a test="works"') + parser.feed('> not closed! + parser.feed('>') + + root = parser.close() + + self.assertEquals(root.tag, "root") + self.assertEquals(len(root), 1) + self.assertEquals(root[0].tag, "a") + self.assertEquals(root[0].get("test"), "works") + self.assertEquals(len(root[0]), 1) + self.assertEquals(root[0][0].tag, "othertag") + # FIXME: would be nice to get some errors logged ... + #self.assert_(len(parser.error_log) > 0, "error log is empty") + + def test_elementtree_parser_target_type_error(self): + assertEquals = self.assertEquals + assertFalse = self.assertFalse + + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start") + assertFalse(attrib) + assertEquals("TAG", tag) + def end(self, tag): + events.append("end") + assertEquals("TAG", tag) + def close(self): + return "DONE" # no Element! + + parser = self.etree.XMLParser(target=Target()) + tree = self.etree.ElementTree() + + self.assertRaises(TypeError, + tree.parse, BytesIO(""), parser=parser) + self.assertEquals(["start", "end"], events) + + def test_parser_target_comment(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + def data(self, data): + events.append("data-" + data) + def comment(self, text): + events.append("comment-" + text) + def close(self): + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + parser.feed(_bytes('AB')) + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["comment-a", "start-root", "data-A", "comment-b", + "start-sub", "end-sub", "comment-c", "data-B", + "end-root", "comment-d"], + events) + + def test_parser_target_pi(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + def data(self, data): + events.append("data-" + data) + def pi(self, target, data): + events.append("pi-" + target + "-" + data) + def close(self): + return "DONE" + + parser = self.etree.XMLParser(target=Target()) + + parser.feed(_bytes('AB')) + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["pi-test-a", "start-root", "data-A", "pi-test-b", + "data-B", "end-root", "pi-test-c"], + events) + + def test_parser_target_cdata(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + def data(self, data): + events.append("data-" + data) + def close(self): + return "DONE" + + parser = self.etree.XMLParser(target=Target(), + strip_cdata=False) + + parser.feed(_bytes('AB')) + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["start-root", "data-A", "start-a", + "data-ca", "end-a", "data-B", "end-root"], + events) + + def test_parser_target_recover(self): + events = [] + class Target(object): + def start(self, tag, attrib): + events.append("start-" + tag) + def end(self, tag): + events.append("end-" + tag) + def data(self, data): + events.append("data-" + data) + def close(self): + events.append("close") + return "DONE" + + parser = self.etree.XMLParser(target=Target(), + recover=True) + + parser.feed(_bytes('AcaB')) + done = parser.close() + + self.assertEquals("DONE", done) + self.assertEquals(["start-root", "data-A", "start-a", + "data-ca", "end-a", "data-B", + "end-root", "close"], + events) + + def test_iterwalk_tag(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + iterator = iterwalk(root, tag="b", events=('start', 'end')) + events = list(iterator) + self.assertEquals( + [('start', root[0]), ('end', root[0])], + events) + + def test_iterwalk_tag_all(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + iterator = iterwalk(root, tag="*", events=('start', 'end')) + events = list(iterator) + self.assertEquals( + 8, + len(events)) + + def test_iterwalk(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + events = list(iterwalk(root)) + self.assertEquals( + [('end', root[0]), ('end', root[1]), ('end', root)], + events) + + def test_iterwalk_start(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + iterator = iterwalk(root, events=('start',)) + events = list(iterator) + self.assertEquals( + [('start', root), ('start', root[0]), ('start', root[1])], + events) + + def test_iterwalk_start_end(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + iterator = iterwalk(root, events=('start','end')) + events = list(iterator) + self.assertEquals( + [('start', root), ('start', root[0]), ('end', root[0]), + ('start', root[1]), ('end', root[1]), ('end', root)], + events) + + def test_iterwalk_clear(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + iterator = iterwalk(root) + for event, elem in iterator: + elem.clear() + + self.assertEquals(0, + len(root)) + + def test_iterwalk_attrib_ns(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + attr_name = '{testns}bla' + events = [] + iterator = iterwalk(root, events=('start','end','start-ns','end-ns')) + for event, elem in iterator: + events.append(event) + if event == 'start': + if elem.tag != '{ns1}a': + elem.set(attr_name, 'value') + + self.assertEquals( + ['start-ns', 'start', 'start', 'start-ns', 'start', + 'end', 'end-ns', 'end', 'end', 'end-ns'], + events) + + self.assertEquals( + None, + root.get(attr_name)) + self.assertEquals( + 'value', + root[0].get(attr_name)) + + def test_iterwalk_getiterator(self): + iterwalk = self.etree.iterwalk + root = self.etree.XML(_bytes('')) + + counts = [] + for event, elem in iterwalk(root): + counts.append(len(list(elem.getiterator()))) + self.assertEquals( + [1,2,1,4], + counts) + + def test_resolve_string_dtd(self): + parse = self.etree.parse + parser = self.etree.XMLParser(dtd_validation=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, test_url) + return self.resolve_string( + _str(''' + ''') % url, context) + + parser.resolvers.add(MyResolver()) + + xml = _str('&myentity;') % test_url + tree = parse(StringIO(xml), parser) + root = tree.getroot() + self.assertEquals(root.text, test_url) + + def test_resolve_bytes_dtd(self): + parse = self.etree.parse + parser = self.etree.XMLParser(dtd_validation=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, test_url) + return self.resolve_string( + (_str(''' + ''') % url).encode('utf-8'), + context) + + parser.resolvers.add(MyResolver()) + + xml = _str('&myentity;') % test_url + tree = parse(StringIO(xml), parser) + root = tree.getroot() + self.assertEquals(root.text, test_url) + + def test_resolve_filelike_dtd(self): + parse = self.etree.parse + parser = self.etree.XMLParser(dtd_validation=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, test_url) + return self.resolve_file( + SillyFileLike( + _str(''' + ''') % url), context) + + parser.resolvers.add(MyResolver()) + + xml = _str('&myentity;') % test_url + tree = parse(StringIO(xml), parser) + root = tree.getroot() + self.assertEquals(root.text, test_url) + + def test_resolve_filename_dtd(self): + parse = self.etree.parse + parser = self.etree.XMLParser(attribute_defaults=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, test_url) + return self.resolve_filename( + fileInTestDir('test.dtd'), context) + + parser.resolvers.add(MyResolver()) + + xml = _str('') % test_url + tree = parse(StringIO(xml), parser) + root = tree.getroot() + self.assertEquals( + root.attrib, {'default': 'valueA'}) + self.assertEquals( + root[0].attrib, {'default': 'valueB'}) + + def test_resolve_filename_dtd_relative(self): + parse = self.etree.parse + parser = self.etree.XMLParser(attribute_defaults=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, fileInTestDir(test_url)) + return self.resolve_filename( + fileInTestDir('test.dtd'), context) + + parser.resolvers.add(MyResolver()) + + xml = _str('') % test_url + tree = parse(StringIO(xml), parser, + base_url=fileInTestDir('__test.xml')) + root = tree.getroot() + self.assertEquals( + root.attrib, {'default': 'valueA'}) + self.assertEquals( + root[0].attrib, {'default': 'valueB'}) + + def test_resolve_file_dtd(self): + parse = self.etree.parse + parser = self.etree.XMLParser(attribute_defaults=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, test_url) + return self.resolve_file( + open(fileInTestDir('test.dtd'), 'rb'), context) + + parser.resolvers.add(MyResolver()) + + xml = _str('') % test_url + tree = parse(StringIO(xml), parser) + root = tree.getroot() + self.assertEquals( + root.attrib, {'default': 'valueA'}) + self.assertEquals( + root[0].attrib, {'default': 'valueB'}) + + def test_resolve_empty(self): + parse = self.etree.parse + parser = self.etree.XMLParser(load_dtd=True) + assertEqual = self.assertEqual + test_url = _str("__nosuch.dtd") + + class check(object): + resolved = False + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + assertEqual(url, test_url) + check.resolved = True + return self.resolve_empty(context) + + parser.resolvers.add(MyResolver()) + + xml = _str('&myentity;') % test_url + self.assertRaises(etree.XMLSyntaxError, parse, StringIO(xml), parser) + self.assert_(check.resolved) + + def test_resolve_error(self): + parse = self.etree.parse + parser = self.etree.XMLParser(dtd_validation=True) + + class _LocalException(Exception): + pass + + class MyResolver(self.etree.Resolver): + def resolve(self, url, id, context): + raise _LocalException + + parser.resolvers.add(MyResolver()) + + xml = '&myentity;' + self.assertRaises(_LocalException, parse, BytesIO(xml), parser) + + if etree.LIBXML_VERSION > (2,6,20): + def test_entity_parse(self): + parse = self.etree.parse + tostring = self.etree.tostring + parser = self.etree.XMLParser(resolve_entities=False) + Entity = self.etree.Entity + + xml = _bytes('&myentity;') + tree = parse(BytesIO(xml), parser) + root = tree.getroot() + self.assertEquals(root[0].tag, Entity) + self.assertEquals(root[0].text, "&myentity;") + self.assertEquals(root[0].tail, None) + self.assertEquals(root[0].name, "myentity") + + self.assertEquals(_bytes('&myentity;'), + tostring(root)) + + def test_entity_restructure(self): + xml = _bytes(''' ]> + + + +   + ''') + + parser = self.etree.XMLParser(resolve_entities=False) + root = etree.fromstring(xml, parser) + self.assertEquals([ el.tag for el in root ], + ['child1', 'child2', 'child3']) + + root[0] = root[-1] + self.assertEquals([ el.tag for el in root ], + ['child3', 'child2']) + self.assertEquals(root[0][0].text, ' ') + self.assertEquals(root[0][0].name, 'nbsp') + + def test_entity_append(self): + Entity = self.etree.Entity + Element = self.etree.Element + tostring = self.etree.tostring + + root = Element("root") + root.append( Entity("test") ) + + self.assertEquals(root[0].tag, Entity) + self.assertEquals(root[0].text, "&test;") + self.assertEquals(root[0].tail, None) + self.assertEquals(root[0].name, "test") + + self.assertEquals(_bytes('&test;'), + tostring(root)) + + def test_entity_values(self): + Entity = self.etree.Entity + self.assertEquals(Entity("test").text, '&test;') + self.assertEquals(Entity("#17683").text, '䔓') + self.assertEquals(Entity("#x1768").text, 'ᝨ') + self.assertEquals(Entity("#x98AF").text, '颯') + + def test_entity_error(self): + Entity = self.etree.Entity + self.assertRaises(ValueError, Entity, 'a b c') + self.assertRaises(ValueError, Entity, 'a,b') + self.assertRaises(ValueError, Entity, 'a\0b') + self.assertRaises(ValueError, Entity, '#abc') + self.assertRaises(ValueError, Entity, '#xxyz') + + def test_cdata(self): + CDATA = self.etree.CDATA + Element = self.etree.Element + tostring = self.etree.tostring + + root = Element("root") + root.text = CDATA('test') + + self.assertEquals('test', + root.text) + self.assertEquals(_bytes(''), + tostring(root)) + + def test_cdata_type(self): + CDATA = self.etree.CDATA + Element = self.etree.Element + root = Element("root") + + root.text = CDATA("test") + self.assertEquals('test', root.text) + + root.text = CDATA(_str("test")) + self.assertEquals('test', root.text) + + self.assertRaises(TypeError, CDATA, 1) + + def test_cdata_errors(self): + CDATA = self.etree.CDATA + Element = self.etree.Element + + root = Element("root") + cdata = CDATA('test') + + self.assertRaises(TypeError, + setattr, root, 'tail', cdata) + self.assertRaises(TypeError, + root.set, 'attr', cdata) + self.assertRaises(TypeError, + operator.setitem, root.attrib, 'attr', cdata) + + def test_cdata_parser(self): + tostring = self.etree.tostring + parser = self.etree.XMLParser(strip_cdata=False) + root = self.etree.XML(_bytes(''), parser) + + self.assertEquals('test', root.text) + self.assertEquals(_bytes(''), + tostring(root)) + + def test_cdata_xpath(self): + tostring = self.etree.tostring + parser = self.etree.XMLParser(strip_cdata=False) + root = self.etree.XML(_bytes(''), parser) + self.assertEquals(_bytes(''), + tostring(root)) + + self.assertEquals(['test'], root.xpath('//text()')) + + # TypeError in etree, AssertionError in ElementTree; + def test_setitem_assert(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + + self.assertRaises(TypeError, + a.__setitem__, 0, 'foo') + + def test_append_None(self): + # raises AssertionError in ElementTree + Element = self.etree.Element + self.assertRaises(TypeError, Element('a').append, None) + + def test_addnext(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + root = Element('root') + SubElement(root, 'a') + SubElement(root, 'b') + + self.assertEquals(['a', 'b'], + [c.tag for c in root]) + root[1].addnext(root[0]) + self.assertEquals(['b', 'a'], + [c.tag for c in root]) + + def test_addprevious(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + root = Element('root') + SubElement(root, 'a') + SubElement(root, 'b') + + self.assertEquals(['a', 'b'], + [c.tag for c in root]) + root[0].addprevious(root[1]) + self.assertEquals(['b', 'a'], + [c.tag for c in root]) + + def test_addnext_root(self): + Element = self.etree.Element + a = Element('a') + b = Element('b') + self.assertRaises(TypeError, a.addnext, b) + + def test_addnext_root(self): + Element = self.etree.Element + a = Element('a') + b = Element('b') + self.assertRaises(TypeError, a.addnext, b) + + def test_addprevious_pi(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + PI = self.etree.PI + root = Element('root') + SubElement(root, 'a') + pi = PI('TARGET', 'TEXT') + pi.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root[0].addprevious(pi) + self.assertEquals(_bytes('TAIL'), + self._writeElement(root)) + + def test_addprevious_root_pi(self): + Element = self.etree.Element + PI = self.etree.PI + root = Element('root') + pi = PI('TARGET', 'TEXT') + pi.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root.addprevious(pi) + self.assertEquals(_bytes('\n'), + self._writeElement(root)) + + def test_addnext_pi(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + PI = self.etree.PI + root = Element('root') + SubElement(root, 'a') + pi = PI('TARGET', 'TEXT') + pi.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root[0].addnext(pi) + self.assertEquals(_bytes('TAIL'), + self._writeElement(root)) + + def test_addnext_root_pi(self): + Element = self.etree.Element + PI = self.etree.PI + root = Element('root') + pi = PI('TARGET', 'TEXT') + pi.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root.addnext(pi) + self.assertEquals(_bytes('\n'), + self._writeElement(root)) + + def test_addnext_comment(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + Comment = self.etree.Comment + root = Element('root') + SubElement(root, 'a') + comment = Comment('TEXT ') + comment.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root[0].addnext(comment) + self.assertEquals(_bytes('TAIL'), + self._writeElement(root)) + + def test_addnext_root_comment(self): + Element = self.etree.Element + Comment = self.etree.Comment + root = Element('root') + comment = Comment('TEXT ') + comment.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root.addnext(comment) + self.assertEquals(_bytes('\n'), + self._writeElement(root)) + + def test_addprevious_comment(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + Comment = self.etree.Comment + root = Element('root') + SubElement(root, 'a') + comment = Comment('TEXT ') + comment.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root[0].addprevious(comment) + self.assertEquals(_bytes('TAIL'), + self._writeElement(root)) + + def test_addprevious_root_comment(self): + Element = self.etree.Element + Comment = self.etree.Comment + root = Element('root') + comment = Comment('TEXT ') + comment.tail = "TAIL" + + self.assertEquals(_bytes(''), + self._writeElement(root)) + root.addprevious(comment) + self.assertEquals(_bytes('\n'), + self._writeElement(root)) + + # ET's Elements have items() and key(), but not values() + def test_attribute_values(self): + XML = self.etree.XML + + root = XML(_bytes('')) + values = root.values() + values.sort() + self.assertEquals(['Alpha', 'Beta', 'Gamma'], values) + + # gives error in ElementTree + def test_comment_empty(self): + Element = self.etree.Element + Comment = self.etree.Comment + + a = Element('a') + a.append(Comment()) + self.assertEquals( + _bytes(''), + self._writeElement(a)) + + # ElementTree ignores comments + def test_comment_parse_empty(self): + ElementTree = self.etree.ElementTree + tostring = self.etree.tostring + + xml = _bytes('') + f = BytesIO(xml) + doc = ElementTree(file=f) + a = doc.getroot() + self.assertEquals( + '', + a[1].text) + self.assertEquals( + xml, + tostring(a)) + + # ElementTree ignores comments + def test_comment_no_proxy_yet(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + a = doc.getroot() + self.assertEquals( + ' hoi ', + a[1].text) + + # does not raise an exception in ElementTree + def test_comment_immutable(self): + Element = self.etree.Element + Comment = self.etree.Comment + + c = Comment() + el = Element('myel') + + self.assertRaises(TypeError, c.append, el) + self.assertRaises(TypeError, c.insert, 0, el) + self.assertRaises(TypeError, c.set, "myattr", "test") + + # test passing 'None' to dump + def test_dump_none(self): + self.assertRaises(TypeError, self.etree.dump, None) + + def test_prefix(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + a = doc.getroot() + self.assertEquals( + None, + a.prefix) + self.assertEquals( + 'foo', + a[0].prefix) + + def test_prefix_default_ns(self): + ElementTree = self.etree.ElementTree + + f = BytesIO('') + doc = ElementTree(file=f) + a = doc.getroot() + self.assertEquals( + None, + a.prefix) + self.assertEquals( + None, + a[0].prefix) + + def test_getparent(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + None, + a.getparent()) + self.assertEquals( + a, + b.getparent()) + self.assertEquals( + b.getparent(), + c.getparent()) + self.assertEquals( + b, + d.getparent()) + + def test_iterchildren(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHm')) + result = [] + for el in root.iterchildren(): + result.append(el.tag) + self.assertEquals(['one', 'two', 'three'], result) + + def test_iterchildren_reversed(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHm')) + result = [] + for el in root.iterchildren(reversed=True): + result.append(el.tag) + self.assertEquals(['three', 'two', 'one'], result) + + def test_iterchildren_tag(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHmBla')) + result = [] + for el in root.iterchildren(tag='two'): + result.append(el.text) + self.assertEquals(['Two', 'Bla'], result) + + def test_iterchildren_tag_reversed(self): + XML = self.etree.XML + + root = XML(_bytes('TwoHmBla')) + result = [] + for el in root.iterchildren(reversed=True, tag='two'): + result.append(el.text) + self.assertEquals(['Bla', 'Two'], result) + + def test_iterancestors(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + [], + list(a.iterancestors())) + self.assertEquals( + [a], + list(b.iterancestors())) + self.assertEquals( + [a], + list(c.iterancestors())) + self.assertEquals( + [b, a], + list(d.iterancestors())) + + def test_iterancestors_tag(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + [a], + list(d.iterancestors(tag='a'))) + + def test_iterdescendants(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [b, d, c, e], + list(a.iterdescendants())) + self.assertEquals( + [], + list(d.iterdescendants())) + + def test_iterdescendants_tag(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + e = SubElement(c, 'e') + + self.assertEquals( + [], + list(a.iterdescendants('a'))) + a2 = SubElement(e, 'a') + self.assertEquals( + [a2], + list(a.iterdescendants('a'))) + self.assertEquals( + [a2], + list(c.iterdescendants('a'))) + + def test_getroottree(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + a, + a.getroottree().getroot()) + self.assertEquals( + a, + b.getroottree().getroot()) + self.assertEquals( + a, + d.getroottree().getroot()) + + def test_getnext(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + self.assertEquals( + None, + a.getnext()) + self.assertEquals( + c, + b.getnext()) + self.assertEquals( + None, + c.getnext()) + + def test_getprevious(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + None, + a.getprevious()) + self.assertEquals( + b, + c.getprevious()) + self.assertEquals( + None, + b.getprevious()) + + def test_itersiblings(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + [], + list(a.itersiblings())) + self.assertEquals( + [c], + list(b.itersiblings())) + self.assertEquals( + [], + list(c.itersiblings())) + self.assertEquals( + [b], + list(c.itersiblings(preceding=True))) + self.assertEquals( + [], + list(b.itersiblings(preceding=True))) + + def test_itersiblings_tag(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(b, 'd') + self.assertEquals( + [], + list(a.itersiblings(tag='XXX'))) + self.assertEquals( + [c], + list(b.itersiblings(tag='c'))) + self.assertEquals( + [b], + list(c.itersiblings(preceding=True, tag='b'))) + self.assertEquals( + [], + list(c.itersiblings(preceding=True, tag='c'))) + + def test_parseid(self): + parseid = self.etree.parseid + XML = self.etree.XML + xml_text = _bytes(''' + + + + + + ]> + +

...

+

...

+

Regular paragraph.

+

XML:ID paragraph.

+

...

+
+ ''') + + tree, dic = parseid(BytesIO(xml_text)) + root = tree.getroot() + root2 = XML(xml_text) + self.assertEquals(self._writeElement(root), + self._writeElement(root2)) + expected = { + "chapter1" : root[0], + "xmlid" : root[3], + "warn1" : root[4] + } + self.assert_("chapter1" in dic) + self.assert_("warn1" in dic) + self.assert_("xmlid" in dic) + self._checkIDDict(dic, expected) + + def test_XMLDTDID(self): + XMLDTDID = self.etree.XMLDTDID + XML = self.etree.XML + xml_text = _bytes(''' + + + + + + ]> + +

...

+

...

+

Regular paragraph.

+

XML:ID paragraph.

+

...

+
+ ''') + + root, dic = XMLDTDID(xml_text) + root2 = XML(xml_text) + self.assertEquals(self._writeElement(root), + self._writeElement(root2)) + expected = { + "chapter1" : root[0], + "xmlid" : root[3], + "warn1" : root[4] + } + self.assert_("chapter1" in dic) + self.assert_("warn1" in dic) + self.assert_("xmlid" in dic) + self._checkIDDict(dic, expected) + + def test_XMLDTDID_empty(self): + XMLDTDID = self.etree.XMLDTDID + XML = self.etree.XML + xml_text = _bytes(''' + +

...

+

...

+

Regular paragraph.

+

...

+
+ ''') + + root, dic = XMLDTDID(xml_text) + root2 = XML(xml_text) + self.assertEquals(self._writeElement(root), + self._writeElement(root2)) + expected = {} + self._checkIDDict(dic, expected) + + def _checkIDDict(self, dic, expected): + self.assertEquals(len(dic), + len(expected)) + self.assertEquals(sorted(dic.items()), + sorted(expected.items())) + if sys.version_info < (3,): + self.assertEquals(sorted(dic.iteritems()), + sorted(expected.iteritems())) + self.assertEquals(sorted(dic.keys()), + sorted(expected.keys())) + if sys.version_info < (3,): + self.assertEquals(sorted(dic.iterkeys()), + sorted(expected.iterkeys())) + if sys.version_info < (3,): + self.assertEquals(sorted(dic.values()), + sorted(expected.values())) + self.assertEquals(sorted(dic.itervalues()), + sorted(expected.itervalues())) + + def test_namespaces(self): + etree = self.etree + + r = {'foo': 'http://ns.infrae.com/foo'} + e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + self.assertEquals( + 'foo', + e.prefix) + self.assertEquals( + _bytes(''), + self._writeElement(e)) + + def test_namespaces_default(self): + etree = self.etree + + r = {None: 'http://ns.infrae.com/foo'} + e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + self.assertEquals( + None, + e.prefix) + self.assertEquals( + '{http://ns.infrae.com/foo}bar', + e.tag) + self.assertEquals( + _bytes(''), + self._writeElement(e)) + + def test_namespaces_default_and_attr(self): + etree = self.etree + + r = {None: 'http://ns.infrae.com/foo', + 'hoi': 'http://ns.infrae.com/hoi'} + e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + e.set('{http://ns.infrae.com/hoi}test', 'value') + self.assertEquals( + _bytes(''), + self._writeElement(e)) + + def test_namespaces_elementtree(self): + etree = self.etree + r = {None: 'http://ns.infrae.com/foo', + 'hoi': 'http://ns.infrae.com/hoi'} + e = etree.Element('{http://ns.infrae.com/foo}z', nsmap=r) + tree = etree.ElementTree(element=e) + etree.SubElement(e, '{http://ns.infrae.com/hoi}x') + self.assertEquals( + _bytes(''), + self._writeElement(e)) + + def test_namespaces_default_copy_element(self): + etree = self.etree + + r = {None: 'http://ns.infrae.com/foo'} + e1 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + e2 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + + e1.append(e2) + + self.assertEquals( + None, + e1.prefix) + self.assertEquals( + None, + e1[0].prefix) + self.assertEquals( + '{http://ns.infrae.com/foo}bar', + e1.tag) + self.assertEquals( + '{http://ns.infrae.com/foo}bar', + e1[0].tag) + + def test_namespaces_copy_element(self): + etree = self.etree + + r = {None: 'http://ns.infrae.com/BAR'} + e1 = etree.Element('{http://ns.infrae.com/BAR}bar', nsmap=r) + e2 = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + + e1.append(e2) + + self.assertEquals( + None, + e1.prefix) + self.assertNotEquals( + None, + e2.prefix) + self.assertEquals( + '{http://ns.infrae.com/BAR}bar', + e1.tag) + self.assertEquals( + '{http://ns.infrae.com/foo}bar', + e2.tag) + + def test_namespaces_reuse_after_move(self): + ns_href = "http://a.b.c" + one = self.etree.fromstring( + _bytes('' % ns_href)) + baz = one[0][0] + + two = self.etree.fromstring( + _bytes('' % ns_href)) + two.append(baz) + del one # make sure the source document is deallocated + + self.assertEquals('{%s}baz' % ns_href, baz.tag) + self.assertEquals( + _bytes('' % ns_href), + self.etree.tostring(two)) + + def test_namespace_cleanup(self): + xml = _bytes('') + root = self.etree.fromstring(xml) + self.assertEquals(xml, + self.etree.tostring(root)) + self.etree.cleanup_namespaces(root) + self.assertEquals( + _bytes(''), + self.etree.tostring(root)) + + def test_element_nsmap(self): + etree = self.etree + + r = {None: 'http://ns.infrae.com/foo', + 'hoi': 'http://ns.infrae.com/hoi'} + e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=r) + self.assertEquals( + r, + e.nsmap) + + def test_subelement_nsmap(self): + etree = self.etree + + re = {None: 'http://ns.infrae.com/foo', + 'hoi': 'http://ns.infrae.com/hoi'} + e = etree.Element('{http://ns.infrae.com/foo}bar', nsmap=re) + + rs = {None: 'http://ns.infrae.com/honk', + 'top': 'http://ns.infrae.com/top'} + s = etree.SubElement(e, '{http://ns.infrae.com/honk}bar', nsmap=rs) + + r = re.copy() + r.update(rs) + self.assertEquals( + re, + e.nsmap) + self.assertEquals( + r, + s.nsmap) + + def test_getiterator_filter_namespace(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('{a}a') + b = SubElement(a, '{a}b') + c = SubElement(a, '{a}c') + d = SubElement(b, '{b}d') + e = SubElement(c, '{a}e') + f = SubElement(c, '{b}f') + + self.assertEquals( + [a], + list(a.getiterator('{a}a'))) + self.assertEquals( + [], + list(a.getiterator('{b}a'))) + self.assertEquals( + [], + list(a.getiterator('a'))) + self.assertEquals( + [f], + list(c.getiterator('{b}*'))) + self.assertEquals( + [d, f], + list(a.getiterator('{b}*'))) + + def test_getiterator_filter_entities(self): + Element = self.etree.Element + Entity = self.etree.Entity + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + entity_b = Entity("TEST-b") + b.append(entity_b) + + self.assertEquals( + [entity_b], + list(a.getiterator(Entity))) + + entity_a = Entity("TEST-a") + a.append(entity_a) + + self.assertEquals( + [entity_b, entity_a], + list(a.getiterator(Entity))) + + self.assertEquals( + [entity_b], + list(b.getiterator(Entity))) + + def test_getiterator_filter_element(self): + Element = self.etree.Element + Comment = self.etree.Comment + PI = self.etree.PI + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + a.append(Comment("test")) + a.append(PI("pi", "content")) + c = SubElement(a, 'c') + + self.assertEquals( + [a, b, c], + list(a.getiterator(Element))) + + def test_getiterator_filter_all_comment_pi(self): + # ElementTree iterates over everything here + Element = self.etree.Element + Comment = self.etree.Comment + PI = self.etree.PI + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + a.append(Comment("test")) + a.append(PI("pi", "content")) + c = SubElement(a, 'c') + + self.assertEquals( + [a, b, c], + list(a.getiterator('*'))) + + def test_elementtree_find_qname(self): + XML = self.etree.XML + ElementTree = self.etree.ElementTree + QName = self.etree.QName + tree = ElementTree(XML(_bytes(''))) + self.assertEquals(tree.find(QName("c")), tree.getroot()[2]) + + def test_elementtree_findall_qname(self): + XML = self.etree.XML + ElementTree = self.etree.ElementTree + QName = self.etree.QName + tree = ElementTree(XML(_bytes(''))) + self.assertEquals(len(list(tree.findall(QName("c")))), 1) + + def test_elementtree_findall_ns_qname(self): + XML = self.etree.XML + ElementTree = self.etree.ElementTree + QName = self.etree.QName + tree = ElementTree(XML( + _bytes(''))) + self.assertEquals(len(list(tree.findall(QName("b")))), 2) + self.assertEquals(len(list(tree.findall(QName("X", "b")))), 1) + + def test_findall_ns(self): + XML = self.etree.XML + root = XML(_bytes('')) + self.assertEquals(len(root.findall(".//{X}b")), 2) + self.assertEquals(len(root.findall(".//{X}*")), 2) + self.assertEquals(len(root.findall(".//b")), 3) + + def test_index(self): + etree = self.etree + e = etree.Element('foo') + for i in range(10): + etree.SubElement(e, 'a%s' % i) + for i in range(10): + self.assertEquals( + i, + e.index(e[i])) + self.assertEquals( + 3, e.index(e[3], 3)) + self.assertRaises( + ValueError, e.index, e[3], 4) + self.assertRaises( + ValueError, e.index, e[3], 0, 2) + self.assertRaises( + ValueError, e.index, e[8], 0, -3) + self.assertRaises( + ValueError, e.index, e[8], -5, -3) + self.assertEquals( + 8, e.index(e[8], 0, -1)) + self.assertEquals( + 8, e.index(e[8], -12, -1)) + self.assertEquals( + 0, e.index(e[0], -12, -1)) + + def test_replace(self): + etree = self.etree + e = etree.Element('foo') + for i in range(10): + el = etree.SubElement(e, 'a%s' % i) + el.text = "text%d" % i + el.tail = "tail%d" % i + + child0 = e[0] + child1 = e[1] + child2 = e[2] + + e.replace(e[0], e[1]) + self.assertEquals( + 9, len(e)) + self.assertEquals( + child1, e[0]) + self.assertEquals( + child1.text, "text1") + self.assertEquals( + child1.tail, "tail1") + self.assertEquals( + child0.tail, "tail0") + self.assertEquals( + child2, e[1]) + + e.replace(e[-1], e[0]) + self.assertEquals( + child1, e[-1]) + self.assertEquals( + child1.text, "text1") + self.assertEquals( + child1.tail, "tail1") + self.assertEquals( + child2, e[0]) + + def test_replace_new(self): + etree = self.etree + e = etree.Element('foo') + for i in range(10): + etree.SubElement(e, 'a%s' % i) + + new_element = etree.Element("test") + new_element.text = "TESTTEXT" + new_element.tail = "TESTTAIL" + child1 = e[1] + e.replace(e[0], new_element) + self.assertEquals( + new_element, e[0]) + self.assertEquals( + "TESTTEXT", + e[0].text) + self.assertEquals( + "TESTTAIL", + e[0].tail) + self.assertEquals( + child1, e[1]) + + def test_setslice_all_empty_reversed(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + + e = Element('e') + f = Element('f') + g = Element('g') + + s = [e, f, g] + a[::-1] = s + self.assertEquals( + [g, f, e], + list(a)) + + def test_setslice_step(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + x = Element('x') + y = Element('y') + + a[1::2] = [x, y] + self.assertEquals( + [b, x, d, y], + list(a)) + + def test_setslice_step_negative(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + x = Element('x') + y = Element('y') + + a[1::-1] = [x, y] + self.assertEquals( + [y, x, d, e], + list(a)) + + def test_setslice_step_negative2(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + x = Element('x') + y = Element('y') + + a[::-2] = [x, y] + self.assertEquals( + [b, y, d, x], + list(a)) + + def test_setslice_step_overrun(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + try: + slice + except NameError: + print("slice() not found") + return + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(a, 'd') + e = SubElement(a, 'e') + + x = Element('x') + y = Element('y') + z = Element('z') + + self.assertRaises( + ValueError, + operator.setitem, a, slice(1,None,2), [x, y, z]) + + self.assertEquals( + [b, c, d, e], + list(a)) + + def test_sourceline_XML(self): + XML = self.etree.XML + root = XML(_bytes(''' + + + + + ''')) + + self.assertEquals( + [2, 2, 4], + [ el.sourceline for el in root.getiterator() ]) + + def test_sourceline_parse(self): + parse = self.etree.parse + tree = parse(fileInTestDir('include/test_xinclude.xml')) + + self.assertEquals( + [1, 2, 3], + [ el.sourceline for el in tree.getiterator() ]) + + def test_sourceline_iterparse_end(self): + iterparse = self.etree.iterparse + lines = [ el.sourceline for (event, el) in + iterparse(fileInTestDir('include/test_xinclude.xml')) ] + + self.assertEquals( + [2, 3, 1], + lines) + + def test_sourceline_iterparse_start(self): + iterparse = self.etree.iterparse + lines = [ el.sourceline for (event, el) in + iterparse(fileInTestDir('include/test_xinclude.xml'), + events=("start",)) ] + + self.assertEquals( + [1, 2, 3], + lines) + + def test_sourceline_element(self): + Element = self.etree.Element + SubElement = self.etree.SubElement + el = Element("test") + self.assertEquals(None, el.sourceline) + + child = SubElement(el, "test") + self.assertEquals(None, el.sourceline) + self.assertEquals(None, child.sourceline) + + def test_XML_base_url_docinfo(self): + etree = self.etree + root = etree.XML(_bytes(""), base_url="http://no/such/url") + docinfo = root.getroottree().docinfo + self.assertEquals(docinfo.URL, "http://no/such/url") + + def test_XML_set_base_url_docinfo(self): + etree = self.etree + root = etree.XML(_bytes(""), base_url="http://no/such/url") + docinfo = root.getroottree().docinfo + self.assertEquals(docinfo.URL, "http://no/such/url") + docinfo.URL = "https://secret/url" + self.assertEquals(docinfo.URL, "https://secret/url") + + def test_parse_stringio_base_url(self): + etree = self.etree + tree = etree.parse(BytesIO(""), base_url="http://no/such/url") + docinfo = tree.docinfo + self.assertEquals(docinfo.URL, "http://no/such/url") + + def test_parse_base_url_docinfo(self): + etree = self.etree + tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), + base_url="http://no/such/url") + docinfo = tree.docinfo + self.assertEquals(docinfo.URL, "http://no/such/url") + + def test_HTML_base_url_docinfo(self): + etree = self.etree + root = etree.HTML(_bytes(""), base_url="http://no/such/url") + docinfo = root.getroottree().docinfo + self.assertEquals(docinfo.URL, "http://no/such/url") + + def test_docinfo_public(self): + etree = self.etree + xml_header = '' + pub_id = "-//W3C//DTD XHTML 1.0 Transitional//EN" + sys_id = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + doctype_string = '' % (pub_id, sys_id) + + xml = _bytes(xml_header + doctype_string + '') + + tree = etree.parse(BytesIO(xml)) + docinfo = tree.docinfo + self.assertEquals(docinfo.encoding, "ascii") + self.assertEquals(docinfo.xml_version, "1.0") + self.assertEquals(docinfo.public_id, pub_id) + self.assertEquals(docinfo.system_url, sys_id) + self.assertEquals(docinfo.root_name, 'html') + self.assertEquals(docinfo.doctype, doctype_string) + + def test_docinfo_system(self): + etree = self.etree + xml_header = '' + sys_id = "some.dtd" + doctype_string = '' % sys_id + xml = _bytes(xml_header + doctype_string + '') + + tree = etree.parse(BytesIO(xml)) + docinfo = tree.docinfo + self.assertEquals(docinfo.encoding, "UTF-8") + self.assertEquals(docinfo.xml_version, "1.0") + self.assertEquals(docinfo.public_id, None) + self.assertEquals(docinfo.system_url, sys_id) + self.assertEquals(docinfo.root_name, 'html') + self.assertEquals(docinfo.doctype, doctype_string) + + def test_docinfo_empty(self): + etree = self.etree + xml = _bytes('') + tree = etree.parse(BytesIO(xml)) + docinfo = tree.docinfo + self.assertEquals(docinfo.encoding, "UTF-8") + self.assertEquals(docinfo.xml_version, "1.0") + self.assertEquals(docinfo.public_id, None) + self.assertEquals(docinfo.system_url, None) + self.assertEquals(docinfo.root_name, 'html') + self.assertEquals(docinfo.doctype, '') + + def test_docinfo_name_only(self): + etree = self.etree + xml = _bytes('') + tree = etree.parse(BytesIO(xml)) + docinfo = tree.docinfo + self.assertEquals(docinfo.encoding, "UTF-8") + self.assertEquals(docinfo.xml_version, "1.0") + self.assertEquals(docinfo.public_id, None) + self.assertEquals(docinfo.system_url, None) + self.assertEquals(docinfo.root_name, 'root') + self.assertEquals(docinfo.doctype, '') + + def test_doctype_name_only_roundtrip(self): + etree = self.etree + xml = _bytes('\n') + tree = etree.parse(BytesIO(xml)) + self.assertEquals(xml, etree.tostring(tree)) + + def test_xml_base(self): + etree = self.etree + root = etree.XML(_bytes(""), base_url="http://no/such/url") + self.assertEquals(root.base, "http://no/such/url") + self.assertEquals( + root.get('{http://www.w3.org/XML/1998/namespace}base'), None) + root.base = "https://secret/url" + self.assertEquals(root.base, "https://secret/url") + self.assertEquals( + root.get('{http://www.w3.org/XML/1998/namespace}base'), + "https://secret/url") + + def test_xml_base_attribute(self): + etree = self.etree + root = etree.XML(_bytes(""), base_url="http://no/such/url") + self.assertEquals(root.base, "http://no/such/url") + self.assertEquals( + root.get('{http://www.w3.org/XML/1998/namespace}base'), None) + root.set('{http://www.w3.org/XML/1998/namespace}base', + "https://secret/url") + self.assertEquals(root.base, "https://secret/url") + self.assertEquals( + root.get('{http://www.w3.org/XML/1998/namespace}base'), + "https://secret/url") + + def test_html_base(self): + etree = self.etree + root = etree.HTML(_bytes(""), + base_url="http://no/such/url") + self.assertEquals(root.base, "http://no/such/url") + + def test_html_base_tag(self): + etree = self.etree + root = etree.HTML(_bytes('')) + self.assertEquals(root.base, "http://no/such/url") + + def test_parse_fileobject_unicode(self): + # parse from a file object that returns unicode strings + f = LargeFileLikeUnicode() + tree = self.etree.parse(f) + root = tree.getroot() + self.assert_(root.tag.endswith('root')) + + def test_dtd_io(self): + # check that DTDs that go in also go back out + xml = _bytes('''\ + + + + ]> + test-test\ + ''') + tree = self.etree.parse(BytesIO(xml)) + self.assertEqual(self.etree.tostring(tree).replace(_bytes(" "), _bytes("")), + xml.replace(_bytes(" "), _bytes(""))) + + def test_byte_zero(self): + Element = self.etree.Element + + a = Element('a') + self.assertRaises(ValueError, setattr, a, "text", 'ha\0ho') + self.assertRaises(ValueError, setattr, a, "tail", 'ha\0ho') + + self.assertRaises(ValueError, Element, 'ha\0ho') + + def test_unicode_byte_zero(self): + Element = self.etree.Element + + a = Element('a') + self.assertRaises(ValueError, setattr, a, "text", + _str('ha\0ho')) + self.assertRaises(ValueError, setattr, a, "tail", + _str('ha\0ho')) + + self.assertRaises(ValueError, Element, + _str('ha\0ho')) + + def test_byte_invalid(self): + Element = self.etree.Element + + a = Element('a') + self.assertRaises(ValueError, setattr, a, "text", 'ha\x07ho') + self.assertRaises(ValueError, setattr, a, "text", 'ha\x02ho') + + self.assertRaises(ValueError, setattr, a, "tail", 'ha\x07ho') + self.assertRaises(ValueError, setattr, a, "tail", 'ha\x02ho') + + self.assertRaises(ValueError, Element, 'ha\x07ho') + self.assertRaises(ValueError, Element, 'ha\x02ho') + + def test_unicode_byte_invalid(self): + Element = self.etree.Element + + a = Element('a') + self.assertRaises(ValueError, setattr, a, "text", + _str('ha\x07ho')) + self.assertRaises(ValueError, setattr, a, "text", + _str('ha\x02ho')) + + self.assertRaises(ValueError, setattr, a, "tail", + _str('ha\x07ho')) + self.assertRaises(ValueError, setattr, a, "tail", + _str('ha\x02ho')) + + self.assertRaises(ValueError, Element, + _str('ha\x07ho')) + self.assertRaises(ValueError, Element, + _str('ha\x02ho')) + + def test_encoding_tostring_utf16(self): + # ElementTree fails to serialize this + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + result = tostring(a, encoding='UTF-16') + self.assertEquals(_bytes(''), + canonicalize(result)) + + def test_tostring_none(self): + # ElementTree raises an AssertionError here + tostring = self.etree.tostring + self.assertRaises(TypeError, self.etree.tostring, None) + + def test_tostring_pretty(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + result = tostring(a) + self.assertEquals(result, _bytes("")) + + result = tostring(a, pretty_print=False) + self.assertEquals(result, _bytes("")) + + result = tostring(a, pretty_print=True) + self.assertEquals(result, _bytes("\n \n \n\n")) + + def test_tostring_with_tail(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.tail = "aTAIL" + b = SubElement(a, 'b') + b.tail = "bTAIL" + c = SubElement(a, 'c') + + result = tostring(a) + self.assertEquals(result, _bytes("bTAILaTAIL")) + + result = tostring(a, with_tail=False) + self.assertEquals(result, _bytes("bTAIL")) + + result = tostring(a, with_tail=True) + self.assertEquals(result, _bytes("bTAILaTAIL")) + + def test_standalone(self): + tostring = self.etree.tostring + XML = self.etree.XML + ElementTree = self.etree.ElementTree + Element = self.etree.Element + + tree = Element("root").getroottree() + self.assertEquals(None, tree.docinfo.standalone) + + tree = XML(_bytes("")).getroottree() + self.assertEquals(None, tree.docinfo.standalone) + + tree = XML(_bytes( + "\n" + )).getroottree() + self.assertEquals(True, tree.docinfo.standalone) + + tree = XML(_bytes( + "\n" + )).getroottree() + self.assertEquals(False, tree.docinfo.standalone) + + def test_tostring_standalone(self): + tostring = self.etree.tostring + XML = self.etree.XML + ElementTree = self.etree.ElementTree + + root = XML(_bytes("")) + + tree = ElementTree(root) + self.assertEquals(None, tree.docinfo.standalone) + + result = tostring(root, xml_declaration=True, encoding="ASCII") + self.assertEquals(result, _bytes( + "\n")) + + result = tostring(root, xml_declaration=True, encoding="ASCII", + standalone=True) + self.assertEquals(result, _bytes( + "\n")) + + tree = ElementTree(XML(result)) + self.assertEquals(True, tree.docinfo.standalone) + + result = tostring(root, xml_declaration=True, encoding="ASCII", + standalone=False) + self.assertEquals(result, _bytes( + "\n")) + + tree = ElementTree(XML(result)) + self.assertEquals(False, tree.docinfo.standalone) + + def test_tostring_standalone_in_out(self): + tostring = self.etree.tostring + XML = self.etree.XML + ElementTree = self.etree.ElementTree + + root = XML(_bytes( + "\n")) + + tree = ElementTree(root) + self.assertEquals(True, tree.docinfo.standalone) + + result = tostring(root, xml_declaration=True, encoding="ASCII") + self.assertEquals(result, _bytes( + "\n")) + + result = tostring(root, xml_declaration=True, encoding="ASCII", + standalone=True) + self.assertEquals(result, _bytes( + "\n")) + + def test_tostring_method_text_encoding(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = "A" + a.tail = "tail" + b = SubElement(a, 'b') + b.text = "B" + b.tail = _str("Søk på nettet") + c = SubElement(a, 'c') + c.text = "C" + + result = tostring(a, method="text", encoding="UTF-16") + + self.assertEquals(_str('ABSøk på nettetCtail').encode("UTF-16"), + result) + + def test_tostring_method_text_unicode(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + a.text = _str('Søk på nettetA') + a.tail = "tail" + b = SubElement(a, 'b') + b.text = "B" + b.tail = _str('Søk på nettetB') + c = SubElement(a, 'c') + c.text = "C" + + self.assertRaises(UnicodeEncodeError, + tostring, a, method="text") + + self.assertEquals( + _str('Søk på nettetABSøk på nettetBCtail').encode('utf-8'), + tostring(a, encoding="UTF-8", method="text")) + + def test_tounicode(self): + tounicode = self.etree.tounicode + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + self.assert_(isinstance(tounicode(a), _unicode)) + self.assertEquals(_bytes(''), + canonicalize(tounicode(a))) + + def test_tounicode_element(self): + tounicode = self.etree.tounicode + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(c, 'd') + self.assert_(isinstance(tounicode(b), _unicode)) + self.assert_(isinstance(tounicode(c), _unicode)) + self.assertEquals(_bytes(''), + canonicalize(tounicode(b))) + self.assertEquals(_bytes(''), + canonicalize(tounicode(c))) + + def test_tounicode_none(self): + tounicode = self.etree.tounicode + self.assertRaises(TypeError, self.etree.tounicode, None) + + def test_tounicode_element_tail(self): + tounicode = self.etree.tounicode + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(c, 'd') + b.tail = 'Foo' + + self.assert_(isinstance(tounicode(b), _unicode)) + self.assert_(tounicode(b) == 'Foo' or + tounicode(b) == 'Foo') + + def test_tounicode_pretty(self): + tounicode = self.etree.tounicode + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + result = tounicode(a) + self.assertEquals(result, "") + + result = tounicode(a, pretty_print=False) + self.assertEquals(result, "") + + result = tounicode(a, pretty_print=True) + self.assertEquals(result, "\n \n \n\n") + + def test_tostring_unicode(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + self.assert_(isinstance(tostring(a, encoding=_unicode), _unicode)) + self.assertEquals(_bytes(''), + canonicalize(tostring(a, encoding=_unicode))) + + def test_tostring_unicode_element(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(c, 'd') + self.assert_(isinstance(tostring(b, encoding=_unicode), _unicode)) + self.assert_(isinstance(tostring(c, encoding=_unicode), _unicode)) + self.assertEquals(_bytes(''), + canonicalize(tostring(b, encoding=_unicode))) + self.assertEquals(_bytes(''), + canonicalize(tostring(c, encoding=_unicode))) + + def test_tostring_unicode_none(self): + tostring = self.etree.tostring + self.assertRaises(TypeError, self.etree.tostring, + None, encoding=_unicode) + + def test_tostring_unicode_element_tail(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + d = SubElement(c, 'd') + b.tail = 'Foo' + + self.assert_(isinstance(tostring(b, encoding=_unicode), _unicode)) + self.assert_(tostring(b, encoding=_unicode) == 'Foo' or + tostring(b, encoding=_unicode) == 'Foo') + + def test_tostring_unicode_pretty(self): + tostring = self.etree.tostring + Element = self.etree.Element + SubElement = self.etree.SubElement + + a = Element('a') + b = SubElement(a, 'b') + c = SubElement(a, 'c') + + result = tostring(a, encoding=_unicode) + self.assertEquals(result, "") + + result = tostring(a, encoding=_unicode, pretty_print=False) + self.assertEquals(result, "") + + result = tostring(a, encoding=_unicode, pretty_print=True) + self.assertEquals(result, "\n \n \n\n") + + # helper methods + + def _writeElement(self, element, encoding='us-ascii', compression=0): + """Write out element for comparison. + """ + ElementTree = self.etree.ElementTree + f = BytesIO() + tree = ElementTree(element=element) + tree.write(f, encoding=encoding, compression=compression) + data = f.getvalue() + if compression: + data = zlib.decompress(data) + return canonicalize(data) + + +class XIncludeTestCase(HelperTestCase): + def test_xinclude_text(self): + filename = fileInTestDir('test_broken.xml') + root = etree.XML(_bytes('''\ + + + + ''' % filename)) + old_text = root.text + content = open(filename).read() + old_tail = root[0].tail + + self.include( etree.ElementTree(root) ) + self.assertEquals(old_text + content + old_tail, + root.text) + + def test_xinclude(self): + tree = etree.parse(fileInTestDir('include/test_xinclude.xml')) + self.assertNotEquals( + 'a', + tree.getroot()[1].tag) + # process xincludes + self.include( tree ) + # check whether we find it replaced with included data + self.assertEquals( + 'a', + tree.getroot()[1].tag) + + def test_xinclude_resolver(self): + class res(etree.Resolver): + include_text = open(fileInTestDir('test.xml')).read() + called = {} + def resolve(self, url, id, context): + if url.endswith(".dtd"): + self.called["dtd"] = True + return self.resolve_filename( + fileInTestDir('test.dtd'), context) + elif url.endswith("test_xinclude.xml"): + self.called["input"] = True + return None # delegate to default resolver + else: + self.called["include"] = True + return self.resolve_string(self.include_text, context) + + res_instance = res() + parser = etree.XMLParser(load_dtd = True) + parser.resolvers.add(res_instance) + + tree = etree.parse(fileInTestDir('include/test_xinclude.xml'), + parser = parser) + + self.include(tree) + + called = list(res_instance.called.items()) + called.sort() + self.assertEquals( + [("dtd", True), ("include", True), ("input", True)], + called) + +class ETreeXIncludeTestCase(XIncludeTestCase): + def include(self, tree): + tree.xinclude() + + +class ElementIncludeTestCase(XIncludeTestCase): + from lxml import ElementInclude + def include(self, tree): + self.ElementInclude.include(tree.getroot()) + + +class ETreeC14NTestCase(HelperTestCase): + def test_c14n(self): + tree = self.parse(_bytes('')) + f = BytesIO() + tree.write_c14n(f) + s = f.getvalue() + self.assertEquals(_bytes(''), + s) + + def test_c14n_gzip(self): + tree = self.parse(_bytes(''+''*200+'')) + f = BytesIO() + tree.write_c14n(f, compression=9) + s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() + self.assertEquals(_bytes(''+''*200+''), + s) + + def test_c14n_file(self): + tree = self.parse(_bytes('')) + handle, filename = tempfile.mkstemp() + try: + tree.write_c14n(filename) + f = open(filename, 'rb') + data = f.read() + f.close() + finally: + os.close(handle) + os.remove(filename) + self.assertEquals(_bytes(''), + data) + + def test_c14n_file_gzip(self): + tree = self.parse(_bytes(''+''*200+'')) + handle, filename = tempfile.mkstemp() + try: + tree.write_c14n(filename, compression=9) + f = gzip.open(filename, 'rb') + data = f.read() + f.close() + finally: + os.close(handle) + os.remove(filename) + self.assertEquals(_bytes(''+''*200+''), + data) + + def test_c14n_with_comments(self): + tree = self.parse(_bytes('')) + f = BytesIO() + tree.write_c14n(f) + s = f.getvalue() + self.assertEquals(_bytes('\n\n'), + s) + f = BytesIO() + tree.write_c14n(f, with_comments=True) + s = f.getvalue() + self.assertEquals(_bytes('\n\n'), + s) + f = BytesIO() + tree.write_c14n(f, with_comments=False) + s = f.getvalue() + self.assertEquals(_bytes(''), + s) + + def test_c14n_exclusive(self): + tree = self.parse(_bytes( + '')) + f = BytesIO() + tree.write_c14n(f) + s = f.getvalue() + self.assertEquals(_bytes(''), + s) + f = BytesIO() + tree.write_c14n(f, exclusive=False) + s = f.getvalue() + self.assertEquals(_bytes(''), + s) + f = BytesIO() + tree.write_c14n(f, exclusive=True) + s = f.getvalue() + self.assertEquals(_bytes(''), + s) + + +class ETreeWriteTestCase(HelperTestCase): + def test_write(self): + tree = self.parse(_bytes('')) + f = BytesIO() + tree.write(f) + s = f.getvalue() + self.assertEquals(_bytes(''), + s) + + def test_write_gzip(self): + tree = self.parse(_bytes(''+''*200+'')) + f = BytesIO() + tree.write(f, compression=9) + s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() + self.assertEquals(_bytes(''+''*200+''), + s) + + def test_write_gzip_level(self): + tree = self.parse(_bytes(''+''*200+'')) + f = BytesIO() + tree.write(f, compression=0) + s0 = f.getvalue() + + f = BytesIO() + tree.write(f) + self.assertEquals(f.getvalue(), s0) + + f = BytesIO() + tree.write(f, compression=1) + s = f.getvalue() + self.assert_(len(s) <= len(s0)) + s1 = gzip.GzipFile(fileobj=BytesIO(s)).read() + + f = BytesIO() + tree.write(f, compression=9) + s = f.getvalue() + self.assert_(len(s) <= len(s0)) + s9 = gzip.GzipFile(fileobj=BytesIO(s)).read() + + self.assertEquals(_bytes(''+''*200+''), + s0) + self.assertEquals(_bytes(''+''*200+''), + s1) + self.assertEquals(_bytes(''+''*200+''), + s9) + + def test_write_file(self): + tree = self.parse(_bytes('')) + handle, filename = tempfile.mkstemp() + try: + tree.write(filename) + f = open(filename, 'rb') + data = f.read() + f.close() + finally: + os.close(handle) + os.remove(filename) + self.assertEquals(_bytes(''), + data) + + def test_write_file_gzip(self): + tree = self.parse(_bytes(''+''*200+'')) + handle, filename = tempfile.mkstemp() + try: + tree.write(filename, compression=9) + f = gzip.open(filename, 'rb') + data = f.read() + f.close() + finally: + os.close(handle) + os.remove(filename) + self.assertEquals(_bytes(''+''*200+''), + data) + + def test_write_file_gzip_parse(self): + tree = self.parse(_bytes(''+''*200+'')) + handle, filename = tempfile.mkstemp() + try: + tree.write(filename, compression=9) + data = etree.tostring(etree.parse(filename)) + finally: + os.close(handle) + os.remove(filename) + self.assertEquals(_bytes(''+''*200+''), + data) + + def test_write_file_gzipfile_parse(self): + tree = self.parse(_bytes(''+''*200+'')) + handle, filename = tempfile.mkstemp() + try: + tree.write(filename, compression=9) + data = etree.tostring(etree.parse( + gzip.GzipFile(filename))) + finally: + os.close(handle) + os.remove(filename) + self.assertEquals(_bytes(''+''*200+''), + data) + +class ETreeErrorLogTest(HelperTestCase): + etree = etree + + def test_parse_error_logging(self): + parse = self.etree.parse + f = BytesIO('') + self.etree.clear_error_log() + try: + parse(f) + logs = None + except SyntaxError: + e = sys.exc_info()[1] + logs = e.error_log + f.close() + self.assert_([ log for log in logs + if 'mismatch' in log.message ]) + self.assert_([ log for log in logs + if 'PARSER' in log.domain_name]) + self.assert_([ log for log in logs + if 'ERR_TAG_NAME_MISMATCH' in log.type_name ]) + self.assert_([ log for log in logs + if 1 == log.line ]) + self.assert_([ log for log in logs + if 15 == log.column ]) + + def _test_python_error_logging(self): + """This can't really be tested as long as there isn't a way to + reset the logging setup ... + """ + parse = self.etree.parse + + messages = [] + class Logger(self.etree.PyErrorLog): + def log(self, entry, message, *args): + messages.append(message) + + self.etree.use_global_python_log(Logger()) + f = BytesIO('') + try: + parse(f) + except SyntaxError: + pass + f.close() + + self.assert_([ message for message in messages + if 'mismatch' in message ]) + self.assert_([ message for message in messages + if ':PARSER:' in message]) + self.assert_([ message for message in messages + if ':ERR_TAG_NAME_MISMATCH:' in message ]) + self.assert_([ message for message in messages + if ':1:15:' in message ]) + +def test_suite(): + suite = unittest.TestSuite() + suite.addTests([unittest.makeSuite(ETreeOnlyTestCase)]) + suite.addTests([unittest.makeSuite(ETreeXIncludeTestCase)]) + suite.addTests([unittest.makeSuite(ElementIncludeTestCase)]) + suite.addTests([unittest.makeSuite(ETreeC14NTestCase)]) + suite.addTests([unittest.makeSuite(ETreeWriteTestCase)]) + suite.addTests([unittest.makeSuite(ETreeErrorLogTest)]) + suite.addTests( + [make_doctest('../../../doc/tutorial.txt')]) + suite.addTests( + [make_doctest('../../../doc/api.txt')]) + suite.addTests( + [make_doctest('../../../doc/FAQ.txt')]) + suite.addTests( + [make_doctest('../../../doc/parsing.txt')]) + suite.addTests( + [make_doctest('../../../doc/resolvers.txt')]) + return suite + +if __name__ == '__main__': + print('to test use test.py %s' % __file__) diff --git a/src/lxml/tests/test_htmlparser.py b/src/lxml/tests/test_htmlparser.py new file mode 100644 index 0000000..c9bf074 --- /dev/null +++ b/src/lxml/tests/test_htmlparser.py @@ -0,0 +1,297 @@ +# -*- coding: utf-8 -*- + +""" +HTML parser test cases for etree +""" + +import unittest +import tempfile, os, os.path, sys + +this_dir = os.path.dirname(__file__) +if this_dir not in sys.path: + sys.path.insert(0, this_dir) # needed for Py3 + +from common_imports import etree, StringIO, BytesIO, fileInTestDir, _bytes, _str +from common_imports import SillyFileLike, HelperTestCase + +try: + unicode = __builtins__["unicode"] +except (NameError, KeyError): + unicode = str + +class HtmlParserTestCase(HelperTestCase): + """HTML parser test cases + """ + etree = etree + + html_str = _bytes("test

page title

") + html_str_pretty = _bytes("""\ + +test +

page title

+ +""") + broken_html_str = _bytes("test<body><h1>page title</h3></p></html>") + uhtml_str = _str("<html><head><title>test á\uF8D2

page á\uF8D2 title

") + + def tearDown(self): + super(HtmlParserTestCase, self).tearDown() + self.etree.set_default_parser() + + def test_module_HTML(self): + element = self.etree.HTML(self.html_str) + self.assertEqual(self.etree.tostring(element, method="html"), + self.html_str) + + def test_module_HTML_unicode(self): + element = self.etree.HTML(self.uhtml_str) + self.assertEqual(unicode(self.etree.tostring(element, method="html", + encoding='UTF8'), 'UTF8'), + unicode(self.uhtml_str.encode('UTF8'), 'UTF8')) + + def test_module_HTML_pretty_print(self): + element = self.etree.HTML(self.html_str) + self.assertEqual(self.etree.tostring(element, method="html", pretty_print=True), + self.html_str_pretty) + + def test_module_parse_html_error(self): + parser = self.etree.HTMLParser(recover=False) + parse = self.etree.parse + f = BytesIO("") + self.assertRaises(self.etree.XMLSyntaxError, + parse, f, parser) + + def test_html_element_name_empty(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + + el = Element('name') + self.assertRaises(ValueError, Element, '{}') + self.assertRaises(ValueError, setattr, el, 'tag', '{}') + + self.assertRaises(ValueError, Element, '{test}') + self.assertRaises(ValueError, setattr, el, 'tag', '{test}') + + def test_html_element_name_colon(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + + pname = Element('p:name') + self.assertEquals(pname.tag, 'p:name') + + pname = Element('{test}p:name') + self.assertEquals(pname.tag, '{test}p:name') + + pname = Element('name') + pname.tag = 'p:name' + self.assertEquals(pname.tag, 'p:name') + + def test_html_element_name_quote(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + + self.assertRaises(ValueError, Element, 'p"name') + self.assertRaises(ValueError, Element, "na'me") + self.assertRaises(ValueError, Element, '{test}"name') + self.assertRaises(ValueError, Element, "{test}name'") + + el = Element('name') + self.assertRaises(ValueError, setattr, el, 'tag', "pname'") + self.assertRaises(ValueError, setattr, el, 'tag', '"pname') + self.assertEquals(el.tag, "name") + + def test_html_element_name_space(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + + self.assertRaises(ValueError, Element, ' name ') + self.assertRaises(ValueError, Element, 'na me') + self.assertRaises(ValueError, Element, '{test} name') + + el = Element('name') + self.assertRaises(ValueError, setattr, el, 'tag', ' name ') + self.assertEquals(el.tag, "name") + + def test_html_subelement_name_empty(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, '{}') + self.assertRaises(ValueError, SubElement, el, '{test}') + + def test_html_subelement_name_colon(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + SubElement = self.etree.SubElement + + el = Element('name') + pname = SubElement(el, 'p:name') + self.assertEquals(pname.tag, 'p:name') + + pname = SubElement(el, '{test}p:name') + self.assertEquals(pname.tag, '{test}p:name') + + def test_html_subelement_name_quote(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, "name'") + self.assertRaises(ValueError, SubElement, el, 'na"me') + self.assertRaises(ValueError, SubElement, el, "{test}na'me") + self.assertRaises(ValueError, SubElement, el, '{test}"name') + + def test_html_subelement_name_space(self): + parser = self.etree.HTMLParser() + Element = parser.makeelement + SubElement = self.etree.SubElement + + el = Element('name') + self.assertRaises(ValueError, SubElement, el, ' name ') + self.assertRaises(ValueError, SubElement, el, 'na me') + self.assertRaises(ValueError, SubElement, el, '{test} name') + + def test_module_parse_html_norecover(self): + parser = self.etree.HTMLParser(recover=False) + parse = self.etree.parse + f = BytesIO(self.broken_html_str) + self.assertRaises(self.etree.XMLSyntaxError, + parse, f, parser) + + def test_parse_encoding_8bit_explicit(self): + text = _str('Søk på nettet') + html_latin1 = (_str('

%s

') % text).encode('iso-8859-1') + + tree = self.etree.parse( + BytesIO(html_latin1), + self.etree.HTMLParser(encoding="iso-8859-1")) + p = tree.find("//p") + self.assertEquals(p.text, text) + + def test_parse_encoding_8bit_override(self): + text = _str('Søk på nettet') + wrong_head = _str(''' + + + ''') + html_latin1 = (_str('%s

%s

') % (wrong_head, + text) + ).encode('iso-8859-1') + + self.assertRaises(self.etree.ParseError, + self.etree.parse, + BytesIO(html_latin1)) + + tree = self.etree.parse( + BytesIO(html_latin1), + self.etree.HTMLParser(encoding="iso-8859-1")) + p = tree.find("//p") + self.assertEquals(p.text, text) + + def test_module_HTML_broken(self): + element = self.etree.HTML(self.broken_html_str) + self.assertEqual(self.etree.tostring(element, method="html"), + self.html_str) + + def test_module_HTML_cdata(self): + # by default, libxml2 generates CDATA nodes for